From 6dbb05c1b633e64db599ca24041d795545106d65 Mon Sep 17 00:00:00 2001 From: "Benjamin, Max (mb388a)" Date: Tue, 2 Apr 2019 23:04:18 -0400 Subject: do not error out when there is no config fixed rollback execution path creation in bb tasks do not error out when there is no config Change-Id: I3e2ce1e203271deebc45e1f14a884c940ecd5d25 Issue-ID: SO-1733 Signed-off-by: Benjamin, Max (mb388a) --- .../workflow/tasks/WorkflowActionBBTasks.java | 15 +++++++---- .../workflow/tasks/WorkflowActionBBTasksTest.java | 31 ++++++++++++++++++++++ 2 files changed, 41 insertions(+), 5 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 242f125bde..359f8ea164 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 @@ -26,6 +26,8 @@ import java.util.List; import java.util.Optional; import java.util.UUID; +import javax.persistence.EntityNotFoundException; + import org.camunda.bpm.engine.delegate.DelegateExecution; import org.onap.aai.domain.yang.Vnfc; import org.onap.so.bpmn.common.workflow.context.WorkflowCallbackResponse; @@ -296,14 +298,15 @@ public class WorkflowActionBBTasks { } } - int flowSize = rollbackFlows.size(); String handlingCode = (String) execution.getVariable("handlingCode"); + List rollbackFlowsFiltered = new ArrayList<>(); + rollbackFlowsFiltered.addAll(rollbackFlows); if(handlingCode.equals("RollbackToAssigned") || handlingCode.equals("RollbackToCreated")){ - for(int i = 0; i flowsToExecute = new ArrayList(); + ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock(); + BuildingBlock bb1 = new BuildingBlock(); + bb1.setBpmnFlowName("AssignVfModuleBB"); + ebb1.setBuildingBlock(bb1); + flowsToExecute.add(ebb1); + ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock(); + BuildingBlock bb2 = new BuildingBlock(); + bb2.setBpmnFlowName("CreateVfModuleBB"); + ebb2.setBuildingBlock(bb2); + flowsToExecute.add(ebb2); + ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock(); + BuildingBlock bb3 = new BuildingBlock(); + bb3.setBpmnFlowName("ActivateVfModuleBB"); + ebb3.setBuildingBlock(bb3); + flowsToExecute.add(ebb3); + + execution.setVariable("flowsToExecute", flowsToExecute); + execution.setVariable("gCurrentSequence", 3); + + workflowActionBBTasks.rollbackExecutionPath(execution); + List ebbs = (List) execution.getVariable("flowsToExecute"); + assertEquals("DeactivateVfModuleBB",ebbs.get(0).getBuildingBlock().getBpmnFlowName()); + assertEquals(0,execution.getVariable("gCurrentSequence")); + assertEquals(1,ebbs.size()); + } + @Test public void checkRetryStatusTest(){ String reqId = "reqId123"; -- cgit 1.2.3-korg