From 9e5994226e9372da655c781e14f2ddc77ff919c5 Mon Sep 17 00:00:00 2001 From: "Kuleshov, Elena" Date: Wed, 22 Jul 2020 12:05:33 -0400 Subject: Keep DeleteFabricConfigurationBB Keep DeleteFabricConfigurationBB in rollbackToCreated scenario. Issue-ID: SO-3094 Signed-off-by: Benjamin, Max (mb388a) Change-Id: Ifb8e6eed8f732ba6278aa75dd38a89936a2356a5 --- .../workflow/tasks/WorkflowActionBBTasks.java | 1 + .../workflow/tasks/WorkflowActionBBTasksTest.java | 36 ++++++++++++++++++++++ 2 files changed, 37 insertions(+) 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 343b25eb97..155011ece0 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 @@ -334,6 +334,7 @@ public class WorkflowActionBBTasks { && !rollbackFlow.getBuildingBlock().getBpmnFlowName().contains("FabricConfiguration")) { rollbackFlowsFiltered.remove(rollbackFlow); } else if (rollbackFlow.getBuildingBlock().getBpmnFlowName().contains("Delete") + && !rollbackFlow.getBuildingBlock().getBpmnFlowName().contains("FabricConfiguration") && ROLLBACKTOCREATED.equals(handlingCode)) { rollbackFlowsFiltered.remove(rollbackFlow); } 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 1aa7640492..70b10c5195 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 @@ -399,6 +399,42 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest { } + @Test + public void rollbackExecutionRollbackToCreatedWithFabricTest() { + execution.setVariable("isRollback", false); + execution.setVariable("handlingCode", "RollbackToCreated"); + execution.setVariable("requestAction", EMPTY_STRING); + execution.setVariable("resourceName", EMPTY_STRING); + List flowsToExecute = new ArrayList<>(); + + BuildingBlock buildingBlock1 = new BuildingBlock().setBpmnFlowName("AssignVfModuleBB"); + ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock1); + flowsToExecute.add(ebb1); + + BuildingBlock buildingBlock2 = new BuildingBlock().setBpmnFlowName("CreateVfModuleBB"); + ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock2); + flowsToExecute.add(ebb2); + + BuildingBlock buildingBlock3 = new BuildingBlock().setBpmnFlowName("ActivateVfModuleBB"); + ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock3); + flowsToExecute.add(ebb3); + + BuildingBlock buildingBlock4 = new BuildingBlock().setBpmnFlowName("AddFabricConfigurationBB"); + ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock4); + flowsToExecute.add(ebb4); + + execution.setVariable("flowsToExecute", flowsToExecute); + execution.setVariable("gCurrentSequence", 4); + + workflowActionBBTasks.rollbackExecutionPath(execution); + List ebbs = (List) execution.getVariable("flowsToExecute"); + assertEquals(0, execution.getVariable("gCurrentSequence")); + assertEquals(2, ebbs.size()); + assertEquals("DeleteFabricConfigurationBB", ebbs.get(0).getBuildingBlock().getBpmnFlowName()); + assertEquals("DeactivateVfModuleBB", ebbs.get(1).getBuildingBlock().getBpmnFlowName()); + + } + @Test public void rollbackExecutionRollbackToCreatedTest() { execution.setVariable("isRollback", false); -- cgit 1.2.3-korg