diff options
author | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2019-04-08 14:14:34 -0400 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2019-04-08 14:24:59 -0400 |
commit | f47919f1fe367b612fa9c96d34c59f01a541e882 (patch) | |
tree | 5b6aa2fc36747d868897e68ccbec0c6db0aee81c /bpmn/so-bpmn-building-blocks/src/test | |
parent | 54452b80a1cf4d22ef750bc1377f8c1b05431d57 (diff) |
Replaced all tabs with spaces in java and pom.xml
Added in maven plugins to enforce coding style rules
Added in eclipse java formatting xml
Change-Id: I3727bbf4ce8dc66abfd8ad21b6cfd0890c5d3ff0
Issue-ID: SO-1765
Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'bpmn/so-bpmn-building-blocks/src/test')
80 files changed, 2586 insertions, 2626 deletions
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/AllTestSuites.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/AllTestSuites.java index 98e613efe6..8c8981e6e6 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/AllTestSuites.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/AllTestSuites.java @@ -19,14 +19,14 @@ */ package org.onap.so; -import org.junit.runner.RunWith; +import org.junit.runner.RunWith; import com.googlecode.junittoolbox.SuiteClasses; import com.googlecode.junittoolbox.WildcardPatternSuite; @RunWith(WildcardPatternSuite.class) @SuiteClasses({"**/*Test.class"}) public class AllTestSuites { - // the class remains empty, - // used only as a holder for the above annotations + // the class remains empty, + // used only as a holder for the above annotations } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/BaseTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/BaseTest.java index 73aa0a7201..5451860a90 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/BaseTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/BaseTest.java @@ -26,7 +26,6 @@ import java.nio.file.Files; import java.nio.file.Paths; import java.util.HashMap; import java.util.Map; - import org.camunda.bpm.engine.RepositoryService; import org.camunda.bpm.engine.RuntimeService; import org.camunda.bpm.model.bpmn.Bpmn; @@ -62,7 +61,6 @@ import org.springframework.http.HttpHeaders; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringRunner; - import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; @@ -74,134 +72,126 @@ import com.fasterxml.jackson.databind.ObjectMapper; public abstract class BaseTest extends BuildingBlockTestDataSetup { - protected Map<String, Object> variables = new HashMap<>(); - - protected TestRestTemplate restTemplate = new TestRestTemplate(); - - protected HttpHeaders headers = new HttpHeaders(); - - @Value("${wiremock.server.port}") - protected String wireMockPort; + protected Map<String, Object> variables = new HashMap<>(); - @Autowired - protected RuntimeService runtimeService; + protected TestRestTemplate restTemplate = new TestRestTemplate(); - @Autowired - private RepositoryService repositoryService; - /* - * Mocked for injection via autowiring - */ + protected HttpHeaders headers = new HttpHeaders(); - @Value("${mso.catalog.db.spring.endpoint}") - protected String endpoint; + @Value("${wiremock.server.port}") + protected String wireMockPort; - @MockBean - protected CatalogDbClient MOCK_catalogDbClient; + @Autowired + protected RuntimeService runtimeService; - @SpyBean - protected InjectionHelper MOCK_injectionHelper; + @Autowired + private RepositoryService repositoryService; + /* + * Mocked for injection via autowiring + */ - @SpyBean - protected NetworkAdapterObjectMapper MOCK_networkAdapterObjectMapper; + @Value("${mso.catalog.db.spring.endpoint}") + protected String endpoint; - @SpyBean - protected AAIObjectMapper MOCK_aaiObjectMapper; - @SpyBean - protected NetworkAdapterClientImpl MOCK_networkAdapterClient; - @SpyBean - protected SDNCClient MOCK_sdncClient; + @MockBean + protected CatalogDbClient MOCK_catalogDbClient; - @SpyBean - protected AAIFlagTasks aaiFlagTasks; + @SpyBean + protected InjectionHelper MOCK_injectionHelper; - @SpyBean - protected AAIVnfResources aaiVnfResources; + @SpyBean + protected NetworkAdapterObjectMapper MOCK_networkAdapterObjectMapper; - @SpyBean - protected ExceptionBuilder exceptionUtil; + @SpyBean + protected AAIObjectMapper MOCK_aaiObjectMapper; + @SpyBean + protected NetworkAdapterClientImpl MOCK_networkAdapterClient; + @SpyBean + protected SDNCClient MOCK_sdncClient; - @SpyBean - protected SDNOHealthCheckResources MOCK_sdnoHealthCheckResources; + @SpyBean + protected AAIFlagTasks aaiFlagTasks; + @SpyBean + protected AAIVnfResources aaiVnfResources; + @SpyBean + protected ExceptionBuilder exceptionUtil; + @SpyBean + protected SDNOHealthCheckResources MOCK_sdnoHealthCheckResources; - /* - * Classes that cannot be simply mocked because they are both - * needed for testing another class, and must be autowired when - * being tested themselves....or classes with private methods that - * must be stubbed during testing - */ + /* + * Classes that cannot be simply mocked because they are both needed for testing another class, and must be + * autowired when being tested themselves....or classes with private methods that must be stubbed during testing + */ + @SpyBean + protected BBInputSetupMapperLayer SPY_bbInputSetupMapperLayer; + @SpyBean + protected BBInputSetupUtils SPY_bbInputSetupUtils; + @SpyBean + protected BBInputSetup SPY_bbInputSetup; + @SpyBean + protected SniroHomingV2 sniroHoming; - @SpyBean - protected BBInputSetupMapperLayer SPY_bbInputSetupMapperLayer; - @SpyBean - protected BBInputSetupUtils SPY_bbInputSetupUtils; - @SpyBean - protected BBInputSetup SPY_bbInputSetup; - @SpyBean - protected SniroHomingV2 sniroHoming; + @SpyBean + protected SniroClient sniroClient; - @SpyBean - protected SniroClient sniroClient; + @SpyBean + protected SDNOHealthCheckTasks sdnoHealthCheckTasks; - @SpyBean - protected SDNOHealthCheckTasks sdnoHealthCheckTasks; + /* + * Mocked for injection via the IntectionHelper + */ - /* - * Mocked for injection via the IntectionHelper - */ + @Before + public void baseTestBefore() { + variables.put("gBuildingBlockExecution", new DelegateExecutionImpl(new HashMap<>())); - @Before - public void baseTestBefore() { - variables.put("gBuildingBlockExecution", new DelegateExecutionImpl(new HashMap<>())); + } - } + @LocalServerPort + private int port; - @LocalServerPort - private int port; + protected String readFile(String path) throws IOException { + return readFile(path, Charset.defaultCharset()); + } - protected String readFile(String path) throws IOException { - return readFile(path, Charset.defaultCharset()); - } + protected String readFile(String path, Charset encoding) throws IOException { + byte[] encoded = Files.readAllBytes(Paths.get(path)); + return new String(encoded, encoding); + } - protected String readFile(String path, Charset encoding) throws IOException { - byte[] encoded = Files.readAllBytes(Paths.get(path)); - return new String(encoded, encoding); - } + protected String readJsonFileAsString(String fileLocation) throws IOException { + ObjectMapper mapper = new ObjectMapper(); + JsonNode jsonNode = mapper.readTree(new File(fileLocation)); + return jsonNode.asText(); + } - protected String readJsonFileAsString(String fileLocation) throws IOException{ - ObjectMapper mapper = new ObjectMapper(); - JsonNode jsonNode = mapper.readTree(new File(fileLocation)); - return jsonNode.asText(); - } + protected String createURLWithPort(String uri) { + return "http://localhost:" + port + uri; + } - protected String createURLWithPort(String uri) { - return "http://localhost:" + port + uri; - } - /** - * Create and deploy a process model with one logger delegate as service task. - * - * @param origProcessKey - * key to call - * @param mockProcessName - * process name - * @param fileName - * file name without extension - */ - protected void mockSubprocess(String origProcessKey, String mockProcessName, String fileName) { - BpmnModelInstance modelInstance = Bpmn.createExecutableProcess(origProcessKey).name(mockProcessName) - .startEvent().name("Start Point").serviceTask().name("Log Something for Test") - .camundaClass(MockLoggerDelegate.class.getName()).endEvent().name("End Point").done(); - repositoryService.createDeployment().addModelInstance(fileName + ".bpmn", modelInstance).deploy(); - } + /** + * Create and deploy a process model with one logger delegate as service task. + * + * @param origProcessKey key to call + * @param mockProcessName process name + * @param fileName file name without extension + */ + protected void mockSubprocess(String origProcessKey, String mockProcessName, String fileName) { + BpmnModelInstance modelInstance = Bpmn.createExecutableProcess(origProcessKey).name(mockProcessName) + .startEvent().name("Start Point").serviceTask().name("Log Something for Test") + .camundaClass(MockLoggerDelegate.class.getName()).endEvent().name("End Point").done(); + repositoryService.createDeployment().addModelInstance(fileName + ".bpmn", modelInstance).deploy(); + } } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/BaseUnitTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/BaseUnitTest.java index 5719ce15e2..fc5709d1be 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/BaseUnitTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/BaseUnitTest.java @@ -20,6 +20,6 @@ package org.onap.so; -public abstract class BaseUnitTest extends BuildingBlockTestDataSetup{ +public abstract class BaseUnitTest extends BuildingBlockTestDataSetup { } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java index 6aa5cf3412..47b05f9690 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java @@ -21,15 +21,12 @@ package org.onap.so; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; - import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.UUID; - - import org.camunda.bpm.engine.delegate.DelegateExecution; import org.camunda.bpm.engine.impl.pvm.runtime.ExecutionImpl; import org.junit.Before; @@ -72,507 +69,509 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.AllottedResource; import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoAllottedResource; import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceProxy; -public class BuildingBlockTestDataSetup{ - private int collectionCounter; - private int configurationCounter; - private int customerCounter; - private int genericVnfCounter; - private int instanceGroupCounter; - private int l3NetworkCounter; - private int owningEntityCounter; - private int pnfCounter; - private int projectCounter; - private int serviceInstanceCounter; - private int serviceProxyCounter; - private int serviceSubscriptionCounter; - private int vfModuleCounter; - private int volumeGroupCounter; - private int vpnBindingCounter; - private int vpnBondingLinkCounter; - - protected BuildingBlockExecution execution; - - protected GeneralBuildingBlock gBBInput; - - protected HashMap<ResourceKey, String> lookupKeyMap; - - protected ExtractPojosForBB extractPojosForBB = new ExtractPojosForBB(); - - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - protected DelegateExecution delegateExecution; - - @Before - public void buildingBlockTestDataSetupBefore() { - collectionCounter = 0; - configurationCounter = 0; - customerCounter = 0; - genericVnfCounter = 0; - instanceGroupCounter = 0; - l3NetworkCounter = 0; - owningEntityCounter = 0; - pnfCounter = 0; - projectCounter = 0; - serviceInstanceCounter = 0; - serviceProxyCounter = 0; - serviceSubscriptionCounter = 0; - vfModuleCounter = 0; - volumeGroupCounter = 0; - vpnBindingCounter = 0; - vpnBondingLinkCounter = 0; - - execution = new DelegateExecutionImpl(new ExecutionImpl()); - execution.setVariable("testProcessKey", "testProcessKeyValue"); - - gBBInput = new GeneralBuildingBlock(); - execution.setVariable("gBBInput", gBBInput); - - lookupKeyMap = new HashMap<ResourceKey, String>(); - execution.setVariable("lookupKeyMap", lookupKeyMap); - - ExecutionImpl mockExecutionImpl = mock(ExecutionImpl.class); - doReturn("test").when(mockExecutionImpl).getProcessInstanceId(); - - ExecutionImpl executionImpl = new ExecutionImpl(); - executionImpl.setProcessInstance(mockExecutionImpl); - - delegateExecution = (DelegateExecution) executionImpl; - delegateExecution.setVariable("testProcessKey", "testProcessKeyValue"); - } - - public Map<String, String> buildUserInput() { - Map<String, String> userInput = new HashMap<>(); - userInput.put("testUserInputKey", "testUserInputValue"); - - return userInput; - } - - public Map<String, String> setUserInput() { - Map<String, String> userInput = buildUserInput(); - - gBBInput.setUserInput(userInput); - - return userInput; - } - - public RequestContext buildRequestContext() { - RequestContext requestContext = new RequestContext(); - requestContext.setMsoRequestId(UUID.randomUUID().toString()); - requestContext.setProductFamilyId("testProductFamilyId"); - requestContext.setRequestorId("testRequestorId"); - - requestContext.setUserParams(new HashMap<>()); - - Map<String,Object> dataMap = new HashMap<>(); - dataMap.put("vpnId","testVpnId"); - dataMap.put("vpnRegion","testVpnRegion"); - dataMap.put("vpnRt","testVpnRt"); - dataMap.put("vpnName","vpnName"); +public class BuildingBlockTestDataSetup { + private int collectionCounter; + private int configurationCounter; + private int customerCounter; + private int genericVnfCounter; + private int instanceGroupCounter; + private int l3NetworkCounter; + private int owningEntityCounter; + private int pnfCounter; + private int projectCounter; + private int serviceInstanceCounter; + private int serviceProxyCounter; + private int serviceSubscriptionCounter; + private int vfModuleCounter; + private int volumeGroupCounter; + private int vpnBindingCounter; + private int vpnBondingLinkCounter; + + protected BuildingBlockExecution execution; + + protected GeneralBuildingBlock gBBInput; + + protected HashMap<ResourceKey, String> lookupKeyMap; + + protected ExtractPojosForBB extractPojosForBB = new ExtractPojosForBB(); + + @Rule + public ExpectedException expectedException = ExpectedException.none(); + + protected DelegateExecution delegateExecution; + + @Before + public void buildingBlockTestDataSetupBefore() { + collectionCounter = 0; + configurationCounter = 0; + customerCounter = 0; + genericVnfCounter = 0; + instanceGroupCounter = 0; + l3NetworkCounter = 0; + owningEntityCounter = 0; + pnfCounter = 0; + projectCounter = 0; + serviceInstanceCounter = 0; + serviceProxyCounter = 0; + serviceSubscriptionCounter = 0; + vfModuleCounter = 0; + volumeGroupCounter = 0; + vpnBindingCounter = 0; + vpnBondingLinkCounter = 0; + + execution = new DelegateExecutionImpl(new ExecutionImpl()); + execution.setVariable("testProcessKey", "testProcessKeyValue"); + + gBBInput = new GeneralBuildingBlock(); + execution.setVariable("gBBInput", gBBInput); + + lookupKeyMap = new HashMap<ResourceKey, String>(); + execution.setVariable("lookupKeyMap", lookupKeyMap); + + ExecutionImpl mockExecutionImpl = mock(ExecutionImpl.class); + doReturn("test").when(mockExecutionImpl).getProcessInstanceId(); + + ExecutionImpl executionImpl = new ExecutionImpl(); + executionImpl.setProcessInstance(mockExecutionImpl); + + delegateExecution = (DelegateExecution) executionImpl; + delegateExecution.setVariable("testProcessKey", "testProcessKeyValue"); + } + + public Map<String, String> buildUserInput() { + Map<String, String> userInput = new HashMap<>(); + userInput.put("testUserInputKey", "testUserInputValue"); + + return userInput; + } + + public Map<String, String> setUserInput() { + Map<String, String> userInput = buildUserInput(); + + gBBInput.setUserInput(userInput); + + return userInput; + } + + public RequestContext buildRequestContext() { + RequestContext requestContext = new RequestContext(); + requestContext.setMsoRequestId(UUID.randomUUID().toString()); + requestContext.setProductFamilyId("testProductFamilyId"); + requestContext.setRequestorId("testRequestorId"); + + requestContext.setUserParams(new HashMap<>()); + + Map<String, Object> dataMap = new HashMap<>(); + dataMap.put("vpnId", "testVpnId"); + dataMap.put("vpnRegion", "testVpnRegion"); + dataMap.put("vpnRt", "testVpnRt"); + dataMap.put("vpnName", "vpnName"); dataMap.put("vpnRegion", Arrays.asList(new String[] {"USA", "EMEA", "APAC"})); - HashMap<String,Object> userParams = new HashMap<>(); - userParams.put("vpnData",dataMap); + HashMap<String, Object> userParams = new HashMap<>(); + userParams.put("vpnData", dataMap); - List<Map<String,Object>> userParamsList = new ArrayList<>(); - userParamsList.add(userParams); + List<Map<String, Object>> userParamsList = new ArrayList<>(); + userParamsList.add(userParams); - RequestParameters requestParameters = new RequestParameters(); - requestParameters.setUserParams(userParamsList); - requestContext.setRequestParameters(requestParameters); + RequestParameters requestParameters = new RequestParameters(); + requestParameters.setUserParams(userParamsList); + requestContext.setRequestParameters(requestParameters); - return requestContext; - } + return requestContext; + } - public RequestContext setRequestContext() { - RequestContext requestContext = buildRequestContext(); + public RequestContext setRequestContext() { + RequestContext requestContext = buildRequestContext(); - gBBInput.setRequestContext(requestContext); + gBBInput.setRequestContext(requestContext); - return requestContext; - } + return requestContext; + } - public CloudRegion buildCloudRegion() { - CloudRegion cloudRegion = new CloudRegion(); - cloudRegion.setLcpCloudRegionId("testLcpCloudRegionId"); - cloudRegion.setTenantId("testTenantId"); - cloudRegion.setCloudOwner("testCloudOwner"); + public CloudRegion buildCloudRegion() { + CloudRegion cloudRegion = new CloudRegion(); + cloudRegion.setLcpCloudRegionId("testLcpCloudRegionId"); + cloudRegion.setTenantId("testTenantId"); + cloudRegion.setCloudOwner("testCloudOwner"); - return cloudRegion; - } + return cloudRegion; + } - public CloudRegion setCloudRegion() { - CloudRegion cloudRegion = buildCloudRegion(); + public CloudRegion setCloudRegion() { + CloudRegion cloudRegion = buildCloudRegion(); - gBBInput.setCloudRegion(cloudRegion); + gBBInput.setCloudRegion(cloudRegion); - return cloudRegion; - } + return cloudRegion; + } - public OrchestrationContext buildOrchestrationContext() { - OrchestrationContext orchestrationContext = new OrchestrationContext(); + public OrchestrationContext buildOrchestrationContext() { + OrchestrationContext orchestrationContext = new OrchestrationContext(); - return orchestrationContext; - } + return orchestrationContext; + } - public OrchestrationContext setOrchestrationContext() { - OrchestrationContext orchestrationContext = buildOrchestrationContext(); + public OrchestrationContext setOrchestrationContext() { + OrchestrationContext orchestrationContext = buildOrchestrationContext(); - gBBInput.setOrchContext(orchestrationContext); + gBBInput.setOrchContext(orchestrationContext); - return orchestrationContext; - } + return orchestrationContext; + } - public Collection buildCollection() { - collectionCounter++; + public Collection buildCollection() { + collectionCounter++; - Collection collection = new Collection(); - collection.setId("testId" + collectionCounter); - collection.setInstanceGroup(buildInstanceGroup()); + Collection collection = new Collection(); + collection.setId("testId" + collectionCounter); + collection.setInstanceGroup(buildInstanceGroup()); - return collection; - } + return collection; + } - public Configuration buildConfiguration() { - configurationCounter++; + public Configuration buildConfiguration() { + configurationCounter++; - Configuration configuration = new Configuration(); - configuration.setConfigurationId("testConfigurationId" + configurationCounter); - configuration.setConfigurationName("testConfigurationName" + configurationCounter); + Configuration configuration = new Configuration(); + configuration.setConfigurationId("testConfigurationId" + configurationCounter); + configuration.setConfigurationName("testConfigurationName" + configurationCounter); - ModelInfoConfiguration modelInfoConfiguration = new ModelInfoConfiguration(); - modelInfoConfiguration.setModelVersionId("testModelVersionId" + configurationCounter); - modelInfoConfiguration.setModelInvariantId("testModelInvariantId" + configurationCounter); - modelInfoConfiguration.setModelCustomizationId("testModelCustomizationId" + configurationCounter); + ModelInfoConfiguration modelInfoConfiguration = new ModelInfoConfiguration(); + modelInfoConfiguration.setModelVersionId("testModelVersionId" + configurationCounter); + modelInfoConfiguration.setModelInvariantId("testModelInvariantId" + configurationCounter); + modelInfoConfiguration.setModelCustomizationId("testModelCustomizationId" + configurationCounter); - configuration.setModelInfoConfiguration(modelInfoConfiguration); + configuration.setModelInfoConfiguration(modelInfoConfiguration); - return configuration; - } + return configuration; + } - public OwningEntity buildOwningEntity() { - owningEntityCounter++; + public OwningEntity buildOwningEntity() { + owningEntityCounter++; - OwningEntity owningEntity = new OwningEntity(); - owningEntity.setOwningEntityId("testOwningEntityId" + owningEntityCounter); - owningEntity.setOwningEntityName("testOwningEntityName" + owningEntityCounter); + OwningEntity owningEntity = new OwningEntity(); + owningEntity.setOwningEntityId("testOwningEntityId" + owningEntityCounter); + owningEntity.setOwningEntityName("testOwningEntityName" + owningEntityCounter); - return owningEntity; - } + return owningEntity; + } - public Project buildProject() { - projectCounter++; + public Project buildProject() { + projectCounter++; - Project project = new Project(); - project.setProjectName("testProjectName" + projectCounter); + Project project = new Project(); + project.setProjectName("testProjectName" + projectCounter); - return project; - } + return project; + } - public ServiceSubscription buildServiceSubscription() { - serviceSubscriptionCounter++; + public ServiceSubscription buildServiceSubscription() { + serviceSubscriptionCounter++; - ServiceSubscription serviceSubscription = new ServiceSubscription(); - serviceSubscription.setTempUbSubAccountId("testTempUbSubAccountId" + serviceSubscriptionCounter); - serviceSubscription.setServiceType("testServiceType" + serviceSubscriptionCounter); + ServiceSubscription serviceSubscription = new ServiceSubscription(); + serviceSubscription.setTempUbSubAccountId("testTempUbSubAccountId" + serviceSubscriptionCounter); + serviceSubscription.setServiceType("testServiceType" + serviceSubscriptionCounter); - return serviceSubscription; - } + return serviceSubscription; + } - public Customer buildCustomer() { - customerCounter++; + public Customer buildCustomer() { + customerCounter++; - Customer customer = new Customer(); - customer.setGlobalCustomerId("testGlobalCustomerId" + customerCounter); - customer.setSubscriberType("testSubscriberType" + customerCounter); + Customer customer = new Customer(); + customer.setGlobalCustomerId("testGlobalCustomerId" + customerCounter); + customer.setSubscriberType("testSubscriberType" + customerCounter); - customer.setServiceSubscription(buildServiceSubscription()); + customer.setServiceSubscription(buildServiceSubscription()); - return customer; - } + return customer; + } - public ServiceInstance buildServiceInstance() { - serviceInstanceCounter++; + public ServiceInstance buildServiceInstance() { + serviceInstanceCounter++; - ServiceInstance serviceInstance = new ServiceInstance(); - serviceInstance.setServiceInstanceId("testServiceInstanceId" + serviceInstanceCounter); - serviceInstance.setServiceInstanceName("testServiceInstanceName" + serviceInstanceCounter); + ServiceInstance serviceInstance = new ServiceInstance(); + serviceInstance.setServiceInstanceId("testServiceInstanceId" + serviceInstanceCounter); + serviceInstance.setServiceInstanceName("testServiceInstanceName" + serviceInstanceCounter); - ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance(); - modelInfoServiceInstance.setModelInvariantUuid("testModelInvariantUUID" + serviceInstanceCounter); - modelInfoServiceInstance.setModelUuid("testModelUUID" + serviceInstanceCounter); - modelInfoServiceInstance.setModelVersion("testModelVersion" + serviceInstanceCounter); - modelInfoServiceInstance.setModelName("testModelName" + serviceInstanceCounter); - modelInfoServiceInstance.setServiceType("testServiceType" + serviceInstanceCounter); - serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); + ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance(); + modelInfoServiceInstance.setModelInvariantUuid("testModelInvariantUUID" + serviceInstanceCounter); + modelInfoServiceInstance.setModelUuid("testModelUUID" + serviceInstanceCounter); + modelInfoServiceInstance.setModelVersion("testModelVersion" + serviceInstanceCounter); + modelInfoServiceInstance.setModelName("testModelName" + serviceInstanceCounter); + modelInfoServiceInstance.setServiceType("testServiceType" + serviceInstanceCounter); + serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); - serviceInstance.setProject(buildProject()); + serviceInstance.setProject(buildProject()); - serviceInstance.setOwningEntity(buildOwningEntity()); + serviceInstance.setOwningEntity(buildOwningEntity()); - serviceInstance.setCollection(buildCollection()); + serviceInstance.setCollection(buildCollection()); - serviceInstance.getConfigurations().add(buildConfiguration()); + serviceInstance.getConfigurations().add(buildConfiguration()); - return serviceInstance; - } + return serviceInstance; + } - public ServiceInstance setServiceInstance() { - ServiceInstance serviceInstance = buildServiceInstance(); + public ServiceInstance setServiceInstance() { + ServiceInstance serviceInstance = buildServiceInstance(); - if(gBBInput.getCustomer() == null) { - gBBInput.setCustomer(buildCustomer()); - } - gBBInput.getCustomer().getServiceSubscription().getServiceInstances().add(serviceInstance); - lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, serviceInstance.getServiceInstanceId()); + if (gBBInput.getCustomer() == null) { + gBBInput.setCustomer(buildCustomer()); + } + gBBInput.getCustomer().getServiceSubscription().getServiceInstances().add(serviceInstance); + lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, serviceInstance.getServiceInstanceId()); - return serviceInstance; - } + return serviceInstance; + } - public Customer setCustomer() { - if(gBBInput.getCustomer() != null) return gBBInput.getCustomer(); - Customer customer = new Customer(); - customer.setGlobalCustomerId("testGlobalCustomerId"); - customer.setSubscriberType("testSubscriberType"); + public Customer setCustomer() { + if (gBBInput.getCustomer() != null) + return gBBInput.getCustomer(); + Customer customer = new Customer(); + customer.setGlobalCustomerId("testGlobalCustomerId"); + customer.setSubscriberType("testSubscriberType"); - customer.setServiceSubscription(buildServiceSubscription()); + customer.setServiceSubscription(buildServiceSubscription()); - gBBInput.setCustomer(customer); + gBBInput.setCustomer(customer); - return customer; - } + return customer; + } - public Collection setCollection() { - Collection collection = new Collection(); - collection.setId("testId"); + public Collection setCollection() { + Collection collection = new Collection(); + collection.setId("testId"); - ServiceInstance serviceInstance = null; + ServiceInstance serviceInstance = null; - try { - serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); - } catch(BBObjectNotFoundException e) { - serviceInstance = setServiceInstance(); - } + try { + serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); + } catch (BBObjectNotFoundException e) { + serviceInstance = setServiceInstance(); + } - serviceInstance.setCollection(collection); + serviceInstance.setCollection(collection); - return collection; - } + return collection; + } - public InstanceGroup setInstanceGroup() { - InstanceGroup instanceGroup = new InstanceGroup(); - instanceGroup.setId("testId"); - instanceGroup.setInstanceGroupFunction("testInstanceGroupFunction"); + public InstanceGroup setInstanceGroup() { + InstanceGroup instanceGroup = new InstanceGroup(); + instanceGroup.setId("testId"); + instanceGroup.setInstanceGroupFunction("testInstanceGroupFunction"); - Collection collection = null; + Collection collection = null; - try { - ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); - collection = serviceInstance.getCollection(); + try { + ServiceInstance serviceInstance = + extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); + collection = serviceInstance.getCollection(); - if (collection == null) { - collection = setCollection(); - } - } catch(BBObjectNotFoundException e) { - collection = setCollection(); - } + if (collection == null) { + collection = setCollection(); + } + } catch (BBObjectNotFoundException e) { + collection = setCollection(); + } - collection.setInstanceGroup(instanceGroup); + collection.setInstanceGroup(instanceGroup); - return instanceGroup; - } + return instanceGroup; + } - public VpnBinding buildVpnBinding() { - vpnBindingCounter++; + public VpnBinding buildVpnBinding() { + vpnBindingCounter++; - VpnBinding vpnBinding = new VpnBinding(); - vpnBinding.setVpnId("testVpnId" + vpnBindingCounter); - vpnBinding.setVpnName("testVpnName" + vpnBindingCounter); - vpnBinding.setCustomerVpnId("testCustomerVpnId" + vpnBindingCounter); + VpnBinding vpnBinding = new VpnBinding(); + vpnBinding.setVpnId("testVpnId" + vpnBindingCounter); + vpnBinding.setVpnName("testVpnName" + vpnBindingCounter); + vpnBinding.setCustomerVpnId("testCustomerVpnId" + vpnBindingCounter); - return vpnBinding; - } + return vpnBinding; + } - public VpnBinding setVpnBinding() { - VpnBinding vpnBinding = buildVpnBinding(); + public VpnBinding setVpnBinding() { + VpnBinding vpnBinding = buildVpnBinding(); - Customer customer = gBBInput.getCustomer(); + Customer customer = gBBInput.getCustomer(); - if(customer == null){ - customer = buildCustomer(); - } + if (customer == null) { + customer = buildCustomer(); + } - customer.getVpnBindings().add(vpnBinding); - lookupKeyMap.put(ResourceKey.VPN_ID, vpnBinding.getVpnId()); + customer.getVpnBindings().add(vpnBinding); + lookupKeyMap.put(ResourceKey.VPN_ID, vpnBinding.getVpnId()); - return vpnBinding; - } + return vpnBinding; + } - public InstanceGroup buildInstanceGroup() { - instanceGroupCounter++; + public InstanceGroup buildInstanceGroup() { + instanceGroupCounter++; - InstanceGroup instanceGroup = new InstanceGroup(); - instanceGroup.setId("testId" + instanceGroupCounter); - instanceGroup.setInstanceGroupFunction("testInstanceGroupFunction" + instanceGroupCounter); + InstanceGroup instanceGroup = new InstanceGroup(); + instanceGroup.setId("testId" + instanceGroupCounter); + instanceGroup.setInstanceGroupFunction("testInstanceGroupFunction" + instanceGroupCounter); - return instanceGroup; - } + return instanceGroup; + } - public L3Network buildL3Network() { - l3NetworkCounter++; + public L3Network buildL3Network() { + l3NetworkCounter++; - L3Network network = new L3Network(); - network.setNetworkId("testNetworkId" + l3NetworkCounter); - network.setNetworkName("testNetworkName" + l3NetworkCounter); - network.setNetworkType("testNetworkType" + l3NetworkCounter); + L3Network network = new L3Network(); + network.setNetworkId("testNetworkId" + l3NetworkCounter); + network.setNetworkName("testNetworkName" + l3NetworkCounter); + network.setNetworkType("testNetworkType" + l3NetworkCounter); - ModelInfoNetwork modelInfoNetwork = new ModelInfoNetwork(); - modelInfoNetwork.setModelInvariantUUID("testModelInvariantUUID" + l3NetworkCounter); - modelInfoNetwork.setModelName("testModelName" + l3NetworkCounter); - modelInfoNetwork.setModelVersion("testModelVersion" + l3NetworkCounter); - modelInfoNetwork.setModelUUID("testModelUUID" + l3NetworkCounter); - network.setModelInfoNetwork(modelInfoNetwork); + ModelInfoNetwork modelInfoNetwork = new ModelInfoNetwork(); + modelInfoNetwork.setModelInvariantUUID("testModelInvariantUUID" + l3NetworkCounter); + modelInfoNetwork.setModelName("testModelName" + l3NetworkCounter); + modelInfoNetwork.setModelVersion("testModelVersion" + l3NetworkCounter); + modelInfoNetwork.setModelUUID("testModelUUID" + l3NetworkCounter); + network.setModelInfoNetwork(modelInfoNetwork); - return network; - } + return network; + } - public L3Network setL3Network() { - L3Network network = buildL3Network(); + public L3Network setL3Network() { + L3Network network = buildL3Network(); - ServiceInstance serviceInstance = null; + ServiceInstance serviceInstance = null; - try { - serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); - } catch(BBObjectNotFoundException e) { - serviceInstance = setServiceInstance(); - } + try { + serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); + } catch (BBObjectNotFoundException e) { + serviceInstance = setServiceInstance(); + } - serviceInstance.getNetworks().add(network); - lookupKeyMap.put(ResourceKey.NETWORK_ID, network.getNetworkId()); + serviceInstance.getNetworks().add(network); + lookupKeyMap.put(ResourceKey.NETWORK_ID, network.getNetworkId()); - return network; - } + return network; + } - public GenericVnf buildGenericVnf() { - genericVnfCounter++; + public GenericVnf buildGenericVnf() { + genericVnfCounter++; - GenericVnf genericVnf = new GenericVnf(); - genericVnf.setVnfId("testVnfId" + genericVnfCounter); - genericVnf.setVnfName("testVnfName" + genericVnfCounter); - genericVnf.setVnfType("testVnfType" + genericVnfCounter); + GenericVnf genericVnf = new GenericVnf(); + genericVnf.setVnfId("testVnfId" + genericVnfCounter); + genericVnf.setVnfName("testVnfName" + genericVnfCounter); + genericVnf.setVnfType("testVnfType" + genericVnfCounter); - Platform platform = new Platform(); - platform.setPlatformName("testPlatformName"); - genericVnf.setPlatform(platform); + Platform platform = new Platform(); + platform.setPlatformName("testPlatformName"); + genericVnf.setPlatform(platform); - LineOfBusiness lob = new LineOfBusiness(); - lob.setLineOfBusinessName("testLineOfBusinessName"); - genericVnf.setLineOfBusiness(lob); + LineOfBusiness lob = new LineOfBusiness(); + lob.setLineOfBusinessName("testLineOfBusinessName"); + genericVnf.setLineOfBusiness(lob); - ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf(); - modelInfoGenericVnf.setModelName("testModelName" + genericVnfCounter); - modelInfoGenericVnf.setModelCustomizationUuid("testModelCustomizationUUID" + genericVnfCounter); - modelInfoGenericVnf.setModelInvariantUuid("testModelInvariantUUID" + genericVnfCounter); - modelInfoGenericVnf.setModelVersion("testModelVersion" + genericVnfCounter); - modelInfoGenericVnf.setModelUuid("testModelUUID" + genericVnfCounter); - modelInfoGenericVnf.setModelInstanceName("testModelInstanceName" + genericVnfCounter); - genericVnf.setModelInfoGenericVnf(modelInfoGenericVnf); + ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf(); + modelInfoGenericVnf.setModelName("testModelName" + genericVnfCounter); + modelInfoGenericVnf.setModelCustomizationUuid("testModelCustomizationUUID" + genericVnfCounter); + modelInfoGenericVnf.setModelInvariantUuid("testModelInvariantUUID" + genericVnfCounter); + modelInfoGenericVnf.setModelVersion("testModelVersion" + genericVnfCounter); + modelInfoGenericVnf.setModelUuid("testModelUUID" + genericVnfCounter); + modelInfoGenericVnf.setModelInstanceName("testModelInstanceName" + genericVnfCounter); + genericVnf.setModelInfoGenericVnf(modelInfoGenericVnf); - return genericVnf; - } + return genericVnf; + } - public GenericVnf setGenericVnf() { - GenericVnf genericVnf = buildGenericVnf(); + public GenericVnf setGenericVnf() { + GenericVnf genericVnf = buildGenericVnf(); - ServiceInstance serviceInstance = null; + ServiceInstance serviceInstance = null; - try { - serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); - } catch(BBObjectNotFoundException e) { - serviceInstance = setServiceInstance(); - } + try { + serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); + } catch (BBObjectNotFoundException e) { + serviceInstance = setServiceInstance(); + } - serviceInstance.getVnfs().add(genericVnf); - lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, genericVnf.getVnfId()); + serviceInstance.getVnfs().add(genericVnf); + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, genericVnf.getVnfId()); - return genericVnf; - } + return genericVnf; + } - public VfModule buildVfModule() { - vfModuleCounter++; + public VfModule buildVfModule() { + vfModuleCounter++; - VfModule vfModule = new VfModule(); - vfModule.setVfModuleId("testVfModuleId" + vfModuleCounter); - vfModule.setVfModuleName("testVfModuleName" + vfModuleCounter); + VfModule vfModule = new VfModule(); + vfModule.setVfModuleId("testVfModuleId" + vfModuleCounter); + vfModule.setVfModuleName("testVfModuleName" + vfModuleCounter); - ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule(); - modelInfoVfModule.setModelInvariantUUID("testModelInvariantUUID" + vfModuleCounter); - modelInfoVfModule.setModelVersion("testModelVersion" + vfModuleCounter); - modelInfoVfModule.setModelUUID("testModelUUID" + vfModuleCounter); - modelInfoVfModule.setModelName("testModelName" + vfModuleCounter); - modelInfoVfModule.setModelCustomizationUUID("testModelCustomizationUUID" + vfModuleCounter); - vfModule.setModelInfoVfModule(modelInfoVfModule); + ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule(); + modelInfoVfModule.setModelInvariantUUID("testModelInvariantUUID" + vfModuleCounter); + modelInfoVfModule.setModelVersion("testModelVersion" + vfModuleCounter); + modelInfoVfModule.setModelUUID("testModelUUID" + vfModuleCounter); + modelInfoVfModule.setModelName("testModelName" + vfModuleCounter); + modelInfoVfModule.setModelCustomizationUUID("testModelCustomizationUUID" + vfModuleCounter); + vfModule.setModelInfoVfModule(modelInfoVfModule); - return vfModule; - } + return vfModule; + } - public VfModule setVfModule() { - VfModule vfModule = buildVfModule(); + public VfModule setVfModule() { + VfModule vfModule = buildVfModule(); - GenericVnf genericVnf = null; + GenericVnf genericVnf = null; - try { - genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); - } catch(BBObjectNotFoundException e) { - genericVnf = setGenericVnf(); - } + try { + genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); + } catch (BBObjectNotFoundException e) { + genericVnf = setGenericVnf(); + } - genericVnf.getVfModules().add(vfModule); - lookupKeyMap.put(ResourceKey.VF_MODULE_ID, vfModule.getVfModuleId()); + genericVnf.getVfModules().add(vfModule); + lookupKeyMap.put(ResourceKey.VF_MODULE_ID, vfModule.getVfModuleId()); - return vfModule; - } + return vfModule; + } - public VolumeGroup buildVolumeGroup() { - volumeGroupCounter++; + public VolumeGroup buildVolumeGroup() { + volumeGroupCounter++; - VolumeGroup volumeGroup = new VolumeGroup(); - volumeGroup.setVolumeGroupId("testVolumeGroupId" + volumeGroupCounter); - volumeGroup.setVolumeGroupName("testVolumeGroupName" + volumeGroupCounter); - volumeGroup.setHeatStackId("testHeatStackId" + volumeGroupCounter); + VolumeGroup volumeGroup = new VolumeGroup(); + volumeGroup.setVolumeGroupId("testVolumeGroupId" + volumeGroupCounter); + volumeGroup.setVolumeGroupName("testVolumeGroupName" + volumeGroupCounter); + volumeGroup.setHeatStackId("testHeatStackId" + volumeGroupCounter); - return volumeGroup; - } + return volumeGroup; + } - public VolumeGroup setVolumeGroup() { - VolumeGroup volumeGroup = buildVolumeGroup(); + public VolumeGroup setVolumeGroup() { + VolumeGroup volumeGroup = buildVolumeGroup(); - GenericVnf genericVnf = null; + GenericVnf genericVnf = null; - try { - genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); - } catch(BBObjectNotFoundException e) { - genericVnf = setGenericVnf(); - } + try { + genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); + } catch (BBObjectNotFoundException e) { + genericVnf = setGenericVnf(); + } - genericVnf.getVolumeGroups().add(volumeGroup); - lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, volumeGroup.getVolumeGroupId()); + genericVnf.getVolumeGroups().add(volumeGroup); + lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, volumeGroup.getVolumeGroupId()); - return volumeGroup; - } + return volumeGroup; + } - public Pnf buildPnf() { - pnfCounter++; + public Pnf buildPnf() { + pnfCounter++; - Pnf pnf = new Pnf(); - pnf.setPnfId("testPnfId" + pnfCounter); - pnf.setPnfName("testPnfName" + pnfCounter); + Pnf pnf = new Pnf(); + pnf.setPnfId("testPnfId" + pnfCounter); + pnf.setPnfName("testPnfName" + pnfCounter); - return pnf; - } + return pnf; + } - public ServiceProxy buildServiceProxy() { - serviceProxyCounter++; + public ServiceProxy buildServiceProxy() { + serviceProxyCounter++; ServiceProxy serviceProxy = new ServiceProxy(); serviceProxy.setServiceInstance(buildServiceInstance()); @@ -587,83 +586,83 @@ public class BuildingBlockTestDataSetup{ serviceProxy.getServiceInstance().getPnfs().add(secondaryPnf); return serviceProxy; - } + } - public VpnBondingLink buildVpnBondingLink() { - vpnBondingLinkCounter++; + public VpnBondingLink buildVpnBondingLink() { + vpnBondingLinkCounter++; - VpnBondingLink vpnBondingLink = new VpnBondingLink(); - vpnBondingLink.setVpnBondingLinkId("testVpnBondingLinkId" + vpnBondingLinkCounter); + VpnBondingLink vpnBondingLink = new VpnBondingLink(); + vpnBondingLink.setVpnBondingLinkId("testVpnBondingLinkId" + vpnBondingLinkCounter); - Configuration vnrConfiguration = buildConfiguration(); - vnrConfiguration.setNetwork(buildL3Network()); - vpnBondingLink.setVnrConfiguration(vnrConfiguration); + Configuration vnrConfiguration = buildConfiguration(); + vnrConfiguration.setNetwork(buildL3Network()); + vpnBondingLink.setVnrConfiguration(vnrConfiguration); - vpnBondingLink.setVrfConfiguration(buildConfiguration()); + vpnBondingLink.setVrfConfiguration(buildConfiguration()); vpnBondingLink.setInfrastructureServiceProxy(buildServiceProxy()); vpnBondingLink.setTransportServiceProxy(buildServiceProxy()); - return vpnBondingLink; - } + return vpnBondingLink; + } - public VpnBondingLink setVpnBondingLink() { - VpnBondingLink vpnBondingLink = buildVpnBondingLink(); + public VpnBondingLink setVpnBondingLink() { + VpnBondingLink vpnBondingLink = buildVpnBondingLink(); - ServiceInstance serviceInstance = null; + ServiceInstance serviceInstance = null; - try { - serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); - } catch(BBObjectNotFoundException e) { - serviceInstance = setServiceInstance(); - } + try { + serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); + } catch (BBObjectNotFoundException e) { + serviceInstance = setServiceInstance(); + } - serviceInstance.getVpnBondingLinks().add(vpnBondingLink); - lookupKeyMap.put(ResourceKey.VPN_BONDING_LINK_ID, vpnBondingLink.getVpnBondingLinkId()); + serviceInstance.getVpnBondingLinks().add(vpnBondingLink); + lookupKeyMap.put(ResourceKey.VPN_BONDING_LINK_ID, vpnBondingLink.getVpnBondingLinkId()); - return vpnBondingLink; - } + return vpnBondingLink; + } - public Customer setAvpnCustomer() { - Customer customer = buildCustomer(); + public Customer setAvpnCustomer() { + Customer customer = buildCustomer(); - gBBInput.setCustomer(customer); + gBBInput.setCustomer(customer); - return customer; - } + return customer; + } - public ServiceProxy setServiceProxy(String uniqueIdentifier, String type) { - ServiceProxy serviceProxy = new ServiceProxy(); - serviceProxy.setId("testProxyId" + uniqueIdentifier); - serviceProxy.setType(type); + public ServiceProxy setServiceProxy(String uniqueIdentifier, String type) { + ServiceProxy serviceProxy = new ServiceProxy(); + serviceProxy.setId("testProxyId" + uniqueIdentifier); + serviceProxy.setType(type); - ModelInfoServiceProxy modelInfo = new ModelInfoServiceProxy(); - modelInfo.setModelInvariantUuid("testProxyModelInvariantUuid" + uniqueIdentifier); - modelInfo.setModelName("testProxyModelName" + uniqueIdentifier); - modelInfo.setModelUuid("testProxyModelUuid" + uniqueIdentifier); - modelInfo.setModelVersion("testProxyModelVersion" + uniqueIdentifier); - modelInfo.setModelInstanceName("testProxyModelInstanceName" + uniqueIdentifier); + ModelInfoServiceProxy modelInfo = new ModelInfoServiceProxy(); + modelInfo.setModelInvariantUuid("testProxyModelInvariantUuid" + uniqueIdentifier); + modelInfo.setModelName("testProxyModelName" + uniqueIdentifier); + modelInfo.setModelUuid("testProxyModelUuid" + uniqueIdentifier); + modelInfo.setModelVersion("testProxyModelVersion" + uniqueIdentifier); + modelInfo.setModelInstanceName("testProxyModelInstanceName" + uniqueIdentifier); - serviceProxy.setModelInfoServiceProxy(modelInfo); + serviceProxy.setModelInfoServiceProxy(modelInfo); - return serviceProxy; - } + return serviceProxy; + } - public AllottedResource setAllottedResource(String uniqueIdentifier) { - AllottedResource ar = new AllottedResource(); - ar.setId("testAllottedResourceId" + uniqueIdentifier); + public AllottedResource setAllottedResource(String uniqueIdentifier) { + AllottedResource ar = new AllottedResource(); + ar.setId("testAllottedResourceId" + uniqueIdentifier); - ModelInfoAllottedResource modelInfo = new ModelInfoAllottedResource(); - modelInfo.setModelInvariantUuid("testAllottedModelInvariantUuid" + uniqueIdentifier); - modelInfo.setModelName("testAllottedModelName" + uniqueIdentifier); - modelInfo.setModelUuid("testAllottedModelUuid" + uniqueIdentifier); - modelInfo.setModelVersion("testAllottedModelVersion" + uniqueIdentifier); - modelInfo.setModelInstanceName("testAllottedModelInstanceName" + uniqueIdentifier); + ModelInfoAllottedResource modelInfo = new ModelInfoAllottedResource(); + modelInfo.setModelInvariantUuid("testAllottedModelInvariantUuid" + uniqueIdentifier); + modelInfo.setModelName("testAllottedModelName" + uniqueIdentifier); + modelInfo.setModelUuid("testAllottedModelUuid" + uniqueIdentifier); + modelInfo.setModelVersion("testAllottedModelVersion" + uniqueIdentifier); + modelInfo.setModelInstanceName("testAllottedModelInstanceName" + uniqueIdentifier); - ar.setModelInfoAllottedResource(modelInfo); + ar.setModelInfoAllottedResource(modelInfo); - return ar; - } -}
\ No newline at end of file + return ar; + } +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java index fb08e5e830..62d9ecee44 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java @@ -19,6 +19,7 @@ */ package org.onap.so; + import ch.vorburger.exec.ManagedProcessException; import ch.vorburger.mariadb4j.DBConfigurationBuilder; import ch.vorburger.mariadb4j.springframework.MariaDB4jSpringService; @@ -35,30 +36,25 @@ public class EmbeddedMariaDbConfig { @Bean MariaDB4jSpringService mariaDB4jSpringService() { - MariaDB4jSpringService service = new MariaDB4jSpringService(); - - - service.getConfiguration().addArg("--lower_case_table_names=1"); + MariaDB4jSpringService service = new MariaDB4jSpringService(); + + + service.getConfiguration().addArg("--lower_case_table_names=1"); return service; } @Bean DataSource dataSource(MariaDB4jSpringService mariaDB4jSpringService, - @Value("${mariaDB4j.databaseName}") String databaseName, - @Value("${spring.datasource.username}") String datasourceUsername, - @Value("${spring.datasource.password}") String datasourcePassword, - @Value("${spring.datasource.driver-class-name}") String datasourceDriver) throws ManagedProcessException { - //Create our database with default root user and no password + @Value("${mariaDB4j.databaseName}") String databaseName, + @Value("${spring.datasource.username}") String datasourceUsername, + @Value("${spring.datasource.password}") String datasourcePassword, + @Value("${spring.datasource.driver-class-name}") String datasourceDriver) throws ManagedProcessException { + // Create our database with default root user and no password mariaDB4jSpringService.getDB().createDB(databaseName); DBConfigurationBuilder config = mariaDB4jSpringService.getConfiguration(); - return DataSourceBuilder - .create() - .username(datasourceUsername) - .password(datasourcePassword) - .url(config.getURL(databaseName)) - .driverClassName(datasourceDriver) - .build(); + return DataSourceBuilder.create().username(datasourceUsername).password(datasourcePassword) + .url(config.getURL(databaseName)).driverClassName(datasourceDriver).build(); } } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/MockLoggerDelegate.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/MockLoggerDelegate.java index 5d4d923426..7b049c63e3 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/MockLoggerDelegate.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/MockLoggerDelegate.java @@ -24,12 +24,12 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import org.camunda.bpm.engine.delegate.JavaDelegate; public class MockLoggerDelegate implements JavaDelegate { - @Override - public void execute(DelegateExecution execution) throws Exception { - System.out.println("\n\n ..." + MockLoggerDelegate.class.getName() + " invoked by " + "processDefinitionId=" - + execution.getProcessDefinitionId() + ", activtyId=" + execution.getCurrentActivityId() - + ", activtyName='" + execution.getCurrentActivityName() + "'" + ", processInstanceId=" - + execution.getProcessInstanceId() + ", businessKey=" + execution.getProcessBusinessKey() - + ", executionId=" + execution.getId() + " \n\n"); - } + @Override + public void execute(DelegateExecution execution) throws Exception { + System.out.println("\n\n ..." + MockLoggerDelegate.class.getName() + " invoked by " + "processDefinitionId=" + + execution.getProcessDefinitionId() + ", activtyId=" + execution.getCurrentActivityId() + + ", activtyName='" + execution.getCurrentActivityName() + "'" + ", processInstanceId=" + + execution.getProcessInstanceId() + ", businessKey=" + execution.getProcessBusinessKey() + + ", executionId=" + execution.getId() + " \n\n"); + } } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/SerializableChecker.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/SerializableChecker.java index 97c17d5238..47ddea1b4f 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/SerializableChecker.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/SerializableChecker.java @@ -29,78 +29,65 @@ import java.util.HashSet; import java.util.List; import java.util.Set; -public final class SerializableChecker -{ - public static class SerializationFailure - { +public final class SerializableChecker { + public static class SerializationFailure { private final String mContainingClass; private final String mMemberName; - public SerializationFailure(String inNonSerializableClass, String inMemberName) - { + public SerializationFailure(String inNonSerializableClass, String inMemberName) { mContainingClass = inNonSerializableClass; mMemberName = inMemberName; } - public String getContainingClass() - { + public String getContainingClass() { return mContainingClass; } - public String getMemberName() - { + public String getMemberName() { return mMemberName; } - public String getBadMemberString() - { + public String getBadMemberString() { if (mMemberName == null) return mContainingClass; return mContainingClass + "." + mMemberName; } @Override - public String toString() - { - return "SerializationFailure [mNonSerializableClass=" + mContainingClass + ", mMemberName=" + mMemberName + "]"; + public String toString() { + return "SerializationFailure [mNonSerializableClass=" + mContainingClass + ", mMemberName=" + mMemberName + + "]"; } } - private static class SerializationCheckerData - { + private static class SerializationCheckerData { private Set<Class<?>> mSerializableClasses; - SerializationCheckerData() - { + SerializationCheckerData() { mSerializableClasses = new HashSet<Class<?>>(); } - boolean isAlreadyChecked(Class<?> inClass) - { + boolean isAlreadyChecked(Class<?> inClass) { return mSerializableClasses.contains(inClass); } - void addSerializableClass(Class<?> inClass) - { + void addSerializableClass(Class<?> inClass) { mSerializableClasses.add(inClass); } } - private SerializableChecker() - { } + private SerializableChecker() {} - public static SerializationFailure isFullySerializable(Class<?> inClass) - { + public static SerializationFailure isFullySerializable(Class<?> inClass) { if (!isSerializable(inClass)) return new SerializationFailure(inClass.getName(), null); return isFullySerializable(inClass, new SerializationCheckerData()); } - private static SerializationFailure isFullySerializable(Class<?> inClass, SerializationCheckerData inSerializationCheckerData) - { - for (Field field : declaredFields(inClass)) - { + private static SerializationFailure isFullySerializable(Class<?> inClass, + SerializationCheckerData inSerializationCheckerData) { + for (Field field : declaredFields(inClass)) { Class<?> fieldDeclaringClass = field.getType(); if (field.getType() == Object.class) @@ -121,8 +108,7 @@ public final class SerializableChecker if (inSerializationCheckerData.isAlreadyChecked(fieldDeclaringClass)) continue; - if (isSerializable(fieldDeclaringClass)) - { + if (isSerializable(fieldDeclaringClass)) { inSerializationCheckerData.addSerializableClass(inClass); SerializationFailure failure = isFullySerializable(field.getType(), inSerializationCheckerData); @@ -140,8 +126,7 @@ public final class SerializableChecker return null; } - private static boolean isSerializable(Class<?> inClass) - { + private static boolean isSerializable(Class<?> inClass) { Set<Class<?>> interfaces = getInterfaces(inClass); if (interfaces == null) return false; @@ -149,8 +134,7 @@ public final class SerializableChecker if (isSerializable) return true; - for (Class<?> classInterface : interfaces) - { + for (Class<?> classInterface : interfaces) { if (isSerializable(classInterface)) return true; } @@ -161,13 +145,11 @@ public final class SerializableChecker return false; } - private static Set<Class<?>> getInterfaces(Class<?> inFieldDeclaringClass) - { + private static Set<Class<?>> getInterfaces(Class<?> inFieldDeclaringClass) { return new HashSet<Class<?>>(Arrays.asList(inFieldDeclaringClass.getInterfaces())); } - private static List<Field> declaredFields(Class<?> inClass) - { + private static List<Field> declaredFields(Class<?> inClass) { List<Field> fields = new ArrayList<Field>(Arrays.asList(inClass.getDeclaredFields())); Class<?> parentClasses = inClass.getSuperclass(); @@ -177,5 +159,5 @@ public final class SerializableChecker fields.addAll(declaredFields(parentClasses)); return fields; - } } +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/TestApplication.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/TestApplication.java index 11309914ef..029b77319b 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/TestApplication.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/TestApplication.java @@ -30,14 +30,14 @@ import org.springframework.context.annotation.Profile; @SpringBootApplication @Profile("test") -@ComponentScan(basePackages = {"org.onap.so"}, nameGenerator = DefaultToShortClassNameBeanNameGenerator.class, excludeFilters = { - @Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class)}) +@ComponentScan(basePackages = {"org.onap.so"}, nameGenerator = DefaultToShortClassNameBeanNameGenerator.class, + excludeFilters = {@Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class)}) public class TestApplication { - public static void main(String... args) { - SpringApplication.run(TestApplication.class, args); - System.getProperties().setProperty("mso.db", "MARIADB"); - System.getProperties().setProperty("server.name", "Springboot"); - - - } + public static void main(String... args) { + SpringApplication.run(TestApplication.class, args); + System.getProperties().setProperty("mso.db", "MARIADB"); + System.getProperties().setProperty("server.name", "Springboot"); + + + } } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/BaseBPMNTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/BaseBPMNTest.java index deb985c62b..2a0fef0caa 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/BaseBPMNTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/BaseBPMNTest.java @@ -94,217 +94,209 @@ import org.springframework.test.context.junit4.SpringRunner; @SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @ActiveProfiles("test") public abstract class BaseBPMNTest { - @Autowired - protected RuntimeService runtimeService; + @Autowired + protected RuntimeService runtimeService; - @Autowired - protected ExternalTaskService externalTaskService; - - @Autowired - private RepositoryService repositoryService; + @Autowired + protected ExternalTaskService externalTaskService; - protected Map<String, Object> variables = new HashMap<>(); + @Autowired + private RepositoryService repositoryService; - protected List<String> mockedSubprocessList = new ArrayList<>(); + protected Map<String, Object> variables = new HashMap<>(); - protected TestRestTemplate restTemplate = new TestRestTemplate(); + protected List<String> mockedSubprocessList = new ArrayList<>(); - protected HttpHeaders headers = new HttpHeaders(); + protected TestRestTemplate restTemplate = new TestRestTemplate(); - @MockBean - protected AAIUpdateTasks aaiUpdateTasks; + protected HttpHeaders headers = new HttpHeaders(); - @MockBean - protected AAICreateTasks aaiCreateTasks; + @MockBean + protected AAIUpdateTasks aaiUpdateTasks; - @MockBean - protected AAIQueryTasks aaiQueryTasks; + @MockBean + protected AAICreateTasks aaiCreateTasks; - @MockBean - protected AAIDeleteTasks aaiDeleteTasks; + @MockBean + protected AAIQueryTasks aaiQueryTasks; - @MockBean - protected AAIFlagTasks aaiFlagTasks; + @MockBean + protected AAIDeleteTasks aaiDeleteTasks; + @MockBean + protected AAIFlagTasks aaiFlagTasks; - @MockBean - protected AppcRunTasks appcRunTasks; - @MockBean - protected SDNCActivateTasks sdncActivateTasks; + @MockBean + protected AppcRunTasks appcRunTasks; - @MockBean - protected SDNCAssignTasks sdncAssignTasks; + @MockBean + protected SDNCActivateTasks sdncActivateTasks; - @MockBean - protected SDNCUnassignTasks sdncUnassignTasks; + @MockBean + protected SDNCAssignTasks sdncAssignTasks; - @MockBean - protected SDNCDeactivateTasks sdncDeactivateTasks; + @MockBean + protected SDNCUnassignTasks sdncUnassignTasks; - @MockBean - protected SDNCQueryTasks sdncQueryTasks; + @MockBean + protected SDNCDeactivateTasks sdncDeactivateTasks; - @MockBean - protected SDNCChangeAssignTasks sdncChangeAssignTasks; + @MockBean + protected SDNCQueryTasks sdncQueryTasks; - @MockBean - protected NetworkAdapterDeleteTasks networkAdapterDeleteTasks; + @MockBean + protected SDNCChangeAssignTasks sdncChangeAssignTasks; - @MockBean - protected NetworkAdapterUpdateTasks networkAdapterUpdateTasks; + @MockBean + protected NetworkAdapterDeleteTasks networkAdapterDeleteTasks; - @MockBean - protected VnfAdapterCreateTasks vnfAdapterCreateTasks; + @MockBean + protected NetworkAdapterUpdateTasks networkAdapterUpdateTasks; - @MockBean - protected NetworkAdapterCreateTasks networkAdapterCreateTasks; + @MockBean + protected VnfAdapterCreateTasks vnfAdapterCreateTasks; - @MockBean - protected CreateNetwork createNetwork; + @MockBean + protected NetworkAdapterCreateTasks networkAdapterCreateTasks; - @MockBean - protected AssignNetworkBBUtils assignNetworkBBUtils; + @MockBean + protected CreateNetwork createNetwork; - @MockBean - protected AssignNetwork assignNetwork; + @MockBean + protected AssignNetworkBBUtils assignNetworkBBUtils; - @MockBean - protected CreateNetworkCollection createNetworkCollection; + @MockBean + protected AssignNetwork assignNetwork; - @MockBean - protected VnfAdapterDeleteTasks vnfAdapterDeleteTasks; + @MockBean + protected CreateNetworkCollection createNetworkCollection; - @MockBean - protected AAICommonTasks aaiCommonTasks; + @MockBean + protected VnfAdapterDeleteTasks vnfAdapterDeleteTasks; - @MockBean - protected ActivateVfModule activateVfModule; - - @MockBean - protected AssignVnf assignVnf; + @MockBean + protected AAICommonTasks aaiCommonTasks; - @MockBean - protected UnassignVnf unassignVnf; + @MockBean + protected ActivateVfModule activateVfModule; - @MockBean - protected VnfAdapterImpl vnfAdapterImpl; + @MockBean + protected AssignVnf assignVnf; - @MockBean - protected UnassignNetworkBB unassignNetworkBB; + @MockBean + protected UnassignVnf unassignVnf; - @MockBean - protected OrchestrationStatusValidator orchestrationStatusValidator; + @MockBean + protected VnfAdapterImpl vnfAdapterImpl; - @MockBean - protected BBInputSetup bbInputSetup; + @MockBean + protected UnassignNetworkBB unassignNetworkBB; - @MockBean - protected BBInputSetupUtils bbInputSetupUtils; + @MockBean + protected OrchestrationStatusValidator orchestrationStatusValidator; - @MockBean - protected ExecuteBuildingBlockRainyDay executeBuildingBlockRainyDay; + @MockBean + protected BBInputSetup bbInputSetup; - @MockBean - protected WorkflowAction workflowAction; - - @MockBean - protected WorkflowActionBBTasks workflowActionBBTasks; - - @MockBean - protected GenericVnfHealthCheck genericVnfHealthCheck; - - @MockBean - protected ConfigurationScaleOut configurationScaleOut; - - @MockBean - protected FlowCompletionTasks flowCompletionTasks; - - @MockBean - protected BuildingBlockValidatorRunner buildingBlockValidatorRunner; - - @MockBean - protected SDNOHealthCheckTasks sdnoHealthCheckTasks; - - @MockBean - protected SDNCClient sdncClient; - - @MockBean - protected SniroHomingV2 sniroHoming; - - @MockBean - protected NamingServiceDeleteTasks namingServiceDeleteTasks; - - @MockBean - protected NamingServiceCreateTasks namingServiceCreateTasks; - - @MockBean - protected WorkflowActionBBFailure workflowActionBBFailure; - - @MockBean - protected AuditTasks auditTasks; - - @MockBean - protected ManualHandlingTasks manualHandlingTasks; - - @LocalServerPort - protected int port; - - protected String createURLWithPort(String uri) { - return "http://localhost:" + port + uri; - } - - @Before - public void baseBefore() { - variables.put("gBuildingBlockExecution", new DelegateExecutionImpl(new HashMap<>())); - } - - @After - public void baseAfter() { - for (String deploymentId : mockedSubprocessList) { - repositoryService.deleteDeployment(deploymentId); - } - mockedSubprocessList.clear(); - } - - /** - * Create and deploy a process model with one logger delegate as service task. - * - * @param origProcessKey - * key to call - * @param mockProcessName - * process name - * @param fileName - * file name without extension - */ - protected void mockSubprocess(String origProcessKey, String mockProcessName, String fileName) { - mockSubprocess(origProcessKey, mockProcessName, fileName, new HashMap<String, String>()); - } - - /** - * Create and deploy a process model with one logger delegate as service task. - * - * @param origProcessKey - * key to call - * @param mockProcessName - * process name - * @param fileName - * file name without extension - * @param outParam - * output parameters - */ - protected void mockSubprocess(String origProcessKey, String mockProcessName, String fileName, Map<String, String> outParam) { - ServiceTaskBuilder builder = Bpmn - .createExecutableProcess(origProcessKey).name(mockProcessName) - .startEvent().name("Start_Event") - .serviceTask().name("Mock_Delegate") - .camundaClass(FluentJavaDelegateMock.class); - - for (String key : outParam.keySet()) { - builder.camundaOutputParameter(key, outParam.get(key)); - } - - BpmnModelInstance modelInstance = builder.endEvent().name("End_Event").done(); - mockedSubprocessList.add(repositoryService.createDeployment().addModelInstance(fileName + ".bpmn", modelInstance).deploy().getId()); - } + @MockBean + protected BBInputSetupUtils bbInputSetupUtils; + + @MockBean + protected ExecuteBuildingBlockRainyDay executeBuildingBlockRainyDay; + + @MockBean + protected WorkflowAction workflowAction; + + @MockBean + protected WorkflowActionBBTasks workflowActionBBTasks; + + @MockBean + protected GenericVnfHealthCheck genericVnfHealthCheck; + + @MockBean + protected ConfigurationScaleOut configurationScaleOut; + + @MockBean + protected FlowCompletionTasks flowCompletionTasks; + + @MockBean + protected BuildingBlockValidatorRunner buildingBlockValidatorRunner; + + @MockBean + protected SDNOHealthCheckTasks sdnoHealthCheckTasks; + + @MockBean + protected SDNCClient sdncClient; + + @MockBean + protected SniroHomingV2 sniroHoming; + + @MockBean + protected NamingServiceDeleteTasks namingServiceDeleteTasks; + + @MockBean + protected NamingServiceCreateTasks namingServiceCreateTasks; + + @MockBean + protected WorkflowActionBBFailure workflowActionBBFailure; + + @MockBean + protected AuditTasks auditTasks; + + @MockBean + protected ManualHandlingTasks manualHandlingTasks; + + @LocalServerPort + protected int port; + + protected String createURLWithPort(String uri) { + return "http://localhost:" + port + uri; + } + + @Before + public void baseBefore() { + variables.put("gBuildingBlockExecution", new DelegateExecutionImpl(new HashMap<>())); + } + + @After + public void baseAfter() { + for (String deploymentId : mockedSubprocessList) { + repositoryService.deleteDeployment(deploymentId); + } + mockedSubprocessList.clear(); + } + + /** + * Create and deploy a process model with one logger delegate as service task. + * + * @param origProcessKey key to call + * @param mockProcessName process name + * @param fileName file name without extension + */ + protected void mockSubprocess(String origProcessKey, String mockProcessName, String fileName) { + mockSubprocess(origProcessKey, mockProcessName, fileName, new HashMap<String, String>()); + } + + /** + * Create and deploy a process model with one logger delegate as service task. + * + * @param origProcessKey key to call + * @param mockProcessName process name + * @param fileName file name without extension + * @param outParam output parameters + */ + protected void mockSubprocess(String origProcessKey, String mockProcessName, String fileName, + Map<String, String> outParam) { + ServiceTaskBuilder builder = Bpmn.createExecutableProcess(origProcessKey).name(mockProcessName).startEvent() + .name("Start_Event").serviceTask().name("Mock_Delegate").camundaClass(FluentJavaDelegateMock.class); + + for (String key : outParam.keySet()) { + builder.camundaOutputParameter(key, outParam.get(key)); + } + + BpmnModelInstance modelInstance = builder.endEvent().name("End_Event").done(); + mockedSubprocessList.add(repositoryService.createDeployment() + .addModelInstance(fileName + ".bpmn", modelInstance).deploy().getId()); + } } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/AAICheckVnfInMaintBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/AAICheckVnfInMaintBBTest.java index 1101fc85f5..11e6d7798d 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/AAICheckVnfInMaintBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/AAICheckVnfInMaintBBTest.java @@ -23,37 +23,36 @@ package org.onap.so.bpmn.common; import static org.camunda.bpm.engine.test.assertions.ProcessEngineAssertions.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; - import java.io.IOException; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Ignore; import org.junit.Test; import org.onap.so.bpmn.BaseBPMNTest; -public class AAICheckVnfInMaintBBTest extends BaseBPMNTest{ - - - @Test - public void sunnyDayAAICheckVnfInMaintBBTest() throws InterruptedException, IOException { - ProcessInstance pi = runtimeService.startProcessInstanceByKey("AAICheckVnfInMaintBB", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("Start_AAICheckVnfInMaintBB", "Task_CheckVnfInMaint", "End_AAICheckVnfInMaintBB"); - assertThat(pi).isEnded(); - } - - @Test - public void rainyDayAAISetVnfInMaintBBTest() { - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiFlagTasks).checkVnfInMaintFlag(any(BuildingBlockExecution.class)); - - ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("AAICheckVnfInMaintBB", variables); - assertThat(processInstance).isNotNull(); - assertThat(processInstance).isStarted() - .hasPassedInOrder("Start_AAICheckVnfInMaintBB", "Task_CheckVnfInMaint") - .hasNotPassed("End_AAICheckVnfInMaintBB"); - assertThat(processInstance).isEnded(); - } +public class AAICheckVnfInMaintBBTest extends BaseBPMNTest { + + + @Test + public void sunnyDayAAICheckVnfInMaintBBTest() throws InterruptedException, IOException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("AAICheckVnfInMaintBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("Start_AAICheckVnfInMaintBB", "Task_CheckVnfInMaint", + "End_AAICheckVnfInMaintBB"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayAAISetVnfInMaintBBTest() { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiFlagTasks) + .checkVnfInMaintFlag(any(BuildingBlockExecution.class)); + + ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("AAICheckVnfInMaintBB", variables); + assertThat(processInstance).isNotNull(); + assertThat(processInstance).isStarted().hasPassedInOrder("Start_AAICheckVnfInMaintBB", "Task_CheckVnfInMaint") + .hasNotPassed("End_AAICheckVnfInMaintBB"); + assertThat(processInstance).isEnded(); + } } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/AAISetVnfInMaintBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/AAISetVnfInMaintBBTest.java index effd50fcf1..64aa06cd20 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/AAISetVnfInMaintBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/AAISetVnfInMaintBBTest.java @@ -23,9 +23,7 @@ package org.onap.so.bpmn.common; import static org.camunda.bpm.engine.test.assertions.ProcessEngineAssertions.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; - import java.io.IOException; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Ignore; @@ -33,25 +31,26 @@ import org.junit.Test; import org.onap.so.bpmn.BaseBPMNTest; public class AAISetVnfInMaintBBTest extends BaseBPMNTest { - - - @Test - public void sunnyDayAAISetVnfInMaintBBTest() throws InterruptedException, IOException { - ProcessInstance pi = runtimeService.startProcessInstanceByKey("AAISetVnfInMaintBB", variables); - assertThat(pi).isNotNull().isStarted().hasPassedInOrder("Start_AAISetVnfInMaintBB", "Task_SetInMaint", "End_AAISetVnfInMaintBB"); - } - - @Test - public void rainyDayAAISetVnfInMaintBBTest() { - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiFlagTasks).modifyVnfInMaintFlag(any(BuildingBlockExecution.class), any(boolean.class)); - - ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("AAISetVnfInMaintBB", variables); - assertThat(processInstance).isNotNull(); - assertThat(processInstance).isStarted() - .hasPassedInOrder("Start_AAISetVnfInMaintBB", "Task_SetInMaint") - .hasNotPassed("End_AAISetVnfInMaintBB"); - assertThat(processInstance).isEnded(); - } - - + + + @Test + public void sunnyDayAAISetVnfInMaintBBTest() throws InterruptedException, IOException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("AAISetVnfInMaintBB", variables); + assertThat(pi).isNotNull().isStarted().hasPassedInOrder("Start_AAISetVnfInMaintBB", "Task_SetInMaint", + "End_AAISetVnfInMaintBB"); + } + + @Test + public void rainyDayAAISetVnfInMaintBBTest() { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiFlagTasks) + .modifyVnfInMaintFlag(any(BuildingBlockExecution.class), any(boolean.class)); + + ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("AAISetVnfInMaintBB", variables); + assertThat(processInstance).isNotNull(); + assertThat(processInstance).isStarted().hasPassedInOrder("Start_AAISetVnfInMaintBB", "Task_SetInMaint") + .hasNotPassed("End_AAISetVnfInMaintBB"); + assertThat(processInstance).isEnded(); + } + + } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/AAIUnsetVnfInMaintBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/AAIUnsetVnfInMaintBBTest.java index 7da8823c56..c67db438d9 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/AAIUnsetVnfInMaintBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/AAIUnsetVnfInMaintBBTest.java @@ -23,9 +23,7 @@ package org.onap.so.bpmn.common; import static org.camunda.bpm.engine.test.assertions.ProcessEngineAssertions.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; - import java.io.IOException; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Ignore; @@ -33,27 +31,28 @@ import org.junit.Test; import org.onap.so.bpmn.BaseBPMNTest; public class AAIUnsetVnfInMaintBBTest extends BaseBPMNTest { - - - @Test - public void sunnyDayAAISetVnftInMaintBBTest() throws InterruptedException, IOException { - ProcessInstance pi = runtimeService.startProcessInstanceByKey("AAIUnsetVnfInMaintBB", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("Start_AAIUnsetVnfInMaintBB", "Task_UnsetInMaint", "End_AAIUnsetVnfInMaintBB"); - assertThat(pi).isEnded(); - } - - @Test - public void rainyDayAAISetVnfInMaintBBTest() { - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiFlagTasks).modifyVnfInMaintFlag(any(BuildingBlockExecution.class), any(boolean.class)); - - ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("AAIUnsetVnfInMaintBB", variables); - assertThat(processInstance).isNotNull(); - assertThat(processInstance).isStarted() - .hasPassedInOrder("Start_AAIUnsetVnfInMaintBB", "Task_UnsetInMaint") - .hasNotPassed("End_AAIUnsetVnfInMaintBB"); - assertThat(processInstance).isEnded(); - } - - + + + @Test + public void sunnyDayAAISetVnftInMaintBBTest() throws InterruptedException, IOException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("AAIUnsetVnfInMaintBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("Start_AAIUnsetVnfInMaintBB", "Task_UnsetInMaint", + "End_AAIUnsetVnfInMaintBB"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayAAISetVnfInMaintBBTest() { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiFlagTasks) + .modifyVnfInMaintFlag(any(BuildingBlockExecution.class), any(boolean.class)); + + ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("AAIUnsetVnfInMaintBB", variables); + assertThat(processInstance).isNotNull(); + assertThat(processInstance).isStarted().hasPassedInOrder("Start_AAIUnsetVnfInMaintBB", "Task_UnsetInMaint") + .hasNotPassed("End_AAIUnsetVnfInMaintBB"); + assertThat(processInstance).isEnded(); + } + + } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/SDNOHealthCheckBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/SDNOHealthCheckBBTest.java index 70351f9aad..ed1fb3fd91 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/SDNOHealthCheckBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/common/SDNOHealthCheckBBTest.java @@ -23,9 +23,7 @@ package org.onap.so.bpmn.common; import static org.camunda.bpm.engine.test.assertions.ProcessEngineAssertions.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; - import java.io.IOException; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Ignore; @@ -33,27 +31,28 @@ import org.junit.Test; import org.onap.so.bpmn.BaseBPMNTest; public class SDNOHealthCheckBBTest extends BaseBPMNTest { - - @Test - - public void sunnyDaySDNOHealthCheckTest() throws InterruptedException, IOException { - ProcessInstance pi = runtimeService.startProcessInstanceByKey("SDNOVnfHealthCheckBB", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("Start_SDNOHealthCheckBB", "Task_SDNOHealthCheck", "End_SDNOHealthCheckBB"); - assertThat(pi).isEnded(); - } - - @Test - public void rainyDaySDNOHealthCheckTest() { - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(sdnoHealthCheckTasks).sdnoHealthCheck(any(BuildingBlockExecution.class)); - - ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("SDNOVnfHealthCheckBB", variables); - assertThat(processInstance).isNotNull(); - assertThat(processInstance).isStarted() - .hasPassedInOrder("Start_SDNOHealthCheckBB", "Task_SDNOHealthCheck") - .hasNotPassed("End_SDNOHealthCheckBB"); - assertThat(processInstance).isEnded(); - } - - + + @Test + + public void sunnyDaySDNOHealthCheckTest() throws InterruptedException, IOException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("SDNOVnfHealthCheckBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("Start_SDNOHealthCheckBB", "Task_SDNOHealthCheck", + "End_SDNOHealthCheckBB"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDaySDNOHealthCheckTest() { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(sdnoHealthCheckTasks) + .sdnoHealthCheck(any(BuildingBlockExecution.class)); + + ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("SDNOVnfHealthCheckBB", variables); + assertThat(processInstance).isNotNull(); + assertThat(processInstance).isStarted().hasPassedInOrder("Start_SDNOHealthCheckBB", "Task_SDNOHealthCheck") + .hasNotPassed("End_SDNOHealthCheckBB"); + assertThat(processInstance).isEnded(); + } + + } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/activity/DeployActivitySpecsTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/activity/DeployActivitySpecsTest.java index a346aaf571..64c0e54a10 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/activity/DeployActivitySpecsTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/activity/DeployActivitySpecsTest.java @@ -24,7 +24,6 @@ import static org.junit.Assert.*; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; - import org.apache.http.HttpResponse; import org.apache.http.ProtocolVersion; import org.apache.http.client.HttpClient; @@ -35,34 +34,34 @@ import org.junit.Test; import org.onap.so.bpmn.BaseBPMNTest; -public class DeployActivitySpecsTest extends BaseBPMNTest{ - private static final String RESULT_STRING = "HTTP/1.1 404 "; +public class DeployActivitySpecsTest extends BaseBPMNTest { + private static final String RESULT_STRING = "HTTP/1.1 404 "; + - - @Test - public void DeployActivitySpecsMain_Test() throws Exception { - String HOSTNAME = createURLWithPort(""); - ProtocolVersion protocolVersion = new ProtocolVersion("", 1, 1); - HttpResponse response = new BasicHttpResponse(protocolVersion, 1, ""); - response.setStatusCode(404); - response.setStatusLine(protocolVersion, 1, ""); - HttpClient clientMock = mock(HttpClient.class); - when(clientMock.execute(any(HttpPost.class))).thenReturn(response); - String[] args = new String[] {HOSTNAME}; - DeployActivitySpecs.main(args); + @Test + public void DeployActivitySpecsMain_Test() throws Exception { + String HOSTNAME = createURLWithPort(""); + ProtocolVersion protocolVersion = new ProtocolVersion("", 1, 1); + HttpResponse response = new BasicHttpResponse(protocolVersion, 1, ""); + response.setStatusCode(404); + response.setStatusLine(protocolVersion, 1, ""); + HttpClient clientMock = mock(HttpClient.class); + when(clientMock.execute(any(HttpPost.class))).thenReturn(response); + String[] args = new String[] {HOSTNAME}; + DeployActivitySpecs.main(args); } - - @Test - @Ignore - public void DeployActivitySpec_Test() throws Exception { - String HOSTNAME = createURLWithPort(""); - ProtocolVersion protocolVersion = new ProtocolVersion("", 1, 1); - HttpResponse response = new BasicHttpResponse(protocolVersion, 1, ""); - response.setStatusCode(404); - response.setStatusLine(protocolVersion, 1, ""); - HttpClient clientMock = mock(HttpClient.class); - when(clientMock.execute(any(HttpPost.class))).thenReturn(response); ; - String result = DeployActivitySpecs.deployActivitySpec(HOSTNAME, "VNFQuiesceTrafficActivitySpec.json"); - assertEquals(result, RESULT_STRING); + + @Test + @Ignore + public void DeployActivitySpec_Test() throws Exception { + String HOSTNAME = createURLWithPort(""); + ProtocolVersion protocolVersion = new ProtocolVersion("", 1, 1); + HttpResponse response = new BasicHttpResponse(protocolVersion, 1, ""); + response.setStatusCode(404); + response.setStatusLine(protocolVersion, 1, ""); + HttpClient clientMock = mock(HttpClient.class); + when(clientMock.execute(any(HttpPost.class))).thenReturn(response);; + String result = DeployActivitySpecs.deployActivitySpec(HOSTNAME, "VNFQuiesceTrafficActivitySpec.json"); + assertEquals(result, RESULT_STRING); } } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/process/WorkflowActionBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/process/WorkflowActionBBTest.java index 3ab1c76ee6..051f373eaf 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/process/WorkflowActionBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/process/WorkflowActionBBTest.java @@ -23,11 +23,9 @@ package org.onap.so.bpmn.infrastructure.bpmn.process; import static org.camunda.bpm.engine.test.assertions.ProcessEngineAssertions.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; - import java.io.IOException; import java.util.HashMap; import java.util.Map; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.camunda.bpm.engine.runtime.ProcessInstance; @@ -37,99 +35,117 @@ import org.onap.so.bpmn.BaseBPMNTest; @Ignore public class WorkflowActionBBTest extends BaseBPMNTest { - - @Test - public void sunnyDaySuccessIsTopLevelFlow() throws InterruptedException, IOException { - variables.put("isTopLevelFlow", true); - variables.put("completed", true); - - Map<String, String> map = new HashMap<>(); - map.put("handlingCode", "Success"); - mockSubprocess("ExecuteBuildingBlock", "Mocked ExecuteBuildingBlock", "GenericStub", map); - - ProcessInstance pi = runtimeService.startProcessInstanceByKey("WorkflowActionBB", variables); - assertThat(pi).isNotNull().isStarted().hasPassedInOrder("Start_WorkflowActionBB", "Task_RetrieveBBExectuionList", "ExclusiveGateway_isTopLevelFlow", "Task_SendSync", - "Task_SelectBB", "Call_ExecuteBB", "ExclusiveGateway_Finished", "ExclusiveGateway_isTopLevelFlowCompleted", "Task_UpdateRequestComplete", - "End_WorkflowActionBB"); - - } - - @Test - public void sunnyDaySuccessNotTopLevelFlow() throws InterruptedException, IOException { - variables.put("isTopLevelFlow", false); - variables.put("completed", true); - - Map<String, String> map = new HashMap<>(); - map.put("handlingCode", "Success"); - mockSubprocess("ExecuteBuildingBlock", "Mocked ExecuteBuildingBlock", "GenericStub", map); - - ProcessInstance pi = runtimeService.startProcessInstanceByKey("WorkflowActionBB", variables); - assertThat(pi).isNotNull().isStarted().hasPassedInOrder("Start_WorkflowActionBB", "Task_RetrieveBBExectuionList", "ExclusiveGateway_isTopLevelFlow", - "Task_SelectBB", "Call_ExecuteBB", "ExclusiveGateway_Finished", "ExclusiveGateway_isTopLevelFlowCompleted", "End_WorkflowActionBB"); - } - - @Test - public void sunnyDayRollback() throws InterruptedException, IOException { - variables.put("isTopLevelFlow", false); - variables.put("isRollbackNeeded", false); - - Map<String, String> map = new HashMap<>(); - map.put("handlingCode", "Rollback"); - mockSubprocess("ExecuteBuildingBlock", "Mocked ExecuteBuildingBlock", "GenericStub", map); - - ProcessInstance pi = runtimeService.startProcessInstanceByKey("WorkflowActionBB", variables); - assertThat(pi).isNotNull().isStarted().hasPassedInOrder("Start_WorkflowActionBB", "Task_RetrieveBBExectuionList", "ExclusiveGateway_isTopLevelFlow", - "Task_SelectBB", "Call_ExecuteBB", "ExclusiveGateway_Finished", "Task_RollbackExecutionPath", "Task_UpdateRequestToFailed", "End_RollbackFailed"); - - } - - @Test - public void rainyDayAbort() throws Exception { - variables.put("isTopLevelFlow", true); - variables.put("completed", false); - - Map<String, String> map = new HashMap<>(); - map.put("handlingCode", "Abort"); - - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(workflowActionBBFailure).abortCallErrorHandling(any(DelegateExecution.class)); - mockSubprocess("ExecuteBuildingBlock", "Mocked ExecuteBuildingBlock", "GenericStub", map); - - ProcessInstance pi = runtimeService.startProcessInstanceByKey("WorkflowActionBB", variables); - assertThat(pi).isNotNull().isStarted().hasPassedInOrder("Start_WorkflowActionBB", "Task_RetrieveBBExectuionList", "ExclusiveGateway_isTopLevelFlow", "Task_SendSync", - "Task_SelectBB", "Call_ExecuteBB", "ExclusiveGateway_Finished", "ExclusiveGateway_isTopLevelFlowAbort", "Task_AbortAndCallErrorHandling", "ErrorStart", - "Task_UpdateDb", "ErrorEnd"); - - } - - @Test - public void retrieveBBExecutionListerrorHandling() throws Exception { - variables.put("isTopLevelFlow", true); - variables.put("sentSyncResponse", false); - doThrow(new IllegalStateException("TESTING ERRORS")).when(workflowAction).selectExecutionList(any(DelegateExecution.class)); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("WorkflowActionBB", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("Start_WorkflowActionBB", "Task_RetrieveBBExectuionList", "StartEvent_runtimeError", "ServiceTask_HandleRuntimeError", "EndEvent__runtimeError", "SubProcess_0rze15o"); - - } - - @Test - public void errorCatchSubprocessHandlingTest() throws Exception { - variables.put("isTopLevelFlow", true); - variables.put("sentSyncResponse", false); - doThrow(new IllegalStateException("TESTING ERRORS")).when(workflowAction).selectExecutionList(any(DelegateExecution.class)); - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(workflowAction).handleRuntimeException(any(DelegateExecution.class)); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("WorkflowActionBB", variables); - assertThat(pi).isNotNull().isStarted().hasPassedInOrder("Start_WorkflowActionBB", "Task_RetrieveBBExectuionList", "StartEvent_runtimeError", "ServiceTask_HandleRuntimeError", "SubProcess_0fuugr9", "ErrorStart", "ExclusiveGateway_10q79b6", "Task_SendSyncAckError", "Task_UpdateDb", "ErrorEnd", "SubProcess_18226x4"); - - } - - @Test - public void errorCatchBpmnSubprocessHandlingTest() throws Exception { - variables.put("isTopLevelFlow", true); - variables.put("sentSyncResponse", false); - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(workflowActionBBTasks).selectBB(any(DelegateExecution.class)); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("WorkflowActionBB", variables); - assertThat(pi).isNotNull().isStarted().hasPassedInOrder("Start_WorkflowActionBB", "Task_RetrieveBBExectuionList","ExclusiveGateway_isTopLevelFlow","Task_SendSync","Task_SelectBB", "ErrorStart", "ExclusiveGateway_10q79b6", "Task_SendSyncAckError", "Task_UpdateDb", "ErrorEnd", "SubProcess_18226x4"); - - } + + @Test + public void sunnyDaySuccessIsTopLevelFlow() throws InterruptedException, IOException { + variables.put("isTopLevelFlow", true); + variables.put("completed", true); + + Map<String, String> map = new HashMap<>(); + map.put("handlingCode", "Success"); + mockSubprocess("ExecuteBuildingBlock", "Mocked ExecuteBuildingBlock", "GenericStub", map); + + ProcessInstance pi = runtimeService.startProcessInstanceByKey("WorkflowActionBB", variables); + assertThat(pi).isNotNull().isStarted().hasPassedInOrder("Start_WorkflowActionBB", + "Task_RetrieveBBExectuionList", "ExclusiveGateway_isTopLevelFlow", "Task_SendSync", "Task_SelectBB", + "Call_ExecuteBB", "ExclusiveGateway_Finished", "ExclusiveGateway_isTopLevelFlowCompleted", + "Task_UpdateRequestComplete", "End_WorkflowActionBB"); + + } + + @Test + public void sunnyDaySuccessNotTopLevelFlow() throws InterruptedException, IOException { + variables.put("isTopLevelFlow", false); + variables.put("completed", true); + + Map<String, String> map = new HashMap<>(); + map.put("handlingCode", "Success"); + mockSubprocess("ExecuteBuildingBlock", "Mocked ExecuteBuildingBlock", "GenericStub", map); + + ProcessInstance pi = runtimeService.startProcessInstanceByKey("WorkflowActionBB", variables); + assertThat(pi).isNotNull().isStarted().hasPassedInOrder("Start_WorkflowActionBB", + "Task_RetrieveBBExectuionList", "ExclusiveGateway_isTopLevelFlow", "Task_SelectBB", "Call_ExecuteBB", + "ExclusiveGateway_Finished", "ExclusiveGateway_isTopLevelFlowCompleted", "End_WorkflowActionBB"); + } + + @Test + public void sunnyDayRollback() throws InterruptedException, IOException { + variables.put("isTopLevelFlow", false); + variables.put("isRollbackNeeded", false); + + Map<String, String> map = new HashMap<>(); + map.put("handlingCode", "Rollback"); + mockSubprocess("ExecuteBuildingBlock", "Mocked ExecuteBuildingBlock", "GenericStub", map); + + ProcessInstance pi = runtimeService.startProcessInstanceByKey("WorkflowActionBB", variables); + assertThat(pi).isNotNull().isStarted().hasPassedInOrder("Start_WorkflowActionBB", + "Task_RetrieveBBExectuionList", "ExclusiveGateway_isTopLevelFlow", "Task_SelectBB", "Call_ExecuteBB", + "ExclusiveGateway_Finished", "Task_RollbackExecutionPath", "Task_UpdateRequestToFailed", + "End_RollbackFailed"); + + } + + @Test + public void rainyDayAbort() throws Exception { + variables.put("isTopLevelFlow", true); + variables.put("completed", false); + + Map<String, String> map = new HashMap<>(); + map.put("handlingCode", "Abort"); + + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(workflowActionBBFailure) + .abortCallErrorHandling(any(DelegateExecution.class)); + mockSubprocess("ExecuteBuildingBlock", "Mocked ExecuteBuildingBlock", "GenericStub", map); + + ProcessInstance pi = runtimeService.startProcessInstanceByKey("WorkflowActionBB", variables); + assertThat(pi).isNotNull().isStarted().hasPassedInOrder("Start_WorkflowActionBB", + "Task_RetrieveBBExectuionList", "ExclusiveGateway_isTopLevelFlow", "Task_SendSync", "Task_SelectBB", + "Call_ExecuteBB", "ExclusiveGateway_Finished", "ExclusiveGateway_isTopLevelFlowAbort", + "Task_AbortAndCallErrorHandling", "ErrorStart", "Task_UpdateDb", "ErrorEnd"); + + } + + @Test + public void retrieveBBExecutionListerrorHandling() throws Exception { + variables.put("isTopLevelFlow", true); + variables.put("sentSyncResponse", false); + doThrow(new IllegalStateException("TESTING ERRORS")).when(workflowAction) + .selectExecutionList(any(DelegateExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("WorkflowActionBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("Start_WorkflowActionBB", "Task_RetrieveBBExectuionList", + "StartEvent_runtimeError", "ServiceTask_HandleRuntimeError", "EndEvent__runtimeError", + "SubProcess_0rze15o"); + + } + + @Test + public void errorCatchSubprocessHandlingTest() throws Exception { + variables.put("isTopLevelFlow", true); + variables.put("sentSyncResponse", false); + doThrow(new IllegalStateException("TESTING ERRORS")).when(workflowAction) + .selectExecutionList(any(DelegateExecution.class)); + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(workflowAction) + .handleRuntimeException(any(DelegateExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("WorkflowActionBB", variables); + assertThat(pi).isNotNull().isStarted().hasPassedInOrder("Start_WorkflowActionBB", + "Task_RetrieveBBExectuionList", "StartEvent_runtimeError", "ServiceTask_HandleRuntimeError", + "SubProcess_0fuugr9", "ErrorStart", "ExclusiveGateway_10q79b6", "Task_SendSyncAckError", + "Task_UpdateDb", "ErrorEnd", "SubProcess_18226x4"); + + } + + @Test + public void errorCatchBpmnSubprocessHandlingTest() throws Exception { + variables.put("isTopLevelFlow", true); + variables.put("sentSyncResponse", false); + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(workflowActionBBTasks) + .selectBB(any(DelegateExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("WorkflowActionBB", variables); + assertThat(pi).isNotNull().isStarted().hasPassedInOrder("Start_WorkflowActionBB", + "Task_RetrieveBBExectuionList", "ExclusiveGateway_isTopLevelFlow", "Task_SendSync", "Task_SelectBB", + "ErrorStart", "ExclusiveGateway_10q79b6", "Task_SendSyncAckError", "Task_UpdateDb", "ErrorEnd", + "SubProcess_18226x4"); + + } } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateNetworkBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateNetworkBBTest.java index dcf679610e..affe1857bd 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateNetworkBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateNetworkBBTest.java @@ -23,30 +23,30 @@ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; import static org.camunda.bpm.engine.test.assertions.ProcessEngineAssertions.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Test; import org.onap.so.bpmn.BaseBPMNTest; import org.onap.so.bpmn.common.BuildingBlockExecution; -public class ActivateNetworkBBTest extends BaseBPMNTest{ +public class ActivateNetworkBBTest extends BaseBPMNTest { @Test public void sunnyDayActivateNetwork_Test() throws InterruptedException { - mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); + mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); ProcessInstance pi = runtimeService.startProcessInstanceByKey("ActivateNetworkBB", variables); assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("activateNetwork_startEvent","Activate_Network_SDNC_ServiceTask","CallActivity_sdncHandler","Activate_Network_AAI_ServiceTask","activateNetwork_EndEvent"); + assertThat(pi).isStarted().hasPassedInOrder("activateNetwork_startEvent", "Activate_Network_SDNC_ServiceTask", + "CallActivity_sdncHandler", "Activate_Network_AAI_ServiceTask", "activateNetwork_EndEvent"); assertThat(pi).isEnded(); } - @Test - public void rainyDayActivateNetwork_Test() throws Exception { - mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiUpdateTasks).updateOrchestrationStatusActiveNetwork(any(BuildingBlockExecution.class)); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("ActivateNetworkBB", variables); - assertThat(pi).isStarted() - .hasPassedInOrder("activateNetwork_startEvent","Activate_Network_SDNC_ServiceTask","Activate_Network_AAI_ServiceTask") - .hasNotPassed("activateNetwork_EndEvent").isEnded(); - } + @Test + public void rainyDayActivateNetwork_Test() throws Exception { + mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiUpdateTasks) + .updateOrchestrationStatusActiveNetwork(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("ActivateNetworkBB", variables); + assertThat(pi).isStarted().hasPassedInOrder("activateNetwork_startEvent", "Activate_Network_SDNC_ServiceTask", + "Activate_Network_AAI_ServiceTask").hasNotPassed("activateNetwork_EndEvent").isEnded(); + } } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateNetworkCollectionBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateNetworkCollectionBBTest.java index c6c301476e..0f0c373c03 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateNetworkCollectionBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateNetworkCollectionBBTest.java @@ -19,10 +19,10 @@ */ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Ignore; @@ -30,22 +30,23 @@ import org.junit.Test; import org.onap.so.bpmn.BaseBPMNTest; import org.onap.so.bpmn.common.BuildingBlockExecution; -public class ActivateNetworkCollectionBBTest extends BaseBPMNTest{ +public class ActivateNetworkCollectionBBTest extends BaseBPMNTest { @Test public void sunnyDayActivateNetworkCollection_Test() throws InterruptedException { - ProcessInstance pi = runtimeService.startProcessInstanceByKey("ActivateNetworkCollectionBB",variables); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("ActivateNetworkCollectionBB", variables); assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("activateNetworkCollection_startEvent","Activate_Network_Collection_AAI_ServiceTask","activateNetworkCollection_EndEvent"); + assertThat(pi).isStarted().hasPassedInOrder("activateNetworkCollection_startEvent", + "Activate_Network_Collection_AAI_ServiceTask", "activateNetworkCollection_EndEvent"); assertThat(pi).isEnded(); } - @Test - - public void rainyDayActivateNetworkCollection_Test() throws Exception { - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiUpdateTasks).updateOrchestrationStatusActiveNetworkCollection(any(BuildingBlockExecution.class)); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("ActivateNetworkCollectionBB", variables); - assertThat(pi).isNotNull().isStarted() - .hasPassedInOrder("activateNetworkCollection_startEvent") - .hasNotPassed("activateNetworkCollection_EndEvent"); - } + @Test + + public void rainyDayActivateNetworkCollection_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiUpdateTasks) + .updateOrchestrationStatusActiveNetworkCollection(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("ActivateNetworkCollectionBB", variables); + assertThat(pi).isNotNull().isStarted().hasPassedInOrder("activateNetworkCollection_startEvent") + .hasNotPassed("activateNetworkCollection_EndEvent"); + } } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateServiceInstanceBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateServiceInstanceBBTest.java index efe7d87fb2..9eefaded9c 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateServiceInstanceBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateServiceInstanceBBTest.java @@ -19,22 +19,21 @@ */ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; -import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat; +import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat; import java.io.IOException; - import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Test; import org.onap.so.bpmn.BaseBPMNTest; -public class ActivateServiceInstanceBBTest extends BaseBPMNTest{ - - @Test - public void sunnyDaySDNC() throws InterruptedException, IOException { - ProcessInstance pi = runtimeService.startProcessInstanceByKey("ActivateServiceInstanceBB", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("Start_ActivateServiceInstanceBB", "Task_NoOpServiceInstance", - "Task_UpdateServiceOrchestrationStatusToActive", "End_ActivateServiceInstanceBB"); - assertThat(pi).isEnded(); - } +public class ActivateServiceInstanceBBTest extends BaseBPMNTest { + + @Test + public void sunnyDaySDNC() throws InterruptedException, IOException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("ActivateServiceInstanceBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("Start_ActivateServiceInstanceBB", "Task_NoOpServiceInstance", + "Task_UpdateServiceOrchestrationStatusToActive", "End_ActivateServiceInstanceBB"); + assertThat(pi).isEnded(); + } } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateVfModuleBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateVfModuleBBTest.java index deac50ca30..6f89f3c738 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateVfModuleBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateVfModuleBBTest.java @@ -19,13 +19,13 @@ */ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.doThrow; import java.io.IOException; import java.util.List; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.externaltask.LockedExternalTask; import org.camunda.bpm.engine.runtime.ProcessInstance; @@ -34,52 +34,55 @@ import org.junit.Test; import org.onap.so.bpmn.BaseBPMNTest; import org.onap.so.bpmn.common.BuildingBlockExecution; -public class ActivateVfModuleBBTest extends BaseBPMNTest{ - - @Before - public void before() { - variables.put("vfModuleActivateTimerDuration", "PT2S"); - variables.put("auditInventoryNeeded", "true"); - variables.put("auditIsSuccessful", "true"); - } +public class ActivateVfModuleBBTest extends BaseBPMNTest { + + @Before + public void before() { + variables.put("vfModuleActivateTimerDuration", "PT2S"); + variables.put("auditInventoryNeeded", "true"); + variables.put("auditIsSuccessful", "true"); + } - @Test - public void sunnyDay() throws InterruptedException, IOException { - mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("ActivateVfModuleBB", variables); - List<LockedExternalTask> tasks = externalTaskService.fetchAndLock(100, "externalWorkerId") + @Test + public void sunnyDay() throws InterruptedException, IOException { + mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("ActivateVfModuleBB", variables); + List<LockedExternalTask> tasks = externalTaskService.fetchAndLock(100, "externalWorkerId") .topic("InventoryAddAudit", 60L * 1000L).execute(); while (!tasks.isEmpty()) { for (LockedExternalTask task : tasks) { externalTaskService.complete(task.getId(), "externalWorkerId"); } - tasks = externalTaskService.fetchAndLock(100, "externalWorkerId") - .topic("InventoryAddAudit", 60L * 1000L).execute(); + tasks = externalTaskService.fetchAndLock(100, "externalWorkerId").topic("InventoryAddAudit", 60L * 1000L) + .execute(); } - - assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("ActivateVfModuleBB_Start","ExclusiveGateway_1v8bmbu","Setup_AAI_Inventory_Audit", "Audit_AAI_Inventory", "ActivateVfModule", "CallActivity_sdncHandler", - "UpdateVfModuleActiveStatus", "ActivateVfModuleBB_End"); - assertThat(pi).isEnded(); - } - - @Test - public void rainyDay() throws Exception { - mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); - doThrow(BpmnError.class).when(aaiUpdateTasks).updateOrchestrationStatusActivateVfModule(any(BuildingBlockExecution.class)); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("ActivateVfModuleBB", variables); - List<LockedExternalTask> tasks = externalTaskService.fetchAndLock(100, "externalWorkerId") + + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("ActivateVfModuleBB_Start", "ExclusiveGateway_1v8bmbu", + "Setup_AAI_Inventory_Audit", "Audit_AAI_Inventory", "ActivateVfModule", "CallActivity_sdncHandler", + "UpdateVfModuleActiveStatus", "ActivateVfModuleBB_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDay() throws Exception { + mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); + doThrow(BpmnError.class).when(aaiUpdateTasks) + .updateOrchestrationStatusActivateVfModule(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("ActivateVfModuleBB", variables); + List<LockedExternalTask> tasks = externalTaskService.fetchAndLock(100, "externalWorkerId") .topic("InventoryAddAudit", 60L * 1000L).execute(); while (!tasks.isEmpty()) { for (LockedExternalTask task : tasks) { externalTaskService.complete(task.getId(), "externalWorkerId"); } - tasks = externalTaskService.fetchAndLock(100, "externalWorkerId") - .topic("InventoryAddAudit", 60L * 1000L).execute(); + tasks = externalTaskService.fetchAndLock(100, "externalWorkerId").topic("InventoryAddAudit", 60L * 1000L) + .execute(); } - assertThat(pi).isNotNull().isStarted() - .hasPassedInOrder("ActivateVfModuleBB_Start","ExclusiveGateway_1v8bmbu","Setup_AAI_Inventory_Audit", "Audit_AAI_Inventory", "ActivateVfModule", "UpdateVfModuleActiveStatus") - .hasNotPassed("ActivateVfModuleBB_End"); - } + assertThat(pi).isNotNull().isStarted() + .hasPassedInOrder("ActivateVfModuleBB_Start", "ExclusiveGateway_1v8bmbu", "Setup_AAI_Inventory_Audit", + "Audit_AAI_Inventory", "ActivateVfModule", "UpdateVfModuleActiveStatus") + .hasNotPassed("ActivateVfModuleBB_End"); + } } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateVnfBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateVnfBBTest.java index d1d95fee71..7a78a6a6e2 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateVnfBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateVnfBBTest.java @@ -19,23 +19,22 @@ */ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; -import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat; +import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat; import java.io.IOException; - import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Test; import org.onap.so.bpmn.BaseBPMNTest; -public class ActivateVnfBBTest extends BaseBPMNTest{ - @Test - public void sunnyDay() throws InterruptedException, IOException { - mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("ActivateVnfBB", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("Start_ActivateVnfBB", "Task_SDNCAdapterVnfTopologyActivate", - "CallActivity_sdncHandler", "Task_ActivateOrchestrationStatusVnf", "End_ActivateVnfBB"); - assertThat(pi).isEnded(); - } +public class ActivateVnfBBTest extends BaseBPMNTest { + @Test + public void sunnyDay() throws InterruptedException, IOException { + mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("ActivateVnfBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("Start_ActivateVnfBB", "Task_SDNCAdapterVnfTopologyActivate", + "CallActivity_sdncHandler", "Task_ActivateOrchestrationStatusVnf", "End_ActivateVnfBB"); + assertThat(pi).isEnded(); + } } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateVolumeGroupBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateVolumeGroupBBTest.java index 8fc198ffcd..602f1c874f 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateVolumeGroupBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateVolumeGroupBBTest.java @@ -19,33 +19,34 @@ */ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Test; import org.onap.so.bpmn.BaseBPMNTest; import org.onap.so.bpmn.common.BuildingBlockExecution; -public class ActivateVolumeGroupBBTest extends BaseBPMNTest{ - @Test - public void sunnyDayAssignVolumeGroup_Test() throws InterruptedException { - ProcessInstance pi = runtimeService.startProcessInstanceByKey("ActivateVolumeGroupBB", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("ActivateVolumeGroupBB_Start", "ActivateVolumeGroup", "ActivateVolumeGroupBB_End"); - assertThat(pi).isEnded(); - } +public class ActivateVolumeGroupBBTest extends BaseBPMNTest { + @Test + public void sunnyDayAssignVolumeGroup_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("ActivateVolumeGroupBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("ActivateVolumeGroupBB_Start", "ActivateVolumeGroup", + "ActivateVolumeGroupBB_End"); + assertThat(pi).isEnded(); + } - @Test - public void rainyDayAssignVolumeGroup_Test() throws Exception { - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiUpdateTasks).updateOrchestrationStatusActiveVolumeGroup(any(BuildingBlockExecution.class)); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("ActivateVolumeGroupBB", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted() - .hasPassedInOrder("ActivateVolumeGroupBB_Start", "ActivateVolumeGroup") - .hasNotPassed("ActivateVolumeGroupBB_End"); - assertThat(pi).isEnded(); - } + @Test + public void rainyDayAssignVolumeGroup_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiUpdateTasks) + .updateOrchestrationStatusActiveVolumeGroup(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("ActivateVolumeGroupBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("ActivateVolumeGroupBB_Start", "ActivateVolumeGroup") + .hasNotPassed("ActivateVolumeGroupBB_End"); + assertThat(pi).isEnded(); + } } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignNetworkBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignNetworkBBTest.java index c581a16349..42291a9593 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignNetworkBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignNetworkBBTest.java @@ -19,10 +19,10 @@ */ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.camunda.bpm.engine.test.Deployment; @@ -30,26 +30,33 @@ import org.junit.Test; import org.onap.so.bpmn.BaseBPMNTest; import org.onap.so.bpmn.common.BuildingBlockExecution; -public class AssignNetworkBBTest extends BaseBPMNTest{ +public class AssignNetworkBBTest extends BaseBPMNTest { @Test - @Deployment(resources = { "subprocess/AssignNetworkRollbackBB.bpmn"}) + @Deployment(resources = {"subprocess/AssignNetworkRollbackBB.bpmn"}) public void sunnyDayAssignNetwork_Test() throws InterruptedException { - mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("AssignNetworkBB",variables); + mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("AssignNetworkBB", variables); assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("AssignNetworkBB_start","networkFoundByName_ExclusiveGateway","ServiceTask_put_network_in_AAI","ServiceTask_connect_to_Tenant","ServiceTask_connect_to_CloudRegion","ServiceTask_connect_to_NCIG","ServiceTask_connect_to_NCSI","ServiceTask_get_cloud_region","ServiceTask_assign_network_sdnc","CallActivity_sdncHandlerCall","ServiceTask_assign_network_aai","AssignNetworkBB_end"); + assertThat(pi).isStarted().hasPassedInOrder("AssignNetworkBB_start", "networkFoundByName_ExclusiveGateway", + "ServiceTask_put_network_in_AAI", "ServiceTask_connect_to_Tenant", "ServiceTask_connect_to_CloudRegion", + "ServiceTask_connect_to_NCIG", "ServiceTask_connect_to_NCSI", "ServiceTask_get_cloud_region", + "ServiceTask_assign_network_sdnc", "CallActivity_sdncHandlerCall", "ServiceTask_assign_network_aai", + "AssignNetworkBB_end"); assertThat(pi).isEnded(); } - @Test - public void rainyDayAssignNetwork_Test() throws Exception { - mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiUpdateTasks).updateOrchestrationStatusAssignedNetwork(any(BuildingBlockExecution.class)); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("AssignNetworkBB", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted() - .hasPassedInOrder("AssignNetworkBB_start", "networkFoundByName_ExclusiveGateway", "ServiceTask_put_network_in_AAI","ServiceTask_connect_to_Tenant","ServiceTask_connect_to_CloudRegion","ServiceTask_connect_to_NCIG","ServiceTask_connect_to_NCSI", "ServiceTask_get_cloud_region", "ServiceTask_assign_network_sdnc", "ServiceTask_assign_network_aai") - .hasNotPassed("AssignNetworkBB_end"); - assertThat(pi).isEnded(); - } + @Test + public void rainyDayAssignNetwork_Test() throws Exception { + mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiUpdateTasks) + .updateOrchestrationStatusAssignedNetwork(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("AssignNetworkBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("AssignNetworkBB_start", "networkFoundByName_ExclusiveGateway", + "ServiceTask_put_network_in_AAI", "ServiceTask_connect_to_Tenant", "ServiceTask_connect_to_CloudRegion", + "ServiceTask_connect_to_NCIG", "ServiceTask_connect_to_NCSI", "ServiceTask_get_cloud_region", + "ServiceTask_assign_network_sdnc", "ServiceTask_assign_network_aai") + .hasNotPassed("AssignNetworkBB_end"); + assertThat(pi).isEnded(); + } } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignServiceInstanceBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignServiceInstanceBBTest.java index 2624cc0ccb..f45ed935a6 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignServiceInstanceBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignServiceInstanceBBTest.java @@ -19,24 +19,23 @@ */ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; -import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat; +import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat; import java.io.IOException; - import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Test; import org.onap.so.bpmn.BaseBPMNTest; -public class AssignServiceInstanceBBTest extends BaseBPMNTest{ - - @Test - public void sunnyDaySDNC() throws InterruptedException, IOException { - mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("AssignServiceInstanceBB", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("Start_AssignServiceInstanceBB", "Task_CreateServiceInstance", - "Task_CreateProject", "Task_CreateOwningEntity", "Task_AssignServiceInstance", "CallActivity_sdncHandler", - "Task_UpdateServiceOstatusToAssigned", "End_AssignServiceInstanceBB"); - assertThat(pi).isEnded(); - } +public class AssignServiceInstanceBBTest extends BaseBPMNTest { + + @Test + public void sunnyDaySDNC() throws InterruptedException, IOException { + mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("AssignServiceInstanceBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("Start_AssignServiceInstanceBB", "Task_CreateServiceInstance", + "Task_CreateProject", "Task_CreateOwningEntity", "Task_AssignServiceInstance", + "CallActivity_sdncHandler", "Task_UpdateServiceOstatusToAssigned", "End_AssignServiceInstanceBB"); + assertThat(pi).isEnded(); + } } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignVfModuleBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignVfModuleBBTest.java index 44d17a350c..358d1a2789 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignVfModuleBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignVfModuleBBTest.java @@ -19,40 +19,36 @@ */ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Test; import org.onap.so.bpmn.BaseBPMNTest; import org.onap.so.bpmn.common.BuildingBlockExecution; -public class AssignVfModuleBBTest extends BaseBPMNTest{ - @Test - public void sunnyDayAssignVfModule_Test() throws InterruptedException { - mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("AssignVfModuleBB", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("AssignVfModuleBB_Start", - "CreateVfModule", - "ConnectVfModuleToVolumeGroup", - "AssignVfModule", - "CallActivity_sdncHandlerCall", - "UpdateVfModuleStatus", - "AssignVfModuleBB_End"); - assertThat(pi).isEnded(); - } +public class AssignVfModuleBBTest extends BaseBPMNTest { + @Test + public void sunnyDayAssignVfModule_Test() throws InterruptedException { + mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("AssignVfModuleBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("AssignVfModuleBB_Start", "CreateVfModule", + "ConnectVfModuleToVolumeGroup", "AssignVfModule", "CallActivity_sdncHandlerCall", + "UpdateVfModuleStatus", "AssignVfModuleBB_End"); + assertThat(pi).isEnded(); + } - @Test - public void rainyDayAssignVfModule_Test() throws Exception { - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiCreateTasks).createVfModule(any(BuildingBlockExecution.class)); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("AssignVfModuleBB", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted() - .hasPassedInOrder("AssignVfModuleBB_Start", "CreateVfModule") - .hasNotPassed("ConnectVfModuleToVolumeGroup", "AssignVfModule", "UpdateVfModuleStatus", "AssignVfModuleBB_End"); - assertThat(pi).isEnded(); - } + @Test + public void rainyDayAssignVfModule_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiCreateTasks) + .createVfModule(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("AssignVfModuleBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("AssignVfModuleBB_Start", "CreateVfModule").hasNotPassed( + "ConnectVfModuleToVolumeGroup", "AssignVfModule", "UpdateVfModuleStatus", "AssignVfModuleBB_End"); + assertThat(pi).isEnded(); + } } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignVnfBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignVnfBBTest.java index f4258f46b8..078b0ae4e2 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignVnfBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignVnfBBTest.java @@ -19,12 +19,11 @@ */ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; - import java.io.IOException; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Test; @@ -32,27 +31,29 @@ import org.onap.so.bpmn.BaseBPMNTest; import org.onap.so.bpmn.common.BuildingBlockExecution; public class AssignVnfBBTest extends BaseBPMNTest { - @Test - public void sunnyDayAssignVnfBBTest() throws InterruptedException, IOException { - variables.put("callHoming", true); - mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("AssignVnfBB", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("Start_AssignVnfBB", "Task_CreateVnf", "ServiceTask_ConnectVnfToCloudRegion", "ServiceTask_ConnectVnfToTenant", "Task_createPlatform", "Task_createLineOfBusiness", "Task_createInstanceGroups", - "Task_callHoming", "Task_SDNCAdapterVnfTopologyAssign","CallActivity_sdncAssign", "Task_UpdateVnfOrchestrationStatusAssigned", - "End_AssignVnfBB"); - assertThat(pi).isEnded(); - } + @Test + public void sunnyDayAssignVnfBBTest() throws InterruptedException, IOException { + variables.put("callHoming", true); + mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("AssignVnfBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("Start_AssignVnfBB", "Task_CreateVnf", + "ServiceTask_ConnectVnfToCloudRegion", "ServiceTask_ConnectVnfToTenant", "Task_createPlatform", + "Task_createLineOfBusiness", "Task_createInstanceGroups", "Task_callHoming", + "Task_SDNCAdapterVnfTopologyAssign", "CallActivity_sdncAssign", + "Task_UpdateVnfOrchestrationStatusAssigned", "End_AssignVnfBB"); + assertThat(pi).isEnded(); + } - @Test - public void rainyDayAssignVnfBBTest() throws Exception { - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiCreateTasks) - .createVnf(any(BuildingBlockExecution.class)); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("AssignVnfBB", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("Start_AssignVnfBB", "Task_CreateVnf").hasNotPassed( - "Task_createPlatform", "Task_createLineOfBusiness", "Task_createInstanceGroups", "Task_SDNCAdapterVnfTopologyAssign", - "Task_UpdateVnfOrchestrationStatusAssigned", "End_AssignVnfBB"); - assertThat(pi).isEnded(); - } + @Test + public void rainyDayAssignVnfBBTest() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiCreateTasks) + .createVnf(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("AssignVnfBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("Start_AssignVnfBB", "Task_CreateVnf").hasNotPassed( + "Task_createPlatform", "Task_createLineOfBusiness", "Task_createInstanceGroups", + "Task_SDNCAdapterVnfTopologyAssign", "Task_UpdateVnfOrchestrationStatusAssigned", "End_AssignVnfBB"); + assertThat(pi).isEnded(); + } } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignVolumeGroupBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignVolumeGroupBBTest.java index e39370b951..0de657ed7f 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignVolumeGroupBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignVolumeGroupBBTest.java @@ -19,33 +19,34 @@ */ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Test; import org.onap.so.bpmn.BaseBPMNTest; import org.onap.so.bpmn.common.BuildingBlockExecution; -public class AssignVolumeGroupBBTest extends BaseBPMNTest{ - @Test - public void sunnyDayAssignVolumeGroup_Test() throws InterruptedException { - ProcessInstance pi = runtimeService.startProcessInstanceByKey("AssignVolumeGroupBB", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("AssignVolumeGroupBB_Start", "AssignVolumeGroup", "AssignVolumeGroupBB_End"); - assertThat(pi).isEnded(); - } +public class AssignVolumeGroupBBTest extends BaseBPMNTest { + @Test + public void sunnyDayAssignVolumeGroup_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("AssignVolumeGroupBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("AssignVolumeGroupBB_Start", "AssignVolumeGroup", + "AssignVolumeGroupBB_End"); + assertThat(pi).isEnded(); + } - @Test - public void rainyDayAssignVolumeGroup_Test() throws Exception { - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiCreateTasks).createVolumeGroup(any(BuildingBlockExecution.class)); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("AssignVolumeGroupBB", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted() - .hasPassedInOrder("AssignVolumeGroupBB_Start", "AssignVolumeGroup") - .hasNotPassed("AssignVolumeGroupBB_End"); - assertThat(pi).isEnded();; - } + @Test + public void rainyDayAssignVolumeGroup_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiCreateTasks) + .createVolumeGroup(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("AssignVolumeGroupBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("AssignVolumeGroupBB_Start", "AssignVolumeGroup") + .hasNotPassed("AssignVolumeGroupBB_End"); + assertThat(pi).isEnded();; + } } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/BuildingBlockValidatorRunnerTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/BuildingBlockValidatorRunnerTest.java index a241ae5eff..a036f6713e 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/BuildingBlockValidatorRunnerTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/BuildingBlockValidatorRunnerTest.java @@ -27,16 +27,16 @@ import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Test; import org.onap.so.bpmn.BaseBPMNTest; -public class BuildingBlockValidatorRunnerTest extends BaseBPMNTest{ +public class BuildingBlockValidatorRunnerTest extends BaseBPMNTest { @Test public void sunnyDayActivateNetwork_Test() throws InterruptedException { - variables.put("flowToBeCalled","CreateVolumeGroupBB"); + variables.put("flowToBeCalled", "CreateVolumeGroupBB"); ProcessInstance pi = runtimeService.startProcessInstanceByKey("BuildingBlockValidatorRunnerTest", variables); assertThat(pi).isNotNull(); - + execute(job()); execute(job()); - assertThat(pi).isStarted().hasPassedInOrder("ServiceTask_1","ServiceTask_2","ServiceTask_3"); + assertThat(pi).isStarted().hasPassedInOrder("ServiceTask_1", "ServiceTask_2", "ServiceTask_3"); assertThat(pi).isEnded(); } } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ChangeModelServiceInstanceBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ChangeModelServiceInstanceBBTest.java index 1772a3af4b..832ee528a1 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ChangeModelServiceInstanceBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ChangeModelServiceInstanceBBTest.java @@ -19,35 +19,40 @@ */ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Test; import org.onap.so.bpmn.BaseBPMNTest; import org.onap.so.bpmn.common.BuildingBlockExecution; -public class ChangeModelServiceInstanceBBTest extends BaseBPMNTest{ - @Test - public void changeModelVnfBBTest() { - mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); - ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("ChangeModelServiceInstanceBB", variables); - assertThat(processInstance).isNotNull(); - assertThat(processInstance).isStarted().hasPassedInOrder("ChangeModelServiceInstance_Start" ,"SDNCChangeModelServiceInstance", "CallActivity_sdncHandlerReq", "AAIUpdateModelServiceInstance", "ChangeModelServiceInstance_End"); - assertThat(processInstance).isEnded(); - } - - @Test - public void changeModelVnfBBExceptionTest() { - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(sdncChangeAssignTasks).changeModelServiceInstance(any(BuildingBlockExecution.class)); - - ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("ChangeModelServiceInstanceBB", variables); - assertThat(processInstance).isNotNull(); - assertThat(processInstance).isStarted() - .hasPassedInOrder("ChangeModelServiceInstance_Start", "SDNCChangeModelServiceInstance") - .hasNotPassed("AAIUpdateModel", "ChangeModelServiceInstance_End"); - assertThat(processInstance).isEnded(); - } +public class ChangeModelServiceInstanceBBTest extends BaseBPMNTest { + @Test + public void changeModelVnfBBTest() { + mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); + ProcessInstance processInstance = + runtimeService.startProcessInstanceByKey("ChangeModelServiceInstanceBB", variables); + assertThat(processInstance).isNotNull(); + assertThat(processInstance).isStarted().hasPassedInOrder("ChangeModelServiceInstance_Start", + "SDNCChangeModelServiceInstance", "CallActivity_sdncHandlerReq", "AAIUpdateModelServiceInstance", + "ChangeModelServiceInstance_End"); + assertThat(processInstance).isEnded(); + } + + @Test + public void changeModelVnfBBExceptionTest() { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(sdncChangeAssignTasks) + .changeModelServiceInstance(any(BuildingBlockExecution.class)); + + ProcessInstance processInstance = + runtimeService.startProcessInstanceByKey("ChangeModelServiceInstanceBB", variables); + assertThat(processInstance).isNotNull(); + assertThat(processInstance).isStarted() + .hasPassedInOrder("ChangeModelServiceInstance_Start", "SDNCChangeModelServiceInstance") + .hasNotPassed("AAIUpdateModel", "ChangeModelServiceInstance_End"); + assertThat(processInstance).isEnded(); + } } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ChangeModelVfModuleBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ChangeModelVfModuleBBTest.java index 8549b6bc5a..42be6a5711 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ChangeModelVfModuleBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ChangeModelVfModuleBBTest.java @@ -19,36 +19,37 @@ */ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Test; import org.onap.so.bpmn.BaseBPMNTest; import org.onap.so.bpmn.common.BuildingBlockExecution; -public class ChangeModelVfModuleBBTest extends BaseBPMNTest{ - @Test - public void sunnyDayChangeModelVfModuleTest() throws InterruptedException { - mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("ChangeModelVfModuleBB", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("ChangeModelVfModuleBB_Start", "ChangeModelVfModule", "CallActivity_sdncHandler", "UpdateVfModuleModel", "ChangeModelVfModuleBB_End"); - assertThat(pi).isEnded(); - } +public class ChangeModelVfModuleBBTest extends BaseBPMNTest { + @Test + public void sunnyDayChangeModelVfModuleTest() throws InterruptedException { + mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("ChangeModelVfModuleBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("ChangeModelVfModuleBB_Start", "ChangeModelVfModule", + "CallActivity_sdncHandler", "UpdateVfModuleModel", "ChangeModelVfModuleBB_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayChangeModelVfModuleTest() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(sdncChangeAssignTasks) + .changeAssignModelVfModule(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("ChangeModelVfModuleBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("ChangeModelVfModuleBB_Start", "ChangeModelVfModule") + .hasNotPassed("ChangeModelVfModuleBB_End"); + assertThat(pi).isEnded(); + } + - @Test - public void rainyDayChangeModelVfModuleTest() throws Exception { - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(sdncChangeAssignTasks).changeAssignModelVfModule(any(BuildingBlockExecution.class)); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("ChangeModelVfModuleBB", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted() - .hasPassedInOrder("ChangeModelVfModuleBB_Start", "ChangeModelVfModule") - .hasNotPassed("ChangeModelVfModuleBB_End"); - assertThat(pi).isEnded(); - } - - } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ChangeModelVnfBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ChangeModelVnfBBTest.java index 43ac1630df..a7835e30f0 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ChangeModelVnfBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ChangeModelVnfBBTest.java @@ -19,35 +19,36 @@ */ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Test; import org.onap.so.bpmn.BaseBPMNTest; import org.onap.so.bpmn.common.BuildingBlockExecution; -public class ChangeModelVnfBBTest extends BaseBPMNTest{ - @Test - public void changeModelVnfBBTest() { - mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); - ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("ChangeModelVnfBB", variables); - assertThat(processInstance).isNotNull(); - assertThat(processInstance).isStarted().hasPassedInOrder("ChangeModelVnf_Start" ,"SDNCChangeModel", "CallActivity_sdncHandlerCall", "AAIUpdateModel", "ChangeModelVnf_End"); - assertThat(processInstance).isEnded(); - } - - @Test - public void changeModelVnfBBExceptionTest() { - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(sdncChangeAssignTasks).changeModelVnf(any(BuildingBlockExecution.class)); - - ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("ChangeModelVnfBB", variables); - assertThat(processInstance).isNotNull(); - assertThat(processInstance).isStarted() - .hasPassedInOrder("ChangeModelVnf_Start", "SDNCChangeModel") - .hasNotPassed("AAIUpdateModel", "ChangeModelVnf_End"); - assertThat(processInstance).isEnded(); - } +public class ChangeModelVnfBBTest extends BaseBPMNTest { + @Test + public void changeModelVnfBBTest() { + mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); + ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("ChangeModelVnfBB", variables); + assertThat(processInstance).isNotNull(); + assertThat(processInstance).isStarted().hasPassedInOrder("ChangeModelVnf_Start", "SDNCChangeModel", + "CallActivity_sdncHandlerCall", "AAIUpdateModel", "ChangeModelVnf_End"); + assertThat(processInstance).isEnded(); + } + + @Test + public void changeModelVnfBBExceptionTest() { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(sdncChangeAssignTasks) + .changeModelVnf(any(BuildingBlockExecution.class)); + + ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("ChangeModelVnfBB", variables); + assertThat(processInstance).isNotNull(); + assertThat(processInstance).isStarted().hasPassedInOrder("ChangeModelVnf_Start", "SDNCChangeModel") + .hasNotPassed("AAIUpdateModel", "ChangeModelVnf_End"); + assertThat(processInstance).isEnded(); + } } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ConfigurationScaleOutBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ConfigurationScaleOutBBTest.java index 4602ff97ce..8a19bc2561 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ConfigurationScaleOutBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ConfigurationScaleOutBBTest.java @@ -19,15 +19,13 @@ */ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; - import java.io.IOException; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; - import org.junit.Test; import org.onap.so.bpmn.BaseBPMNTest; import org.onap.so.bpmn.common.BuildingBlockExecution; @@ -36,23 +34,23 @@ import org.onap.so.bpmn.common.BuildingBlockExecution; public class ConfigurationScaleOutBBTest extends BaseBPMNTest { - @Test - public void sunnyDayConfigurationScaleOutBBTest() throws InterruptedException, IOException { - ProcessInstance pi = runtimeService.startProcessInstanceByKey("ConfigurationScaleOutBB", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("Start_ConfigScaleOutBB", "QueryVfModule", "GetConfigScaleOutParams", - "Call-AppC-ConfigScaleOut", "End_ConfigScaleOutBB"); - assertThat(pi).isEnded(); - } - - @Test - public void configurationScaleOutBBExceptionTest() throws Exception { - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(sdncQueryTasks).queryVfModule(any(BuildingBlockExecution.class)); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("ConfigurationScaleOutBB", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted() - .hasPassedInOrder("Start_ConfigScaleOutBB", "QueryVfModule") - .hasNotPassed("GetConfigScaleOutParams", "Call-AppC-ConfigScaleOut", "End_ConfigScaleOutBB"); - assertThat(pi).isEnded(); - } + @Test + public void sunnyDayConfigurationScaleOutBBTest() throws InterruptedException, IOException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("ConfigurationScaleOutBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("Start_ConfigScaleOutBB", "QueryVfModule", + "GetConfigScaleOutParams", "Call-AppC-ConfigScaleOut", "End_ConfigScaleOutBB"); + assertThat(pi).isEnded(); + } + + @Test + public void configurationScaleOutBBExceptionTest() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(sdncQueryTasks) + .queryVfModule(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("ConfigurationScaleOutBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("Start_ConfigScaleOutBB", "QueryVfModule") + .hasNotPassed("GetConfigScaleOutParams", "Call-AppC-ConfigScaleOut", "End_ConfigScaleOutBB"); + assertThat(pi).isEnded(); + } } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateCustomerBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateCustomerBBTest.java index 91d3fd20a2..ee85f9bc05 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateCustomerBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateCustomerBBTest.java @@ -19,34 +19,35 @@ */ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Test; import org.onap.so.bpmn.BaseBPMNTest; import org.onap.so.bpmn.common.BuildingBlockExecution; -public class CreateCustomerBBTest extends BaseBPMNTest{ - @Test - public void createCustomerBBTest() throws InterruptedException { - ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateCustomerBB", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("CreateCustomerBB_Start", "CreateCustomerAAI", "CreateCustomerBB_End"); - assertThat(pi).isEnded(); - } +public class CreateCustomerBBTest extends BaseBPMNTest { + @Test + public void createCustomerBBTest() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateCustomerBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("CreateCustomerBB_Start", "CreateCustomerAAI", + "CreateCustomerBB_End"); + assertThat(pi).isEnded(); + } - @Test - public void createCustomerBBExceptionTest() throws Exception { - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiCreateTasks).createCustomer(any(BuildingBlockExecution.class)); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateCustomerBB", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted() - .hasPassedInOrder("CreateCustomerBB_Start", "CreateCustomerAAI") - .hasNotPassed("CreateCustomer_End"); - assertThat(pi).isEnded(); - } + @Test + public void createCustomerBBExceptionTest() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiCreateTasks) + .createCustomer(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateCustomerBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("CreateCustomerBB_Start", "CreateCustomerAAI") + .hasNotPassed("CreateCustomer_End"); + assertThat(pi).isEnded(); + } } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateNetworkBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateNetworkBBTest.java index 0aba1cc484..ece5b93ee2 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateNetworkBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateNetworkBBTest.java @@ -19,35 +19,37 @@ */ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Test; import org.onap.so.bpmn.BaseBPMNTest; import org.onap.so.bpmn.common.BuildingBlockExecution; -public class CreateNetworkBBTest extends BaseBPMNTest{ +public class CreateNetworkBBTest extends BaseBPMNTest { @Test public void sunnyDayCreateNetwork_Test() throws InterruptedException { - ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateNetworkBB",variables); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateNetworkBB", variables); assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("createNetwork_startEvent", "ServiceTask_get_cloud_region", "QueryVpnBinding_ServiceTask", "QueryNetworkPolicy_ServiceTask", "QueryNetworkTableRef_ServiceTask", "QueryNetworkSubnet_ServiceTask", "Create_Network_ServiceTask", "Update_Network_AAI_ServiceTask", "createNetwork_EndEvent"); + assertThat(pi).isStarted().hasPassedInOrder("createNetwork_startEvent", "ServiceTask_get_cloud_region", + "QueryVpnBinding_ServiceTask", "QueryNetworkPolicy_ServiceTask", "QueryNetworkTableRef_ServiceTask", + "QueryNetworkSubnet_ServiceTask", "Create_Network_ServiceTask", "Update_Network_AAI_ServiceTask", + "createNetwork_EndEvent"); assertThat(pi).isEnded(); } - @Test - public void rainyDayCreateNetwork_Test() throws Exception { - - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(createNetwork).buildCreateNetworkRequest(any(BuildingBlockExecution.class)); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateNetworkBB", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted() - .hasPassedInOrder("createNetwork_startEvent") - .hasNotPassed("End Flow"); - assertThat(pi).isEnded(); - } + @Test + public void rainyDayCreateNetwork_Test() throws Exception { + + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(createNetwork) + .buildCreateNetworkRequest(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateNetworkBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("createNetwork_startEvent").hasNotPassed("End Flow"); + assertThat(pi).isEnded(); + } } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateNetworkCollectionBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateNetworkCollectionBBTest.java index 5c67324e0a..1d9cf5ad69 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateNetworkCollectionBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateNetworkCollectionBBTest.java @@ -19,33 +19,36 @@ */ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Test; import org.onap.so.bpmn.BaseBPMNTest; import org.onap.so.bpmn.common.BuildingBlockExecution; -public class CreateNetworkCollectionBBTest extends BaseBPMNTest{ +public class CreateNetworkCollectionBBTest extends BaseBPMNTest { @Test public void sunnyDayCreateNetworkCollection_Test() throws InterruptedException { - ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateNetworkCollectionBB",variables); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateNetworkCollectionBB", variables); assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("createNetworkCollection_startEvent", "BuildName_ServiceTask", "ServiceTask_create_NetworkCollection", "ServiceTask_create_NetworkCollectionInstanceGroup", "ServiceTask_Connect_Collection_to_InstanceGroup", "ServiceTask_Connect_InstanceGroup_to_CloudRegion", "ServiceTask_Connect_Collection_to_ServiceInstance", "createNetworkCollection_EndEvent"); + assertThat(pi).isStarted().hasPassedInOrder("createNetworkCollection_startEvent", "BuildName_ServiceTask", + "ServiceTask_create_NetworkCollection", "ServiceTask_create_NetworkCollectionInstanceGroup", + "ServiceTask_Connect_Collection_to_InstanceGroup", "ServiceTask_Connect_InstanceGroup_to_CloudRegion", + "ServiceTask_Connect_Collection_to_ServiceInstance", "createNetworkCollection_EndEvent"); assertThat(pi).isEnded(); } - @Test - public void rainyDayCreateNetworkCollection_Test() throws Exception { - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiCreateTasks).createNetworkCollectionInstanceGroup(any(BuildingBlockExecution.class)); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateNetworkCollectionBB", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted() - .hasPassedInOrder("createNetworkCollection_startEvent", "BuildName_ServiceTask", "ServiceTask_create_NetworkCollection") - .hasNotPassed("createNetworkCollection_EndEvent"); - assertThat(pi).isEnded(); - } + @Test + public void rainyDayCreateNetworkCollection_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiCreateTasks) + .createNetworkCollectionInstanceGroup(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateNetworkCollectionBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("createNetworkCollection_startEvent", "BuildName_ServiceTask", + "ServiceTask_create_NetworkCollection").hasNotPassed("createNetworkCollection_EndEvent"); + assertThat(pi).isEnded(); + } } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateVfModuleBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateVfModuleBBTest.java index 8c44309cca..4c5edade6e 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateVfModuleBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateVfModuleBBTest.java @@ -19,100 +19,99 @@ */ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Test; import org.onap.so.bpmn.BaseBPMNTest; import org.onap.so.bpmn.common.BuildingBlockExecution; -public class CreateVfModuleBBTest extends BaseBPMNTest{ - @Test - public void sunnyDayCreateVfModule_Test() throws InterruptedException { - mockSubprocess("VnfAdapter", "Mocked VnfAdapter", "GenericStub"); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateVfModuleBB", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("CreateVfModuleBB_Start", - "QueryVnf", - "QueryVfModule", - "CreateVfModule", - "VnfAdapter", - "CreateNetworkPolicies", - "UpdateVnfIpv4OamAddress", - "UpdateVnfManagementV6Address", - "UpdateVfModuleContrailServiceInstanceFqdn", - "UpdateVfModuleHeatStackId", - "UpdateVfModuleStatus", - "CreateVfModuleBB_End"); - assertThat(pi).isEnded(); - } - - @Test - public void rainyDayCreateVfModuleSDNCQueryVnfError_Test() throws Exception { - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(sdncQueryTasks).queryVnf(any(BuildingBlockExecution.class)); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateVfModuleBB", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted() - .hasPassedInOrder("CreateVfModuleBB_Start", "QueryVnf") - .hasNotPassed("QueryVfModule", "CreateVfModule", "VnfAdapter", "CreateNetworkPolicies", "UpdateVnfIpv4OamAddress", - "UpdateVnfManagementV6Address","UpdateVfModuleContrailServiceInstanceFqdn","UpdateVfModuleHeatStackId", - "UpdateVfModuleStatus", "CreateVfModuleBB_End"); - assertThat(pi).isEnded(); - } +public class CreateVfModuleBBTest extends BaseBPMNTest { + @Test + public void sunnyDayCreateVfModule_Test() throws InterruptedException { + mockSubprocess("VnfAdapter", "Mocked VnfAdapter", "GenericStub"); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateVfModuleBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("CreateVfModuleBB_Start", "QueryVnf", "QueryVfModule", + "CreateVfModule", "VnfAdapter", "CreateNetworkPolicies", "UpdateVnfIpv4OamAddress", + "UpdateVnfManagementV6Address", "UpdateVfModuleContrailServiceInstanceFqdn", + "UpdateVfModuleHeatStackId", "UpdateVfModuleStatus", "CreateVfModuleBB_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayCreateVfModuleSDNCQueryVnfError_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(sdncQueryTasks) + .queryVnf(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateVfModuleBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("CreateVfModuleBB_Start", "QueryVnf").hasNotPassed("QueryVfModule", + "CreateVfModule", "VnfAdapter", "CreateNetworkPolicies", "UpdateVnfIpv4OamAddress", + "UpdateVnfManagementV6Address", "UpdateVfModuleContrailServiceInstanceFqdn", + "UpdateVfModuleHeatStackId", "UpdateVfModuleStatus", "CreateVfModuleBB_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayCreateVfModuleSDNCQueryVnfModuleError_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(sdncQueryTasks) + .queryVfModule(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateVfModuleBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("CreateVfModuleBB_Start", "QueryVnf", "QueryVfModule").hasNotPassed( + "CreateVfModule", "VnfAdapter", "CreateNetworkPolicies", "UpdateVnfIpv4OamAddress", + "UpdateVnfManagementV6Address", "UpdateVfModuleContrailServiceInstanceFqdn", + "UpdateVfModuleHeatStackId", "UpdateVfModuleStatus", "CreateVfModuleBB_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayCreateVfModuleVnfAdapterCreateError_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(vnfAdapterCreateTasks) + .createVfModule(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateVfModuleBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted() + .hasPassedInOrder("CreateVfModuleBB_Start", "QueryVnf", "QueryVfModule", "CreateVfModule") + .hasNotPassed("VnfAdapter", "CreateNetworkPolicies", "UpdateVnfIpv4OamAddress", + "UpdateVnfManagementV6Address", "UpdateVfModuleContrailServiceInstanceFqdn", + "UpdateVfModuleHeatStackId", "UpdateVfModuleStatus", "CreateVfModuleBB_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayCreateVfModuleUpdateVfModuleHeatStackIdError_Test() throws Exception { + mockSubprocess("VnfAdapter", "Mocked VnfAdapter", "GenericStub"); + + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiUpdateTasks) + .updateHeatStackIdVfModule(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateVfModuleBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted() + .hasPassedInOrder("CreateVfModuleBB_Start", "QueryVnf", "QueryVfModule", "CreateVfModule", "VnfAdapter", + "CreateNetworkPolicies", "UpdateVnfIpv4OamAddress", "UpdateVnfManagementV6Address", + "UpdateVfModuleContrailServiceInstanceFqdn", "UpdateVfModuleHeatStackId") + .hasNotPassed("UpdateVfModuleStatus", "CreateVfModuleBB_End"); + assertThat(pi).isEnded(); - @Test - public void rainyDayCreateVfModuleSDNCQueryVnfModuleError_Test() throws Exception { - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(sdncQueryTasks).queryVfModule(any(BuildingBlockExecution.class)); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateVfModuleBB", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted() - .hasPassedInOrder("CreateVfModuleBB_Start", "QueryVnf", "QueryVfModule") - .hasNotPassed("CreateVfModule", "VnfAdapter", "CreateNetworkPolicies", "UpdateVnfIpv4OamAddress", "UpdateVnfManagementV6Address", - "UpdateVfModuleContrailServiceInstanceFqdn","UpdateVfModuleHeatStackId", "UpdateVfModuleStatus", "CreateVfModuleBB_End"); - assertThat(pi).isEnded(); - } - - @Test - public void rainyDayCreateVfModuleVnfAdapterCreateError_Test() throws Exception { - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(vnfAdapterCreateTasks).createVfModule(any(BuildingBlockExecution.class)); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateVfModuleBB", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted() - .hasPassedInOrder("CreateVfModuleBB_Start", "QueryVnf", "QueryVfModule", "CreateVfModule") - .hasNotPassed("VnfAdapter", "CreateNetworkPolicies","UpdateVnfIpv4OamAddress", "UpdateVnfManagementV6Address", - "UpdateVfModuleContrailServiceInstanceFqdn","UpdateVfModuleHeatStackId", "UpdateVfModuleStatus", "CreateVfModuleBB_End"); - assertThat(pi).isEnded(); - } - - @Test - public void rainyDayCreateVfModuleUpdateVfModuleHeatStackIdError_Test() throws Exception { - mockSubprocess("VnfAdapter", "Mocked VnfAdapter", "GenericStub"); + } - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiUpdateTasks).updateHeatStackIdVfModule(any(BuildingBlockExecution.class)); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateVfModuleBB", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted() - .hasPassedInOrder("CreateVfModuleBB_Start", "QueryVnf", "QueryVfModule", "CreateVfModule", "VnfAdapter", "CreateNetworkPolicies", - "UpdateVnfIpv4OamAddress", "UpdateVnfManagementV6Address", "UpdateVfModuleContrailServiceInstanceFqdn","UpdateVfModuleHeatStackId") - .hasNotPassed("UpdateVfModuleStatus", "CreateVfModuleBB_End"); - assertThat(pi).isEnded(); - - } - - @Test - public void rainyDayCreateVfModuleUpdateVfModuleStatusError_Test() throws Exception { - mockSubprocess("VnfAdapter", "Mocked VnfAdapter", "GenericStub"); - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiUpdateTasks).updateOrchestrationStatusCreatedVfModule(any(BuildingBlockExecution.class)); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateVfModuleBB", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted() - .hasPassedInOrder("CreateVfModuleBB_Start", "QueryVnf", "QueryVfModule", "CreateVfModule", "VnfAdapter", "CreateNetworkPolicies", - "UpdateVnfIpv4OamAddress", "UpdateVnfManagementV6Address", "UpdateVfModuleContrailServiceInstanceFqdn","UpdateVfModuleHeatStackId", - "UpdateVfModuleStatus") - .hasNotPassed("CreateVfModuleBB_End"); - assertThat(pi).isEnded(); - } + @Test + public void rainyDayCreateVfModuleUpdateVfModuleStatusError_Test() throws Exception { + mockSubprocess("VnfAdapter", "Mocked VnfAdapter", "GenericStub"); + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiUpdateTasks) + .updateOrchestrationStatusCreatedVfModule(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateVfModuleBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted() + .hasPassedInOrder("CreateVfModuleBB_Start", "QueryVnf", "QueryVfModule", "CreateVfModule", "VnfAdapter", + "CreateNetworkPolicies", "UpdateVnfIpv4OamAddress", "UpdateVnfManagementV6Address", + "UpdateVfModuleContrailServiceInstanceFqdn", "UpdateVfModuleHeatStackId", + "UpdateVfModuleStatus") + .hasNotPassed("CreateVfModuleBB_End"); + assertThat(pi).isEnded(); + } } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateVolumeGroupBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateVolumeGroupBBTest.java index 34a17cbb89..c7eb2ac3d1 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateVolumeGroupBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateVolumeGroupBBTest.java @@ -19,48 +19,54 @@ */ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Test; import org.onap.so.bpmn.BaseBPMNTest; import org.onap.so.bpmn.common.BuildingBlockExecution; -public class CreateVolumeGroupBBTest extends BaseBPMNTest{ - @Test - public void sunnyDayCreateVolumeGroup_Test() throws InterruptedException { - mockSubprocess("VnfAdapter", "Mocked VnfAdapter", "GenericStub"); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateVolumeGroupBB", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("CreateVolumeGroupBB_Start", "QueryVfModuleSDNC", "CreateVolumeGroupVnfAdapter", "Vnf_Adapter", "UpdateVolumeGroupHeatStackId", "UpdateVolumeGroupAAI", "CreateVolumeGroupBB_End"); - assertThat(pi).isEnded(); - assertThat(pi).hasPassedInOrder("CreateVolumeGroupBB_Start", "QueryVfModuleSDNC", "CreateVolumeGroupVnfAdapter", "Vnf_Adapter","UpdateVolumeGroupAAI", "CreateVolumeGroupBB_End"); - } +public class CreateVolumeGroupBBTest extends BaseBPMNTest { + @Test + public void sunnyDayCreateVolumeGroup_Test() throws InterruptedException { + mockSubprocess("VnfAdapter", "Mocked VnfAdapter", "GenericStub"); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateVolumeGroupBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("CreateVolumeGroupBB_Start", "QueryVfModuleSDNC", + "CreateVolumeGroupVnfAdapter", "Vnf_Adapter", "UpdateVolumeGroupHeatStackId", "UpdateVolumeGroupAAI", + "CreateVolumeGroupBB_End"); + assertThat(pi).isEnded(); + assertThat(pi).hasPassedInOrder("CreateVolumeGroupBB_Start", "QueryVfModuleSDNC", "CreateVolumeGroupVnfAdapter", + "Vnf_Adapter", "UpdateVolumeGroupAAI", "CreateVolumeGroupBB_End"); + } + + @Test + public void rainyDayCreateVolumeGroup_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(vnfAdapterCreateTasks) + .createVolumeGroupRequest(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateVolumeGroupBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted() + .hasPassedInOrder("CreateVolumeGroupBB_Start", "QueryVfModuleSDNC", "CreateVolumeGroupVnfAdapter") + .hasNotPassed("UpdateVolumeGroupHeatStackId", "UpdateVolumeGroupAAI", "CreateVolumeGroupBB_End"); + assertThat(pi).isEnded(); + } - @Test - public void rainyDayCreateVolumeGroup_Test() throws Exception { - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(vnfAdapterCreateTasks).createVolumeGroupRequest(any(BuildingBlockExecution.class)); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateVolumeGroupBB", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted() - .hasPassedInOrder("CreateVolumeGroupBB_Start", "QueryVfModuleSDNC", "CreateVolumeGroupVnfAdapter") - .hasNotPassed("UpdateVolumeGroupHeatStackId", "UpdateVolumeGroupAAI", "CreateVolumeGroupBB_End"); - assertThat(pi).isEnded(); - } - - @Test - public void rainyDayCreateVolumeGroupUpdateHeatStackIdError_Test() throws Exception { - mockSubprocess("VnfAdapter", "Mocked VnfAdapter", "GenericStub"); - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiUpdateTasks).updateHeatStackIdVolumeGroup(any(BuildingBlockExecution.class)); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateVolumeGroupBB", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted() - .hasPassedInOrder("CreateVolumeGroupBB_Start", "QueryVfModuleSDNC", "CreateVolumeGroupVnfAdapter", "Vnf_Adapter") - .hasNotPassed("UpdateVolumeGroupAAI", "CreateVolumeGroupBB_End"); - assertThat(pi).isEnded(); - } + @Test + public void rainyDayCreateVolumeGroupUpdateHeatStackIdError_Test() throws Exception { + mockSubprocess("VnfAdapter", "Mocked VnfAdapter", "GenericStub"); + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiUpdateTasks) + .updateHeatStackIdVolumeGroup(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateVolumeGroupBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi) + .isStarted().hasPassedInOrder("CreateVolumeGroupBB_Start", "QueryVfModuleSDNC", + "CreateVolumeGroupVnfAdapter", "Vnf_Adapter") + .hasNotPassed("UpdateVolumeGroupAAI", "CreateVolumeGroupBB_End"); + assertThat(pi).isEnded(); + } } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateNetworkBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateNetworkBBTest.java index ad93eec514..548dca2225 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateNetworkBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateNetworkBBTest.java @@ -19,35 +19,36 @@ */ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Test; import org.onap.so.bpmn.BaseBPMNTest; import org.onap.so.bpmn.common.BuildingBlockExecution; -public class DeactivateNetworkBBTest extends BaseBPMNTest{ - @Test - public void sunnyDayDeactivateNetworkBB_Test() throws InterruptedException { - mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeactivateNetworkBB", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("DeactivateNetworkBB_Start", "DeactivateNetworkSDNC", "CallActivity_sdncHandler","DeactivateNetworkAAI", "DeactivateNetworkBB_End"); - assertThat(pi).isEnded(); - } +public class DeactivateNetworkBBTest extends BaseBPMNTest { + @Test + public void sunnyDayDeactivateNetworkBB_Test() throws InterruptedException { + mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeactivateNetworkBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("DeactivateNetworkBB_Start", "DeactivateNetworkSDNC", + "CallActivity_sdncHandler", "DeactivateNetworkAAI", "DeactivateNetworkBB_End"); + assertThat(pi).isEnded(); + } - @Test - public void rainyDayDeactivateNetworkBB_Test() throws Exception { - mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(sdncDeactivateTasks).deactivateNetwork(any(BuildingBlockExecution.class)); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeactivateNetworkBB", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted() - .hasPassedInOrder("DeactivateNetworkBB_Start", "DeactivateNetworkSDNC") - .hasNotPassed("DeactivateNetworkAAI", "DeactivateNetworkBB_End"); - assertThat(pi).isEnded(); - } + @Test + public void rainyDayDeactivateNetworkBB_Test() throws Exception { + mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(sdncDeactivateTasks) + .deactivateNetwork(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeactivateNetworkBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("DeactivateNetworkBB_Start", "DeactivateNetworkSDNC") + .hasNotPassed("DeactivateNetworkAAI", "DeactivateNetworkBB_End"); + assertThat(pi).isEnded(); + } } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateServiceInstanceBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateServiceInstanceBBTest.java index 428713d9a7..ba9beabce7 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateServiceInstanceBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateServiceInstanceBBTest.java @@ -19,8 +19,8 @@ */ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; -import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Test; import org.onap.so.bpmn.BaseBPMNTest; @@ -28,13 +28,15 @@ import org.onap.so.bpmn.BaseBPMNTest; /** * Unit test cases for DeActivateServiceInstanceTest.bpmn */ -public class DeactivateServiceInstanceBBTest extends BaseBPMNTest{ - @Test - public void sunnyDayDeactivateServiceInstanceSDNC() throws InterruptedException { - mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeactivateServiceInstanceBB", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("Start_DeactivateServiceInstanceBB", "Task_DeactivateServiceInstance_SDNC", "CallActivity_sdncHandler", "Task_DeactivateServiceInstance_AAI", "End_DeactivateServiceInstanceBB"); - assertThat(pi).isEnded(); - } +public class DeactivateServiceInstanceBBTest extends BaseBPMNTest { + @Test + public void sunnyDayDeactivateServiceInstanceSDNC() throws InterruptedException { + mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeactivateServiceInstanceBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("Start_DeactivateServiceInstanceBB", + "Task_DeactivateServiceInstance_SDNC", "CallActivity_sdncHandler", "Task_DeactivateServiceInstance_AAI", + "End_DeactivateServiceInstanceBB"); + assertThat(pi).isEnded(); + } } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateVfModuleBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateVfModuleBBTest.java index c7232e504e..945c212f90 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateVfModuleBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateVfModuleBBTest.java @@ -19,39 +19,39 @@ */ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; - import java.io.IOException; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Test; import org.onap.so.bpmn.BaseBPMNTest; import org.onap.so.bpmn.common.BuildingBlockExecution; -public class DeactivateVfModuleBBTest extends BaseBPMNTest{ - @Test - public void sunnyDay() throws InterruptedException, IOException { - mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeactivateVfModuleBB", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("DeactivateVfModuleBB_Start", "DeactivateVfModule", "CallActivity_sdncHandler", - "UpdateVfModuleDeactivateStatus", "DeactivateVfModuleBB_End"); - assertThat(pi).isEnded(); - } - - @Test - public void rainyDay() throws Exception { - mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); - doThrow(BpmnError.class).when(aaiUpdateTasks).updateOrchestrationStatusDeactivateVfModule(any(BuildingBlockExecution.class)); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeactivateVfModuleBB", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted() - .hasPassedInOrder("DeactivateVfModuleBB_Start", "DeactivateVfModule", "UpdateVfModuleDeactivateStatus") - .hasNotPassed("DeActivateVfModuleBB_End"); - assertThat(pi).isEnded(); - - } +public class DeactivateVfModuleBBTest extends BaseBPMNTest { + @Test + public void sunnyDay() throws InterruptedException, IOException { + mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeactivateVfModuleBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("DeactivateVfModuleBB_Start", "DeactivateVfModule", + "CallActivity_sdncHandler", "UpdateVfModuleDeactivateStatus", "DeactivateVfModuleBB_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDay() throws Exception { + mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); + doThrow(BpmnError.class).when(aaiUpdateTasks) + .updateOrchestrationStatusDeactivateVfModule(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeactivateVfModuleBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted() + .hasPassedInOrder("DeactivateVfModuleBB_Start", "DeactivateVfModule", "UpdateVfModuleDeactivateStatus") + .hasNotPassed("DeActivateVfModuleBB_End"); + assertThat(pi).isEnded(); + + } } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateVnfBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateVnfBBTest.java index bf5e228cbf..0ecf0448e2 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateVnfBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateVnfBBTest.java @@ -19,49 +19,48 @@ */ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; - import java.io.IOException; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Test; import org.onap.so.bpmn.BaseBPMNTest; import org.onap.so.bpmn.common.BuildingBlockExecution; -public class DeactivateVnfBBTest extends BaseBPMNTest{ - @Test - public void sunnyDay() throws InterruptedException, IOException { - mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeactivateVnfBB", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("Start_DeactivateVnfBB","Task_SDNCAdapterVnfTopologyDeactivate", - "CallActivity_sdncHandler", "Task_DeactivateOrchestrationStatusVnf", "End_DeactivateVnfBB"); - assertThat(pi).isEnded(); - } +public class DeactivateVnfBBTest extends BaseBPMNTest { + @Test + public void sunnyDay() throws InterruptedException, IOException { + mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeactivateVnfBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("Start_DeactivateVnfBB", "Task_SDNCAdapterVnfTopologyDeactivate", + "CallActivity_sdncHandler", "Task_DeactivateOrchestrationStatusVnf", "End_DeactivateVnfBB"); + assertThat(pi).isEnded(); + } - @Test - public void rainyDayDeactivateVnfSDNCError_Test() throws Exception { - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(sdncDeactivateTasks).deactivateVnf(any(BuildingBlockExecution.class)); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeactivateVnfBB", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted() - .hasPassedInOrder("Start_DeactivateVnfBB", "Task_SDNCAdapterVnfTopologyDeactivate") - .hasNotPassed("Task_DeactivateOrchestrationStatusVnf", "End_DeactivateVnfBB"); - assertThat(pi).isEnded(); - } + @Test + public void rainyDayDeactivateVnfSDNCError_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(sdncDeactivateTasks) + .deactivateVnf(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeactivateVnfBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("Start_DeactivateVnfBB", "Task_SDNCAdapterVnfTopologyDeactivate") + .hasNotPassed("Task_DeactivateOrchestrationStatusVnf", "End_DeactivateVnfBB"); + assertThat(pi).isEnded(); + } - @Test - public void rainyDayDeactivateVnfAAIError_Test() throws Exception { - mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiUpdateTasks).updateOrchestrationStatusAssignedVnf(any(BuildingBlockExecution.class)); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeactivateVnfBB", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted() - .hasPassedInOrder("Start_DeactivateVnfBB", "Task_SDNCAdapterVnfTopologyDeactivate","Task_DeactivateOrchestrationStatusVnf") - .hasNotPassed("End_DeactivateVnfBB"); - assertThat(pi).isEnded(); - } + @Test + public void rainyDayDeactivateVnfAAIError_Test() throws Exception { + mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiUpdateTasks) + .updateOrchestrationStatusAssignedVnf(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeactivateVnfBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("Start_DeactivateVnfBB", "Task_SDNCAdapterVnfTopologyDeactivate", + "Task_DeactivateOrchestrationStatusVnf").hasNotPassed("End_DeactivateVnfBB"); + assertThat(pi).isEnded(); + } } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateVolumeGroupBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateVolumeGroupBBTest.java index 8ed3e0710f..ab0903d645 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateVolumeGroupBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeactivateVolumeGroupBBTest.java @@ -19,10 +19,10 @@ */ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Test; @@ -30,22 +30,23 @@ import org.onap.so.bpmn.BaseBPMNTest; import org.onap.so.bpmn.common.BuildingBlockExecution; public class DeactivateVolumeGroupBBTest extends BaseBPMNTest { - @Test - public void sunnyDayAssignVolumeGroup_Test() throws InterruptedException { - ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeactivateVolumeGroupBB", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("DeactivateVolumeGroupBB_Start", "DeactivateVolumeGroup", "DeactivateVolumeGroupBB_End"); - assertThat(pi).isEnded(); - } + @Test + public void sunnyDayAssignVolumeGroup_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeactivateVolumeGroupBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("DeactivateVolumeGroupBB_Start", "DeactivateVolumeGroup", + "DeactivateVolumeGroupBB_End"); + assertThat(pi).isEnded(); + } - @Test - public void rainyDayAssignVolumeGroup_Test() throws Exception { - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiUpdateTasks).updateOrchestrationStatusCreatedVolumeGroup(any(BuildingBlockExecution.class)); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeactivateVolumeGroupBB", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted() - .hasPassedInOrder("DeactivateVolumeGroupBB_Start", "DeactivateVolumeGroup") - .hasNotPassed("DeactivateVolumeGroupBB_End"); - assertThat(pi).isEnded(); - } + @Test + public void rainyDayAssignVolumeGroup_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiUpdateTasks) + .updateOrchestrationStatusCreatedVolumeGroup(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeactivateVolumeGroupBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("DeactivateVolumeGroupBB_Start", "DeactivateVolumeGroup") + .hasNotPassed("DeactivateVolumeGroupBB_End"); + assertThat(pi).isEnded(); + } } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteInstanceGroupBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteInstanceGroupBBTest.java index 6dc36ae100..b527e8887e 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteInstanceGroupBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteInstanceGroupBBTest.java @@ -18,36 +18,35 @@ * ============LICENSE_END========================================================= */ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; - import java.io.IOException; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Test; import org.onap.so.bpmn.BaseBPMNTest; import org.onap.so.bpmn.common.BuildingBlockExecution; -public class DeleteInstanceGroupBBTest extends BaseBPMNTest{ - @Test - public void sunnyDay() throws InterruptedException, IOException { - ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeleteInstanceGroupBB", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("DeleteInstanceGroupBB_Start", "DeleteInstanceGroupNaming", "DeleteInstanceGroupAAI", - "DeleteInstanceGroupBB_End"); - assertThat(pi).isEnded(); - } +public class DeleteInstanceGroupBBTest extends BaseBPMNTest { + @Test + public void sunnyDay() throws InterruptedException, IOException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeleteInstanceGroupBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("DeleteInstanceGroupBB_Start", "DeleteInstanceGroupNaming", + "DeleteInstanceGroupAAI", "DeleteInstanceGroupBB_End"); + assertThat(pi).isEnded(); + } - @Test - public void rainyDay() throws Exception { - doThrow(BpmnError.class).when(aaiDeleteTasks).deleteInstanceGroup(any(BuildingBlockExecution.class)); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeleteInstanceGroupBB", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted() - .hasPassedInOrder("DeleteInstanceGroupBB_Start", "DeleteInstanceGroupNaming", "DeleteInstanceGroupAAI") - .hasNotPassed("DeleteInstanceGroupBB_End"); - assertThat(pi).isEnded(); - } + @Test + public void rainyDay() throws Exception { + doThrow(BpmnError.class).when(aaiDeleteTasks).deleteInstanceGroup(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeleteInstanceGroupBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted() + .hasPassedInOrder("DeleteInstanceGroupBB_Start", "DeleteInstanceGroupNaming", "DeleteInstanceGroupAAI") + .hasNotPassed("DeleteInstanceGroupBB_End"); + assertThat(pi).isEnded(); + } } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteNetworkBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteNetworkBBTest.java index ce25a42a26..5a62436bfc 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteNetworkBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteNetworkBBTest.java @@ -19,33 +19,34 @@ */ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Test; import org.onap.so.bpmn.BaseBPMNTest; import org.onap.so.bpmn.common.BuildingBlockExecution; -public class DeleteNetworkBBTest extends BaseBPMNTest{ +public class DeleteNetworkBBTest extends BaseBPMNTest { @Test public void sunnyDayDeleteNetwork_Test() throws InterruptedException { - ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeleteNetworkBB",variables); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeleteNetworkBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("deleteNetwork_startEvent", "deleteNetworkAIC", "updateNetworkAAI", + "deleteNetwork_endEvent"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayDeleteNetwork_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(networkAdapterDeleteTasks) + .deleteNetwork(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeleteNetworkBB", variables); assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("deleteNetwork_startEvent", "deleteNetworkAIC", "updateNetworkAAI", "deleteNetwork_endEvent"); + assertThat(pi).isStarted().hasPassedInOrder("deleteNetwork_startEvent", "deleteNetworkAIC") + .hasNotPassed("updateNetworkAAI", "deleteNetwork_endEvent"); assertThat(pi).isEnded(); } - - @Test - public void rainyDayDeleteNetwork_Test() throws Exception { - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(networkAdapterDeleteTasks).deleteNetwork(any(BuildingBlockExecution.class)); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeleteNetworkBB", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted() - .hasPassedInOrder("deleteNetwork_startEvent", "deleteNetworkAIC") - .hasNotPassed("updateNetworkAAI", "deleteNetwork_endEvent"); - assertThat(pi).isEnded(); - } } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteNetworkCollectionBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteNetworkCollectionBBTest.java index 388f169b9c..f1da33d75a 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteNetworkCollectionBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteNetworkCollectionBBTest.java @@ -19,34 +19,36 @@ */ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Test; import org.onap.so.bpmn.BaseBPMNTest; import org.onap.so.bpmn.common.BuildingBlockExecution; -public class DeleteNetworkCollectionBBTest extends BaseBPMNTest{ +public class DeleteNetworkCollectionBBTest extends BaseBPMNTest { @Test public void sunnyDayCreateNetworkCollection_Test() throws InterruptedException { - ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeleteNetworkCollectionBB",variables); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeleteNetworkCollectionBB", variables); assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("deleteNetworkCollection_startEvent", "ServiceTask_delete_NetworkCollectionInstanceGroup", "ServiceTask_delete_NetworkCollection", "deleteNetworkCollection_EndEvent"); + assertThat(pi).isStarted().hasPassedInOrder("deleteNetworkCollection_startEvent", + "ServiceTask_delete_NetworkCollectionInstanceGroup", "ServiceTask_delete_NetworkCollection", + "deleteNetworkCollection_EndEvent"); assertThat(pi).isEnded(); } - @Test - public void rainyDayCreateNetworkCollection_Test() throws Exception { - - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiDeleteTasks).deleteInstanceGroup(any(BuildingBlockExecution.class)); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeleteNetworkCollectionBB", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted() - .hasPassedInOrder("deleteNetworkCollection_startEvent") - .hasNotPassed("deleteNetworkCollection_EndEvent"); - assertThat(pi).isEnded(); - } + @Test + public void rainyDayCreateNetworkCollection_Test() throws Exception { + + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiDeleteTasks) + .deleteInstanceGroup(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeleteNetworkCollectionBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("deleteNetworkCollection_startEvent") + .hasNotPassed("deleteNetworkCollection_EndEvent"); + assertThat(pi).isEnded(); + } } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteVfModuleBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteVfModuleBBTest.java index 48ae22cb1a..e88df73f39 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteVfModuleBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteVfModuleBBTest.java @@ -18,13 +18,12 @@ * ============LICENSE_END========================================================= */ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; - import java.io.IOException; import java.util.List; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.externaltask.LockedExternalTask; import org.camunda.bpm.engine.runtime.ProcessInstance; @@ -33,55 +32,54 @@ import org.junit.Test; import org.onap.so.bpmn.BaseBPMNTest; import org.onap.so.bpmn.common.BuildingBlockExecution; -public class DeleteVfModuleBBTest extends BaseBPMNTest{ +public class DeleteVfModuleBBTest extends BaseBPMNTest { - @Before - public void before() { - variables.put("auditInventoryNeeded", true); - } + @Before + public void before() { + variables.put("auditInventoryNeeded", true); + } - @Test - public void sunnyDay() throws InterruptedException, IOException { - mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); - mockSubprocess("VnfAdapter", "Mocked VnfAdapter", "GenericStub"); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeleteVfModuleBB", variables); - List<LockedExternalTask> tasks = externalTaskService.fetchAndLock(100, "externalWorkerId") + @Test + public void sunnyDay() throws InterruptedException, IOException { + mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); + mockSubprocess("VnfAdapter", "Mocked VnfAdapter", "GenericStub"); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeleteVfModuleBB", variables); + List<LockedExternalTask> tasks = externalTaskService.fetchAndLock(100, "externalWorkerId") .topic("InventoryDeleteAudit", 60L * 1000L).execute(); while (!tasks.isEmpty()) { for (LockedExternalTask task : tasks) { externalTaskService.complete(task.getId(), "externalWorkerId"); } - tasks = externalTaskService.fetchAndLock(100, "externalWorkerId") - .topic("InventoryDeleteAudit", 60L * 1000L).execute(); + tasks = externalTaskService.fetchAndLock(100, "externalWorkerId").topic("InventoryDeleteAudit", 60L * 1000L) + .execute(); } - assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassed("DeleteVfModuleBB_Start","ExclusiveGateway_0xrgzm7","ExclusiveGateway_1yvh16a","Check_Audit", - "Setup_Audit_Variable","Audit_Inventory","DeleteVfModuleVnfAdapter", "VnfAdapter", - "DeleteNetworkPolicies", "UpdateVnfIpv4OamAddress", "UpdateVnfManagementV6Address", - "UpdateVfModuleContrailServiceInstanceFqdn", - "UpdateVfModuleHeatStackId", "UpdateVfModuleDeleteStatus", "DeleteVfModuleBB_End"); - assertThat(pi).isEnded(); - } + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassed("DeleteVfModuleBB_Start", "ExclusiveGateway_0xrgzm7", + "ExclusiveGateway_1yvh16a", "Check_Audit", "Setup_Audit_Variable", "Audit_Inventory", + "DeleteVfModuleVnfAdapter", "VnfAdapter", "DeleteNetworkPolicies", "UpdateVnfIpv4OamAddress", + "UpdateVnfManagementV6Address", "UpdateVfModuleContrailServiceInstanceFqdn", + "UpdateVfModuleHeatStackId", "UpdateVfModuleDeleteStatus", "DeleteVfModuleBB_End"); + assertThat(pi).isEnded(); + } - @Test - public void rainyDay() throws Exception { - doThrow(BpmnError.class).when(vnfAdapterDeleteTasks).deleteVfModule(any(BuildingBlockExecution.class)); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeleteVfModuleBB", variables); - List<LockedExternalTask> tasks = externalTaskService.fetchAndLock(100, "externalWorkerId") + @Test + public void rainyDay() throws Exception { + doThrow(BpmnError.class).when(vnfAdapterDeleteTasks).deleteVfModule(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeleteVfModuleBB", variables); + List<LockedExternalTask> tasks = externalTaskService.fetchAndLock(100, "externalWorkerId") .topic("InventoryDeleteAudit", 60L * 1000L).execute(); while (!tasks.isEmpty()) { for (LockedExternalTask task : tasks) { externalTaskService.complete(task.getId(), "externalWorkerId"); } - tasks = externalTaskService.fetchAndLock(100, "externalWorkerId") - .topic("InventoryDeleteAudit", 60L * 1000L).execute(); + tasks = externalTaskService.fetchAndLock(100, "externalWorkerId").topic("InventoryDeleteAudit", 60L * 1000L) + .execute(); } - assertThat(pi).isNotNull(); - assertThat(pi).isStarted() - .hasPassed("DeleteVfModuleBB_Start", "DeleteVfModuleVnfAdapter") - .hasNotPassed("VnfAdapter", "DeleteNetworkPolicies", "UpdateVnfIpv4OamAddress", "UpdateVnfManagementV6Address", - "UpdateVfModuleContrailServiceInstanceFqdn","UpdateVfModuleHeatStackId", "UpdateVfModuleDeleteStatus", - "DeleteVfModuleBB_End"); - assertThat(pi).isEnded(); - } + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassed("DeleteVfModuleBB_Start", "DeleteVfModuleVnfAdapter").hasNotPassed( + "VnfAdapter", "DeleteNetworkPolicies", "UpdateVnfIpv4OamAddress", "UpdateVnfManagementV6Address", + "UpdateVfModuleContrailServiceInstanceFqdn", "UpdateVfModuleHeatStackId", "UpdateVfModuleDeleteStatus", + "DeleteVfModuleBB_End"); + assertThat(pi).isEnded(); + } } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteVolumeGroupBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteVolumeGroupBBTest.java index 2336bb54ca..00adcd2c59 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteVolumeGroupBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteVolumeGroupBBTest.java @@ -19,10 +19,10 @@ */ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Test; @@ -30,24 +30,26 @@ import org.onap.so.bpmn.BaseBPMNTest; import org.onap.so.bpmn.common.BuildingBlockExecution; public class DeleteVolumeGroupBBTest extends BaseBPMNTest { - @Test - public void sunnyDayDeleteVolumeGroup_Test() throws InterruptedException { - mockSubprocess("VnfAdapter", "Mocked VnfAdapter", "GenericStub"); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeleteVolumeGroupBB", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("DeleteVolumeGroupBB_Start", "DeleteVolumeGroupVnfAdapter", "VnfAdapter", "UpdateVolumeGroupHeatStackId", "UpdateVolumeGroupAAI", "DeleteVolumeGroupBB_End"); - assertThat(pi).isEnded(); - } + @Test + public void sunnyDayDeleteVolumeGroup_Test() throws InterruptedException { + mockSubprocess("VnfAdapter", "Mocked VnfAdapter", "GenericStub"); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeleteVolumeGroupBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("DeleteVolumeGroupBB_Start", "DeleteVolumeGroupVnfAdapter", + "VnfAdapter", "UpdateVolumeGroupHeatStackId", "UpdateVolumeGroupAAI", "DeleteVolumeGroupBB_End"); + assertThat(pi).isEnded(); + } - @Test - public void rainyDayDeleteVolumeGroup_Test() throws Exception { - mockSubprocess("VnfAdapter", "Mocked VnfAdapter", "GenericStub"); - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiUpdateTasks).updateOrchestrationStatusAssignedVolumeGroup(any(BuildingBlockExecution.class)); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeleteVolumeGroupBB", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted() - .hasPassedInOrder("DeleteVolumeGroupBB_Start", "DeleteVolumeGroupVnfAdapter", "VnfAdapter", "UpdateVolumeGroupHeatStackId", "UpdateVolumeGroupAAI") - .hasNotPassed("DeleteVolumeGroupBB_End"); - assertThat(pi).isEnded(); - } + @Test + public void rainyDayDeleteVolumeGroup_Test() throws Exception { + mockSubprocess("VnfAdapter", "Mocked VnfAdapter", "GenericStub"); + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiUpdateTasks) + .updateOrchestrationStatusAssignedVolumeGroup(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeleteVolumeGroupBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("DeleteVolumeGroupBB_Start", "DeleteVolumeGroupVnfAdapter", + "VnfAdapter", "UpdateVolumeGroupHeatStackId", "UpdateVolumeGroupAAI") + .hasNotPassed("DeleteVolumeGroupBB_End"); + assertThat(pi).isEnded(); + } } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DistributeTrafficActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DistributeTrafficActivityTest.java index 35fbaa1a04..8306de4794 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DistributeTrafficActivityTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DistributeTrafficActivityTest.java @@ -19,10 +19,10 @@ */ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Test; @@ -30,28 +30,25 @@ import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.BaseBPMNTest; import org.onap.appc.client.lcm.model.Action; -public class DistributeTrafficActivityTest extends BaseBPMNTest{ - @Test - public void sunnyDayDistributeTrafficActivity_Test() throws InterruptedException { - ProcessInstance pi = runtimeService.startProcessInstanceByKey("DistributeTrafficActivity", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("DistributeTrafficActivity_Start", - "TaskPreProcessActivity", - "TaskDistributeTraffic", - "DistributeTrafficActivity_End"); - assertThat(pi).isEnded(); - } - - @Test - public void rainyDayDistributeTrafficActivity_Test() throws Exception { - variables.put("actionDistributeTraffic", Action.DistributeTraffic); - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks) - .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class)); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("DistributeTrafficActivity", variables); - assertThat(pi).isNotNull().isStarted().hasPassedInOrder("DistributeTrafficActivity_Start", - "TaskPreProcessActivity", - "TaskDistributeTraffic").hasNotPassed( - "DistributeTrafficActivity_End"); - } - +public class DistributeTrafficActivityTest extends BaseBPMNTest { + @Test + public void sunnyDayDistributeTrafficActivity_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("DistributeTrafficActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("DistributeTrafficActivity_Start", "TaskPreProcessActivity", + "TaskDistributeTraffic", "DistributeTrafficActivity_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayDistributeTrafficActivity_Test() throws Exception { + variables.put("actionDistributeTraffic", Action.DistributeTraffic); + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks) + .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("DistributeTrafficActivity", variables); + assertThat(pi).isNotNull().isStarted() + .hasPassedInOrder("DistributeTrafficActivity_Start", "TaskPreProcessActivity", "TaskDistributeTraffic") + .hasNotPassed("DistributeTrafficActivity_End"); + } + } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DistributeTrafficCheckActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DistributeTrafficCheckActivityTest.java index e360c83335..195a1ed809 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DistributeTrafficCheckActivityTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DistributeTrafficCheckActivityTest.java @@ -19,10 +19,10 @@ */ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Test; @@ -30,28 +30,26 @@ import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.BaseBPMNTest; import org.onap.appc.client.lcm.model.Action; -public class DistributeTrafficCheckActivityTest extends BaseBPMNTest{ - @Test - public void sunnyDayDistributeTrafficCheckActivity_Test() throws InterruptedException { - ProcessInstance pi = runtimeService.startProcessInstanceByKey("DistributeTrafficCheckActivity", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("DistributeTrafficCheckActivity_Start", - "TaskPreProcessActivity", - "TaskDistributeTrafficCheck", - "DistributeTrafficCheckActivity_End"); - assertThat(pi).isEnded(); - } - - @Test - public void rainyDayDistributeTrafficActivity_Test() throws Exception { - variables.put("actionDistributeTrafficCheck", Action.DistributeTrafficCheck); - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks) - .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class)); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("DistributeTrafficCheckActivity", variables); - assertThat(pi).isNotNull().isStarted().hasPassedInOrder("DistributeTrafficCheckActivity_Start", - "TaskPreProcessActivity", - "TaskDistributeTrafficCheck").hasNotPassed( - "DistributeTrafficCheckActivity_End"); - } - +public class DistributeTrafficCheckActivityTest extends BaseBPMNTest { + @Test + public void sunnyDayDistributeTrafficCheckActivity_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("DistributeTrafficCheckActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("DistributeTrafficCheckActivity_Start", "TaskPreProcessActivity", + "TaskDistributeTrafficCheck", "DistributeTrafficCheckActivity_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayDistributeTrafficActivity_Test() throws Exception { + variables.put("actionDistributeTrafficCheck", Action.DistributeTrafficCheck); + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks) + .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("DistributeTrafficCheckActivity", variables); + assertThat(pi) + .isNotNull().isStarted().hasPassedInOrder("DistributeTrafficCheckActivity_Start", + "TaskPreProcessActivity", "TaskDistributeTrafficCheck") + .hasNotPassed("DistributeTrafficCheckActivity_End"); + } + } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ExecuteBuildingBlockTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ExecuteBuildingBlockTest.java index 03e50591c7..07554cdf97 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ExecuteBuildingBlockTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ExecuteBuildingBlockTest.java @@ -19,14 +19,13 @@ */ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat; import static org.junit.Assert.assertNotNull; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.doThrow; - import java.util.List; - import org.camunda.bpm.engine.ManagementService; import org.camunda.bpm.engine.TaskService; import org.camunda.bpm.engine.delegate.BpmnError; @@ -46,86 +45,98 @@ import org.onap.so.db.catalog.beans.OrchestrationStatusValidationDirective; import org.springframework.beans.factory.annotation.Autowired; public class ExecuteBuildingBlockTest extends BaseBPMNTest { - @Autowired - private TaskService taskService; - @Autowired - private ManagementService managementService; - - @Test - public void runExecuteFlowTest() { - - variables.put("orchestrationStatusValidationResult", OrchestrationStatusValidationDirective.CONTINUE); - variables.put("flowToBeCalled", "MockFlow"); - - mockSubprocess("MockFlow", "My Mock Process Name", "GenericStub"); - - ProcessInstance pi = runtimeService.startProcessInstanceByKey("ExecuteBuildingBlock", variables); - - assertThat(pi).isNotNull(); - assertThat(pi).isStarted() - .hasPassedInOrder("Start_ExecuteBuildingBlock", "Task_BBInputSetup", "StatusPolicy", "CheckOrchestrationStatusValidationResults", "Task_PreValidate", "Call_BBToExecute", "Task_PostValidate", "Task_setHandlingCodeSuccess", "End_ExecuteBuildingBlock"); - assertThat(pi).isEnded(); - - - } - @Test - public void test_sunnyDayExecuteBuildingBlock_silentSuccess() throws Exception { - variables.put("orchestrationStatusValidationResult", OrchestrationStatusValidationDirective.SILENT_SUCCESS); - - ProcessInstance pi = runtimeService.startProcessInstanceByKey("ExecuteBuildingBlock", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted() - .hasPassedInOrder("Start_ExecuteBuildingBlock", "Task_BBInputSetup", "StatusPolicy", "CheckOrchestrationStatusValidationResults","Task_setHandlingCodeSuccess", "End_ExecuteBuildingBlock") - .hasNotPassed("Call_BBToExecute", "ErrorStart", "Task_QueryRainyDayTable", "ExclusiveGateway_1aonzik", "ExclusiveGateway_1aonzik", "ErrorEnd2", "Task_SetRetryTimer"); - assertThat(pi).isEnded(); - } - - @Test - @Ignore - public void test_rainyDayExecuteBuildingBlock_rollbackOrAbort() throws Exception { - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(bbInputSetup).execute(any(DelegateExecution.class)); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("ExecuteBuildingBlock", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted() - .hasPassedInOrder("Start_ExecuteBuildingBlock", "Task_BBInputSetup", "StartEvent_0tmcs9g", "Task_QueryRainyDayTable", "ExclusiveGateway_1aonzik", "EndEvent_0mvmk3i", "SubProcess_0tv8zda") - .hasNotPassed("StatusPolicy", "CheckOrchestrationStatusValidationResults", "Task_setHandlingCodeSuccess","Call_BBToExecute", "End_ExecuteBuildingBlock", "ExclusiveGateway_0ey4zpt", "Task_SetRetryTimer"); - assertThat(pi).isEnded(); - } - - @Test - @Ignore - public void test_rainyDayExecuteBuildingBlock_retryNoRetriesLeft() throws Exception { - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(bbInputSetup).execute(any(DelegateExecution.class)); - - variables.put("handlingCode", "Retry"); - variables.put("RetryCount", 5); - - ProcessInstance pi = runtimeService.startProcessInstanceByKey("ExecuteBuildingBlock", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted() - .hasPassedInOrder("Start_ExecuteBuildingBlock", "Task_BBInputSetup", "StartEvent_0tmcs9g", "Task_QueryRainyDayTable", "ExclusiveGateway_1aonzik", "ExclusiveGateway_0ey4zpt", "ErrorEnd2") - .hasNotPassed("StatusPolicy", "CheckOrchestrationStatusValidationResults", "Task_setHandlingCodeSuccess","Call_BBToExecute", "End_ExecuteBuildingBlock", "Task_SetRetryTimer"); - assertThat(pi).isEnded(); - } - - @Test - @Ignore - public void test_rainyDayExecuteBuildingBlock_retryRetriesLeft() throws Exception { - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(bbInputSetup).execute(any(DelegateExecution.class)); - - variables.put("handlingCode", "Retry"); - variables.put("RetryCount", 4); - variables.put("RetryDuration", "PT1S"); - - ProcessInstance pi = runtimeService.startProcessInstanceByKey("ExecuteBuildingBlock", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted(); - assertThat(pi).isWaitingAt("IntermediateCatchEvent_RetryTimer"); - Job job = managementService.createJobQuery().activityId("IntermediateCatchEvent_RetryTimer").singleResult(); - assertNotNull(job); - managementService.executeJob(job.getId()); - assertThat(pi).isEnded() - .hasPassedInOrder("Start_ExecuteBuildingBlock", "Task_BBInputSetup", "BoundaryEvent_0i3q236", "Task_QueryRainyDayTable", "ExclusiveGateway_1aonzik", "ExclusiveGateway_0ey4zpt", "Task_SetRetryTimer", "EndEvent_1sez2lh") - .hasNotPassed("StatusPolicy", "CheckOrchestrationStatusValidationResults", "Task_setHandlingCodeSuccess","Call_BBToExecute", "End_ExecuteBuildingBlock", "ErrorEnd2"); - } + @Autowired + private TaskService taskService; + @Autowired + private ManagementService managementService; + + @Test + public void runExecuteFlowTest() { + + variables.put("orchestrationStatusValidationResult", OrchestrationStatusValidationDirective.CONTINUE); + variables.put("flowToBeCalled", "MockFlow"); + + mockSubprocess("MockFlow", "My Mock Process Name", "GenericStub"); + + ProcessInstance pi = runtimeService.startProcessInstanceByKey("ExecuteBuildingBlock", variables); + + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("Start_ExecuteBuildingBlock", "Task_BBInputSetup", "StatusPolicy", + "CheckOrchestrationStatusValidationResults", "Task_PreValidate", "Call_BBToExecute", + "Task_PostValidate", "Task_setHandlingCodeSuccess", "End_ExecuteBuildingBlock"); + assertThat(pi).isEnded(); + + + } + + @Test + public void test_sunnyDayExecuteBuildingBlock_silentSuccess() throws Exception { + variables.put("orchestrationStatusValidationResult", OrchestrationStatusValidationDirective.SILENT_SUCCESS); + + ProcessInstance pi = runtimeService.startProcessInstanceByKey("ExecuteBuildingBlock", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("Start_ExecuteBuildingBlock", "Task_BBInputSetup", "StatusPolicy", + "CheckOrchestrationStatusValidationResults", "Task_setHandlingCodeSuccess", "End_ExecuteBuildingBlock") + .hasNotPassed("Call_BBToExecute", "ErrorStart", "Task_QueryRainyDayTable", "ExclusiveGateway_1aonzik", + "ExclusiveGateway_1aonzik", "ErrorEnd2", "Task_SetRetryTimer"); + assertThat(pi).isEnded(); + } + + @Test + @Ignore + public void test_rainyDayExecuteBuildingBlock_rollbackOrAbort() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(bbInputSetup).execute(any(DelegateExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("ExecuteBuildingBlock", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted() + .hasPassedInOrder("Start_ExecuteBuildingBlock", "Task_BBInputSetup", "StartEvent_0tmcs9g", + "Task_QueryRainyDayTable", "ExclusiveGateway_1aonzik", "EndEvent_0mvmk3i", "SubProcess_0tv8zda") + .hasNotPassed("StatusPolicy", "CheckOrchestrationStatusValidationResults", + "Task_setHandlingCodeSuccess", "Call_BBToExecute", "End_ExecuteBuildingBlock", + "ExclusiveGateway_0ey4zpt", "Task_SetRetryTimer"); + assertThat(pi).isEnded(); + } + + @Test + @Ignore + public void test_rainyDayExecuteBuildingBlock_retryNoRetriesLeft() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(bbInputSetup).execute(any(DelegateExecution.class)); + + variables.put("handlingCode", "Retry"); + variables.put("RetryCount", 5); + + ProcessInstance pi = runtimeService.startProcessInstanceByKey("ExecuteBuildingBlock", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted() + .hasPassedInOrder("Start_ExecuteBuildingBlock", "Task_BBInputSetup", "StartEvent_0tmcs9g", + "Task_QueryRainyDayTable", "ExclusiveGateway_1aonzik", "ExclusiveGateway_0ey4zpt", "ErrorEnd2") + .hasNotPassed("StatusPolicy", "CheckOrchestrationStatusValidationResults", + "Task_setHandlingCodeSuccess", "Call_BBToExecute", "End_ExecuteBuildingBlock", + "Task_SetRetryTimer"); + assertThat(pi).isEnded(); + } + + @Test + @Ignore + public void test_rainyDayExecuteBuildingBlock_retryRetriesLeft() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(bbInputSetup).execute(any(DelegateExecution.class)); + + variables.put("handlingCode", "Retry"); + variables.put("RetryCount", 4); + variables.put("RetryDuration", "PT1S"); + + ProcessInstance pi = runtimeService.startProcessInstanceByKey("ExecuteBuildingBlock", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted(); + assertThat(pi).isWaitingAt("IntermediateCatchEvent_RetryTimer"); + Job job = managementService.createJobQuery().activityId("IntermediateCatchEvent_RetryTimer").singleResult(); + assertNotNull(job); + managementService.executeJob(job.getId()); + assertThat(pi).isEnded() + .hasPassedInOrder("Start_ExecuteBuildingBlock", "Task_BBInputSetup", "BoundaryEvent_0i3q236", + "Task_QueryRainyDayTable", "ExclusiveGateway_1aonzik", "ExclusiveGateway_0ey4zpt", + "Task_SetRetryTimer", "EndEvent_1sez2lh") + .hasNotPassed("StatusPolicy", "CheckOrchestrationStatusValidationResults", + "Task_setHandlingCodeSuccess", "Call_BBToExecute", "End_ExecuteBuildingBlock", "ErrorEnd2"); + } } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/FlowCompleteActivity.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/FlowCompleteActivity.java index 26e8fcb5b9..1b0e8ed8a3 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/FlowCompleteActivity.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/FlowCompleteActivity.java @@ -19,37 +19,35 @@ */ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Test; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.BaseBPMNTest; -public class FlowCompleteActivity extends BaseBPMNTest{ - @Test - public void sunnyDayFlowCompleteActivity_Test() throws InterruptedException { - ProcessInstance pi = runtimeService.startProcessInstanceByKey("FlowCompleteActivity", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("FlowCompleteActivity_Start", - "TaskUpdateRequestDB", - "FlowCompleteActivity_End"); - assertThat(pi).isEnded(); - } - - @Test - public void rainyDayFlowCompleteActivity_Test() throws Exception { - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(flowCompletionTasks) - .updateRequestDbStatus(any(BuildingBlockExecution.class)); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("FlowCompleteActivity", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("FlowCompleteActivity_Start", - "TaskUpdateRequestDB").hasNotPassed( - "FlowCompleteActivity_End"); - assertThat(pi).isEnded(); - } - +public class FlowCompleteActivity extends BaseBPMNTest { + @Test + public void sunnyDayFlowCompleteActivity_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("FlowCompleteActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("FlowCompleteActivity_Start", "TaskUpdateRequestDB", + "FlowCompleteActivity_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayFlowCompleteActivity_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(flowCompletionTasks) + .updateRequestDbStatus(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("FlowCompleteActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("FlowCompleteActivity_Start", "TaskUpdateRequestDB") + .hasNotPassed("FlowCompleteActivity_End"); + assertThat(pi).isEnded(); + } + } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/GenericVnfHealthCheckBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/GenericVnfHealthCheckBBTest.java index c321ca1f71..b10a1007f5 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/GenericVnfHealthCheckBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/GenericVnfHealthCheckBBTest.java @@ -19,12 +19,11 @@ */ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; - import java.io.IOException; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Test; @@ -34,27 +33,27 @@ import org.onap.so.bpmn.common.BuildingBlockExecution; public class GenericVnfHealthCheckBBTest extends BaseBPMNTest { - - @Test - public void sunnyDayGenericVnfHealthCheckBBTest() throws InterruptedException, IOException { - - ProcessInstance pi = runtimeService.startProcessInstanceByKey("GenericVnfHealthCheckBB", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("Start_GenericVnfHealthChkBB", "SetParamsHealthCheck", - "Call-AppC-HealthCheck", "End_GenericVnfHealthChkBB"); - assertThat(pi).isEnded(); - } - - @Test - public void genericVnfHealthCheckBBExceptionTest() throws Exception { - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(genericVnfHealthCheck).setParamsForGenericVnfHealthCheck(any(BuildingBlockExecution.class)); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("GenericVnfHealthCheckBB", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted() - .hasPassedInOrder("Start_GenericVnfHealthChkBB", "SetParamsHealthCheck") - .hasNotPassed("Call-AppC-HealthCheck", "End_GenericVnfHealthChkBB"); - assertThat(pi).isEnded(); - } + + @Test + public void sunnyDayGenericVnfHealthCheckBBTest() throws InterruptedException, IOException { + + ProcessInstance pi = runtimeService.startProcessInstanceByKey("GenericVnfHealthCheckBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("Start_GenericVnfHealthChkBB", "SetParamsHealthCheck", + "Call-AppC-HealthCheck", "End_GenericVnfHealthChkBB"); + assertThat(pi).isEnded(); + } + + @Test + public void genericVnfHealthCheckBBExceptionTest() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(genericVnfHealthCheck) + .setParamsForGenericVnfHealthCheck(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("GenericVnfHealthCheckBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("Start_GenericVnfHealthChkBB", "SetParamsHealthCheck") + .hasNotPassed("Call-AppC-HealthCheck", "End_GenericVnfHealthChkBB"); + assertThat(pi).isEnded(); + } } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/HomingBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/HomingBBTest.java index 27bb328177..f1bb1462d6 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/HomingBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/HomingBBTest.java @@ -23,7 +23,6 @@ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; import static org.camunda.bpm.engine.test.assertions.ProcessEngineAssertions.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Ignore; @@ -34,37 +33,36 @@ import org.onap.so.bpmn.common.BuildingBlockExecution; import org.springframework.boot.test.mock.mockito.MockBean; -public class HomingBBTest extends BaseBPMNTest{ +public class HomingBBTest extends BaseBPMNTest { + + @Test + public void testHomingV2_success() { + mockSubprocess("ReceiveWorkflowMessage", "Mock ReceiveWorkflowMessage", "GenericStub"); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("HomingBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("start", "sniroOofCheck", "callSniro", "ExclusiveGateway_1ckp059", + "receiveAsyncCallback", "sniroOofCheck2", "processSniroSolution", "ExclusiveGateway_1kvzxpb", "end"); + assertThat(pi).isEnded(); + } - @Test - public void testHomingV2_success(){ - mockSubprocess("ReceiveWorkflowMessage", "Mock ReceiveWorkflowMessage", "GenericStub"); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("HomingBB", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("start", "sniroOofCheck", "callSniro", "ExclusiveGateway_1ckp059", "receiveAsyncCallback", "sniroOofCheck2", "processSniroSolution", "ExclusiveGateway_1kvzxpb", "end"); - assertThat(pi).isEnded(); - } + @Test + public void testHomingV2_error_bpmnError() { + doThrow(new BpmnError("MSOWorkflowException")).when(sniroHoming).callSniro(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("HomingBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassed("start", "sniroOofCheck", "startBpmnError", "bpmnErrorSubprocess", + "processMsoWorkflowException", "endBpmnError").hasNotPassed("callReceiveAsync"); + assertThat(pi).isEnded(); + } - @Test - public void testHomingV2_error_bpmnError(){ - doThrow(new BpmnError("MSOWorkflowException")).when(sniroHoming).callSniro(any(BuildingBlockExecution.class)); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("HomingBB", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted() - .hasPassed("start", "sniroOofCheck", "startBpmnError", "bpmnErrorSubprocess", "processMsoWorkflowException", "endBpmnError") - .hasNotPassed("callReceiveAsync"); - assertThat(pi).isEnded(); - } - - @Test - public void testHomingV2_error_javaException(){ - doThrow(new RuntimeException("Test")).when(sniroHoming).callSniro(any(BuildingBlockExecution.class)); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("HomingBB", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted() - .hasPassed("start", "sniroOofCheck", "callSniro", "startJavaError", "processJavaException", "javaExceptionSubProcess", "endJavaError") - .hasNotPassed("callReceiveAsync"); - assertThat(pi).isEnded(); - } + @Test + public void testHomingV2_error_javaException() { + doThrow(new RuntimeException("Test")).when(sniroHoming).callSniro(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("HomingBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassed("start", "sniroOofCheck", "callSniro", "startJavaError", + "processJavaException", "javaExceptionSubProcess", "endJavaError").hasNotPassed("callReceiveAsync"); + assertThat(pi).isEnded(); + } } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/PauseForManualTaskActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/PauseForManualTaskActivityTest.java index faf485f0d7..484f9b8506 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/PauseForManualTaskActivityTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/PauseForManualTaskActivityTest.java @@ -19,11 +19,11 @@ */ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat; import static org.junit.Assert.assertNotNull; import static org.mockito.Matchers.any; import static org.mockito.Mockito.doThrow; - import org.camunda.bpm.engine.ManagementService; import org.camunda.bpm.engine.TaskService; import org.camunda.bpm.engine.delegate.BpmnError; @@ -37,67 +37,60 @@ import org.springframework.beans.factory.annotation.Autowired; import org.onap.so.bpmn.BaseBPMNTest; -public class PauseForManualTaskActivityTest extends BaseBPMNTest{ - private static final String TIMEOUT_10_S = "PT10S"; - - @Autowired - protected ManagementService managementService; - - @Autowired - protected TaskService taskService; - - @Test - public void sunnyDayPauseForManualTaskTimeout_Test() throws InterruptedException { - variables.put("taskTimeout", TIMEOUT_10_S); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("PauseForManualTaskActivity", variables); - assertThat(pi).isNotNull(); - BpmnAwareAssertions.assertThat(pi).isWaitingAt("ManualUserTask"); - Task task = taskService.createTaskQuery().active().list().get(0); - assertThat(pi).task().isNotNull(); - assertNotNull(task); - - Job job = managementService.createJobQuery().activityId("ManualTaskTimer").singleResult(); - assertNotNull(job); - managementService.executeJob(job.getId()); - - assertThat(pi).isStarted().hasPassedInOrder("PauseForManualTaskActivity_Start", - "UpdateDbStatusToPendingManualTask", - "CreateExternalTicket", - "ManualTaskTimer", - "UpdateDBStatusToTimeout", - "ThrowTimeoutError"); - } - - @Test - public void sunnyDayPauseForManualTaskCompleted_Test() throws InterruptedException { - variables.put("taskTimeout", TIMEOUT_10_S); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("PauseForManualTaskActivity", variables); - assertThat(pi).isNotNull(); - BpmnAwareAssertions.assertThat(pi).isWaitingAt("ManualUserTask"); - assertThat(pi).task().isNotNull(); - Task task = taskService.createTaskQuery().active().list().get(0); - assertNotNull(task); - taskService.complete(task.getId()); - - assertThat(pi).isStarted().hasPassedInOrder("PauseForManualTaskActivity_Start", - "UpdateDbStatusToPendingManualTask", - "CreateExternalTicket", - "ManualUserTask", - "UpdateDbStatusToInProgress", - "PauseForManualTaskActivity_End"); - assertThat(pi).isEnded(); - } - - @Test - public void rainyDayPauseForManualTask_Test() throws Exception { - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(manualHandlingTasks).createExternalTicket((any(DelegateExecution.class))); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("PauseForManualTaskActivity", variables); - assertThat(pi).isNotNull().isStarted().hasPassedInOrder("PauseForManualTaskActivity_Start", - "UpdateDbStatusToPendingManualTask", - "CreateExternalTicket").hasNotPassed( - "ManualUserTask", - "UpdateDbStatusToInProgress", - "PauseForManualTaskActivity_End"); - } - +public class PauseForManualTaskActivityTest extends BaseBPMNTest { + private static final String TIMEOUT_10_S = "PT10S"; + + @Autowired + protected ManagementService managementService; + + @Autowired + protected TaskService taskService; + + @Test + public void sunnyDayPauseForManualTaskTimeout_Test() throws InterruptedException { + variables.put("taskTimeout", TIMEOUT_10_S); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("PauseForManualTaskActivity", variables); + assertThat(pi).isNotNull(); + BpmnAwareAssertions.assertThat(pi).isWaitingAt("ManualUserTask"); + Task task = taskService.createTaskQuery().active().list().get(0); + assertThat(pi).task().isNotNull(); + assertNotNull(task); + + Job job = managementService.createJobQuery().activityId("ManualTaskTimer").singleResult(); + assertNotNull(job); + managementService.executeJob(job.getId()); + + assertThat(pi).isStarted().hasPassedInOrder("PauseForManualTaskActivity_Start", + "UpdateDbStatusToPendingManualTask", "CreateExternalTicket", "ManualTaskTimer", + "UpdateDBStatusToTimeout", "ThrowTimeoutError"); + } + + @Test + public void sunnyDayPauseForManualTaskCompleted_Test() throws InterruptedException { + variables.put("taskTimeout", TIMEOUT_10_S); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("PauseForManualTaskActivity", variables); + assertThat(pi).isNotNull(); + BpmnAwareAssertions.assertThat(pi).isWaitingAt("ManualUserTask"); + assertThat(pi).task().isNotNull(); + Task task = taskService.createTaskQuery().active().list().get(0); + assertNotNull(task); + taskService.complete(task.getId()); + + assertThat(pi).isStarted().hasPassedInOrder("PauseForManualTaskActivity_Start", + "UpdateDbStatusToPendingManualTask", "CreateExternalTicket", "ManualUserTask", + "UpdateDbStatusToInProgress", "PauseForManualTaskActivity_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayPauseForManualTask_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(manualHandlingTasks) + .createExternalTicket((any(DelegateExecution.class))); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("PauseForManualTaskActivity", variables); + assertThat(pi).isNotNull().isStarted() + .hasPassedInOrder("PauseForManualTaskActivity_Start", "UpdateDbStatusToPendingManualTask", + "CreateExternalTicket") + .hasNotPassed("ManualUserTask", "UpdateDbStatusToInProgress", "PauseForManualTaskActivity_End"); + } + } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/SDNCHandlerTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/SDNCHandlerTest.java index ad9f97f951..199ada5909 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/SDNCHandlerTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/SDNCHandlerTest.java @@ -22,13 +22,11 @@ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; import static org.mockito.Mockito.doReturn; - import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; import java.util.HashMap; import java.util.Map; - import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Test; import org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation; @@ -37,41 +35,45 @@ import org.onap.so.client.exception.BadResponseException; import org.onap.so.client.exception.MapperException; import org.onap.so.client.sdnc.beans.SDNCRequest; import org.onap.so.client.sdnc.endpoint.SDNCTopology; - import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; -public class SDNCHandlerTest extends BaseBPMNTest{ - @Test - public void sunnyDay_SDNCHandler_Sync_Final_Test() throws InterruptedException, MapperException, BadResponseException, IOException { - final String sdncResponse = new String(Files.readAllBytes(Paths.get("src/test/resources/SDNCClientPut200Response.json"))); - doReturn(sdncResponse).when(sdncClient).post(createSDNCRequest().getSDNCPayload(),SDNCTopology.CONFIGURATION); - Map<String, Object> startVariables = new HashMap<>(); - startVariables.put("SDNCRequest", createSDNCRequest()); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("SDNCHandler", startVariables); - assertThat(pi).isNotNull().isStarted().hasPassedInOrder("SDNC_Start","SNDC_SetupCallback","Call_SDNC","isAsync_Gateway","SDNC_End").isEnded(); - } +public class SDNCHandlerTest extends BaseBPMNTest { + @Test + public void sunnyDay_SDNCHandler_Sync_Final_Test() + throws InterruptedException, MapperException, BadResponseException, IOException { + final String sdncResponse = + new String(Files.readAllBytes(Paths.get("src/test/resources/SDNCClientPut200Response.json"))); + doReturn(sdncResponse).when(sdncClient).post(createSDNCRequest().getSDNCPayload(), SDNCTopology.CONFIGURATION); + Map<String, Object> startVariables = new HashMap<>(); + startVariables.put("SDNCRequest", createSDNCRequest()); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("SDNCHandler", startVariables); + assertThat(pi).isNotNull().isStarted() + .hasPassedInOrder("SDNC_Start", "SNDC_SetupCallback", "Call_SDNC", "isAsync_Gateway", "SDNC_End") + .isEnded(); + } - public SDNCRequest createSDNCRequest(){ - SDNCRequest request = new SDNCRequest(); - request.setCorrelationName("correlationName"); - request.setCorrelationValue("correlationValue"); - request.setTopology(SDNCTopology.CONFIGURATION); - ObjectMapper mapper = new ObjectMapper(); - try { - GenericResourceApiServiceOperationInformation sdncReq = - mapper.readValue(Files.readAllBytes(Paths.get("src/test/resources/SDNC_Client_Request.json")), GenericResourceApiServiceOperationInformation.class); - request.setSDNCPayload(sdncReq); - } catch (JsonParseException e) { + public SDNCRequest createSDNCRequest() { + SDNCRequest request = new SDNCRequest(); + request.setCorrelationName("correlationName"); + request.setCorrelationValue("correlationValue"); + request.setTopology(SDNCTopology.CONFIGURATION); + ObjectMapper mapper = new ObjectMapper(); + try { + GenericResourceApiServiceOperationInformation sdncReq = + mapper.readValue(Files.readAllBytes(Paths.get("src/test/resources/SDNC_Client_Request.json")), + GenericResourceApiServiceOperationInformation.class); + request.setSDNCPayload(sdncReq); + } catch (JsonParseException e) { - } catch (JsonMappingException e) { + } catch (JsonMappingException e) { - } catch (IOException e) { + } catch (IOException e) { - } + } - return request; - } + return request; + } } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignNetworkBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignNetworkBBTest.java index b65f30fa9a..c20a56af66 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignNetworkBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignNetworkBBTest.java @@ -19,36 +19,38 @@ */ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.doThrow; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Test; import org.onap.so.bpmn.BaseBPMNTest; import org.onap.so.bpmn.common.BuildingBlockExecution; -public class UnassignNetworkBBTest extends BaseBPMNTest { +public class UnassignNetworkBBTest extends BaseBPMNTest { @Test public void sunnyDayAssignNetwork_Test() throws InterruptedException { - mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("UnassignNetworkBB",variables); + mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("UnassignNetworkBB", variables); assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("Start_UnassignNetworkBB","Task_VfModuleRelatioship","Task_GetCloudRegionVersion","Task_SNDCUnAssign","CallActivity_sdncHandlerCall","Task_DeleteNetwork","End_UnassignNetworkBB"); + assertThat(pi).isStarted().hasPassedInOrder("Start_UnassignNetworkBB", "Task_VfModuleRelatioship", + "Task_GetCloudRegionVersion", "Task_SNDCUnAssign", "CallActivity_sdncHandlerCall", "Task_DeleteNetwork", + "End_UnassignNetworkBB"); assertThat(pi).isEnded(); } - @Test - public void rainyDayAssignNetwork_Test() throws Exception { - mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(unassignNetworkBB).checkRelationshipRelatedTo(any(BuildingBlockExecution.class), eq("vf-module")); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("UnassignNetworkBB", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted() - .hasPassedInOrder("Start_UnassignNetworkBB", "Task_VfModuleRelatioship") - .hasNotPassed("End_UnassignNetworkBB"); - assertThat(pi).isEnded(); - } + @Test + public void rainyDayAssignNetwork_Test() throws Exception { + mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(unassignNetworkBB) + .checkRelationshipRelatedTo(any(BuildingBlockExecution.class), eq("vf-module")); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("UnassignNetworkBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("Start_UnassignNetworkBB", "Task_VfModuleRelatioship") + .hasNotPassed("End_UnassignNetworkBB"); + assertThat(pi).isEnded(); + } } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignServiceInstanceBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignServiceInstanceBBTest.java index 854c4f9c2e..3b503618f1 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignServiceInstanceBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignServiceInstanceBBTest.java @@ -19,8 +19,8 @@ */ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; -import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat; +import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat; import org.camunda.bpm.engine.impl.pvm.runtime.ExecutionImpl; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Test; @@ -28,15 +28,17 @@ import org.onap.so.bpmn.BaseBPMNTest; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.common.DelegateExecutionImpl; -public class UnassignServiceInstanceBBTest extends BaseBPMNTest{ - @Test - public void sunnyDayUnassignServiceInstanceSDNC() throws InterruptedException { - mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); - BuildingBlockExecution bbe = new DelegateExecutionImpl(new ExecutionImpl()); - variables.put("gBuildingBlockExecution", bbe); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("UnassignServiceInstanceBB", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("Start_UnassignServiceInstanceBB", "Task_SdncUnassignServiceInstance", "CallActivity_sdncHandlerCall", "Task_AAIDeleteServiceInstance", "End_UnassignServiceInstanceBB"); - assertThat(pi).isEnded(); - } +public class UnassignServiceInstanceBBTest extends BaseBPMNTest { + @Test + public void sunnyDayUnassignServiceInstanceSDNC() throws InterruptedException { + mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); + BuildingBlockExecution bbe = new DelegateExecutionImpl(new ExecutionImpl()); + variables.put("gBuildingBlockExecution", bbe); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("UnassignServiceInstanceBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("Start_UnassignServiceInstanceBB", + "Task_SdncUnassignServiceInstance", "CallActivity_sdncHandlerCall", "Task_AAIDeleteServiceInstance", + "End_UnassignServiceInstanceBB"); + assertThat(pi).isEnded(); + } } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignVfModuleBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignVfModuleBBTest.java index 89089770b1..e6fae0b005 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignVfModuleBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignVfModuleBBTest.java @@ -19,50 +19,47 @@ */ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Test; import org.onap.so.bpmn.BaseBPMNTest; import org.onap.so.bpmn.common.BuildingBlockExecution; -public class UnassignVfModuleBBTest extends BaseBPMNTest{ - @Test - public void sunnyDayUnassignVfModule_Test() throws InterruptedException { - mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("UnassignVfModuleBB", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("UnassignVfModuleBB_Start", - "UnassignVfModule", - "CallActivity_sdncHandler", - "DeleteVfModule", - "UnassignVfModuleBB_End"); - assertThat(pi).isEnded(); - } +public class UnassignVfModuleBBTest extends BaseBPMNTest { + @Test + public void sunnyDayUnassignVfModule_Test() throws InterruptedException { + mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("UnassignVfModuleBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("UnassignVfModuleBB_Start", "UnassignVfModule", + "CallActivity_sdncHandler", "DeleteVfModule", "UnassignVfModuleBB_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayUnassignVfModuleAAIDeleteFailed_Test() throws Exception { + mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiDeleteTasks) + .deleteVfModule(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("UnassignVfModuleBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("UnassignVfModuleBB_Start", "UnassignVfModule", "DeleteVfModule") + .hasNotPassed("UnassignVfModuleBB_End"); + assertThat(pi).isEnded(); + } - @Test - public void rainyDayUnassignVfModuleAAIDeleteFailed_Test() throws Exception { - mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiDeleteTasks).deleteVfModule(any(BuildingBlockExecution.class)); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("UnassignVfModuleBB", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted() - .hasPassedInOrder("UnassignVfModuleBB_Start", "UnassignVfModule", "DeleteVfModule") - .hasNotPassed("UnassignVfModuleBB_End"); - assertThat(pi).isEnded(); - } - - @Test - public void rainyDayUnassignVfModuleSDNCUnassignFailed_Test() throws Exception { - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(sdncUnassignTasks).unassignVfModule(any(BuildingBlockExecution.class)); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("UnassignVfModuleBB", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted() - .hasPassedInOrder("UnassignVfModuleBB_Start", "UnassignVfModule") - .hasNotPassed("DeleteVfModule", "UnassignVfModuleBB_End"); - assertThat(pi).isEnded(); - } + @Test + public void rainyDayUnassignVfModuleSDNCUnassignFailed_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(sdncUnassignTasks) + .unassignVfModule(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("UnassignVfModuleBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("UnassignVfModuleBB_Start", "UnassignVfModule") + .hasNotPassed("DeleteVfModule", "UnassignVfModuleBB_End"); + assertThat(pi).isEnded(); + } } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignVnfBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignVnfBBTest.java index d508f4fcd7..2a6435218d 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignVnfBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignVnfBBTest.java @@ -19,10 +19,10 @@ */ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Ignore; @@ -30,49 +30,48 @@ import org.junit.Test; import org.onap.so.bpmn.BaseBPMNTest; import org.onap.so.bpmn.common.BuildingBlockExecution; -public class UnassignVnfBBTest extends BaseBPMNTest{ - @Test - public void sunnyDayUnassignVnf_Test() throws InterruptedException { - mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("UnassignVnfBB", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("UnassignVnfBB_Start", - "UnassignVnf", - "CallActivity_sdncHandlerCall", - "DeleteVnfInstanceGroups", - "DeleteVnf", - "UnassignVnfBB_End"); - assertThat(pi).isEnded(); - } - - @Test - @Ignore - public void rainyDayUnassignVnfInstanceGroupsDeleteFailed_Test() throws Exception { - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(unassignVnf).deleteInstanceGroups(any(BuildingBlockExecution.class)); //.deleteVnf(any(BuildingBlockExecution.class)); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("UnassignVnfBB", variables); - assertThat(pi).isNotNull().isStarted() - .hasPassedInOrder("UnassignVnfBB_Start", "UnassignVnf", "DeleteVnfInstanceGroups") - .hasNotPassed("DeleteVnf","UnassignVnfBB_End"); - - } - - @Test - public void rainyDayUnassignVnfAAIDeleteFailed_Test() throws Exception { - mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiDeleteTasks).deleteVnf(any(BuildingBlockExecution.class)); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("UnassignVnfBB", variables); - assertThat(pi).isNotNull().isStarted().hasPassedInOrder("UnassignVnfBB_Start", "UnassignVnf", "DeleteVnfInstanceGroups","DeleteVnf") - .hasNotPassed("UnassignVnfBB_End"); - } - - @Test - public void rainyDayUnassignVnfSDNCUnassignFailed_Test() throws Exception { - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(sdncUnassignTasks).unassignVnf(any(BuildingBlockExecution.class)); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("UnassignVnfBB", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted() - .hasPassedInOrder("UnassignVnfBB_Start", "UnassignVnf") - .hasNotPassed("DeleteVnfInstanceGroups","DeleteVnf", "UnassignVnfBB_End"); - assertThat(pi).isEnded(); - } +public class UnassignVnfBBTest extends BaseBPMNTest { + @Test + public void sunnyDayUnassignVnf_Test() throws InterruptedException { + mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("UnassignVnfBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("UnassignVnfBB_Start", "UnassignVnf", + "CallActivity_sdncHandlerCall", "DeleteVnfInstanceGroups", "DeleteVnf", "UnassignVnfBB_End"); + assertThat(pi).isEnded(); + } + + @Test + @Ignore + public void rainyDayUnassignVnfInstanceGroupsDeleteFailed_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(unassignVnf) + .deleteInstanceGroups(any(BuildingBlockExecution.class)); // .deleteVnf(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("UnassignVnfBB", variables); + assertThat(pi).isNotNull().isStarted() + .hasPassedInOrder("UnassignVnfBB_Start", "UnassignVnf", "DeleteVnfInstanceGroups") + .hasNotPassed("DeleteVnf", "UnassignVnfBB_End"); + + } + + @Test + public void rainyDayUnassignVnfAAIDeleteFailed_Test() throws Exception { + mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiDeleteTasks) + .deleteVnf(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("UnassignVnfBB", variables); + assertThat(pi).isNotNull().isStarted() + .hasPassedInOrder("UnassignVnfBB_Start", "UnassignVnf", "DeleteVnfInstanceGroups", "DeleteVnf") + .hasNotPassed("UnassignVnfBB_End"); + } + + @Test + public void rainyDayUnassignVnfSDNCUnassignFailed_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(sdncUnassignTasks) + .unassignVnf(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("UnassignVnfBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("UnassignVnfBB_Start", "UnassignVnf") + .hasNotPassed("DeleteVnfInstanceGroups", "DeleteVnf", "UnassignVnfBB_End"); + assertThat(pi).isEnded(); + } } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignVolumeGroupBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignVolumeGroupBBTest.java index 6b176293fe..1cc0788613 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignVolumeGroupBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignVolumeGroupBBTest.java @@ -19,10 +19,10 @@ */ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Test; @@ -30,23 +30,24 @@ import org.onap.so.bpmn.BaseBPMNTest; import org.onap.so.bpmn.common.BuildingBlockExecution; public class UnassignVolumeGroupBBTest extends BaseBPMNTest { - @Test - public void sunnyDayUnassignVolumeGroup_Test() throws InterruptedException { - ProcessInstance pi = runtimeService.startProcessInstanceByKey("UnassignVolumeGroupBB", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("UnassignVolumeGroupBB_Start", "UnassignVolumeGroup", "UnassignVolumeGroupBB_End"); - assertThat(pi).isEnded(); - } - - @Test - public void rainyDayUnassignVolumeGroup_Test() throws InterruptedException { - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiDeleteTasks).deleteVolumeGroup(any(BuildingBlockExecution.class)); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("UnassignVolumeGroupBB", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted() - .hasPassedInOrder("UnassignVolumeGroupBB_Start", "UnassignVolumeGroup") - .hasNotPassed("UnassignVolumeGroupBB_End"); - assertThat(pi).isEnded(); - } + @Test + public void sunnyDayUnassignVolumeGroup_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("UnassignVolumeGroupBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("UnassignVolumeGroupBB_Start", "UnassignVolumeGroup", + "UnassignVolumeGroupBB_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayUnassignVolumeGroup_Test() throws InterruptedException { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiDeleteTasks) + .deleteVolumeGroup(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("UnassignVolumeGroupBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("UnassignVolumeGroupBB_Start", "UnassignVolumeGroup") + .hasNotPassed("UnassignVolumeGroupBB_End"); + assertThat(pi).isEnded(); + } } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UpdateNetworkBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UpdateNetworkBBTest.java index 1bb065ae06..d9194587c6 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UpdateNetworkBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UpdateNetworkBBTest.java @@ -19,10 +19,10 @@ */ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Test; @@ -33,27 +33,28 @@ import org.onap.so.bpmn.common.BuildingBlockExecution; public class UpdateNetworkBBTest extends BaseBPMNTest { @Test public void updateNetworkBBTest() throws InterruptedException { - mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); - ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("UpdateNetworkBB", variables); - assertThat(processInstance).isNotNull(); - assertThat(processInstance).isStarted().hasPassedInOrder( - "UpdateNetworkBB_Start", "SDNCChangeAssignNetwork", "CallActivity_sdncHandlerCallChangeAssign", - "QueryVpnBindingAAI", "QueryNetworkPolicyAAI", "QueryNetworkTableRefAAI", - "Create_Network_ServiceTask", "CallActivity_NetworkAdapterRestV1", "ServiceTask_ProcessResponse", "Update_Network_AAI_ServiceTask", "UpdateNetworkBB_End"); - assertThat(processInstance).isEnded(); + mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); + ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("UpdateNetworkBB", variables); + assertThat(processInstance).isNotNull(); + assertThat(processInstance).isStarted().hasPassedInOrder("UpdateNetworkBB_Start", "SDNCChangeAssignNetwork", + "CallActivity_sdncHandlerCallChangeAssign", "QueryVpnBindingAAI", "QueryNetworkPolicyAAI", + "QueryNetworkTableRefAAI", "Create_Network_ServiceTask", "CallActivity_NetworkAdapterRestV1", + "ServiceTask_ProcessResponse", "Update_Network_AAI_ServiceTask", "UpdateNetworkBB_End"); + assertThat(processInstance).isEnded(); } - @Test - public void updateNetworkBBExceptionTest() throws Exception { - mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiQueryTasks).queryNetworkVpnBinding(any(BuildingBlockExecution.class)); - - ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("UpdateNetworkBB", variables); - assertThat(processInstance).isStarted().hasPassedInOrder( - "UpdateNetworkBB_Start", "SDNCChangeAssignNetwork", "CallActivity_sdncHandlerCallChangeAssign", - "QueryVpnBindingAAI") - .hasNotPassed("QueryNetworkPolicyAAI", "QueryNetworkTableRefAAI", - "UpdateNetworkAdapter", "UpdateNetworkAAI", "UpdateNetworkBB_End"); - assertThat(processInstance).isEnded(); - } + @Test + public void updateNetworkBBExceptionTest() throws Exception { + mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiQueryTasks) + .queryNetworkVpnBinding(any(BuildingBlockExecution.class)); + + ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("UpdateNetworkBB", variables); + assertThat(processInstance).isStarted() + .hasPassedInOrder("UpdateNetworkBB_Start", "SDNCChangeAssignNetwork", + "CallActivity_sdncHandlerCallChangeAssign", "QueryVpnBindingAAI") + .hasNotPassed("QueryNetworkPolicyAAI", "QueryNetworkTableRefAAI", "UpdateNetworkAdapter", + "UpdateNetworkAAI", "UpdateNetworkBB_End"); + assertThat(processInstance).isEnded(); + } } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckClosedLoopDisabledFlagActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckClosedLoopDisabledFlagActivityTest.java index ac4499bf89..55d21471fc 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckClosedLoopDisabledFlagActivityTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckClosedLoopDisabledFlagActivityTest.java @@ -19,37 +19,39 @@ */ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; import static org.mockito.Matchers.any; import static org.mockito.Mockito.doThrow; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Test; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.BaseBPMNTest; -public class VNFCheckClosedLoopDisabledFlagActivityTest extends BaseBPMNTest{ - @Test - public void sunnyDayVNFCheckClosedLoopDisabledFlagActivity_Test() throws InterruptedException { - ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFCheckClosedLoopDisabledFlagActivity", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("VNFCheckClosedLoopDisabledFlagActivity_Start", - "TaskCheckClosedLoopDisabledFlagActivity", - "VNFCheckClosedLoopDisabledFlagActivity_End"); - assertThat(pi).isEnded(); - } - - @Test - public void rainyDayVNFCheckClosedLoopDisabledFlagActivity_Test() throws Exception { - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiFlagTasks) - .checkVnfClosedLoopDisabledFlag(any(BuildingBlockExecution.class)); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFCheckClosedLoopDisabledFlagActivity", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("VNFCheckClosedLoopDisabledFlagActivity_Start", - "TaskCheckClosedLoopDisabledFlagActivity").hasNotPassed( - "VNFCheckClosedLoopDisabledFlagActivity_End"); - assertThat(pi).isEnded(); - } - +public class VNFCheckClosedLoopDisabledFlagActivityTest extends BaseBPMNTest { + @Test + public void sunnyDayVNFCheckClosedLoopDisabledFlagActivity_Test() throws InterruptedException { + ProcessInstance pi = + runtimeService.startProcessInstanceByKey("VNFCheckClosedLoopDisabledFlagActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFCheckClosedLoopDisabledFlagActivity_Start", + "TaskCheckClosedLoopDisabledFlagActivity", "VNFCheckClosedLoopDisabledFlagActivity_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayVNFCheckClosedLoopDisabledFlagActivity_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiFlagTasks) + .checkVnfClosedLoopDisabledFlag(any(BuildingBlockExecution.class)); + ProcessInstance pi = + runtimeService.startProcessInstanceByKey("VNFCheckClosedLoopDisabledFlagActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted() + .hasPassedInOrder("VNFCheckClosedLoopDisabledFlagActivity_Start", + "TaskCheckClosedLoopDisabledFlagActivity") + .hasNotPassed("VNFCheckClosedLoopDisabledFlagActivity_End"); + assertThat(pi).isEnded(); + } + } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckInMaintFlagActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckInMaintFlagActivityTest.java index 050d3124f6..6f66df6c0d 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckInMaintFlagActivityTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckInMaintFlagActivityTest.java @@ -19,10 +19,10 @@ */ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; import static org.mockito.Matchers.any; import static org.mockito.Mockito.doThrow; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Test; @@ -30,27 +30,25 @@ import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.BaseBPMNTest; -public class VNFCheckInMaintFlagActivityTest extends BaseBPMNTest{ - @Test - public void sunnyDayVNFCheckInMaintFlagActivity_Test() throws InterruptedException { - ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFCheckInMaintFlagActivity", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("VNFCheckInMaintFlagActivity_Start", - "TaskCheckInMaintFlag", - "VNFCheckInMaintFlagActivity_End"); - assertThat(pi).isEnded(); - } - - @Test - public void rainyDayVNFCheckInMaintFlagActivity_Test() throws Exception { - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiFlagTasks) - .checkVnfInMaintFlag(any(BuildingBlockExecution.class)); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFCheckInMaintFlagActivity", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("VNFCheckInMaintFlagActivity_Start", - "TaskCheckInMaintFlag").hasNotPassed( - "VNFCheckInMaintFlagActivity_End"); - assertThat(pi).isEnded(); - } - +public class VNFCheckInMaintFlagActivityTest extends BaseBPMNTest { + @Test + public void sunnyDayVNFCheckInMaintFlagActivity_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFCheckInMaintFlagActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFCheckInMaintFlagActivity_Start", "TaskCheckInMaintFlag", + "VNFCheckInMaintFlagActivity_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayVNFCheckInMaintFlagActivity_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiFlagTasks) + .checkVnfInMaintFlag(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFCheckInMaintFlagActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFCheckInMaintFlagActivity_Start", "TaskCheckInMaintFlag") + .hasNotPassed("VNFCheckInMaintFlagActivity_End"); + assertThat(pi).isEnded(); + } + } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckPserversLockedFlagActivity.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckPserversLockedFlagActivity.java index e43f47fa6a..8bfe6c020f 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckPserversLockedFlagActivity.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckPserversLockedFlagActivity.java @@ -19,37 +19,36 @@ */ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; import static org.mockito.Matchers.any; import static org.mockito.Mockito.doThrow; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Test; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.BaseBPMNTest; -public class VNFCheckPserversLockedFlagActivity extends BaseBPMNTest{ - @Test - public void sunnyDayVNFCheckInMaintFlagActivity_Test() throws InterruptedException { - ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFCheckPserversLockedFlagActivity", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("VNFCheckPserversLockedFlagActivity_Start", - "TaskCheckPserversLockedFlagActivity", - "VNFCheckPserversLockedFlagActivity_End"); - assertThat(pi).isEnded(); - } - - @Test - public void rainyDayVNFCheckPserversLockedFlagActivity_Test() throws Exception { - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiFlagTasks) - .checkVnfPserversLockedFlag(any(BuildingBlockExecution.class)); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFCheckPserversLockedFlagActivity", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("VNFCheckPserversLockedFlagActivity_Start", - "TaskCheckPserversLockedFlagActivity").hasNotPassed( - "VNFCheckPserversLockedFlagActivity_End"); - assertThat(pi).isEnded(); - } - +public class VNFCheckPserversLockedFlagActivity extends BaseBPMNTest { + @Test + public void sunnyDayVNFCheckInMaintFlagActivity_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFCheckPserversLockedFlagActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFCheckPserversLockedFlagActivity_Start", + "TaskCheckPserversLockedFlagActivity", "VNFCheckPserversLockedFlagActivity_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayVNFCheckPserversLockedFlagActivity_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiFlagTasks) + .checkVnfPserversLockedFlag(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFCheckPserversLockedFlagActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted() + .hasPassedInOrder("VNFCheckPserversLockedFlagActivity_Start", "TaskCheckPserversLockedFlagActivity") + .hasNotPassed("VNFCheckPserversLockedFlagActivity_End"); + assertThat(pi).isEnded(); + } + } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFHealthCheckActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFHealthCheckActivityTest.java index 8e76f8f4d1..0b17e3e099 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFHealthCheckActivityTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFHealthCheckActivityTest.java @@ -19,10 +19,10 @@ */ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Test; @@ -30,28 +30,25 @@ import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.BaseBPMNTest; import org.onap.appc.client.lcm.model.Action; -public class VNFHealthCheckActivityTest extends BaseBPMNTest{ - @Test - public void sunnyDayVNFHealthCheckActivity_Test() throws InterruptedException { - ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFHealthCheckActivity", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("VNFHealthCheckActivity_Start", - "TaskPreProcessActivity", - "TaskHealthCheck", - "VNFHealthCheckActivity_End"); - assertThat(pi).isEnded(); - } - - @Test - public void rainyDayVNFHealthCheckActivity_Test() throws Exception { - variables.put("actionHealthCheck", Action.HealthCheck); - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks) - .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class)); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFHealthCheckActivity", variables); - assertThat(pi).isNotNull().isStarted().hasPassedInOrder("VNFHealthCheckActivity_Start", - "TaskPreProcessActivity", - "TaskHealthCheck").hasNotPassed( - "VNFHealthCheckActivity_End"); - } - +public class VNFHealthCheckActivityTest extends BaseBPMNTest { + @Test + public void sunnyDayVNFHealthCheckActivity_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFHealthCheckActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFHealthCheckActivity_Start", "TaskPreProcessActivity", + "TaskHealthCheck", "VNFHealthCheckActivity_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayVNFHealthCheckActivity_Test() throws Exception { + variables.put("actionHealthCheck", Action.HealthCheck); + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks) + .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFHealthCheckActivity", variables); + assertThat(pi).isNotNull().isStarted() + .hasPassedInOrder("VNFHealthCheckActivity_Start", "TaskPreProcessActivity", "TaskHealthCheck") + .hasNotPassed("VNFHealthCheckActivity_End"); + } + } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFLockActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFLockActivityTest.java index f36a72fc01..45cf44848f 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFLockActivityTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFLockActivityTest.java @@ -19,10 +19,10 @@ */ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Test; @@ -30,28 +30,25 @@ import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.BaseBPMNTest; import org.onap.appc.client.lcm.model.Action; -public class VNFLockActivityTest extends BaseBPMNTest{ - @Test - public void sunnyDayVNFLockActivity_Test() throws InterruptedException { - ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFLockActivity", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("VNFLockActivity_Start", - "TaskPreProcessActivity", - "TaskLock", - "VNFLockActivity_End"); - assertThat(pi).isEnded(); - } - - @Test - public void rainyDayVNFLockActivity_Test() throws Exception { - variables.put("actionLock", Action.Lock); - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks) - .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class)); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFLockActivity", variables); - assertThat(pi).isNotNull().isStarted().hasPassedInOrder("VNFLockActivity_Start", - "TaskPreProcessActivity", - "TaskLock").hasNotPassed( - "VNFLockActivity_End"); - } - +public class VNFLockActivityTest extends BaseBPMNTest { + @Test + public void sunnyDayVNFLockActivity_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFLockActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFLockActivity_Start", "TaskPreProcessActivity", "TaskLock", + "VNFLockActivity_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayVNFLockActivity_Test() throws Exception { + variables.put("actionLock", Action.Lock); + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks) + .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFLockActivity", variables); + assertThat(pi).isNotNull().isStarted() + .hasPassedInOrder("VNFLockActivity_Start", "TaskPreProcessActivity", "TaskLock") + .hasNotPassed("VNFLockActivity_End"); + } + } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFQuiesceTrafficActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFQuiesceTrafficActivityTest.java index 2d9b952509..fb462bc02f 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFQuiesceTrafficActivityTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFQuiesceTrafficActivityTest.java @@ -19,10 +19,10 @@ */ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Test; @@ -30,28 +30,25 @@ import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.BaseBPMNTest; import org.onap.appc.client.lcm.model.Action; -public class VNFQuiesceTrafficActivityTest extends BaseBPMNTest{ - @Test - public void sunnyDayVNFQuiesceTrafficActivity_Test() throws InterruptedException { - ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFQuiesceTrafficActivity", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("VNFQuiesceTrafficActivity_Start", - "TaskPreProcessActivity", - "TaskQuiesceTraffic", - "VNFQuiesceTrafficActivity_End"); - assertThat(pi).isEnded(); - } - - @Test - public void rainyDayVNFQuiesceTrafficActivity_Test() throws Exception { - variables.put("actionQuiesceTraffic", Action.QuiesceTraffic); - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks) - .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class)); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFQuiesceTrafficActivity", variables); - assertThat(pi).isNotNull().isStarted().hasPassedInOrder("VNFQuiesceTrafficActivity_Start", - "TaskPreProcessActivity", - "TaskQuiesceTraffic").hasNotPassed( - "VNFQuiesceTrafficActivity_End"); - } - +public class VNFQuiesceTrafficActivityTest extends BaseBPMNTest { + @Test + public void sunnyDayVNFQuiesceTrafficActivity_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFQuiesceTrafficActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFQuiesceTrafficActivity_Start", "TaskPreProcessActivity", + "TaskQuiesceTraffic", "VNFQuiesceTrafficActivity_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayVNFQuiesceTrafficActivity_Test() throws Exception { + variables.put("actionQuiesceTraffic", Action.QuiesceTraffic); + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks) + .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFQuiesceTrafficActivity", variables); + assertThat(pi).isNotNull().isStarted() + .hasPassedInOrder("VNFQuiesceTrafficActivity_Start", "TaskPreProcessActivity", "TaskQuiesceTraffic") + .hasNotPassed("VNFQuiesceTrafficActivity_End"); + } + } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFResumeTrafficActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFResumeTrafficActivityTest.java index d541cdf834..61d88a5770 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFResumeTrafficActivityTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFResumeTrafficActivityTest.java @@ -19,10 +19,10 @@ */ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Test; @@ -30,29 +30,26 @@ import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.BaseBPMNTest; import org.onap.appc.client.lcm.model.Action; -public class VNFResumeTrafficActivityTest extends BaseBPMNTest{ - @Test - public void sunnyDayVNFResumeTrafficActivity_Test() throws InterruptedException { - ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFResumeTrafficActivity", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("VNFResumeTrafficActivity_Start", - "TaskPreProcessActivity", - "TaskResumeTraffic", - "VNFResumeTrafficActivity_End"); - assertThat(pi).isEnded(); - } - - @Test - public void rainyDayVNFResumeTrafficActivity_Test() throws Exception { - variables.put("actionResumeTraffic", Action.ResumeTraffic); - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks) - .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class)); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFResumeTrafficActivity", variables); - assertThat(pi).isNotNull().isStarted().hasPassedInOrder("VNFResumeTrafficActivity_Start", - "TaskPreProcessActivity", - "TaskResumeTraffic").hasNotPassed( - "VNFResumeTrafficActivity_End"); - - } - +public class VNFResumeTrafficActivityTest extends BaseBPMNTest { + @Test + public void sunnyDayVNFResumeTrafficActivity_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFResumeTrafficActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFResumeTrafficActivity_Start", "TaskPreProcessActivity", + "TaskResumeTraffic", "VNFResumeTrafficActivity_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayVNFResumeTrafficActivity_Test() throws Exception { + variables.put("actionResumeTraffic", Action.ResumeTraffic); + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks) + .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFResumeTrafficActivity", variables); + assertThat(pi).isNotNull().isStarted() + .hasPassedInOrder("VNFResumeTrafficActivity_Start", "TaskPreProcessActivity", "TaskResumeTraffic") + .hasNotPassed("VNFResumeTrafficActivity_End"); + + } + } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFSetClosedLoopDisabledFlagActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFSetClosedLoopDisabledFlagActivityTest.java index 8e56051f47..001dc70b54 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFSetClosedLoopDisabledFlagActivityTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFSetClosedLoopDisabledFlagActivityTest.java @@ -19,37 +19,38 @@ */ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat; import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; import static org.mockito.Matchers.any; import static org.mockito.Mockito.doThrow; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Test; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.BaseBPMNTest; -public class VNFSetClosedLoopDisabledFlagActivityTest extends BaseBPMNTest{ - @Test - public void sunnyDayVNFSetClosedLoopDisabledFlagActivity_Test() throws InterruptedException { - ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFSetClosedLoopDisabledFlagActivity", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("VNFSetClosedLoopDisabledFlagActivity_Start", - "TaskSetClosedLoopDisabledFlagActivity", - "VNFSetClosedLoopDisabledFlagActivity_End"); - assertThat(pi).isEnded(); - } - - @Test - public void rainyDayVNFSetClosedLoopDisabledFlagActivity_Test() throws Exception { - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiFlagTasks) - .modifyVnfClosedLoopDisabledFlag(any(BuildingBlockExecution.class), any(boolean.class)); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFSetClosedLoopDisabledFlagActivity", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("VNFSetClosedLoopDisabledFlagActivity_Start", - "TaskSetClosedLoopDisabledFlagActivity").hasNotPassed( - "VNFSetInMaintFlagActivity_End"); - assertThat(pi).isEnded(); - } +public class VNFSetClosedLoopDisabledFlagActivityTest extends BaseBPMNTest { + @Test + public void sunnyDayVNFSetClosedLoopDisabledFlagActivity_Test() throws InterruptedException { + ProcessInstance pi = + runtimeService.startProcessInstanceByKey("VNFSetClosedLoopDisabledFlagActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFSetClosedLoopDisabledFlagActivity_Start", + "TaskSetClosedLoopDisabledFlagActivity", "VNFSetClosedLoopDisabledFlagActivity_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayVNFSetClosedLoopDisabledFlagActivity_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiFlagTasks) + .modifyVnfClosedLoopDisabledFlag(any(BuildingBlockExecution.class), any(boolean.class)); + ProcessInstance pi = + runtimeService.startProcessInstanceByKey("VNFSetClosedLoopDisabledFlagActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted() + .hasPassedInOrder("VNFSetClosedLoopDisabledFlagActivity_Start", "TaskSetClosedLoopDisabledFlagActivity") + .hasNotPassed("VNFSetInMaintFlagActivity_End"); + assertThat(pi).isEnded(); + } } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFSetInMaintFlagActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFSetInMaintFlagActivityTest.java index 2dc6420688..1df0ea2e65 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFSetInMaintFlagActivityTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFSetInMaintFlagActivityTest.java @@ -19,37 +19,35 @@ */ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Test; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.BaseBPMNTest; -public class VNFSetInMaintFlagActivityTest extends BaseBPMNTest{ - @Test - public void sunnyDayVNFSetInMaintFlagActivity_Test() throws InterruptedException { - ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFSetInMaintFlagActivity", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("VNFSetInMaintFlagActivity_Start", - "TaskSetInMaint", - "VNFSetInMaintFlagActivity_End"); - assertThat(pi).isEnded(); - } - - @Test - public void rainyDayVNFSetInMaintFlagActivity_Test() throws Exception { - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiFlagTasks) - .modifyVnfInMaintFlag(any(BuildingBlockExecution.class), any(boolean.class)); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFSetInMaintFlagActivity", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("VNFSetInMaintFlagActivity_Start", - "TaskSetInMaint").hasNotPassed( - "VNFSetInMaintFlagActivity_End"); - assertThat(pi).isEnded(); - } - +public class VNFSetInMaintFlagActivityTest extends BaseBPMNTest { + @Test + public void sunnyDayVNFSetInMaintFlagActivity_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFSetInMaintFlagActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFSetInMaintFlagActivity_Start", "TaskSetInMaint", + "VNFSetInMaintFlagActivity_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayVNFSetInMaintFlagActivity_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiFlagTasks) + .modifyVnfInMaintFlag(any(BuildingBlockExecution.class), any(boolean.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFSetInMaintFlagActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFSetInMaintFlagActivity_Start", "TaskSetInMaint") + .hasNotPassed("VNFSetInMaintFlagActivity_End"); + assertThat(pi).isEnded(); + } + } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFSnapShotActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFSnapShotActivityTest.java index f6bfd04d03..6f1e076c02 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFSnapShotActivityTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFSnapShotActivityTest.java @@ -19,10 +19,10 @@ */ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Test; @@ -30,28 +30,25 @@ import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.BaseBPMNTest; import org.onap.appc.client.lcm.model.Action; -public class VNFSnapShotActivityTest extends BaseBPMNTest{ - @Test - public void sunnyDayVNFSnapShotActivity_Test() throws InterruptedException { - ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFSnapShotActivity", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("VNFSnapShotActivity_Start", - "TaskPreProcessActivity", - "TaskSnapShot", - "VNFSnapShotActivity_End"); - assertThat(pi).isEnded(); - } - - @Test - public void rainyDayVNFSnapShotActivity_Test() throws Exception { - variables.put("actionSnapshot", Action.Snapshot); - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks) - .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class)); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFSnapShotActivity", variables); - assertThat(pi).isNotNull().isStarted().hasPassedInOrder("VNFSnapShotActivity_Start", - "TaskPreProcessActivity", - "TaskSnapShot").hasNotPassed( - "VNFSnapShotActivity_End"); - } - +public class VNFSnapShotActivityTest extends BaseBPMNTest { + @Test + public void sunnyDayVNFSnapShotActivity_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFSnapShotActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFSnapShotActivity_Start", "TaskPreProcessActivity", + "TaskSnapShot", "VNFSnapShotActivity_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayVNFSnapShotActivity_Test() throws Exception { + variables.put("actionSnapshot", Action.Snapshot); + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks) + .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFSnapShotActivity", variables); + assertThat(pi).isNotNull().isStarted() + .hasPassedInOrder("VNFSnapShotActivity_Start", "TaskPreProcessActivity", "TaskSnapShot") + .hasNotPassed("VNFSnapShotActivity_End"); + } + } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFStartActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFStartActivityTest.java index 6e4be69a91..a8e974d63a 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFStartActivityTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFStartActivityTest.java @@ -19,10 +19,10 @@ */ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Test; @@ -30,28 +30,25 @@ import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.BaseBPMNTest; import org.onap.appc.client.lcm.model.Action; -public class VNFStartActivityTest extends BaseBPMNTest{ - @Test - public void sunnyDayVNFStartActivity_Test() throws InterruptedException { - ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFStartActivity", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("VNFStartActivity_Start", - "TaskPreProcessActivity", - "TaskStart", - "VNFStartActivity_End"); - assertThat(pi).isEnded(); - } - - @Test - public void rainyDayVNFStartActivity_Test() throws Exception { - variables.put("actionStart", Action.Start); - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks) - .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class)); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFStartActivity", variables); - assertThat(pi).isNotNull().isStarted().hasPassedInOrder("VNFStartActivity_Start", - "TaskPreProcessActivity", - "TaskStart").hasNotPassed( - "VNFStartActivity_End"); - } - +public class VNFStartActivityTest extends BaseBPMNTest { + @Test + public void sunnyDayVNFStartActivity_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFStartActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFStartActivity_Start", "TaskPreProcessActivity", "TaskStart", + "VNFStartActivity_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayVNFStartActivity_Test() throws Exception { + variables.put("actionStart", Action.Start); + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks) + .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFStartActivity", variables); + assertThat(pi).isNotNull().isStarted() + .hasPassedInOrder("VNFStartActivity_Start", "TaskPreProcessActivity", "TaskStart") + .hasNotPassed("VNFStartActivity_End"); + } + } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFStopActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFStopActivityTest.java index 3bc5940493..58dfff8bd7 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFStopActivityTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFStopActivityTest.java @@ -19,10 +19,10 @@ */ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Test; @@ -30,28 +30,25 @@ import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.BaseBPMNTest; import org.onap.appc.client.lcm.model.Action; -public class VNFStopActivityTest extends BaseBPMNTest{ - @Test - public void sunnyDayVNFStopActivity_Test() throws InterruptedException { - ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFStopActivity", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("VNFStopActivity_Start", - "TaskPreProcessActivity", - "TaskStop", - "VNFStopActivity_End"); - assertThat(pi).isEnded(); - } - - @Test - public void rainyDayVNFStopActivity_Test() throws Exception { - variables.put("actionStop", Action.Stop); - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks) - .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class)); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFStopActivity", variables); - assertThat(pi).isNotNull().isStarted().hasPassedInOrder("VNFStopActivity_Start", - "TaskPreProcessActivity", - "TaskStop").hasNotPassed( - "VNFStopActivity_End"); - } - +public class VNFStopActivityTest extends BaseBPMNTest { + @Test + public void sunnyDayVNFStopActivity_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFStopActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFStopActivity_Start", "TaskPreProcessActivity", "TaskStop", + "VNFStopActivity_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayVNFStopActivity_Test() throws Exception { + variables.put("actionStop", Action.Stop); + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks) + .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFStopActivity", variables); + assertThat(pi).isNotNull().isStarted() + .hasPassedInOrder("VNFStopActivity_Start", "TaskPreProcessActivity", "TaskStop") + .hasNotPassed("VNFStopActivity_End"); + } + } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnlockActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnlockActivityTest.java index d0db70b2aa..b6faf1b806 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnlockActivityTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnlockActivityTest.java @@ -19,10 +19,10 @@ */ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Test; @@ -30,28 +30,25 @@ import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.BaseBPMNTest; import org.onap.appc.client.lcm.model.Action; -public class VNFUnlockActivityTest extends BaseBPMNTest{ - @Test - public void sunnyDayVNFUnlockActivity_Test() throws InterruptedException { - ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUnlockActivity", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("VNFUnlockActivity_Start", - "TaskPreProcessActivity", - "TaskUnlock", - "VNFUnlockActivity_End"); - assertThat(pi).isEnded(); - } - - @Test - public void rainyDayVNFUnlockActivity_Test() throws Exception { - variables.put("actionUnlock", Action.Unlock); - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks) - .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class)); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUnlockActivity", variables); - assertThat(pi).isNotNull().isStarted().hasPassedInOrder("VNFUnlockActivity_Start", - "TaskPreProcessActivity", - "TaskUnlock").hasNotPassed( - "VNFUnlockActivity_End"); - } - +public class VNFUnlockActivityTest extends BaseBPMNTest { + @Test + public void sunnyDayVNFUnlockActivity_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUnlockActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFUnlockActivity_Start", "TaskPreProcessActivity", "TaskUnlock", + "VNFUnlockActivity_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayVNFUnlockActivity_Test() throws Exception { + variables.put("actionUnlock", Action.Unlock); + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks) + .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUnlockActivity", variables); + assertThat(pi).isNotNull().isStarted() + .hasPassedInOrder("VNFUnlockActivity_Start", "TaskPreProcessActivity", "TaskUnlock") + .hasNotPassed("VNFUnlockActivity_End"); + } + } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnsetClosedLoopDisabledFlagActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnsetClosedLoopDisabledFlagActivityTest.java index 4c9b33c2c7..035d124402 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnsetClosedLoopDisabledFlagActivityTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnsetClosedLoopDisabledFlagActivityTest.java @@ -19,36 +19,38 @@ */ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; import static org.mockito.Matchers.any; import static org.mockito.Mockito.doThrow; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Test; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.BaseBPMNTest; -public class VNFUnsetClosedLoopDisabledFlagActivityTest extends BaseBPMNTest{ - @Test - public void sunnyDayVNFUnsetClosedLoopDisabledFlagActivity_Test() throws InterruptedException { - ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUnsetInClosedLoopDisabledFlagActivity", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("VNFUnsetClosedLoopDisabledFlagActivity_Start", - "TaskVNFUnsetClosedLoopDisabledFlagActivity", - "VNFUnsetClosedLoopDisabledFlagActivity_End"); - assertThat(pi).isEnded(); - } - - @Test - public void rainyDayVNFUnsetClosedLoopFlag_Test() throws Exception { - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiFlagTasks) - .modifyVnfClosedLoopDisabledFlag(any(BuildingBlockExecution.class), any(boolean.class)); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUnsetInClosedLoopDisabledFlagActivity", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("VNFUnsetClosedLoopDisabledFlagActivity_Start", - "TaskVNFUnsetClosedLoopDisabledFlagActivity").hasNotPassed( - "VNFUnsetClosedLoopDisabledFlagActivity_End"); - assertThat(pi).isEnded(); - } +public class VNFUnsetClosedLoopDisabledFlagActivityTest extends BaseBPMNTest { + @Test + public void sunnyDayVNFUnsetClosedLoopDisabledFlagActivity_Test() throws InterruptedException { + ProcessInstance pi = + runtimeService.startProcessInstanceByKey("VNFUnsetInClosedLoopDisabledFlagActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFUnsetClosedLoopDisabledFlagActivity_Start", + "TaskVNFUnsetClosedLoopDisabledFlagActivity", "VNFUnsetClosedLoopDisabledFlagActivity_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayVNFUnsetClosedLoopFlag_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiFlagTasks) + .modifyVnfClosedLoopDisabledFlag(any(BuildingBlockExecution.class), any(boolean.class)); + ProcessInstance pi = + runtimeService.startProcessInstanceByKey("VNFUnsetInClosedLoopDisabledFlagActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted() + .hasPassedInOrder("VNFUnsetClosedLoopDisabledFlagActivity_Start", + "TaskVNFUnsetClosedLoopDisabledFlagActivity") + .hasNotPassed("VNFUnsetClosedLoopDisabledFlagActivity_End"); + assertThat(pi).isEnded(); + } } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnsetInMaintFlagActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnsetInMaintFlagActivityTest.java index fcb328fa0b..15623bab3d 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnsetInMaintFlagActivityTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnsetInMaintFlagActivityTest.java @@ -19,37 +19,35 @@ */ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Test; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.BaseBPMNTest; -public class VNFUnsetInMaintFlagActivityTest extends BaseBPMNTest{ - @Test - public void sunnyDayVNFUnsetInMaintFlagActivity_Test() throws InterruptedException { - ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUnsetInMaintFlagActivity", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("VNFUnsetInMaintFlagActivity_Start", - "TaskUnsetInMaint", - "VNFUnsetInMaintFlagActivity_End"); - assertThat(pi).isEnded(); - } - - @Test - public void rainyDayVNFUnsetInMaintFlag_Test() throws Exception { - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiFlagTasks) - .modifyVnfInMaintFlag(any(BuildingBlockExecution.class), any(boolean.class)); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUnsetInMaintFlagActivity", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("VNFUnsetInMaintFlagActivity_Start", - "TaskUnsetInMaint").hasNotPassed( - "VNFUnsetInMaintFlagActivity_End"); - assertThat(pi).isEnded(); - } - +public class VNFUnsetInMaintFlagActivityTest extends BaseBPMNTest { + @Test + public void sunnyDayVNFUnsetInMaintFlagActivity_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUnsetInMaintFlagActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFUnsetInMaintFlagActivity_Start", "TaskUnsetInMaint", + "VNFUnsetInMaintFlagActivity_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayVNFUnsetInMaintFlag_Test() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiFlagTasks) + .modifyVnfInMaintFlag(any(BuildingBlockExecution.class), any(boolean.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUnsetInMaintFlagActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFUnsetInMaintFlagActivity_Start", "TaskUnsetInMaint") + .hasNotPassed("VNFUnsetInMaintFlagActivity_End"); + assertThat(pi).isEnded(); + } + } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradeBackupActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradeBackupActivityTest.java index c68196c3bf..4d99147761 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradeBackupActivityTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradeBackupActivityTest.java @@ -23,7 +23,6 @@ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Test; @@ -31,30 +30,27 @@ import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.BaseBPMNTest; import org.onap.appc.client.lcm.model.Action; -public class VNFUpgradeBackupActivityTest extends BaseBPMNTest{ - @Test - public void sunnyDayVNFUpgradeBackupActivity_Test() throws InterruptedException { - ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUpgradeBackupActivity", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("VNFUpgradeBackupActivity_Start", - "TaskPreProcessActivity", - "TaskUpgradeBackup", - "VNFUpgradeBackupActivity_End"); - assertThat(pi).isEnded(); - } - - @Test - public void rainyDayVNFUpgradeBackupActivity_Test() throws Exception { - variables.put("actionUpgradeBackup", Action.UpgradeBackup); - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks) - .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class)); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUpgradeBackupActivity", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("VNFUpgradeBackupActivity_Start", - "TaskPreProcessActivity", - "TaskUpgradeBackup").hasNotPassed( - "VNFUpgradeBackupActivity_End"); - assertThat(pi).isEnded(); - } - +public class VNFUpgradeBackupActivityTest extends BaseBPMNTest { + @Test + public void sunnyDayVNFUpgradeBackupActivity_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUpgradeBackupActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFUpgradeBackupActivity_Start", "TaskPreProcessActivity", + "TaskUpgradeBackup", "VNFUpgradeBackupActivity_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayVNFUpgradeBackupActivity_Test() throws Exception { + variables.put("actionUpgradeBackup", Action.UpgradeBackup); + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks) + .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUpgradeBackupActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted() + .hasPassedInOrder("VNFUpgradeBackupActivity_Start", "TaskPreProcessActivity", "TaskUpgradeBackup") + .hasNotPassed("VNFUpgradeBackupActivity_End"); + assertThat(pi).isEnded(); + } + } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradePostCheckActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradePostCheckActivityTest.java index 5fa930712d..c87cc44f29 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradePostCheckActivityTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradePostCheckActivityTest.java @@ -19,10 +19,10 @@ */ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Test; @@ -30,28 +30,25 @@ import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.BaseBPMNTest; import org.onap.appc.client.lcm.model.Action; -public class VNFUpgradePostCheckActivityTest extends BaseBPMNTest{ - @Test - public void sunnyDayVNFUpgradePostCheckActivity_Test() throws InterruptedException { - ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUpgradePostCheckActivity", variables); - assertThat(pi).isNotNull().isStarted().hasPassedInOrder("VNFUpgradePostCheckActivity_Start", - "TaskPreProcessActivity", - "TaskUpgradePostCheck", - "VNFUpgradePostCheckActivity_End"); - - } - - @Test - public void rainyDayVNFUpgradePostCheckActivity_Test() throws Exception { - variables.put("actionUpgradePostCheck", Action.UpgradePostCheck); - - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks) - .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class)); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUpgradePostCheckActivity", variables); - assertThat(pi).isNotNull().isStarted().hasPassedInOrder("VNFUpgradePostCheckActivity_Start", - "TaskPreProcessActivity", - "TaskUpgradePostCheck").hasNotPassed( - "VNFUpgradePostCheckActivity_End"); - } - +public class VNFUpgradePostCheckActivityTest extends BaseBPMNTest { + @Test + public void sunnyDayVNFUpgradePostCheckActivity_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUpgradePostCheckActivity", variables); + assertThat(pi).isNotNull().isStarted().hasPassedInOrder("VNFUpgradePostCheckActivity_Start", + "TaskPreProcessActivity", "TaskUpgradePostCheck", "VNFUpgradePostCheckActivity_End"); + + } + + @Test + public void rainyDayVNFUpgradePostCheckActivity_Test() throws Exception { + variables.put("actionUpgradePostCheck", Action.UpgradePostCheck); + + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks) + .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUpgradePostCheckActivity", variables); + assertThat(pi).isNotNull().isStarted() + .hasPassedInOrder("VNFUpgradePostCheckActivity_Start", "TaskPreProcessActivity", "TaskUpgradePostCheck") + .hasNotPassed("VNFUpgradePostCheckActivity_End"); + } + } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradePreCheckActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradePreCheckActivityTest.java index 40f5df8dae..79fc43396d 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradePreCheckActivityTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradePreCheckActivityTest.java @@ -19,10 +19,10 @@ */ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Test; @@ -30,28 +30,25 @@ import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.BaseBPMNTest; import org.onap.appc.client.lcm.model.Action; -public class VNFUpgradePreCheckActivityTest extends BaseBPMNTest{ - @Test - public void sunnyDayVNFUpgradePreCheckActivity_Test() throws InterruptedException { - ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUpgradePreCheckActivity", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("VNFUpgradePreCheckActivity_Start", - "TaskPreProcessActivity", - "TaskUpgradePreCheck", - "VNFUpgradePreCheckActivity_End"); - assertThat(pi).isEnded(); - } - - @Test - public void rainyDayVNFUpgradePreCheckActivity_Test() throws Exception { - variables.put("actionUpgradePreCheck", Action.UpgradePreCheck); - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks) - .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class)); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUpgradePreCheckActivity", variables); - assertThat(pi).isNotNull().isStarted().hasPassedInOrder("VNFUpgradePreCheckActivity_Start", - "TaskPreProcessActivity", - "TaskUpgradePreCheck").hasNotPassed( - "VNFUpgradePreCheckActivity_End"); - } - +public class VNFUpgradePreCheckActivityTest extends BaseBPMNTest { + @Test + public void sunnyDayVNFUpgradePreCheckActivity_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUpgradePreCheckActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFUpgradePreCheckActivity_Start", "TaskPreProcessActivity", + "TaskUpgradePreCheck", "VNFUpgradePreCheckActivity_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayVNFUpgradePreCheckActivity_Test() throws Exception { + variables.put("actionUpgradePreCheck", Action.UpgradePreCheck); + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks) + .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUpgradePreCheckActivity", variables); + assertThat(pi).isNotNull().isStarted() + .hasPassedInOrder("VNFUpgradePreCheckActivity_Start", "TaskPreProcessActivity", "TaskUpgradePreCheck") + .hasNotPassed("VNFUpgradePreCheckActivity_End"); + } + } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradeSoftwareActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradeSoftwareActivityTest.java index 91e6bf40be..b550185702 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradeSoftwareActivityTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUpgradeSoftwareActivityTest.java @@ -19,10 +19,10 @@ */ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Test; @@ -30,28 +30,25 @@ import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.BaseBPMNTest; import org.onap.appc.client.lcm.model.Action; -public class VNFUpgradeSoftwareActivityTest extends BaseBPMNTest{ - @Test - public void sunnyDayVNFUpgradeSoftwareActivity_Test() throws InterruptedException { - ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUpgradeSoftwareActivity", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("VNFUpgradeSoftwareActivity_Start", - "TaskPreProcessActivity", - "TaskUpgradeSoftware", - "VNFUpgradeSoftwareActivity_End"); - assertThat(pi).isEnded(); - } - - @Test - public void rainyDayVNFUpgradeSoftwareActivity_Test() throws Exception { - variables.put("actionUpgradeSoftware", Action.UpgradeSoftware); - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks) - .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class)); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUpgradeSoftwareActivity", variables); - assertThat(pi).isNotNull().isStarted().hasPassedInOrder("VNFUpgradeSoftwareActivity_Start", - "TaskPreProcessActivity", - "TaskUpgradeSoftware").hasNotPassed( - "VNFUpgradeSoftwareActivity_End"); - } - +public class VNFUpgradeSoftwareActivityTest extends BaseBPMNTest { + @Test + public void sunnyDayVNFUpgradeSoftwareActivity_Test() throws InterruptedException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUpgradeSoftwareActivity", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("VNFUpgradeSoftwareActivity_Start", "TaskPreProcessActivity", + "TaskUpgradeSoftware", "VNFUpgradeSoftwareActivity_End"); + assertThat(pi).isEnded(); + } + + @Test + public void rainyDayVNFUpgradeSoftwareActivity_Test() throws Exception { + variables.put("actionUpgradeSoftware", Action.UpgradeSoftware); + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(appcRunTasks) + .runAppcCommand(any(BuildingBlockExecution.class), any(Action.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUpgradeSoftwareActivity", variables); + assertThat(pi).isNotNull().isStarted() + .hasPassedInOrder("VNFUpgradeSoftwareActivity_Start", "TaskPreProcessActivity", "TaskUpgradeSoftware") + .hasNotPassed("VNFUpgradeSoftwareActivity_End"); + } + } diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VnfAdapterTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VnfAdapterTest.java index 39625ac9bf..8ad4e0f07f 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VnfAdapterTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VnfAdapterTest.java @@ -18,10 +18,10 @@ * ============LICENSE_END========================================================= */ package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Test; @@ -32,19 +32,22 @@ import org.onap.so.bpmn.common.BuildingBlockExecution; public class VnfAdapterTest extends BaseBPMNTest { @Test public void vnfAdapterCreatedTest() { - mockSubprocess("vnfAdapterRestV1", "Mocked vnfAdapterRestV1", "GenericStub"); + mockSubprocess("vnfAdapterRestV1", "Mocked vnfAdapterRestV1", "GenericStub"); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("VnfAdapter", variables); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VnfAdapter", variables); assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("VnfAdapter_Start", "PreProcessRequest", "Call_vnfAdapterRestV1","PostProcessResponse", "VnfAdapter_End"); + assertThat(pi).isStarted().hasPassedInOrder("VnfAdapter_Start", "PreProcessRequest", "Call_vnfAdapterRestV1", + "PostProcessResponse", "VnfAdapter_End"); assertThat(pi).isEnded(); } - + @Test public void vnfAdapterErrorTest() { - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(vnfAdapterImpl).preProcessVnfAdapter(any(BuildingBlockExecution.class)); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("VnfAdapter", variables); + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(vnfAdapterImpl) + .preProcessVnfAdapter(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("VnfAdapter", variables); assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("VnfAdapter_Start", "PreProcessRequest").hasNotPassed("VnfAdapter_End"); + assertThat(pi).isStarted().hasPassedInOrder("VnfAdapter_Start", "PreProcessRequest") + .hasNotPassed("VnfAdapter_End"); } } |