From 3d249b7ac314a5cd59e117672d4b678d33e34c7a Mon Sep 17 00:00:00 2001 From: "Benjamin, Max (mb388a)" Date: Tue, 9 Oct 2018 10:10:47 -0400 Subject: Fix rollback removed useless error handling test case from workflow changed method name and added junit coverage to errors added max retry and success status after completed bb added assertion that global count var was reset to 0 updated rollback to reset current sequence count var revert the other change and fix the rollback logic instead fixed current sequence and updated rollback code Change-Id: Ifd3282de1dbda8b36d4d89e5b7135ad464a9b963 Issue-ID: SO-1107 Signed-off-by: Benjamin, Max (mb388a) --- .../tasks/ExecuteBuildingBlockRainyDay.java | 9 +- .../BuildingBlock/ExecuteBuildingBlock.bpmn | 57 ++++++++----- .../subprocess/BuildingBlock/WorkflowActionBB.bpmn | 42 +++++----- .../bpmn/subprocess/ExecuteBuildingBlockTest.java | 8 +- .../workflow/tasks/WorkflowAction.java | 1 + .../workflow/tasks/WorkflowActionBBTasks.java | 95 ++++++++++++++-------- .../workflow/tasks/WorkflowActionBBTasksTest.java | 72 ++++++++++++++-- 7 files changed, 191 insertions(+), 93 deletions(-) diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java index 70d523eab4..d8f9a66568 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java @@ -39,6 +39,7 @@ import org.springframework.stereotype.Component; public class ExecuteBuildingBlockRainyDay { private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ExecuteBuildingBlockRainyDay.class); + public static final String HANDLING_CODE = "handlingCode"; @Autowired private CatalogDbClient catalogDbClient; @@ -107,10 +108,14 @@ public class ExecuteBuildingBlockRainyDay { handlingCode = rainyDayHandlerStatus.getPolicy(); } msoLogger.debug("RainyDayHandler Status Code is: " + handlingCode); - execution.setVariable("handlingCode", handlingCode); + execution.setVariable(HANDLING_CODE, handlingCode); } catch (Exception e) { msoLogger.debug("RainyDayHandler Status Code is: Abort"); - execution.setVariable("handlingCode", "Abort"); + execution.setVariable(HANDLING_CODE, "Abort"); } } + + public void setHandlingStatusSuccess(DelegateExecution execution){ + execution.setVariable(HANDLING_CODE, "Success"); + } } diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ExecuteBuildingBlock.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ExecuteBuildingBlock.bpmn index 01d88b91dc..57a5557391 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ExecuteBuildingBlock.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ExecuteBuildingBlock.bpmn @@ -1,5 +1,5 @@ - + SequenceFlow_0rq4c5r @@ -20,22 +20,18 @@ SequenceFlow_0uzwjrq - SequenceFlow_01h9qmz - SequenceFlow_1ryv9sh + SequenceFlow_16lmcxp - + SequenceFlow_0uzwjrq SequenceFlow_0je0y25 - - - SequenceFlow_0je0y25 Continue - SequenceFlow_1ryv9sh + SequenceFlow_1j0vskt @@ -91,6 +87,15 @@ + + + + + + SequenceFlow_01h9qmz + SequenceFlow_1j0vskt + SequenceFlow_16lmcxp + @@ -123,16 +128,16 @@ - + - + - + - + @@ -217,15 +222,6 @@ - - - - - - - - - @@ -274,6 +270,25 @@ + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn index 13dad149cd..8cda1d7c7b 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn @@ -1,5 +1,5 @@ - + SequenceFlow_15s0okp @@ -39,7 +39,7 @@ - + SequenceFlow_15s0okp @@ -148,10 +148,9 @@ SequenceFlow_1m2eezj - SequenceFlow_0kf5sen SequenceFlow_0x4urgp + SequenceFlow_0kf5sen - @@ -161,13 +160,13 @@ - + SequenceFlow_11dlyzt SequenceFlow_0l7kaba SequenceFlow_1ui67mc - + @@ -190,6 +189,7 @@ SequenceFlow_0mew9im + @@ -203,7 +203,7 @@ - + @@ -263,7 +263,7 @@ - + @@ -272,7 +272,7 @@ - + @@ -394,7 +394,7 @@ - + @@ -415,22 +415,14 @@ - + - - - - - - - - - + @@ -482,7 +474,7 @@ - + @@ -560,6 +552,14 @@ + + + + + + + + diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ExecuteBuildingBlockTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ExecuteBuildingBlockTest.java index 51f5f723ad..63ded7ee30 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ExecuteBuildingBlockTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ExecuteBuildingBlockTest.java @@ -59,7 +59,7 @@ public class ExecuteBuildingBlockTest extends BaseBPMNTest { ProcessInstance pi = runtimeService.startProcessInstanceByKey("ExecuteBuildingBlock", variables); assertThat(pi).isNotNull(); assertThat(pi).isStarted() - .hasPassedInOrder("Start_ExecuteBuildingBlock", "Task_BBInputSetup", "StatusPolicy", "CheckOrchestrationStatusValidationResults", "End_ExecuteBuildingBlock") + .hasPassedInOrder("Start_ExecuteBuildingBlock", "Task_BBInputSetup", "StatusPolicy", "CheckOrchestrationStatusValidationResults","Task_setHandlingCodeSuccess", "End_ExecuteBuildingBlock") .hasNotPassed("Call_BBToExecute", "ErrorStart", "Task_QueryRainyDayTable", "ExclusiveGateway_1aonzik", "ExclusiveGateway_1aonzik", "ErrorEnd2", "Task_SetRetryTimer"); assertThat(pi).isEnded(); } @@ -71,7 +71,7 @@ public class ExecuteBuildingBlockTest extends BaseBPMNTest { assertThat(pi).isNotNull(); assertThat(pi).isStarted() .hasPassedInOrder("Start_ExecuteBuildingBlock", "Task_BBInputSetup", "BoundaryEvent_0i3q236", "Task_QueryRainyDayTable", "ExclusiveGateway_1aonzik", "ErrorEnd2") - .hasNotPassed("StatusPolicy", "CheckOrchestrationStatusValidationResults", "Call_BBToExecute", "End_ExecuteBuildingBlock", "ExclusiveGateway_0ey4zpt", "Task_SetRetryTimer"); + .hasNotPassed("StatusPolicy", "CheckOrchestrationStatusValidationResults", "Task_setHandlingCodeSuccess","Call_BBToExecute", "End_ExecuteBuildingBlock", "ExclusiveGateway_0ey4zpt", "Task_SetRetryTimer"); assertThat(pi).isEnded(); } @@ -86,7 +86,7 @@ public class ExecuteBuildingBlockTest extends BaseBPMNTest { assertThat(pi).isNotNull(); assertThat(pi).isStarted() .hasPassedInOrder("Start_ExecuteBuildingBlock", "Task_BBInputSetup", "BoundaryEvent_0i3q236", "Task_QueryRainyDayTable", "ExclusiveGateway_1aonzik", "ExclusiveGateway_0ey4zpt", "ErrorEnd2") - .hasNotPassed("StatusPolicy", "CheckOrchestrationStatusValidationResults", "Call_BBToExecute", "End_ExecuteBuildingBlock", "Task_SetRetryTimer"); + .hasNotPassed("StatusPolicy", "CheckOrchestrationStatusValidationResults", "Task_setHandlingCodeSuccess","Call_BBToExecute", "End_ExecuteBuildingBlock", "Task_SetRetryTimer"); assertThat(pi).isEnded(); } @@ -108,6 +108,6 @@ public class ExecuteBuildingBlockTest extends BaseBPMNTest { managementService.executeJob(job.getId()); assertThat(pi).isEnded() .hasPassedInOrder("Start_ExecuteBuildingBlock", "Task_BBInputSetup", "BoundaryEvent_0i3q236", "Task_QueryRainyDayTable", "ExclusiveGateway_1aonzik", "ExclusiveGateway_0ey4zpt", "Task_SetRetryTimer", "EndEvent_1sez2lh") - .hasNotPassed("StatusPolicy", "CheckOrchestrationStatusValidationResults", "Call_BBToExecute", "End_ExecuteBuildingBlock", "ErrorEnd2"); + .hasNotPassed("StatusPolicy", "CheckOrchestrationStatusValidationResults", "Task_setHandlingCodeSuccess","Call_BBToExecute", "End_ExecuteBuildingBlock", "ErrorEnd2"); } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java index 2d5638c2b7..e7d09f83e0 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java @@ -290,6 +290,7 @@ public class WorkflowAction { execution.setVariable(G_CURRENT_SEQUENCE, 0); execution.setVariable("retryCount", 0); + execution.setVariable("isRollback", false); execution.setVariable("flowsToExecute", flowsToExecute); } catch (Exception ex) { 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 d3f817c2a5..8a16b54bf4 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 @@ -50,6 +50,7 @@ public class WorkflowActionBBTasks { private static final String G_REQUEST_ID = "mso-request-id"; private static final String G_ALACARTE = "aLaCarte"; private static final String G_ACTION = "requestAction"; + private static final String RETRY_COUNT = "retryCount"; private static final Logger logger = LoggerFactory.getLogger(WorkflowActionBBTasks.class); @Autowired @@ -221,13 +222,18 @@ public class WorkflowActionBBTasks { } public void checkRetryStatus(DelegateExecution execution) { - if (execution.getVariable("handlingCode").equals("Retry")) { - int currSequence = (int) execution.getVariable("gCurrentSequence"); - currSequence--; - execution.setVariable("gCurrentSequence", currSequence); - int currRetryCount = (int) execution.getVariable("retryCount"); - currRetryCount++; - execution.setVariable("retryCount", currRetryCount); + String handlingCode = (String) execution.getVariable("handlingCode"); + int retryCount = (int) execution.getVariable(RETRY_COUNT); + if (handlingCode.equals("Retry")){ + if(retryCount<5){ + int currSequence = (int) execution.getVariable("gCurrentSequence"); + execution.setVariable("gCurrentSequence", currSequence-1); + execution.setVariable(RETRY_COUNT, retryCount + 1); + }else{ + workflowAction.buildAndThrowException(execution, "Exceeded maximum retries. Ending flow with status Abort"); + } + }else{ + execution.setVariable(RETRY_COUNT, 0); } } @@ -236,37 +242,41 @@ public class WorkflowActionBBTasks { * layer will rollback the flow its currently working on. */ public void rollbackExecutionPath(DelegateExecution execution) { - List flowsToExecute = (List) execution - .getVariable("flowsToExecute"); - List rollbackFlows = new ArrayList(); - int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE) + 1; - int listSize = flowsToExecute.size(); - for (int i = listSize - 1; i >= 0; i--) { - if (i >= currentSequence) { - flowsToExecute.remove(i); - } else { - ExecuteBuildingBlock ebb = flowsToExecute.get(i); - BuildingBlock bb = flowsToExecute.get(i).getBuildingBlock(); - String flowName = flowsToExecute.get(i).getBuildingBlock().getBpmnFlowName(); - if (flowName.contains("Assign")) { - flowName = "Unassign" + flowName.substring(6, flowName.length()); - } else if (flowName.contains("Create")) { - flowName = "Delete" + flowName.substring(6, flowName.length()); - } else if (flowName.contains("Activate")) { - flowName = "Deactivate" + flowName.substring(8, flowName.length()); - }else{ - continue; + if(!(boolean)execution.getVariable("isRollback")){ + List flowsToExecute = (List) execution + .getVariable("flowsToExecute"); + List rollbackFlows = new ArrayList(); + int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE); + int listSize = flowsToExecute.size(); + for (int i = listSize - 1; i >= 0; i--) { + if (i > currentSequence - 1) { + flowsToExecute.remove(i); + } else { + String flowName = flowsToExecute.get(i).getBuildingBlock().getBpmnFlowName(); + if (flowName.contains("Assign")) { + flowName = "Unassign" + flowName.substring(6, flowName.length()); + } else if (flowName.contains("Create")) { + flowName = "Delete" + flowName.substring(6, flowName.length()); + } else if (flowName.contains("Activate")) { + flowName = "Deactivate" + flowName.substring(8, flowName.length()); + }else{ + continue; + } + flowsToExecute.get(i).getBuildingBlock().setBpmnFlowName(flowName); + rollbackFlows.add(flowsToExecute.get(i)); } - flowsToExecute.get(i).getBuildingBlock().setBpmnFlowName(flowName); - rollbackFlows.add(flowsToExecute.get(i)); } + if (rollbackFlows.isEmpty()) + execution.setVariable("isRollbackNeeded", false); + else + execution.setVariable("isRollbackNeeded", true); + execution.setVariable("flowsToExecute", rollbackFlows); + execution.setVariable("handlingCode", "PreformingRollback"); + execution.setVariable("isRollback", true); + execution.setVariable("gCurrentSequence", 0); + }else{ + workflowAction.buildAndThrowException(execution, "Rollback has already been called. Cannot rollback a request that is currently in the rollback state."); } - if (rollbackFlows.isEmpty()) - execution.setVariable("isRollbackNeeded", false); - else - execution.setVariable("isRollbackNeeded", true); - execution.setVariable("flowsToExecute", rollbackFlows); - execution.setVariable("handlingCode", "PreformingRollback"); } public void abortCallErrorHandling(DelegateExecution execution) { @@ -280,9 +290,17 @@ public class WorkflowActionBBTasks { String requestId = (String) execution.getVariable(G_REQUEST_ID); InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId); String errorMsg = null; + boolean rollback = false; try { WorkflowException exception = (WorkflowException) execution.getVariable("WorkflowException"); - request.setStatusMessage(exception.getErrorMessage()); + if(exception.getErrorMessage()!=null || !exception.getErrorMessage().equals("")){ + errorMsg = exception.getErrorMessage(); + rollback = (boolean) execution.getVariable("isRollbackComplete"); + if(rollback){ + errorMsg = errorMsg + " + Rollback has been completed successfully."; + } + request.setStatusMessage(errorMsg); + } } catch (Exception ex) { //log error and attempt to extact WorkflowExceptionMessage logger.error("Failed to extract workflow exception from execution.",ex); @@ -303,4 +321,9 @@ public class WorkflowActionBBTasks { workflowAction.buildAndThrowException(execution, "Error Updating Request Database", e); } } + + public void updateRequestStatusToFailedWithRollback(DelegateExecution execution) { + execution.setVariable("isRollbackComplete", true); + updateRequestStatusToFailed(execution); + } } 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 6cac238482..8ed1f44b8a 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 @@ -23,17 +23,22 @@ package org.onap.so.bpmn.infrastructure.workflow.tasks; import static org.junit.Assert.assertEquals; import static org.mockito.Matchers.anyObject; import static org.mockito.Matchers.anyString; +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.when; import java.util.ArrayList; import java.util.List; +import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; +import org.mockito.Mock; import org.onap.so.bpmn.BaseTaskTest; import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; @@ -150,59 +155,99 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest { @Test public void rollbackExecutionPathTest(){ + execution.setVariable("isRollback", false); List flowsToExecute = new ArrayList(); ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock(); BuildingBlock bb1 = new BuildingBlock(); bb1.setBpmnFlowName("AssignVfModuleBB"); - flowsToExecute.add(ebb1); ebb1.setBuildingBlock(bb1); + flowsToExecute.add(ebb1); ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock(); BuildingBlock bb2 = new BuildingBlock(); bb2.setBpmnFlowName("CreateVfModuleBB"); - flowsToExecute.add(ebb2); ebb2.setBuildingBlock(bb2); + flowsToExecute.add(ebb2); ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock(); BuildingBlock bb3 = new BuildingBlock(); bb3.setBpmnFlowName("ActivateVfModuleBB"); - flowsToExecute.add(ebb3); ebb3.setBuildingBlock(bb3); + flowsToExecute.add(ebb3); execution.setVariable("flowsToExecute", flowsToExecute); - execution.setVariable("gCurrentSequence", 2); + execution.setVariable("gCurrentSequence", 3); workflowActionBBTasks.rollbackExecutionPath(execution); List ebbs = (List) execution.getVariable("flowsToExecute"); assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(),"DeactivateVfModuleBB"); assertEquals(ebbs.get(1).getBuildingBlock().getBpmnFlowName(),"DeleteVfModuleBB"); - assertEquals(ebbs.get(2).getBuildingBlock().getBpmnFlowName(),"UnassignVfModuleBB"); + assertEquals(ebbs.get(2).getBuildingBlock().getBpmnFlowName(),"UnassignVfModuleBB"); + assertEquals(0,execution.getVariable("gCurrentSequence")); } @Test public void rollbackExecutionPathUnfinishedFlowTest(){ + execution.setVariable("isRollback", false); List flowsToExecute = new ArrayList(); ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock(); BuildingBlock bb1 = new BuildingBlock(); bb1.setBpmnFlowName("AssignVfModuleBB"); - flowsToExecute.add(ebb1); ebb1.setBuildingBlock(bb1); + flowsToExecute.add(ebb1); ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock(); BuildingBlock bb2 = new BuildingBlock(); bb2.setBpmnFlowName("CreateVfModuleBB"); - flowsToExecute.add(ebb2); ebb2.setBuildingBlock(bb2); + flowsToExecute.add(ebb2); ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock(); BuildingBlock bb3 = new BuildingBlock(); bb3.setBpmnFlowName("ActivateVfModuleBB"); - flowsToExecute.add(ebb3); ebb3.setBuildingBlock(bb3); + flowsToExecute.add(ebb3); execution.setVariable("flowsToExecute", flowsToExecute); - execution.setVariable("gCurrentSequence", 1); + execution.setVariable("gCurrentSequence", 2); workflowActionBBTasks.rollbackExecutionPath(execution); List ebbs = (List) execution.getVariable("flowsToExecute"); assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(),"DeleteVfModuleBB"); assertEquals(ebbs.get(1).getBuildingBlock().getBpmnFlowName(),"UnassignVfModuleBB"); + assertEquals(0,execution.getVariable("gCurrentSequence")); + } + + @Test + public void rollbackExecutionTest(){ + execution.setVariable("isRollback", false); + List flowsToExecute = new ArrayList(); + ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock(); + BuildingBlock bb1 = new BuildingBlock(); + bb1.setBpmnFlowName("AssignServiceInstanceBB"); + ebb1.setBuildingBlock(bb1); + flowsToExecute.add(ebb1); + ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock(); + BuildingBlock bb2 = new BuildingBlock(); + bb2.setBpmnFlowName("CreateNetworkCollectionBB"); + ebb2.setBuildingBlock(bb2); + flowsToExecute.add(ebb2); + ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock(); + BuildingBlock bb3 = new BuildingBlock(); + bb3.setBpmnFlowName("AssignNetworkBB"); + ebb3.setBuildingBlock(bb3); + flowsToExecute.add(ebb3); + ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock(); + BuildingBlock bb4 = new BuildingBlock(); + bb4.setBpmnFlowName("CreateNetworkBB"); + ebb4.setBuildingBlock(bb4); + flowsToExecute.add(ebb4); + + execution.setVariable("flowsToExecute", flowsToExecute); + execution.setVariable("gCurrentSequence", 3); + + workflowActionBBTasks.rollbackExecutionPath(execution); + List ebbs = (List) execution.getVariable("flowsToExecute"); + assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(),"UnassignNetworkBB"); + assertEquals(ebbs.get(1).getBuildingBlock().getBpmnFlowName(),"DeleteNetworkCollectionBB"); + assertEquals(ebbs.get(2).getBuildingBlock().getBpmnFlowName(),"UnassignServiceInstanceBB"); + assertEquals(0,execution.getVariable("gCurrentSequence")); } @Test @@ -213,4 +258,13 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest { workflowActionBBTasks.checkRetryStatus(execution); assertEquals(0,execution.getVariable("gCurrentSequence")); } + + @Test + public void checkRetryStatusNoRetryTest(){ + execution.setVariable("retryCount", 3); + execution.setVariable("handlingCode","Success"); + execution.setVariable("gCurrentSequence",1); + workflowActionBBTasks.checkRetryStatus(execution); + assertEquals(0,execution.getVariable("retryCount")); + } } -- cgit 1.2.3-korg