diff options
author | Kuleshov, Elena <evn@att.com> | 2020-10-03 11:17:14 -0400 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@att.com> | 2020-10-07 14:15:26 -0400 |
commit | 0216cec34a95d896ab5795174c69a110a5a51d23 (patch) | |
tree | 2ffdca0edab256538df3c433e34aa8e0794d92eb /bpmn/so-bpmn-tasks/src | |
parent | dbef19af78e71d4170236d88dbe67fd7e3dc261f (diff) |
add work step option for failures
Introduce new Policy and workStep to handle failures
Reapply changes using correct camunda modeler version.
Issue-ID: SO-3287
Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com>
Change-Id: I7e0a36305322c255f6678529f0a27c023fd983ef
Diffstat (limited to 'bpmn/so-bpmn-tasks/src')
2 files changed, 43 insertions, 3 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 5425b2a725..f0898ace81 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 @@ -75,6 +75,7 @@ public class WorkflowActionBBTasks { private static final String COMPLETED = "completed"; private static final String HANDLINGCODE = "handlingCode"; private static final String ROLLBACKTOCREATED = "RollbackToCreated"; + private static final String ROLLBACKTOCREATEDNOCONFIGURATION = "RollbackToCreatedNoConfiguration"; private static final String REPLACEINSTANCE = "replaceInstance"; private static final String VFMODULE = "VfModule"; protected String maxRetries = "mso.rainyDay.maxRetries"; @@ -334,14 +335,19 @@ public class WorkflowActionBBTasks { String handlingCode = (String) execution.getVariable(HANDLINGCODE); List<ExecuteBuildingBlock> rollbackFlowsFiltered = new ArrayList<>(rollbackFlows); - if ("RollbackToAssigned".equals(handlingCode) || ROLLBACKTOCREATED.equals(handlingCode)) { + if ("RollbackToAssigned".equals(handlingCode) || ROLLBACKTOCREATED.equals(handlingCode) + || ROLLBACKTOCREATEDNOCONFIGURATION.equals(handlingCode)) { for (ExecuteBuildingBlock rollbackFlow : rollbackFlows) { if (rollbackFlow.getBuildingBlock().getBpmnFlowName().contains("Unassign") && !rollbackFlow.getBuildingBlock().getBpmnFlowName().contains("FabricConfiguration")) { rollbackFlowsFiltered.remove(rollbackFlow); } else if (rollbackFlow.getBuildingBlock().getBpmnFlowName().contains("Delete") - && !rollbackFlow.getBuildingBlock().getBpmnFlowName().contains("FabricConfiguration") - && ROLLBACKTOCREATED.equals(handlingCode)) { + && ((!rollbackFlow.getBuildingBlock().getBpmnFlowName().contains("FabricConfiguration") + && (ROLLBACKTOCREATED.equals(handlingCode) + || ROLLBACKTOCREATEDNOCONFIGURATION.equals(handlingCode))) + || (rollbackFlow.getBuildingBlock().getBpmnFlowName() + .contains("FabricConfiguration") + && ROLLBACKTOCREATEDNOCONFIGURATION.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 a7ee89f073..3290bb3dce 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 @@ -436,6 +436,40 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest { } @Test + public void rollbackExecutionRollbackToCreatedNoConfigurationWithFabricTest() { + execution.setVariable("isRollback", false); + execution.setVariable("handlingCode", "RollbackToCreatedNoConfiguration"); + execution.setVariable("requestAction", EMPTY_STRING); + execution.setVariable("resourceName", EMPTY_STRING); + List<ExecuteBuildingBlock> 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<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute"); + assertEquals(0, execution.getVariable("gCurrentSequence")); + assertEquals(1, ebbs.size()); + assertEquals("DeactivateVfModuleBB", ebbs.get(0).getBuildingBlock().getBpmnFlowName()); + } + + @Test public void rollbackExecutionRollbackToCreatedTest() { execution.setVariable("isRollback", false); execution.setVariable("handlingCode", "RollbackToCreated"); |