Update gvnfm-driver .gitreview file
[vfc/nfvo/driver/vnfm/gvnfm.git] / juju / juju-vnfmadapter / Juju-vnfmadapterService / service / src / test / java / org / onap / vfc / nfvo / vnfm / gvnfm / jujuvnfmadapter / service / adapter / impl / JujuClientManagerTest.java
1 /*
2  * Copyright 2016-2017 Huawei Technologies Co., Ltd.
3  *
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
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16 package org.onap.vfc.nfvo.vnfm.gvnfm.jujuvnfmadapter.service.adapter.impl;
17
18 import static org.junit.Assert.assertTrue;
19
20 import java.io.IOException;
21
22 import org.junit.Ignore;
23 import org.junit.Test;
24 import org.onap.vfc.nfvo.vnfm.gvnfm.jujuvnfmadapter.service.adapter.impl.JujuClientManager;
25
26 import mockit.Mock;
27 import mockit.MockUp;
28 import net.sf.json.JSONObject;
29
30 public class JujuClientManagerTest {
31
32     @Test
33     public void testdeploy() {
34         JujuClientManager jujuClientManager = new JujuClientManager();
35         JSONObject json = jujuClientManager.deploy("charmPath", "appName");
36         assertTrue(json != null);
37     }
38
39     @Test
40     public void testdeploy3() {
41         new MockUp<ProcessBuilder>() {
42             @Mock
43             public Process start() throws IOException {
44                 Process process = new ProcessMockImpl();
45                 return process;
46             }
47         };
48         JujuClientManager jujuClientManager = new JujuClientManager();
49         JSONObject json = jujuClientManager.deploy("charmPath","appName");
50         assertTrue(json != null);
51     }
52
53     @Test
54     public void testdeploy1() {
55
56         JujuClientManager jujuClientManager = new JujuClientManager();
57         JSONObject json = jujuClientManager.deploy("charmPath", null);
58         assertTrue(json != null);
59     }
60
61     @Test
62     public void testdeploy2() {
63
64         JujuClientManager jujuClientManager = new JujuClientManager();
65         JSONObject json = jujuClientManager.deploy(null, null);
66         assertTrue(json != null);
67     }
68
69     @Test
70 @Ignore
71     public void testdestroy() {
72
73         JujuClientManager jujuClientManager = new JujuClientManager();
74         JSONObject json = jujuClientManager.destroy("appName");
75         assertTrue(json != null);
76     }
77
78     @Test
79     public void testdestroy1() {
80         new MockUp<ProcessBuilder>() {
81             @Mock
82             public Process start() throws IOException {
83                 Process process = new ProcessMockImpl();
84                 return process;
85             }
86         };
87         JujuClientManager jujuClientManager = new JujuClientManager();
88         JSONObject json = jujuClientManager.destroy("appName");
89         assertTrue(json != null);
90     }
91
92     @Test
93     public void testgetStatus() {
94
95         JujuClientManager jujuClientManager = new JujuClientManager();
96         JSONObject json = jujuClientManager.getStatus("appName");
97         assertTrue(json != null);
98     }
99
100     @Test
101     public void testgetStatus1() {
102
103         JujuClientManager jujuClientManager = new JujuClientManager();
104         JSONObject json = jujuClientManager.getStatus("");
105         assertTrue(json != null);
106     }
107
108     @Test
109     public void testgetStatus2() {
110         new MockUp<ProcessBuilder>() {
111             @Mock
112             public Process start() throws IOException {
113                 Process process = new ProcessMockImpl();
114                 return process;
115             }
116         };
117
118         JujuClientManager jujuClientManager = new JujuClientManager();
119         JSONObject json = jujuClientManager.getStatus("");
120         assertTrue(json != null);
121     }
122     @Test
123     public void testParseYaml(){
124         JujuClientManager jujuClientManager = new JujuClientManager();
125         jujuClientManager.parseYaml("abc/efg", "mediawiki.yaml", "addResource");
126     }
127 }