summaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-tasks
diff options
context:
space:
mode:
authorKalkere Ramesh, Sharan (sk720x) <sk720x@att.com>2020-10-21 19:03:26 -0400
committerKalkere Ramesh, Sharan (sk720x) <sk720x@att.com>2020-10-22 10:51:55 -0400
commiteeaf0330f835b237812bbbf26ca5bba3c44f4671 (patch)
tree6f67907dd2ac1da8be0162626c73b22275113a19 /bpmn/so-bpmn-tasks
parent7396509f9c11cc4e9651210cf8a290679bb17fd5 (diff)
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 <sk720x@att.com>
Diffstat (limited to 'bpmn/so-bpmn-tasks')
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java7
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListener.java19
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListenerTest.java42
4 files changed, 61 insertions, 11 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
index 43a85051be..0cb8fb2ccd 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
@@ -103,7 +103,6 @@ public class WorkflowActionBBTasks {
(List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
execution.setVariable("MacroRollback", false);
- flowManipulatorListenerRunner.modifyFlows(flowsToExecute, new DelegateExecutionImpl(execution));
int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE);
ExecuteBuildingBlock ebb = flowsToExecute.get(currentSequence);
@@ -114,6 +113,12 @@ public class WorkflowActionBBTasks {
execution.setVariable(G_CURRENT_SEQUENCE, currentSequence);
}
+ public void runFlowManipulator(DelegateExecution execution) {
+ List<ExecuteBuildingBlock> flowsToExecute =
+ (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+ flowManipulatorListenerRunner.modifyFlows(flowsToExecute, new DelegateExecutionImpl(execution));
+ }
+
public void updateFlowStatistics(DelegateExecution execution) {
try {
int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListener.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListener.java
index 2119ced951..42aab4c16e 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListener.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListener.java
@@ -52,6 +52,8 @@ public class SkipCDSBuildingBlockListener implements FlowManipulator {
private Set<String> pnfActions =
new HashSet<>(Arrays.asList("config-assign", "config-deploy", "PnfConfigAssign", "PnfConfigDeploy"));
+ private static final String COMPLETED = "completed";
+
@Override
public boolean shouldRunFor(String currentBBName, boolean isFirst, BuildingBlockExecution execution) {
@@ -70,6 +72,7 @@ public class SkipCDSBuildingBlockListener implements FlowManipulator {
public void run(List<ExecuteBuildingBlock> flowsToExecute, ExecuteBuildingBlock currentBB,
BuildingBlockExecution execution) {
String customizationUUID = currentBB.getBuildingBlock().getKey();
+ int flowsToExecuteSize = flowsToExecute.size();
if (Strings.isEmpty(customizationUUID)) {
return;
@@ -85,7 +88,7 @@ public class SkipCDSBuildingBlockListener implements FlowManipulator {
vnfResourceCustomizations);
if (null != vrc) {
boolean skipConfigVNF = vrc.isSkipPostInstConf();
- currentSequenceSkipCheck(execution, skipConfigVNF);
+ currentSequenceSkipCheck(execution, skipConfigVNF, flowsToExecuteSize);
}
}
@@ -97,7 +100,7 @@ public class SkipCDSBuildingBlockListener implements FlowManipulator {
if (null != vfc) {
boolean skipVfModule = vfc.isSkipPostInstConf();
- currentSequenceSkipCheck(execution, skipVfModule);
+ currentSequenceSkipCheck(execution, skipVfModule, flowsToExecuteSize);
}
} else if (currentBB.getBuildingBlock().getBpmnScope().equalsIgnoreCase("PNF")
@@ -107,7 +110,7 @@ public class SkipCDSBuildingBlockListener implements FlowManipulator {
if (null != pnfResourceCustomization) {
boolean skipConfigPNF = pnfResourceCustomization.isSkipPostInstConf();
- currentSequenceSkipCheck(execution, skipConfigPNF);
+ currentSequenceSkipCheck(execution, skipConfigPNF, flowsToExecuteSize);
}
}
}
@@ -118,10 +121,16 @@ public class SkipCDSBuildingBlockListener implements FlowManipulator {
}
- private void currentSequenceSkipCheck(BuildingBlockExecution execution, boolean skipModule) {
+ private void currentSequenceSkipCheck(BuildingBlockExecution execution, boolean skipModule,
+ int flowsToExecuteSize) {
if (skipModule) {
int currentSequence = execution.getVariable(BBConstants.G_CURRENT_SEQUENCE);
- execution.setVariable(BBConstants.G_CURRENT_SEQUENCE, currentSequence + 1);
+ currentSequence++;
+ if (currentSequence >= flowsToExecuteSize) {
+ execution.setVariable(COMPLETED, true);
+ } else {
+ execution.setVariable(BBConstants.G_CURRENT_SEQUENCE, currentSequence);
+ }
}
}
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<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
private List<VnfResourceCustomization> vnfResourceCustomization;
private List<VfModuleCustomization> vfModuleCustomization;
private ExecuteBuildingBlock executeBuildingBlock = new ExecuteBuildingBlock();
@@ -91,6 +91,9 @@ public class SkipCDSBuildingBlockListenerTest {
@Test
public void testProcessForVNFToSkipCDSBB() {
+ List<ExecuteBuildingBlock> 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<ExecuteBuildingBlock> 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<ExecuteBuildingBlock> 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<ExecuteBuildingBlock> 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<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
+ flowsToExecute.add(executeBuildingBlock);
+ flowsToExecute.add(new ExecuteBuildingBlock());
// given
setBuildingBlockAndCurrentSequence(PNF_SCOPE, PNFModule_TEST_ACTION, 0);
pnfResourceCustomization = getPnfResourceCustomization(true);
@@ -190,7 +205,32 @@ public class SkipCDSBuildingBlockListenerTest {
}
@Test
+ public void testProcessForPNFToSkipCDSBBLastBBInList() {
+ List<ExecuteBuildingBlock> 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<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
+ flowsToExecute.add(executeBuildingBlock);
+ flowsToExecute.add(new ExecuteBuildingBlock());
// given
setBuildingBlockAndCurrentSequence(PNF_SCOPE, PNFModule_TEST_ACTION, 0);
pnfResourceCustomization = getPnfResourceCustomization(false);