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.so.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.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);
 
  83     public void testListener() throws Exception {
 
  84         request.setAction(Action.QuiesceTraffic);
 
  85         Status status = applicationControllerTaskImpl.execute("testRequestId", request, listener);