1 package org.onap.so.adapters.appc.orchestrator.service;
4 import java.util.Optional;
5 import org.junit.Before;
7 import org.junit.runner.RunWith;
8 import org.mockito.InjectMocks;
9 import org.mockito.Mock;
10 import org.mockito.Mockito;
11 import org.mockito.Spy;
12 import org.mockito.junit.MockitoJUnitRunner;
13 import org.onap.appc.client.lcm.model.Status;
14 import org.onap.so.TestApplication;
15 import org.onap.so.adapters.appc.orchestrator.client.ApplicationControllerCallback;
16 import org.onap.so.adapters.appc.orchestrator.client.ApplicationControllerClient;
17 import org.onap.so.adapters.appc.orchestrator.client.ApplicationControllerOrchestratorException;
18 import org.onap.so.adapters.appc.orchestrator.client.ApplicationControllerSupport;
19 import org.onap.so.adapters.appc.orchestrator.client.beans.ConfigurationParameters;
20 import org.onap.so.adapters.appc.orchestrator.client.beans.Identity;
21 import org.onap.so.adapters.appc.orchestrator.client.beans.Parameters;
22 import org.onap.so.adapters.appc.orchestrator.client.beans.RequestParameters;
23 import org.onap.so.adapters.appc.orchestrator.service.ApplicationControllerTaskImpl;
24 import org.onap.so.appc.orchestrator.service.beans.ApplicationControllerTaskRequest;
25 import org.onap.so.appc.orchestrator.service.beans.ApplicationControllerVnf;
26 import org.onap.aaiclient.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
27 import org.springframework.beans.factory.annotation.Autowired;
28 import org.springframework.boot.test.context.SpringBootTest;
29 import org.springframework.cloud.contract.wiremock.AutoConfigureWireMock;
30 import org.springframework.test.context.ActiveProfiles;
31 import org.springframework.test.context.ContextConfiguration;
32 import org.springframework.test.context.junit4.SpringRunner;
33 import org.camunda.bpm.client.task.ExternalTask;
34 import org.camunda.bpm.client.task.ExternalTaskService;
35 import com.fasterxml.jackson.core.JsonProcessingException;
36 import org.onap.appc.client.lcm.model.Action;
38 @RunWith(SpringRunner.class)
39 @SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
40 @ActiveProfiles("test")
42 @AutoConfigureWireMock(port = 0)
43 public class ApplicationControllerTaskImplITTest {
46 private ApplicationControllerTaskImpl applicationControllerTaskImpl;
49 ExternalTask externalTask;
52 ExternalTaskService externalTaskService;
55 ApplicationControllerSupport appCSupport;
57 ApplicationControllerTaskRequest request;
59 ApplicationControllerCallback listener;
61 GraphInventoryCommonObjectMapperProvider mapper = new GraphInventoryCommonObjectMapperProvider();
65 request = new ApplicationControllerTaskRequest();
66 request.setRequestorId("testRequestorId");
67 request.setBookName("testBookName");
68 request.setControllerType("testControllerType");
69 request.setFileParameters("testFileParams");
70 request.setIdentityUrl("testIdentityUrl");
71 request.setNewSoftwareVersion("2.0");
72 request.setExistingSoftwareVersion("1.0");
73 request.setOperationsTimeout("30");
74 ApplicationControllerVnf applicationControllerVnf = new ApplicationControllerVnf();
75 applicationControllerVnf.setVnfHostIpAddress("100.100");
76 applicationControllerVnf.setVnfId("testVnfId");
77 applicationControllerVnf.setVnfName("testVnfName");
78 request.setApplicationControllerVnf(applicationControllerVnf);
79 listener = new ApplicationControllerCallback(null, externalTaskService, appCSupport);
84 public void testListener() throws Exception {
85 request.setAction(Action.QuiesceTraffic);
86 Status status = applicationControllerTaskImpl.execute("testRequestId", request, listener);