Remove tests which do not test anything
[so.git] / bpmn / MSOCommonBPMN / src / test / java / org / openecomp / mso / client / appc / ApplicationControllerClientTest.java
1 /*-\r
2  * ============LICENSE_START=======================================================\r
3  * ONAP - SO\r
4  * ================================================================================\r
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
6  * ================================================================================\r
7  * Licensed under the Apache License, Version 2.0 (the "License");\r
8  * you may not use this file except in compliance with the License.\r
9  * You may obtain a copy of the License at\r
10  *\r
11  *      http://www.apache.org/licenses/LICENSE-2.0\r
12  *\r
13  * Unless required by applicable law or agreed to in writing, software\r
14  * distributed under the License is distributed on an "AS IS" BASIS,\r
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
16  * See the License for the specific language governing permissions and\r
17  * limitations under the License.\r
18  * ============LICENSE_END=========================================================\r
19  */\r
20 \r
21 package org.openecomp.mso.client.appc;\r
22 \r
23 import static org.junit.Assert.assertEquals;\r
24 import static org.junit.Assert.assertNotNull;\r
25 \r
26 import java.util.Properties;\r
27 import java.util.UUID;\r
28 \r
29 import org.junit.BeforeClass;\r
30 import org.junit.Ignore;\r
31 import org.junit.Test;\r
32 import org.onap.appc.client.lcm.model.Action;\r
33 import org.onap.appc.client.lcm.model.ActionIdentifiers;\r
34 import org.onap.appc.client.lcm.model.CheckLockInput;\r
35 import org.onap.appc.client.lcm.model.Status;\r
36 \r
37 public class ApplicationControllerClientTest {\r
38 \r
39         @BeforeClass\r
40         public static void beforeClass() {\r
41                 System.setProperty("mso.config.path", "src/test/resources");\r
42         }\r
43 \r
44         @Test\r
45         public void testClientCreation() {\r
46                 ApplicationControllerClient client = new ApplicationControllerClient("appc");\r
47                 assertEquals(client.getControllerType(), "appc");\r
48                 assertNotNull(client.getAppCClient());\r
49         }\r
50 \r
51         @Test\r
52         public void createRequest_CheckLock_RequestBuilt() {\r
53                 ApplicationControllerClient client = new ApplicationControllerClient("appc");\r
54                 ActionIdentifiers actionIdentifiers = new ActionIdentifiers();\r
55                 actionIdentifiers.setVnfId("vnfId");\r
56                 CheckLockInput checkLockInput = (CheckLockInput) client.createRequest(Action.CheckLock, actionIdentifiers, null,\r
57                                 "requestId");\r
58                 assertEquals(checkLockInput.getAction().name(), "CheckLock");\r
59         }\r
60 \r
61         @Test\r
62         @Ignore // 1802 merge\r
63         public void runCommand_liveAppc() {\r
64                 ApplicationControllerClient client = new ApplicationControllerClient("appc");\r
65                 ActionIdentifiers actionIdentifiers = new ActionIdentifiers();\r
66                 //actionIdentifiers.setVnfId("ca522254-2ba4-4fbd-b15b-0ef0d9cfda5f");\r
67                 actionIdentifiers.setVnfId("2d2bf10e-81a5-");\r
68                 Status status;\r
69                 try {\r
70                         status = client.runCommand(Action.Lock, actionIdentifiers, null, UUID.randomUUID().toString());\r
71                 } catch (ApplicationControllerOrchestratorException e) {\r
72                         status = new Status();\r
73                         status.setCode(e.getAppcCode());\r
74                         status.setMessage(e.getMessage());\r
75                 }\r
76                 assertEquals("Status of run command is correct", status.getCode(), 306);\r
77         }\r
78 \r
79         @Test\r
80         @Ignore // 1802 merge\r
81         public void runCommand_CheckLock_RequestBuilt() {\r
82                 ApplicationControllerClient client = new ApplicationControllerClient("appc");\r
83                 ActionIdentifiers actionIdentifiers = new ActionIdentifiers();\r
84                 actionIdentifiers.setVnfId("fusion-vpp-vnf-001");\r
85                 Status status;\r
86                 try {\r
87                         status = client.runCommand(Action.Unlock, actionIdentifiers, null, "requestId");\r
88                 } catch (ApplicationControllerOrchestratorException e) {\r
89                         status = new Status();\r
90                         status.setCode(e.getAppcCode());\r
91                         status.setMessage(e.getMessage());\r
92                 }\r
93                 assertEquals("Status of run command is correct", status.getCode(), 309);\r
94         }\r
95 \r
96         @Test\r
97         public void test_getLCMPropertiesHelper() {\r
98                 ApplicationControllerClient client = new ApplicationControllerClient("appc");\r
99                 Properties properties = client.getLCMProperties();\r
100                 assertEquals(properties.get("topic.read"), "APPC-TEST-AMDOCS2");\r
101                 assertEquals(properties.get("topic.write"), "APPC-TEST-AMDOCS1-DEV3");\r
102                 assertEquals(properties.get("topic.sdnc.read"), "SDNC-LCM-READ");\r
103                 assertEquals(properties.get("topic.sdnc.write"), "SDNC-LCM-WRITE");\r
104                 assertEquals(properties.get("topic.read.timeout"), "120000");\r
105                 assertEquals(properties.get("client.response.timeout"), "120000");\r
106                 assertEquals(properties.get("poolMembers"),\r
107                                 "uebsb93kcdc.it.att.com:3904,uebsb92kcdc.it.att.com:3904,uebsb91kcdc.it.att.com:3904");\r
108                 assertEquals(properties.get("client.key"), "iaEMAfjsVsZnraBP");\r
109                 assertEquals(properties.get("client.secret"), "wcivUjsjXzmGFBfxMmyJu9dz");\r
110         }\r
111 \r
112 }