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.AfterClass;
\r
29 import org.junit.BeforeClass;
\r
30 import org.junit.Ignore;
\r
31 import org.junit.Test;
\r
33 import org.openecomp.appc.client.lcm.model.Action;
\r
34 import org.openecomp.appc.client.lcm.model.ActionIdentifiers;
\r
35 import org.openecomp.appc.client.lcm.model.CheckLockInput;
\r
36 import org.openecomp.appc.client.lcm.model.Flags;
\r
37 import org.openecomp.appc.client.lcm.model.Status;
\r
39 public class ApplicationControllerClientTest {
\r
41 private static ApplicationControllerClient client;
\r
42 private static ApplicationControllerSupport support;
\r
45 public static void beforeClass() {
\r
46 client = new ApplicationControllerClient();
\r
47 support = new ApplicationControllerSupport();
\r
48 client.appCSupport = support;
\r
49 System.setProperty("mso.config.path", "src/test/resources");
\r
54 public static void afterClass() throws Exception {
\r
55 client.shutdownclient();
\r
59 @Ignore // IGNORED FOR 1710 MERGE TO ONAP
\r
60 public void createRequest_CheckLock_RequestBuilt() throws Exception {
\r
62 org.springframework.test.util.ReflectionTestUtils.setField(support, "lcmModelPackage",
\r
63 "org.openecomp.appc.client.lcm.model");
\r
64 Flags flags = new Flags();
\r
65 ActionIdentifiers actionIdentifiers = new ActionIdentifiers();
\r
66 actionIdentifiers.setVnfId("vnfId");
\r
67 CheckLockInput checkLockInput = (CheckLockInput) client.createRequest(Action.CheckLock, actionIdentifiers,
\r
68 flags, null, "requestId");
\r
69 assertEquals(checkLockInput.getAction().name(), "CheckLock");
\r
73 @Ignore // IGNORED FOR 1710 MERGE TO ONAP
\r
74 public void runCommand_liveAppc() throws Exception {
\r
75 org.springframework.test.util.ReflectionTestUtils.setField(support, "lcmModelPackage",
\r
76 "org.openecomp.appc.client.lcm.model");
\r
77 Flags flags = new Flags();
\r
78 ActionIdentifiers actionIdentifiers = new ActionIdentifiers();
\r
79 actionIdentifiers.setVnfId("ca522254-2ba4-4fbd-b15b-0ef0d9cfda5f");
\r
81 // CheckLockInput checkLockInput = (CheckLockInput)
\r
82 // client.createRequest(Action.CheckLock,actionIdentifiers,flags,null,"requestId");
\r
83 Status status = client.runCommand(Action.Lock, actionIdentifiers, flags, null, UUID.randomUUID().toString());
\r
84 assertEquals("Status of run command is correct", status.getCode(), 306);
\r
88 @Ignore // IGNORED FOR 1710 MERGE TO ONAP
\r
89 public void runCommand_CheckLock_RequestBuilt() throws Exception {
\r
90 org.springframework.test.util.ReflectionTestUtils.setField(support, "lcmModelPackage",
\r
91 "org.openecomp.appc.client.lcm.model");
\r
92 Flags flags = new Flags();
\r
93 ActionIdentifiers actionIdentifiers = new ActionIdentifiers();
\r
94 actionIdentifiers.setVnfId("fusion-vpp-vnf-001");
\r
95 Status status = client.runCommand(Action.CheckLock, actionIdentifiers, flags, null, "requestId");
\r
96 assertEquals("Status of run command is correct", status.getCode(), 400);
\r