2 * Copyright 2016-2017 Huawei Technologies Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org.openo.nfvo.jujuvnfmadapter.service.adapter.impl;
18 import static org.junit.Assert.assertTrue;
20 import java.io.IOException;
22 import org.junit.Ignore;
23 import org.junit.Test;
27 import net.sf.json.JSONObject;
29 public class JujuClientManagerTest {
32 public void testdeploy() {
33 JujuClientManager jujuClientManager = new JujuClientManager();
34 JSONObject json = jujuClientManager.deploy("charmPath", "appName");
35 assertTrue(json != null);
39 public void testdeploy3() {
40 new MockUp<ProcessBuilder>() {
42 public Process start() throws IOException {
43 Process process = new ProcessMockImpl();
47 JujuClientManager jujuClientManager = new JujuClientManager();
48 JSONObject json = jujuClientManager.deploy("charmPath","appName");
49 assertTrue(json != null);
53 public void testdeploy1() {
55 JujuClientManager jujuClientManager = new JujuClientManager();
56 JSONObject json = jujuClientManager.deploy("charmPath", null);
57 assertTrue(json != null);
61 public void testdeploy2() {
63 JujuClientManager jujuClientManager = new JujuClientManager();
64 JSONObject json = jujuClientManager.deploy(null, null);
65 assertTrue(json != null);
70 public void testdestroy() {
72 JujuClientManager jujuClientManager = new JujuClientManager();
73 JSONObject json = jujuClientManager.destroy("appName");
74 assertTrue(json != null);
78 public void testdestroy1() {
79 new MockUp<ProcessBuilder>() {
81 public Process start() throws IOException {
82 Process process = new ProcessMockImpl();
86 JujuClientManager jujuClientManager = new JujuClientManager();
87 JSONObject json = jujuClientManager.destroy("appName");
88 assertTrue(json != null);
92 public void testgetStatus() {
94 JujuClientManager jujuClientManager = new JujuClientManager();
95 JSONObject json = jujuClientManager.getStatus("appName");
96 assertTrue(json != null);
100 public void testgetStatus1() {
102 JujuClientManager jujuClientManager = new JujuClientManager();
103 JSONObject json = jujuClientManager.getStatus("");
104 assertTrue(json != null);
108 public void testgetStatus2() {
109 new MockUp<ProcessBuilder>() {
111 public Process start() throws IOException {
112 Process process = new ProcessMockImpl();
117 JujuClientManager jujuClientManager = new JujuClientManager();
118 JSONObject json = jujuClientManager.getStatus("");
119 assertTrue(json != null);
122 public void testParseYaml(){
123 JujuClientManager jujuClientManager = new JujuClientManager();
124 jujuClientManager.parseYaml("abc/efg", "mediawiki.yaml", "addResource");