diff options
author | Steve Smokowski <ss835w@att.com> | 2019-02-04 13:40:09 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-02-04 13:40:09 +0000 |
commit | 3f97da710ec3008a625e941609106f40db71b5e8 (patch) | |
tree | 9714f630dd08b019a77ed6f700e87b3f04b2d6e3 /bpmn/so-bpmn-building-blocks/src/test | |
parent | 2b3983621d6650ae767b5062a098b8343e5e3441 (diff) | |
parent | 4e63348e5b0c9b8df287ee6eba33b69ffd5f2516 (diff) |
Merge "compare resources from openstack to aai"
Diffstat (limited to 'bpmn/so-bpmn-building-blocks/src/test')
4 files changed, 40 insertions, 13 deletions
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 f501151ec9..79bade3cf3 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 @@ -23,7 +23,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; - +import org.camunda.bpm.engine.ExternalTaskService; import org.camunda.bpm.engine.RepositoryService; import org.camunda.bpm.engine.RuntimeService; import org.camunda.bpm.extension.mockito.mock.FluentJavaDelegateMock; @@ -50,6 +50,7 @@ import org.onap.so.bpmn.infrastructure.adapter.vnf.tasks.VnfAdapterCreateTasks; import org.onap.so.bpmn.infrastructure.adapter.vnf.tasks.VnfAdapterDeleteTasks; import org.onap.so.bpmn.infrastructure.adapter.vnf.tasks.VnfAdapterImpl; import org.onap.so.bpmn.infrastructure.appc.tasks.AppcRunTasks; +import org.onap.so.bpmn.infrastructure.audit.AuditTasks; import org.onap.so.bpmn.infrastructure.flowspecific.tasks.ActivateVfModule; import org.onap.so.bpmn.infrastructure.flowspecific.tasks.AssignNetwork; import org.onap.so.bpmn.infrastructure.flowspecific.tasks.AssignNetworkBBUtils; @@ -94,6 +95,9 @@ public abstract class BaseBPMNTest { protected RuntimeService runtimeService; @Autowired + protected ExternalTaskService externalTaskService; + + @Autowired private RepositoryService repositoryService; protected Map<String, Object> variables = new HashMap<>(); @@ -227,6 +231,9 @@ public abstract class BaseBPMNTest { @MockBean protected WorkflowActionBBFailure workflowActionBBFailure; + + @MockBean + protected AuditTasks auditTasks; @LocalServerPort protected int port; 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 1bce605076..9ffcd9d77a 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 @@ -21,9 +21,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; import org.junit.Before; import org.junit.Test; @@ -35,17 +39,25 @@ public class ActivateVfModuleBBTest extends BaseBPMNTest{ @Before public void before() { variables.put("vfModuleActivateTimerDuration", "PT2S"); + variables.put("auditInventoryNeeded", "true"); } @Test public void sunnyDay() throws InterruptedException, IOException { mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); ProcessInstance pi = runtimeService.startProcessInstanceByKey("ActivateVfModuleBB", variables); - while(runtimeService.createProcessInstanceQuery().processInstanceId(pi.getId()).singleResult() != null) { - Thread.sleep(1000); - } + List<LockedExternalTask> tasks = externalTaskService.fetchAndLock(100, "externalWorkerId") + .topic("InventoryAudit", 60L * 1000L).execute(); + while (!tasks.isEmpty()) { + for (LockedExternalTask task : tasks) { + externalTaskService.complete(task.getId(), "externalWorkerId"); + } + tasks = externalTaskService.fetchAndLock(100, "externalWorkerId") + .topic("InventoryAudit", 60L * 1000L).execute(); + } + assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("ActivateVfModuleBB_Start", "SetTimerDuration", "Timer", "ActivateVfModule", "CallActivity_sdncHandler", + assertThat(pi).isStarted().hasPassedInOrder("ActivateVfModuleBB_Start","ExclusiveGateway_1v8bmbu","Setup_AAI_Inventory_Audit", "Audit_AAI_Inventory", "ActivateVfModule", "CallActivity_sdncHandler", "UpdateVfModuleActiveStatus", "ActivateVfModuleBB_End"); assertThat(pi).isEnded(); } @@ -55,11 +67,18 @@ public class ActivateVfModuleBBTest extends BaseBPMNTest{ mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); doThrow(BpmnError.class).when(aaiUpdateTasks).updateOrchestrationStatusActivateVfModule(any(BuildingBlockExecution.class)); ProcessInstance pi = runtimeService.startProcessInstanceByKey("ActivateVfModuleBB", variables); - while(runtimeService.createProcessInstanceQuery().processInstanceId(pi.getId()).singleResult() != null) { - Thread.sleep(1000); - } + List<LockedExternalTask> tasks = externalTaskService.fetchAndLock(100, "externalWorkerId") + .topic("InventoryAudit", 60L * 1000L).execute(); + while (!tasks.isEmpty()) { + for (LockedExternalTask task : tasks) { + externalTaskService.complete(task.getId(), "externalWorkerId"); + } + tasks = externalTaskService.fetchAndLock(100, "externalWorkerId") + .topic("InventoryAudit", 60L * 1000L).execute(); + } + assertThat(pi).isNotNull().isStarted() - .hasPassedInOrder("ActivateVfModuleBB_Start", "SetTimerDuration", "Timer", "ActivateVfModule", "UpdateVfModuleActiveStatus") + .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/resources/application-test.yaml b/bpmn/so-bpmn-building-blocks/src/test/resources/application-test.yaml index 1090ab7be4..c36172c3bf 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/resources/application-test.yaml +++ b/bpmn/so-bpmn-building-blocks/src/test/resources/application-test.yaml @@ -31,6 +31,10 @@ log: vnfAdapterCreateV1: 'true' vnfAdapterRestV1: 'true' mso: + infra: + auditInventory: true + customer: + id: testCustIdInfra adapters: completemsoprocess: endpoint: http://localhost:28090/CompleteMsoProcess @@ -96,9 +100,6 @@ mso: healthcheck: log: debug: 'false' - infra: - customer: - id: testCustIdInfra logPath: logs msoKey: 07a7159d3bf51a0e53be7a8f89699be7 po: diff --git a/bpmn/so-bpmn-building-blocks/src/test/resources/logback-test.xml b/bpmn/so-bpmn-building-blocks/src/test/resources/logback-test.xml index 64b6bfc81b..d8f6ba3930 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/resources/logback-test.xml +++ b/bpmn/so-bpmn-building-blocks/src/test/resources/logback-test.xml @@ -26,5 +26,5 @@ </root> <logger name="wiremock.org" level="DEBUG" /> -<logger name="org.camunda" level="DEBUG" /> + </configuration>
\ No newline at end of file |