82b0695ed9e9bb1befa9ddfd662e93f57909eb4e
[so.git] /
1 package org.onap.so.adapters.appc.orchestrator.service;
2
3 import java.util.List;
4 import java.util.Optional;
5 import org.junit.Before;
6 import org.junit.Test;
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;
37
38 @RunWith(SpringRunner.class)
39 @SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
40 @ActiveProfiles("test")
41 @ContextConfiguration
42 @AutoConfigureWireMock(port = 0)
43 public class ApplicationControllerTaskImplITTest {
44
45     @Autowired
46     private ApplicationControllerTaskImpl applicationControllerTaskImpl;
47
48     @Mock
49     ExternalTask externalTask;
50
51     @Mock
52     ExternalTaskService externalTaskService;
53
54     @Mock
55     ApplicationControllerSupport appCSupport;
56
57     ApplicationControllerTaskRequest request;
58
59     ApplicationControllerCallback listener;
60
61     GraphInventoryCommonObjectMapperProvider mapper = new GraphInventoryCommonObjectMapperProvider();
62
63     @Before
64     public void setup() {
65         request = new ApplicationControllerTaskRequest();
66         request.setBookName("testBookName");
67         request.setControllerType("testControllerType");
68         request.setFileParameters("testFileParams");
69         request.setIdentityUrl("testIdentityUrl");
70         request.setNewSoftwareVersion("2.0");
71         request.setExistingSoftwareVersion("1.0");
72         request.setOperationsTimeout("30");
73         ApplicationControllerVnf applicationControllerVnf = new ApplicationControllerVnf();
74         applicationControllerVnf.setVnfHostIpAddress("100.100");
75         applicationControllerVnf.setVnfId("testVnfId");
76         applicationControllerVnf.setVnfName("testVnfName");
77         request.setApplicationControllerVnf(applicationControllerVnf);
78         listener = new ApplicationControllerCallback(null, externalTaskService, appCSupport);
79     }
80
81
82     @Test
83     public void testListener() throws Exception {
84         request.setAction(Action.QuiesceTraffic);
85         Status status = applicationControllerTaskImpl.execute("testRequestId", request, listener);
86     }
87
88 }