summaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-tasks
diff options
context:
space:
mode:
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.java15
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java31
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<ExecuteBuildingBlock> rollbackFlowsFiltered = new ArrayList<>();
+ rollbackFlowsFiltered.addAll(rollbackFlows);
if(handlingCode.equals("RollbackToAssigned") || handlingCode.equals("RollbackToCreated")){
- for(int i = 0; i<flowSize; i++){
+ for(int i = 0; i<rollbackFlows.size(); i++){
if(rollbackFlows.get(i).getBuildingBlock().getBpmnFlowName().contains("Unassign")){
- rollbackFlows.remove(i);
+ rollbackFlowsFiltered.remove(rollbackFlows.get(i));
} else if(rollbackFlows.get(i).getBuildingBlock().getBpmnFlowName().contains("Delete") && handlingCode.equals("RollbackToCreated")) {
- rollbackFlows.remove(i);
+ rollbackFlowsFiltered.remove(rollbackFlows.get(i));
}
}
}
@@ -314,7 +317,7 @@ public class WorkflowActionBBTasks {
execution.setVariable("isRollbackNeeded", false);
else
execution.setVariable("isRollbackNeeded", true);
- execution.setVariable("flowsToExecute", rollbackFlows);
+ execution.setVariable("flowsToExecute", rollbackFlowsFiltered);
execution.setVariable("handlingCode", "PreformingRollback");
execution.setVariable("isRollback", true);
execution.setVariable("gCurrentSequence", 0);
@@ -396,6 +399,8 @@ public class WorkflowActionBBTasks {
logger.debug("No cvnfcCustomization found for customizationId: " + modelCustomizationId);
}
}
+ } catch (EntityNotFoundException e) {
+ logger.debug(e.getMessage() + " Will not be running Fabric Config Building Blocks");
} catch (Exception e) {
String errorMessage = "Error occurred in post processing of Vf Module create";
execution.setVariable("handlingCode", "RollbackToCreated");
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 c2bca34fb6..c5b4a482b7 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
@@ -272,6 +272,37 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
}
@Test
+ public void rollbackExecutionRollbackToCreatedTest(){
+ execution.setVariable("isRollback", false);
+ execution.setVariable("handlingCode", "RollbackToCreated");
+ List<ExecuteBuildingBlock> 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<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) 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";
execution.setVariable("mso-request-id", reqId);