summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGamboa, Gilbert <gilbert.g.gamboa@att.com>2019-07-05 10:30:58 -0400
committerBenjamin, Max (mb388a) <mb388a@us.att.com>2019-07-05 10:31:04 -0400
commitcc805b184620525115c88c1a52ddfde55c73e15b (patch)
tree419e6d3573b0860d2aa18d0b462e310a2d17bef9
parent0e2cda138f35ee6a7a8a54c29a6c4edf07d51745 (diff)
mso will support new requeststate values
Support new request status - ROLLED_BACK, ROLLED_BACK_TO_ASSIGNED, ROLLED_BACK_TO_CREATED, and ABORTED. Support new request status - ROLLED_BACK, ROLLED_BACK_TO_ASSIGNED, ROLLED_BACK_TO_CREATED, and ABORTED. Added default FAILED request status in case rollback is not needed. Variable rollbackTargetState needs to be returned to WorkflowAction flow Variable rollbackTargetState needs to in to ExecuteBuildingBlock as well. Add new RequestDb migration file to expand infra_active_requests column request_status to 25 bytes to fit new request states. Change-Id: I0da2f8013001a28dcc20f64eb9455e4cfd3dd197 Issue-ID: SO-2093 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
-rw-r--r--adapters/mso-requests-db-adapter/src/main/resources/db/migration/V6.2__Expand_Column_Size_Infra_Active_Requests_Request_Status.sql3
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java14
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java30
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn204
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java12
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailureTest.java54
6 files changed, 214 insertions, 103 deletions
diff --git a/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V6.2__Expand_Column_Size_Infra_Active_Requests_Request_Status.sql b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V6.2__Expand_Column_Size_Infra_Active_Requests_Request_Status.sql
new file mode 100644
index 0000000000..427eb0bf07
--- /dev/null
+++ b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V6.2__Expand_Column_Size_Infra_Active_Requests_Request_Status.sql
@@ -0,0 +1,3 @@
+use requestdb;
+
+ALTER TABLE infra_active_requests MODIFY COLUMN REQUEST_STATUS varchar(25) NULL; \ No newline at end of file
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 ed31e1d079..fd2054c3d0 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
@@ -30,6 +30,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.constants.Status;
import org.onap.so.db.catalog.beans.macro.RainyDayHandlerStatus;
import org.onap.so.db.catalog.client.CatalogDbClient;
import org.onap.so.db.request.beans.InfraActiveRequests;
@@ -47,6 +48,7 @@ public class ExecuteBuildingBlockRainyDay {
private static final Logger logger = LoggerFactory.getLogger(ExecuteBuildingBlockRainyDay.class);
public static final String HANDLING_CODE = "handlingCode";
+ public static final String ROLLBACK_TARGET_STATE = "rollbackTargetState";
@Autowired
private CatalogDbClient catalogDbClient;
@@ -167,6 +169,18 @@ public class ExecuteBuildingBlockRainyDay {
if (handlingCode.equals("RollbackToAssigned") && !aLaCarte) {
handlingCode = "Rollback";
}
+ if (handlingCode.startsWith("Rollback")) {
+ String targetState = "";
+ if (handlingCode.equalsIgnoreCase("RollbackToAssigned")) {
+ targetState = Status.ROLLED_BACK_TO_ASSIGNED.toString();
+ } else if (handlingCode.equalsIgnoreCase("RollbackToCreated")) {
+ targetState = Status.ROLLED_BACK_TO_CREATED.toString();
+ } else {
+ targetState = Status.ROLLED_BACK.toString();
+ }
+ execution.setVariable(ROLLBACK_TARGET_STATE, targetState);
+ logger.debug("Rollback target state is: {}", targetState);
+ }
}
logger.debug("RainyDayHandler Status Code is: {}", handlingCode);
execution.setVariable(HANDLING_CODE, handlingCode);
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java
index c5da3cbd51..80373eb760 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java
@@ -38,6 +38,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
+import org.onap.so.constants.Status;
import org.onap.so.db.catalog.beans.macro.RainyDayHandlerStatus;
import org.springframework.beans.factory.annotation.Autowired;
@@ -207,6 +208,7 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest {
executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, true);
assertEquals("Rollback", delegateExecution.getVariable("handlingCode"));
+ assertEquals(Status.ROLLED_BACK.toString(), delegateExecution.getVariable("rollbackTargetState"));
}
@Test
@@ -232,9 +234,37 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest {
executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, true);
assertEquals("RollbackToAssigned", delegateExecution.getVariable("handlingCode"));
+ assertEquals(Status.ROLLED_BACK_TO_ASSIGNED.toString(), delegateExecution.getVariable("rollbackTargetState"));
}
@Test
+ public void queryRainyDayTableRollbackToCreated() throws Exception {
+ customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
+ serviceInstance.getModelInfoServiceInstance().setServiceType("st1");
+ vnf.setVnfType("vnft1");
+ delegateExecution.setVariable("aLaCarte", true);
+ delegateExecution.setVariable("suppressRollback", false);
+ delegateExecution.setVariable("WorkflowExceptionCode", "7000");
+ RainyDayHandlerStatus rainyDayHandlerStatus = new RainyDayHandlerStatus();
+ rainyDayHandlerStatus.setErrorCode("7000");
+ rainyDayHandlerStatus.setFlowName("AssignServiceInstanceBB");
+ rainyDayHandlerStatus.setServiceType("st1");
+ rainyDayHandlerStatus.setVnfType("vnft1");
+ rainyDayHandlerStatus.setPolicy("RollbackToCreated");
+ rainyDayHandlerStatus.setWorkStep(ASTERISK);
+ rainyDayHandlerStatus.setSecondaryPolicy("Abort");
+
+ doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient).getRainyDayHandlerStatus("AssignServiceInstanceBB",
+ "st1", "vnft1", "7000", "*", "errorMessage");
+
+ executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, true);
+
+ assertEquals("RollbackToCreated", delegateExecution.getVariable("handlingCode"));
+ assertEquals(Status.ROLLED_BACK_TO_CREATED.toString(), delegateExecution.getVariable("rollbackTargetState"));
+ }
+
+
+ @Test
public void suppressRollbackTest() throws Exception {
delegateExecution.setVariable("suppressRollback", true);
delegateExecution.setVariable("aLaCarte", true);
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 47b9efeb6d..efdee8601e 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 @@
<?xml version="1.0" encoding="UTF-8"?>
-<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.7.2">
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.0.3">
<bpmn:process id="WorkflowActionBB" name="WorkflowActionBB" isExecutable="true">
<bpmn:startEvent id="Start_WorkflowActionBB" name="start">
<bpmn:outgoing>SequenceFlow_15s0okp</bpmn:outgoing>
@@ -24,6 +24,8 @@
<camunda:in source="suppressRollback" target="suppressRollback" />
<camunda:out source="StatusMessage" target="StatusMessage" />
<camunda:in source="isRollback" target="isRollback" />
+ <camunda:in source="rollbackTargetState" target="rollbackTargetState" />
+ <camunda:out source="rollbackTargetState" target="rollbackTargetState" />
</bpmn:extensionElements>
<bpmn:incoming>SequenceFlow_0mew9im</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_1hsqed1</bpmn:outgoing>
@@ -44,7 +46,7 @@
<bpmn:outgoing>SequenceFlow_0l7kaba</bpmn:outgoing>
</bpmn:exclusiveGateway>
<bpmn:sequenceFlow id="SequenceFlow_1m2eezj" name="Completed = true" sourceRef="ExclusiveGateway_Finished" targetRef="ExclusiveGateway_isTopLevelFlowC">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("completed")==true&&execution.getVariable("isRollback")==false&&execution.getVariable("handlingCode")=="Success"}]]></bpmn:conditionExpression>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("completed")==true&amp;&amp;execution.getVariable("isRollback")==false&amp;&amp;execution.getVariable("handlingCode")=="Success"}</bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:serviceTask id="Task_RetrieveBBExectuionList" name="Retrieve BB Execution List" camunda:expression="${WorkflowAction.selectExecutionList(execution)}">
<bpmn:incoming>SequenceFlow_15s0okp</bpmn:incoming>
@@ -81,7 +83,7 @@
</bpmn:exclusiveGateway>
<bpmn:sequenceFlow id="SequenceFlow_024g0d1" name="no" sourceRef="ExclusiveGateway_10q79b6" targetRef="Task_UpdateDb" />
<bpmn:sequenceFlow id="SequenceFlow_0vi883o" name="yes" sourceRef="ExclusiveGateway_10q79b6" targetRef="Task_SendSyncAckError">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("isTopLevelFlow")==true&&execution.getVariable("sentSyncResponse")==false}]]></bpmn:conditionExpression>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("isTopLevelFlow")==true&amp;&amp;execution.getVariable("sentSyncResponse")==false}</bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:sequenceFlow id="SequenceFlow_0eana0l" sourceRef="Task_SendSyncAckError" targetRef="Task_UpdateDb" />
<bpmn:serviceTask id="Task_SendSyncAckError" name="Send Sync Ack API Handler" camunda:asyncAfter="true" camunda:expression="${WorkflowActionBBTasks.sendSyncAck(execution)}">
@@ -90,10 +92,10 @@
</bpmn:serviceTask>
</bpmn:subProcess>
<bpmn:sequenceFlow id="SequenceFlow_0v588sm" name="Rollback = true" sourceRef="ExclusiveGateway_Finished" targetRef="Task_RollbackExecutionPath">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("handlingCode")=="Rollback"||execution.getVariable("handlingCode")=="RollbackToAssigned"||execution.getVariable("handlingCode")=="RollbackToCreated"}]]></bpmn:conditionExpression>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("handlingCode")=="Rollback"||execution.getVariable("handlingCode")=="RollbackToAssigned"||execution.getVariable("handlingCode")=="RollbackToCreated"}</bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:sequenceFlow id="SequenceFlow_1atzsgn" sourceRef="Task_RollbackExecutionPath" targetRef="Task_SelectBB">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("isRollbackNeeded")==true}]]></bpmn:conditionExpression>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("isRollbackNeeded")==true}</bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:serviceTask id="Task_RollbackExecutionPath" name="Rollback Execution Path" camunda:expression="${WorkflowActionBBTasks.rollbackExecutionPath(execution)}">
<bpmn:incoming>SequenceFlow_0v588sm</bpmn:incoming>
@@ -102,7 +104,7 @@
</bpmn:serviceTask>
<bpmn:sequenceFlow id="SequenceFlow_0vc9go9" sourceRef="Task_RetrieveBBExectuionList" targetRef="ExclusiveGateway_isTopLevelFlow" />
<bpmn:sequenceFlow id="SequenceFlow_11530ei" name="Abort = true" sourceRef="ExclusiveGateway_Finished" targetRef="ExclusiveGateway_isTopLevelFlowAbort">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("handlingCode")=="Abort"}]]></bpmn:conditionExpression>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("handlingCode")=="Abort"}</bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:serviceTask id="Task_AbortAndCallErrorHandling" name="Update Request To Failed" camunda:expression="${WorkflowActionBBFailure.updateRequestStatusToFailed(execution)}">
<bpmn:incoming>SequenceFlow_02ksbt0</bpmn:incoming>
@@ -126,7 +128,7 @@
</bpmn:exclusiveGateway>
<bpmn:sequenceFlow id="SequenceFlow_0sckerv" name="yes" sourceRef="ExclusiveGateway_isTopLevelFlow" targetRef="Task_SendSync" />
<bpmn:sequenceFlow id="SequenceFlow_0unbew4" name="no" sourceRef="ExclusiveGateway_isTopLevelFlow" targetRef="Task_PreValidateWorkflow">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("isTopLevelFlow")==false}]]></bpmn:conditionExpression>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("isTopLevelFlow")==false}</bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:exclusiveGateway id="ExclusiveGateway_isTopLevelFlowAbort" name="Is Top-Level Flow?" default="SequenceFlow_02ksbt0">
<bpmn:incoming>SequenceFlow_11530ei</bpmn:incoming>
@@ -135,7 +137,7 @@
</bpmn:exclusiveGateway>
<bpmn:sequenceFlow id="SequenceFlow_02ksbt0" name="yes" sourceRef="ExclusiveGateway_isTopLevelFlowAbort" targetRef="Task_AbortAndCallErrorHandling" />
<bpmn:sequenceFlow id="SequenceFlow_1r570x3" name="no" sourceRef="ExclusiveGateway_isTopLevelFlowAbort" targetRef="EndEvent_0lzz1ya">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("isTopLevelFlow")==false}]]></bpmn:conditionExpression>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("isTopLevelFlow")==false}</bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:exclusiveGateway id="ExclusiveGateway_isTopLevelFlowC" name="Is Top-Level Flow?" default="SequenceFlow_0kf5sen">
<bpmn:incoming>SequenceFlow_1m2eezj</bpmn:incoming>
@@ -143,13 +145,13 @@
<bpmn:outgoing>SequenceFlow_0kf5sen</bpmn:outgoing>
</bpmn:exclusiveGateway>
<bpmn:sequenceFlow id="SequenceFlow_0x4urgp" name="no" sourceRef="ExclusiveGateway_isTopLevelFlowC" targetRef="End_WorkflowActionBB">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("isTopLevelFlow")==false}]]></bpmn:conditionExpression>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("isTopLevelFlow")==false}</bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:endEvent id="End_RollbackFailed" name="end">
<bpmn:incoming>SequenceFlow_1ui67mc</bpmn:incoming>
</bpmn:endEvent>
<bpmn:sequenceFlow id="SequenceFlow_11dlyzt" name="Rollback Not Needed" sourceRef="Task_RollbackExecutionPath" targetRef="Task_UpdateRequestToFailed">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("isRollbackNeeded")==false}]]></bpmn:conditionExpression>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("isRollbackNeeded")==false}</bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:serviceTask id="Task_UpdateRequestToFailed" name="Update Request To Failed" camunda:expression="${WorkflowActionBBFailure.updateRequestStatusToFailedWithRollback(execution)}">
<bpmn:incoming>SequenceFlow_11dlyzt</bpmn:incoming>
@@ -157,7 +159,7 @@
<bpmn:outgoing>SequenceFlow_1ui67mc</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:sequenceFlow id="SequenceFlow_0l7kaba" name="Rollback Completed" sourceRef="ExclusiveGateway_Finished" targetRef="Task_UpdateRequestToFailed">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("completed")==true&&execution.getVariable("isRollback")==true&&execution.getVariable("handlingCode")=="Success"}]]></bpmn:conditionExpression>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("completed")==true&amp;&amp;execution.getVariable("isRollback")==true&amp;&amp;execution.getVariable("handlingCode")=="Success"}</bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:sequenceFlow id="SequenceFlow_1ui67mc" sourceRef="Task_UpdateRequestToFailed" targetRef="End_RollbackFailed" />
<bpmn:subProcess id="SubProcess_0fuugr9" name="Java Exception Handling Sub Process" triggeredByEvent="true">
@@ -211,8 +213,8 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_15s0okp_di" bpmnElement="SequenceFlow_15s0okp">
- <di:waypoint xsi:type="dc:Point" x="-398" y="120" />
- <di:waypoint xsi:type="dc:Point" x="-365" y="120" />
+ <di:waypoint x="-398" y="120" />
+ <di:waypoint x="-365" y="120" />
<bpmndi:BPMNLabel>
<dc:Bounds x="-381" y="99" width="0" height="0" />
</bpmndi:BPMNLabel>
@@ -221,8 +223,8 @@
<dc:Bounds x="560" y="80" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0mqrkxv_di" bpmnElement="SequenceFlow_0mqrkxv">
- <di:waypoint xsi:type="dc:Point" x="339" y="120" />
- <di:waypoint xsi:type="dc:Point" x="400" y="120" />
+ <di:waypoint x="339" y="120" />
+ <di:waypoint x="400" y="120" />
<bpmndi:BPMNLabel>
<dc:Bounds x="324.5" y="105" width="90" height="0" />
</bpmndi:BPMNLabel>
@@ -237,9 +239,9 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1m2eezj_di" bpmnElement="SequenceFlow_1m2eezj">
- <di:waypoint xsi:type="dc:Point" x="949" y="132" />
- <di:waypoint xsi:type="dc:Point" x="980" y="165" />
- <di:waypoint xsi:type="dc:Point" x="1060" y="165" />
+ <di:waypoint x="949" y="132" />
+ <di:waypoint x="980" y="165" />
+ <di:waypoint x="1060" y="165" />
<bpmndi:BPMNLabel>
<dc:Bounds x="968" y="168" width="83" height="12" />
</bpmndi:BPMNLabel>
@@ -254,9 +256,9 @@
<dc:Bounds x="1161" y="206" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1pz6edz_di" bpmnElement="SequenceFlow_1pz6edz">
- <di:waypoint xsi:type="dc:Point" x="1261" y="246" />
- <di:waypoint xsi:type="dc:Point" x="1322" y="246" />
- <di:waypoint xsi:type="dc:Point" x="1322" y="183" />
+ <di:waypoint x="1261" y="246" />
+ <di:waypoint x="1322" y="246" />
+ <di:waypoint x="1322" y="183" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1247" y="231" width="90" height="0" />
</bpmndi:BPMNLabel>
@@ -277,16 +279,16 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0v588sm_di" bpmnElement="SequenceFlow_0v588sm">
- <di:waypoint xsi:type="dc:Point" x="936" y="145" />
- <di:waypoint xsi:type="dc:Point" x="936" y="262" />
- <di:waypoint xsi:type="dc:Point" x="339" y="262" />
+ <di:waypoint x="936" y="145" />
+ <di:waypoint x="936" y="262" />
+ <di:waypoint x="339" y="262" />
<bpmndi:BPMNLabel>
<dc:Bounds x="769.202380952381" y="272" width="73" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1atzsgn_di" bpmnElement="SequenceFlow_1atzsgn">
- <di:waypoint xsi:type="dc:Point" x="289" y="222" />
- <di:waypoint xsi:type="dc:Point" x="289" y="160" />
+ <di:waypoint x="289" y="222" />
+ <di:waypoint x="289" y="160" />
<bpmndi:BPMNLabel>
<dc:Bounds x="259" y="191" width="90" height="0" />
</bpmndi:BPMNLabel>
@@ -295,16 +297,16 @@
<dc:Bounds x="239" y="222" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0vc9go9_di" bpmnElement="SequenceFlow_0vc9go9">
- <di:waypoint xsi:type="dc:Point" x="-265" y="120" />
- <di:waypoint xsi:type="dc:Point" x="-228" y="120" />
+ <di:waypoint x="-265" y="120" />
+ <di:waypoint x="-228" y="120" />
<bpmndi:BPMNLabel>
<dc:Bounds x="-246" y="105" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_11530ei_di" bpmnElement="SequenceFlow_11530ei">
- <di:waypoint xsi:type="dc:Point" x="946" y="105" />
- <di:waypoint xsi:type="dc:Point" x="983" y="44" />
- <di:waypoint xsi:type="dc:Point" x="1060" y="45" />
+ <di:waypoint x="946" y="105" />
+ <di:waypoint x="983" y="44" />
+ <di:waypoint x="1060" y="45" />
<bpmndi:BPMNLabel>
<dc:Bounds x="975" y="17" width="58" height="12" />
</bpmndi:BPMNLabel>
@@ -319,28 +321,28 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1p8yxu6_di" bpmnElement="SequenceFlow_1p8yxu6">
- <di:waypoint xsi:type="dc:Point" x="1276" y="-36" />
- <di:waypoint xsi:type="dc:Point" x="1359" y="-36" />
- <di:waypoint xsi:type="dc:Point" x="1359" y="45" />
- <di:waypoint xsi:type="dc:Point" x="1386" y="45" />
+ <di:waypoint x="1276" y="-36" />
+ <di:waypoint x="1359" y="-36" />
+ <di:waypoint x="1359" y="45" />
+ <di:waypoint x="1386" y="45" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1329" y="5" width="90" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1wb59ic_di" bpmnElement="SequenceFlow_1wb59ic">
- <di:waypoint xsi:type="dc:Point" x="-32" y="34" />
- <di:waypoint xsi:type="dc:Point" x="32" y="34" />
- <di:waypoint xsi:type="dc:Point" x="32" y="120" />
- <di:waypoint xsi:type="dc:Point" x="80" y="120" />
+ <di:waypoint x="-32" y="34" />
+ <di:waypoint x="32" y="34" />
+ <di:waypoint x="32" y="120" />
+ <di:waypoint x="80" y="120" />
<bpmndi:BPMNLabel>
<dc:Bounds x="47" y="77" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_01j184u_di" bpmnElement="SequenceFlow_01j184u">
- <di:waypoint xsi:type="dc:Point" x="936" y="95" />
- <di:waypoint xsi:type="dc:Point" x="936" y="55" />
- <di:waypoint xsi:type="dc:Point" x="936" y="55" />
- <di:waypoint xsi:type="dc:Point" x="936" y="4" />
+ <di:waypoint x="936" y="95" />
+ <di:waypoint x="936" y="55" />
+ <di:waypoint x="936" y="55" />
+ <di:waypoint x="936" y="4" />
<bpmndi:BPMNLabel>
<dc:Bounds x="906" y="49" width="90" height="0" />
</bpmndi:BPMNLabel>
@@ -355,16 +357,16 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0sckerv_di" bpmnElement="SequenceFlow_0sckerv">
- <di:waypoint xsi:type="dc:Point" x="-202" y="96" />
- <di:waypoint xsi:type="dc:Point" x="-202" y="34" />
- <di:waypoint xsi:type="dc:Point" x="-132" y="34" />
+ <di:waypoint x="-202" y="96" />
+ <di:waypoint x="-202" y="34" />
+ <di:waypoint x="-132" y="34" />
<bpmndi:BPMNLabel>
<dc:Bounds x="-195" y="55.55555555555556" width="18" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0unbew4_di" bpmnElement="SequenceFlow_0unbew4">
- <di:waypoint xsi:type="dc:Point" x="-178" y="120" />
- <di:waypoint xsi:type="dc:Point" x="80" y="120" />
+ <di:waypoint x="-178" y="120" />
+ <di:waypoint x="80" y="120" />
<bpmndi:BPMNLabel>
<dc:Bounds x="-87" y="99.95468180757382" width="12" height="12" />
</bpmndi:BPMNLabel>
@@ -376,16 +378,16 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_02ksbt0_di" bpmnElement="SequenceFlow_02ksbt0">
- <di:waypoint xsi:type="dc:Point" x="1085" y="20" />
- <di:waypoint xsi:type="dc:Point" x="1085" y="-37" />
- <di:waypoint xsi:type="dc:Point" x="1176" y="-37" />
+ <di:waypoint x="1085" y="20" />
+ <di:waypoint x="1085" y="-37" />
+ <di:waypoint x="1176" y="-37" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1091" y="-8" width="19" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1r570x3_di" bpmnElement="SequenceFlow_1r570x3">
- <di:waypoint xsi:type="dc:Point" x="1110" y="45" />
- <di:waypoint xsi:type="dc:Point" x="1386" y="45" />
+ <di:waypoint x="1110" y="45" />
+ <di:waypoint x="1386" y="45" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1242" y="20" width="12" height="12" />
</bpmndi:BPMNLabel>
@@ -397,10 +399,10 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0x4urgp_di" bpmnElement="SequenceFlow_0x4urgp">
- <di:waypoint xsi:type="dc:Point" x="1110" y="165" />
- <di:waypoint xsi:type="dc:Point" x="1220" y="165" />
- <di:waypoint xsi:type="dc:Point" x="1220" y="165" />
- <di:waypoint xsi:type="dc:Point" x="1304" y="165" />
+ <di:waypoint x="1110" y="165" />
+ <di:waypoint x="1220" y="165" />
+ <di:waypoint x="1220" y="165" />
+ <di:waypoint x="1304" y="165" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1256" y="140" width="12" height="12" />
</bpmndi:BPMNLabel>
@@ -412,9 +414,9 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_11dlyzt_di" bpmnElement="SequenceFlow_11dlyzt">
- <di:waypoint xsi:type="dc:Point" x="289" y="302" />
- <di:waypoint xsi:type="dc:Point" x="289" y="368" />
- <di:waypoint xsi:type="dc:Point" x="960" y="368" />
+ <di:waypoint x="289" y="302" />
+ <di:waypoint x="289" y="368" />
+ <di:waypoint x="960" y="368" />
<bpmndi:BPMNLabel>
<dc:Bounds x="381.45685840707966" y="325" width="63" height="24" />
</bpmndi:BPMNLabel>
@@ -426,33 +428,33 @@
<dc:Bounds x="960" y="325" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0l7kaba_di" bpmnElement="SequenceFlow_0l7kaba">
- <di:waypoint xsi:type="dc:Point" x="942" y="139" />
- <di:waypoint xsi:type="dc:Point" x="976" y="252" />
- <di:waypoint xsi:type="dc:Point" x="1016" y="252" />
- <di:waypoint xsi:type="dc:Point" x="1016" y="325" />
+ <di:waypoint x="942" y="139" />
+ <di:waypoint x="976" y="252" />
+ <di:waypoint x="1016" y="252" />
+ <di:waypoint x="1016" y="325" />
<bpmndi:BPMNLabel>
<dc:Bounds x="959" y="255" width="52" height="24" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1edjl5x_di" bpmnElement="SequenceFlow_1edjl5x">
- <di:waypoint xsi:type="dc:Point" x="556" y="657" />
- <di:waypoint xsi:type="dc:Point" x="602" y="657" />
+ <di:waypoint x="556" y="657" />
+ <di:waypoint x="602" y="657" />
<bpmndi:BPMNLabel>
<dc:Bounds x="534" y="636" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0wvzfgf_di" bpmnElement="SequenceFlow_0wvzfgf">
- <di:waypoint xsi:type="dc:Point" x="813" y="657" />
- <di:waypoint xsi:type="dc:Point" x="880" y="657" />
+ <di:waypoint x="813" y="657" />
+ <di:waypoint x="880" y="657" />
<bpmndi:BPMNLabel>
<dc:Bounds x="801.5" y="636" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1ui67mc_di" bpmnElement="SequenceFlow_1ui67mc">
- <di:waypoint xsi:type="dc:Point" x="1060" y="365" />
- <di:waypoint xsi:type="dc:Point" x="1134" y="365" />
- <di:waypoint xsi:type="dc:Point" x="1134" y="365" />
- <di:waypoint xsi:type="dc:Point" x="1159" y="365" />
+ <di:waypoint x="1060" y="365" />
+ <di:waypoint x="1134" y="365" />
+ <di:waypoint x="1134" y="365" />
+ <di:waypoint x="1159" y="365" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1104" y="359" width="90" height="13" />
</bpmndi:BPMNLabel>
@@ -464,25 +466,25 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_024g0d1_di" bpmnElement="SequenceFlow_024g0d1">
- <di:waypoint xsi:type="dc:Point" x="652" y="657" />
- <di:waypoint xsi:type="dc:Point" x="683" y="657" />
- <di:waypoint xsi:type="dc:Point" x="683" y="657" />
- <di:waypoint xsi:type="dc:Point" x="713" y="657" />
+ <di:waypoint x="652" y="657" />
+ <di:waypoint x="683" y="657" />
+ <di:waypoint x="683" y="657" />
+ <di:waypoint x="713" y="657" />
<bpmndi:BPMNLabel>
<dc:Bounds x="677" y="634" width="12" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0vi883o_di" bpmnElement="SequenceFlow_0vi883o">
- <di:waypoint xsi:type="dc:Point" x="627" y="632" />
- <di:waypoint xsi:type="dc:Point" x="627" y="548" />
- <di:waypoint xsi:type="dc:Point" x="713" y="548" />
+ <di:waypoint x="627" y="632" />
+ <di:waypoint x="627" y="548" />
+ <di:waypoint x="713" y="548" />
<bpmndi:BPMNLabel>
<dc:Bounds x="633" y="584" width="18" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0eana0l_di" bpmnElement="SequenceFlow_0eana0l">
- <di:waypoint xsi:type="dc:Point" x="763" y="588" />
- <di:waypoint xsi:type="dc:Point" x="763" y="617" />
+ <di:waypoint x="763" y="588" />
+ <di:waypoint x="763" y="617" />
<bpmndi:BPMNLabel>
<dc:Bounds x="778" y="596.5" width="0" height="12" />
</bpmndi:BPMNLabel>
@@ -509,15 +511,15 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_11d126w_di" bpmnElement="SequenceFlow_11d126w">
- <di:waypoint xsi:type="dc:Point" x="606" y="875" />
- <di:waypoint xsi:type="dc:Point" x="690" y="875" />
+ <di:waypoint x="606" y="875" />
+ <di:waypoint x="690" y="875" />
<bpmndi:BPMNLabel>
<dc:Bounds x="603" y="854" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0w4sx88_di" bpmnElement="SequenceFlow_0w4sx88">
- <di:waypoint xsi:type="dc:Point" x="790" y="875" />
- <di:waypoint xsi:type="dc:Point" x="856" y="875" />
+ <di:waypoint x="790" y="875" />
+ <di:waypoint x="856" y="875" />
<bpmndi:BPMNLabel>
<dc:Bounds x="778" y="854" width="0" height="12" />
</bpmndi:BPMNLabel>
@@ -526,25 +528,25 @@
<dc:Bounds x="400" y="80" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0mew9im_di" bpmnElement="SequenceFlow_0mew9im">
- <di:waypoint xsi:type="dc:Point" x="500" y="120" />
- <di:waypoint xsi:type="dc:Point" x="560" y="120" />
+ <di:waypoint x="500" y="120" />
+ <di:waypoint x="560" y="120" />
<bpmndi:BPMNLabel>
<dc:Bounds x="530" y="99" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0kf5sen_di" bpmnElement="SequenceFlow_0kf5sen">
- <di:waypoint xsi:type="dc:Point" x="1085" y="190" />
- <di:waypoint xsi:type="dc:Point" x="1085" y="246" />
- <di:waypoint xsi:type="dc:Point" x="1161" y="246" />
+ <di:waypoint x="1085" y="190" />
+ <di:waypoint x="1085" y="246" />
+ <di:waypoint x="1161" y="246" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1091" y="218" width="19" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1tfizxf_di" bpmnElement="SequenceFlow_1tfizxf">
- <di:waypoint xsi:type="dc:Point" x="180" y="120" />
- <di:waypoint xsi:type="dc:Point" x="211" y="120" />
- <di:waypoint xsi:type="dc:Point" x="211" y="120" />
- <di:waypoint xsi:type="dc:Point" x="239" y="120" />
+ <di:waypoint x="180" y="120" />
+ <di:waypoint x="211" y="120" />
+ <di:waypoint x="211" y="120" />
+ <di:waypoint x="239" y="120" />
<bpmndi:BPMNLabel>
<dc:Bounds x="226" y="120" width="0" height="0" />
</bpmndi:BPMNLabel>
@@ -556,23 +558,23 @@
<dc:Bounds x="735" y="80" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1hsqed1_di" bpmnElement="SequenceFlow_1hsqed1">
- <di:waypoint xsi:type="dc:Point" x="660" y="120" />
- <di:waypoint xsi:type="dc:Point" x="735" y="120" />
+ <di:waypoint x="660" y="120" />
+ <di:waypoint x="735" y="120" />
<bpmndi:BPMNLabel>
<dc:Bounds x="697.5" y="99" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1fftixk_di" bpmnElement="SequenceFlow_1fftixk">
- <di:waypoint xsi:type="dc:Point" x="835" y="120" />
- <di:waypoint xsi:type="dc:Point" x="911" y="120" />
+ <di:waypoint x="835" y="120" />
+ <di:waypoint x="911" y="120" />
<bpmndi:BPMNLabel>
<dc:Bounds x="873" y="99" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1pnkpim_di" bpmnElement="SequenceFlow_1pnkpim">
- <di:waypoint xsi:type="dc:Point" x="886" y="-36" />
- <di:waypoint xsi:type="dc:Point" x="289" y="-36" />
- <di:waypoint xsi:type="dc:Point" x="289" y="80" />
+ <di:waypoint x="886" y="-36" />
+ <di:waypoint x="289" y="-36" />
+ <di:waypoint x="289" y="80" />
<bpmndi:BPMNLabel>
<dc:Bounds x="587.5" y="-57" width="0" height="12" />
</bpmndi:BPMNLabel>
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java
index 67dc9fec26..2d3f5de616 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java
@@ -26,6 +26,7 @@ import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.onap.so.bpmn.core.WorkflowException;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
+import org.onap.so.constants.Status;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
import org.slf4j.Logger;
@@ -37,6 +38,7 @@ import org.springframework.stereotype.Component;
public class WorkflowActionBBFailure {
private static final Logger logger = LoggerFactory.getLogger(WorkflowActionBBFailure.class);
+ public static final String ROLLBACK_TARGET_STATE = "rollbackTargetState";
@Autowired
private RequestsDbClient requestDbclient;
@Autowired
@@ -89,6 +91,8 @@ public class WorkflowActionBBFailure {
rollbackErrorMsg = "Rollback has been completed successfully.";
request.setRollbackStatusMessage(rollbackErrorMsg);
execution.setVariable("RollbackErrorMessage", rollbackErrorMsg);
+ String rollbackTargetState = (String) execution.getVariable(ROLLBACK_TARGET_STATE);
+ request.setRequestStatus(rollbackTargetState);
} else if (isRollbackFailure) {
Optional<String> rollbackErrorMsgOp = retrieveErrorMessage(execution);
if (rollbackErrorMsgOp.isPresent()) {
@@ -98,6 +102,7 @@ public class WorkflowActionBBFailure {
}
request.setRollbackStatusMessage(rollbackErrorMsg);
execution.setVariable("RollbackErrorMessage", rollbackErrorMsg);
+ request.setRequestStatus(Status.FAILED.toString());
} else {
Optional<String> errorMsgOp = retrieveErrorMessage(execution);
if (errorMsgOp.isPresent()) {
@@ -107,6 +112,12 @@ public class WorkflowActionBBFailure {
}
request.setStatusMessage(errorMsg);
execution.setVariable("ErrorMessage", errorMsg);
+ String handlingCode = (String) execution.getVariable("handlingCode");
+ if ("Abort".equalsIgnoreCase(handlingCode)) {
+ request.setRequestStatus(Status.ABORTED.toString());
+ } else {
+ request.setRequestStatus(Status.FAILED.toString());
+ }
}
if (ebb != null && ebb.getBuildingBlock() != null) {
String flowStatus = "";
@@ -120,7 +131,6 @@ public class WorkflowActionBBFailure {
}
request.setProgress(Long.valueOf(100));
- request.setRequestStatus("FAILED");
request.setLastModifiedBy("CamundaBPMN");
request.setEndTime(new Timestamp(System.currentTimeMillis()));
requestDbclient.updateInfraActiveRequests(request);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailureTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailureTest.java
index 12f34eaddf..2d48d02774 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailureTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailureTest.java
@@ -41,6 +41,7 @@ import org.mockito.Spy;
import org.onap.so.bpmn.BaseTaskTest;
import org.onap.so.bpmn.core.WorkflowException;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
+import org.onap.so.constants.Status;
import org.onap.so.db.request.beans.InfraActiveRequests;
public class WorkflowActionBBFailureTest extends BaseTaskTest {
@@ -102,6 +103,24 @@ public class WorkflowActionBBFailureTest extends BaseTaskTest {
workflowActionBBFailure.updateRequestStatusToFailed(execution);
String errorMsg = (String) execution.getVariable("ErrorMessage");
assertEquals("error in test case", errorMsg);
+ assertEquals(Status.FAILED.toString(), req.getRequestStatus());
+ }
+
+ @Test
+ public void updateRequestStatusToAborted() {
+ execution.setVariable("mso-request-id", "123");
+ execution.setVariable("isRollbackComplete", false);
+ execution.setVariable("isRollback", false);
+ execution.setVariable("handlingCode", "Abort");
+ InfraActiveRequests req = new InfraActiveRequests();
+ WorkflowException wfe = new WorkflowException("processKey123", 1, "error in test case");
+ execution.setVariable("WorkflowException", wfe);
+ doReturn(req).when(requestsDbClient).getInfraActiveRequestbyRequestId("123");
+ doNothing().when(requestsDbClient).updateInfraActiveRequests(isA(InfraActiveRequests.class));
+ workflowActionBBFailure.updateRequestStatusToFailed(execution);
+ String errorMsg = (String) execution.getVariable("ErrorMessage");
+ assertEquals("error in test case", errorMsg);
+ assertEquals(Status.ABORTED.toString(), req.getRequestStatus());
}
@Test
@@ -117,19 +136,52 @@ public class WorkflowActionBBFailureTest extends BaseTaskTest {
workflowActionBBFailure.updateRequestStatusToFailed(execution);
String errorMsg = (String) execution.getVariable("RollbackErrorMessage");
assertEquals("error in rollback", errorMsg);
+ assertEquals(Status.FAILED.toString(), req.getRequestStatus());
+ }
+
+ @Test
+ public void updateRequestStatusToRolledback() {
+ execution.setVariable("mso-request-id", "123");
+ execution.setVariable("isRollbackComplete", true);
+ execution.setVariable("isRollback", true);
+ execution.setVariable("rollbackTargetState", "ROLLED_BACK");
+ InfraActiveRequests req = new InfraActiveRequests();
+ doReturn(req).when(requestsDbClient).getInfraActiveRequestbyRequestId("123");
+ doNothing().when(requestsDbClient).updateInfraActiveRequests(isA(InfraActiveRequests.class));
+ workflowActionBBFailure.updateRequestStatusToFailed(execution);
+ String errorMsg = (String) execution.getVariable("RollbackErrorMessage");
+ assertEquals("Rollback has been completed successfully.", errorMsg);
+ assertEquals(Status.ROLLED_BACK.toString(), req.getRequestStatus());
+ }
+
+ @Test
+ public void updateRequestStatusToRolledbackToAssigned() {
+ execution.setVariable("mso-request-id", "123");
+ execution.setVariable("isRollbackComplete", true);
+ execution.setVariable("isRollback", true);
+ execution.setVariable("rollbackTargetState", "ROLLED_BACK_TO_ASSIGNED");
+ InfraActiveRequests req = new InfraActiveRequests();
+ doReturn(req).when(requestsDbClient).getInfraActiveRequestbyRequestId("123");
+ doNothing().when(requestsDbClient).updateInfraActiveRequests(isA(InfraActiveRequests.class));
+ workflowActionBBFailure.updateRequestStatusToFailed(execution);
+ String errorMsg = (String) execution.getVariable("RollbackErrorMessage");
+ assertEquals("Rollback has been completed successfully.", errorMsg);
+ assertEquals(Status.ROLLED_BACK_TO_ASSIGNED.toString(), req.getRequestStatus());
}
@Test
- public void updateRequestStatusToFailedRollbackCompleted() {
+ public void updateRequestStatusToRolledbackToCreated() {
execution.setVariable("mso-request-id", "123");
execution.setVariable("isRollbackComplete", true);
execution.setVariable("isRollback", true);
+ execution.setVariable("rollbackTargetState", "ROLLED_BACK_TO_CREATED");
InfraActiveRequests req = new InfraActiveRequests();
doReturn(req).when(requestsDbClient).getInfraActiveRequestbyRequestId("123");
doNothing().when(requestsDbClient).updateInfraActiveRequests(isA(InfraActiveRequests.class));
workflowActionBBFailure.updateRequestStatusToFailed(execution);
String errorMsg = (String) execution.getVariable("RollbackErrorMessage");
assertEquals("Rollback has been completed successfully.", errorMsg);
+ assertEquals(Status.ROLLED_BACK_TO_CREATED.toString(), req.getRequestStatus());
}
@Test