2 * ============LICENSE_START=======================================================
\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
11 * http://www.apache.org/licenses/LICENSE-2.0
\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
21 package org.openecomp.mso.client.appc;
\r
23 import static org.junit.Assert.assertEquals;
\r
25 import java.util.Properties;
\r
26 import java.util.UUID;
\r
28 import org.junit.BeforeClass;
\r
29 import org.junit.Ignore;
\r
30 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
37 public class ApplicationControllerClientTest {
\r
40 public static void beforeClass() {
\r
41 System.setProperty("mso.config.path", "src/test/resources");
\r
45 public void createRequest_CheckLock_RequestBuilt() {
\r
46 ApplicationControllerClient client = new ApplicationControllerClient();
\r
47 ActionIdentifiers actionIdentifiers = new ActionIdentifiers();
\r
48 actionIdentifiers.setVnfId("vnfId");
\r
49 CheckLockInput checkLockInput = (CheckLockInput) client.createRequest(Action.CheckLock, actionIdentifiers, null,
\r
51 assertEquals(checkLockInput.getAction().name(), "CheckLock");
\r
55 @Ignore // 1802 merge
\r
56 public void runCommand_liveAppc() {
\r
57 ApplicationControllerClient client = new ApplicationControllerClient();
\r
58 ActionIdentifiers actionIdentifiers = new ActionIdentifiers();
\r
59 //actionIdentifiers.setVnfId("ca522254-2ba4-4fbd-b15b-0ef0d9cfda5f");
\r
60 actionIdentifiers.setVnfId("2d2bf10e-81a5-");
\r
63 status = client.runCommand(Action.Lock, actionIdentifiers, null, UUID.randomUUID().toString());
\r
64 } catch (ApplicationControllerOrchestratorException e) {
\r
65 status = new Status();
\r
66 status.setCode(e.getAppcCode());
\r
67 status.setMessage(e.getMessage());
\r
69 assertEquals("Status of run command is correct", status.getCode(), 306);
\r
73 @Ignore // 1802 merge
\r
74 public void runCommand_CheckLock_RequestBuilt() {
\r
75 ApplicationControllerClient client = new ApplicationControllerClient();
\r
76 ActionIdentifiers actionIdentifiers = new ActionIdentifiers();
\r
77 actionIdentifiers.setVnfId("fusion-vpp-vnf-001");
\r
80 status = client.runCommand(Action.Unlock, actionIdentifiers, null, "requestId");
\r
81 } catch (ApplicationControllerOrchestratorException e) {
\r
82 status = new Status();
\r
83 status.setCode(e.getAppcCode());
\r
84 status.setMessage(e.getMessage());
\r
86 assertEquals("Status of run command is correct", status.getCode(), 309);
\r
90 public void test_getLCMPropertiesHelper() {
\r
91 ApplicationControllerClient client = new ApplicationControllerClient();
\r
92 Properties properties = client.getLCMProperties();
\r
93 assertEquals(properties.get("topic.write"), "APPC-TEST-AMDOCS1-DEV3");
\r
94 assertEquals(properties.get("topic.read.timeout"), "120000");
\r
95 assertEquals(properties.get("client.response.timeout"), "120000");
\r
96 assertEquals(properties.get("topic.read"), "APPC-TEST-AMDOCS2");
\r
97 assertEquals(properties.get("poolMembers"),
\r
98 "uebsb93kcdc.it.att.com:3904,uebsb92kcdc.it.att.com:3904,uebsb91kcdc.it.att.com:3904");
\r
99 assertEquals(properties.get("client.key"), "iaEMAfjsVsZnraBP");
\r
100 assertEquals(properties.get("client.secret"), "wcivUjsjXzmGFBfxMmyJu9dz");
\r