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/MSOCommonBPMN/src/test/java | |
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/MSOCommonBPMN/src/test/java')
2 files changed, 44 insertions, 0 deletions
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayTest.java index ee47b514d1..b34d9dce9c 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayTest.java @@ -259,6 +259,35 @@ public class ExecuteBuildingBlockRainyDayTest extends BaseTest { assertEquals(Status.ROLLED_BACK_TO_CREATED.toString(), delegateExecution.getVariable("rollbackTargetState")); } + @Test + public void queryRainyDayTableRollbackToCreatedNoConfiguration() throws Exception { + customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + serviceInstance.getModelInfoServiceInstance().setServiceType("st1"); + vnf.setVnfType("vnft1"); + BuildingBlock buildingBlock = new BuildingBlock().setBpmnFlowName("AddFabricConfigurationBB"); + ExecuteBuildingBlock executeBuildingBlock = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock); + delegateExecution.setVariable("buildingBlock", executeBuildingBlock); + delegateExecution.setVariable("aLaCarte", true); + delegateExecution.setVariable("suppressRollback", false); + delegateExecution.setVariable("WorkflowExceptionCode", "7000"); + RainyDayHandlerStatus rainyDayHandlerStatus = new RainyDayHandlerStatus(); + rainyDayHandlerStatus.setErrorCode("7000"); + rainyDayHandlerStatus.setFlowName("AddFabricConfigurationBB"); + rainyDayHandlerStatus.setServiceType("st1"); + rainyDayHandlerStatus.setVnfType("vnft1"); + rainyDayHandlerStatus.setPolicy("RollbackToCreatedNoConfiguration"); + rainyDayHandlerStatus.setWorkStep(ASTERISK); + rainyDayHandlerStatus.setSecondaryPolicy("Abort"); + + doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient).getRainyDayHandlerStatus("AddFabricConfigurationBB", + "st1", "vnft1", "7000", "*", "errorMessage", "*"); + + executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, true); + + assertEquals("RollbackToCreatedNoConfiguration", delegateExecution.getVariable("handlingCode")); + assertEquals(Status.ROLLED_BACK_TO_CREATED.toString(), delegateExecution.getVariable("rollbackTargetState")); + } + @Test public void suppressRollbackTest() throws Exception { diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderUnitTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderUnitTest.java index 5baafbba67..b7e4dd98d8 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderUnitTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderUnitTest.java @@ -22,6 +22,7 @@ package org.onap.so.client.exception; +import static org.junit.Assert.assertEquals; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.times; @@ -39,6 +40,7 @@ import org.mockito.Mock; import org.mockito.Spy; import org.mockito.junit.MockitoJUnitRunner; import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.core.WorkflowException; import org.onap.logging.filter.base.ONAPComponents; @RunWith(MockitoJUnitRunner.class) @@ -95,4 +97,17 @@ public class ExceptionBuilderUnitTest { thrown.expect(BpmnError.class); exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage(), ONAPComponents.SDNC); } + + @Test + public void buildAndThrowWorkflowExceptionWithWorkStepTest() { + doReturn("Process key").when(exceptionBuilder).getProcessKey(execution); + + try { + exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage(), ONAPComponents.SDNC, + "WORKSTEP"); + } catch (BpmnError e) { + } + WorkflowException workflowException = (WorkflowException) execution.getVariable("WorkflowException"); + assertEquals("WORKSTEP", workflowException.getWorkStep()); + } } |