From eeaf0330f835b237812bbbf26ca5bba3c44f4671 Mon Sep 17 00:00:00 2001 From: "Kalkere Ramesh, Sharan (sk720x)" Date: Wed, 21 Oct 2020 19:03:26 -0400 Subject: PNF service instantiation using building blocks fails End flow if ControllerExecutionBB is last in list Change-Id: Ia7020572a4418e7cbd5a9d167788f6476ff3554a Issue-ID: SO-3322 Signed-off-by: Kalkere Ramesh, Sharan --- .../workflow/tasks/WorkflowActionBBTasksTest.java | 4 --- .../SkipCDSBuildingBlockListenerTest.java | 42 +++++++++++++++++++++- 2 files changed, 41 insertions(+), 5 deletions(-) (limited to 'bpmn/so-bpmn-tasks/src/test') diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java index 3290bb3dce..b0358c51f0 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java @@ -41,7 +41,6 @@ import org.onap.aai.domain.yang.ServiceInstance; import org.onap.aai.domain.yang.VfModule; import org.onap.aai.domain.yang.VolumeGroup; import org.onap.so.bpmn.BaseTaskTest; -import org.onap.so.bpmn.common.listener.flowmanipulator.FlowManipulatorListenerRunner; import org.onap.so.bpmn.core.WorkflowException; import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.ConfigurationResourceKeys; @@ -90,9 +89,6 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest { @Mock protected Environment environment; - @Mock - private FlowManipulatorListenerRunner flowManipulatorListenerRunner; - @Rule public ExpectedException thrown = ExpectedException.none(); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListenerTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListenerTest.java index fdf4d36c89..1d68cf0adb 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListenerTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListenerTest.java @@ -55,10 +55,10 @@ public class SkipCDSBuildingBlockListenerTest { private static final String PNFModule_TEST_ACTION = "config-assign"; private static final String MODELCUSTOMIZATIONUUID = "123456789"; private static final String BBNAME = "ControllerExecutionBB"; + private static final String COMPLETED = "completed"; private static final boolean ISFIRST = true; private int actual; - private List flowsToExecute = new ArrayList<>(); private List vnfResourceCustomization; private List vfModuleCustomization; private ExecuteBuildingBlock executeBuildingBlock = new ExecuteBuildingBlock(); @@ -91,6 +91,9 @@ public class SkipCDSBuildingBlockListenerTest { @Test public void testProcessForVNFToSkipCDSBB() { + List flowsToExecute = new ArrayList<>(); + flowsToExecute.add(executeBuildingBlock); + flowsToExecute.add(new ExecuteBuildingBlock()); // given setBuildingBlockAndCurrentSequence(VNF_SCOPE, VNF_TEST_ACTION, 0); vnfResourceCustomization = getVnfResourceCustomizationList(true); @@ -112,6 +115,9 @@ public class SkipCDSBuildingBlockListenerTest { @Test public void testProcessForVNFNotToSkipCDSBB() { + List flowsToExecute = new ArrayList<>(); + flowsToExecute.add(executeBuildingBlock); + flowsToExecute.add(new ExecuteBuildingBlock()); // given setBuildingBlockAndCurrentSequence(VNF_SCOPE, VNF_TEST_ACTION, 0); vnfResourceCustomization = getVnfResourceCustomizationList(false); @@ -134,6 +140,9 @@ public class SkipCDSBuildingBlockListenerTest { @Test public void testProcessForVFToSkipCDSBB() { + List flowsToExecute = new ArrayList<>(); + flowsToExecute.add(executeBuildingBlock); + flowsToExecute.add(new ExecuteBuildingBlock()); // given setBuildingBlockAndCurrentSequence(VF_SCOPE, VFModule_TEST_ACTION, 0); vfModuleCustomization = getVfModuleCustomizationList(true); @@ -153,6 +162,9 @@ public class SkipCDSBuildingBlockListenerTest { @Test public void testProcessForVFNotToSkipCDSBB() { + List flowsToExecute = new ArrayList<>(); + flowsToExecute.add(executeBuildingBlock); + flowsToExecute.add(new ExecuteBuildingBlock()); // given setBuildingBlockAndCurrentSequence(VF_SCOPE, VFModule_TEST_ACTION, 0); vfModuleCustomization = getVfModuleCustomizationList(false); @@ -172,6 +184,9 @@ public class SkipCDSBuildingBlockListenerTest { @Test public void testProcessForPNFToSkipCDSBB() { + List flowsToExecute = new ArrayList<>(); + flowsToExecute.add(executeBuildingBlock); + flowsToExecute.add(new ExecuteBuildingBlock()); // given setBuildingBlockAndCurrentSequence(PNF_SCOPE, PNFModule_TEST_ACTION, 0); pnfResourceCustomization = getPnfResourceCustomization(true); @@ -189,8 +204,33 @@ public class SkipCDSBuildingBlockListenerTest { } + @Test + public void testProcessForPNFToSkipCDSBBLastBBInList() { + List flowsToExecute = new ArrayList<>(); + flowsToExecute.add(executeBuildingBlock); + // given + setBuildingBlockAndCurrentSequence(PNF_SCOPE, PNFModule_TEST_ACTION, 0); + pnfResourceCustomization = getPnfResourceCustomization(true); + + when(catalogDbClient + .getPnfResourceCustomizationByModelCustomizationUUID(executeBuildingBlock.getBuildingBlock().getKey())) + .thenReturn(pnfResourceCustomization); + + // when + skipCDSBuildingBlockListener.run(flowsToExecute, executeBuildingBlock, buildingBlockExecution); + + // then + actual = buildingBlockExecution.getVariable(BBConstants.G_CURRENT_SEQUENCE); + boolean isCompleted = buildingBlockExecution.getVariable(COMPLETED); + assertEquals(true, isCompleted); + assertEquals(0, actual); + } + @Test public void testProcessForPNFNotToSkipCDSBB() { + List flowsToExecute = new ArrayList<>(); + flowsToExecute.add(executeBuildingBlock); + flowsToExecute.add(new ExecuteBuildingBlock()); // given setBuildingBlockAndCurrentSequence(PNF_SCOPE, PNFModule_TEST_ACTION, 0); pnfResourceCustomization = getPnfResourceCustomization(false); -- cgit 1.2.3-korg