summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin, Max (mb388a) <mb388a@us.att.com>2018-08-23 08:48:58 -0400
committerBenjamin, Max (mb388a) <mb388a@us.att.com>2018-08-23 08:49:17 -0400
commit4db25ff7b585c21f14e1acb306aec752bd362610 (patch)
treefdd50bf5b0c28b5b569cb95a6e9e122a0ed24f45
parentbb6310f30287b352ad941ecc97aeb278a327d595 (diff)
write update status of BBs progress
added in the missing bpmn file change add implementation to update status of BBs progress Change-Id: If913b4e4da2a548e7b5660be947721cb17c60d3f Issue-ID: SO-890 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn101
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java39
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java27
4 files changed, 128 insertions, 43 deletions
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 6544387775..13dad149cd 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="1.10.0">
<bpmn:process id="WorkflowActionBB" name="WorkflowActionBB" isExecutable="true">
<bpmn:startEvent id="Start_WorkflowActionBB" name="start">
<bpmn:outgoing>SequenceFlow_15s0okp</bpmn:outgoing>
@@ -18,10 +18,10 @@
<camunda:in source="retryCount" target="retryCount" />
<camunda:out source="WorkflowExceptionErrorMessage" target="WorkflowExceptionErrorMessage" />
</bpmn:extensionElements>
- <bpmn:incoming>SequenceFlow_0mqrkxv</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_0mew9im</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_07h9d4y</bpmn:outgoing>
</bpmn:callActivity>
- <bpmn:sequenceFlow id="SequenceFlow_0mqrkxv" sourceRef="Task_SelectBB" targetRef="Call_ExecuteBB" />
+ <bpmn:sequenceFlow id="SequenceFlow_0mqrkxv" sourceRef="Task_SelectBB" targetRef="ServiceTask_0e2p0xs" />
<bpmn:serviceTask id="Task_SelectBB" name="Select BB" camunda:expression="${WorkflowActionBBTasks.selectBB(execution)}">
<bpmn:incoming>SequenceFlow_1atzsgn</bpmn:incoming>
<bpmn:incoming>SequenceFlow_1wb59ic</bpmn:incoming>
@@ -185,14 +185,19 @@
<bpmn:sequenceFlow id="SequenceFlow_11d126w" sourceRef="StartEvent_runtimeError" targetRef="ServiceTask_HandleRuntimeError" />
<bpmn:sequenceFlow id="SequenceFlow_0w4sx88" sourceRef="ServiceTask_HandleRuntimeError" targetRef="EndEvent__runtimeError" />
</bpmn:subProcess>
+ <bpmn:serviceTask id="ServiceTask_0e2p0xs" name="Update Flow Statistics" camunda:expression="${WorkflowActionBBTasks.updateFlowStatistics(execution)}">
+ <bpmn:incoming>SequenceFlow_0mqrkxv</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0mew9im</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0mew9im" sourceRef="ServiceTask_0e2p0xs" targetRef="Call_ExecuteBB" />
</bpmn:process>
<bpmn:error id="Error_0kd2o2a" name="java.lang.Exception" errorCode="java.lang.Exception" />
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="WorkflowActionBB">
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="Start_WorkflowActionBB">
- <dc:Bounds x="-52" y="102" width="36" height="36" />
+ <dc:Bounds x="-241" y="102" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="-45" y="138" width="22" height="12" />
+ <dc:Bounds x="-234" y="138" width="23" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="EndEvent_1uv6erv_di" bpmnElement="End_WorkflowActionBB">
@@ -202,24 +207,24 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_15s0okp_di" bpmnElement="SequenceFlow_15s0okp">
- <di:waypoint xsi:type="dc:Point" x="-16" y="120" />
- <di:waypoint xsi:type="dc:Point" x="17" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="-205" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="-172" y="120" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="-44.5" y="98.5" width="90" height="13" />
+ <dc:Bounds x="-233" y="99" width="90" height="13" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="CallActivity_03m7z4y_di" bpmnElement="Call_ExecuteBB">
<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="528" y="120" />
- <di:waypoint xsi:type="dc:Point" x="560" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="339" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="400" y="120" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="544" y="99" width="0" height="0" />
+ <dc:Bounds x="324.5" y="105" width="90" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ServiceTask_1snenqk_di" bpmnElement="Task_SelectBB">
- <dc:Bounds x="428" y="80" width="100" height="80" />
+ <dc:Bounds x="239" y="80" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ExclusiveGateway_0m1zt0q_di" bpmnElement="ExclusiveGateway_Finished" isMarkerVisible="true">
<dc:Bounds x="692" y="95" width="50" height="50" />
@@ -243,10 +248,10 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ServiceTask_0kn8jt8_di" bpmnElement="Task_RetrieveBBExectuionList">
- <dc:Bounds x="17" y="80" width="100" height="80" />
+ <dc:Bounds x="-172" y="80" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_0654g3m_di" bpmnElement="Task_SendSync">
- <dc:Bounds x="235" y="-7" width="100" height="80" />
+ <dc:Bounds x="46" y="-7" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_0wzh11j_di" bpmnElement="Task_SetupCompleteMsoProcess">
<dc:Bounds x="900" y="210" width="100" height="80" />
@@ -288,26 +293,26 @@
<bpmndi:BPMNEdge id="SequenceFlow_0v588sm_di" bpmnElement="SequenceFlow_0v588sm">
<di:waypoint xsi:type="dc:Point" x="717" y="145" />
<di:waypoint xsi:type="dc:Point" x="717" y="262" />
- <di:waypoint xsi:type="dc:Point" x="528" y="262" />
+ <di:waypoint xsi:type="dc:Point" x="339" y="262" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="638.5121951219512" y="272" width="74" height="13" />
+ <dc:Bounds x="597.5" 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="478" y="222" />
- <di:waypoint xsi:type="dc:Point" x="478" y="160" />
+ <di:waypoint xsi:type="dc:Point" x="289" y="222" />
+ <di:waypoint xsi:type="dc:Point" x="289" y="160" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="448" y="191" width="90" height="0" />
+ <dc:Bounds x="259" y="191" width="90" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ServiceTask_19t1oyr_di" bpmnElement="Task_RollbackExecutionPath">
- <dc:Bounds x="428" y="222" width="100" height="80" />
+ <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="117" y="120" />
- <di:waypoint xsi:type="dc:Point" x="150" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="-72" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="-39" y="120" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="134" y="105" width="0" height="0" />
+ <dc:Bounds x="-100" y="105" width="90" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_11530ei_di" bpmnElement="SequenceFlow_11530ei">
@@ -337,12 +342,12 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1wb59ic_di" bpmnElement="SequenceFlow_1wb59ic">
- <di:waypoint xsi:type="dc:Point" x="335" y="33" />
- <di:waypoint xsi:type="dc:Point" x="382" y="33" />
- <di:waypoint xsi:type="dc:Point" x="382" y="120" />
- <di:waypoint xsi:type="dc:Point" x="428" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="146" y="33" />
+ <di:waypoint xsi:type="dc:Point" x="193" y="33" />
+ <di:waypoint xsi:type="dc:Point" x="193" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="239" y="120" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="397" y="76.5" width="0" height="0" />
+ <dc:Bounds x="163" y="77" width="90" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_01j184u_di" bpmnElement="SequenceFlow_01j184u">
@@ -356,34 +361,34 @@
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_005hi8o_di" bpmnElement="SequenceFlow_005hi8o">
<di:waypoint xsi:type="dc:Point" x="667" y="-36" />
- <di:waypoint xsi:type="dc:Point" x="478" y="-36" />
- <di:waypoint xsi:type="dc:Point" x="478" y="80" />
+ <di:waypoint xsi:type="dc:Point" x="289" y="-36" />
+ <di:waypoint xsi:type="dc:Point" x="289" y="80" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="573" y="-57" width="0" height="0" />
+ <dc:Bounds x="433" y="-51" width="90" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ServiceTask_1c1v3p1_di" bpmnElement="Task_0a31dkf">
<dc:Bounds x="667" y="-76" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ExclusiveGateway_0ptb1yi_di" bpmnElement="ExclusiveGateway_isTopLevelFlow" isMarkerVisible="true">
- <dc:Bounds x="150" y="95" width="50" height="50" />
+ <dc:Bounds x="-39" y="95" width="50" height="50" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="144" y="145" width="61" height="24" />
+ <dc:Bounds x="-45" y="145" width="61" height="24" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0sckerv_di" bpmnElement="SequenceFlow_0sckerv">
- <di:waypoint xsi:type="dc:Point" x="176" y="96" />
- <di:waypoint xsi:type="dc:Point" x="176" y="33" />
- <di:waypoint xsi:type="dc:Point" x="235" y="33" />
+ <di:waypoint xsi:type="dc:Point" x="-13" y="96" />
+ <di:waypoint xsi:type="dc:Point" x="-13" y="33" />
+ <di:waypoint xsi:type="dc:Point" x="46" y="33" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="182" y="54.5" width="18" height="12" />
+ <dc:Bounds x="-7" y="55" width="19" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0unbew4_di" bpmnElement="SequenceFlow_0unbew4">
- <di:waypoint xsi:type="dc:Point" x="200" y="120" />
- <di:waypoint xsi:type="dc:Point" x="428" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="11" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="239" y="120" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="308" y="95" width="12" height="12" />
+ <dc:Bounds x="119" y="95" width="12" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ExclusiveGateway_001g41v_di" bpmnElement="ExclusiveGateway_isTopLevelFlowAbort" isMarkerVisible="true">
@@ -435,11 +440,11 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_11dlyzt_di" bpmnElement="SequenceFlow_11dlyzt">
- <di:waypoint xsi:type="dc:Point" x="478" y="302" />
- <di:waypoint xsi:type="dc:Point" x="478" y="368" />
+ <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="741" y="368" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="495" y="324.65" width="62" height="24" />
+ <dc:Bounds x="340.85361216730035" y="325" width="63" height="24" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ServiceTask_1h154rn_di" bpmnElement="Task_UpdateDb">
@@ -545,6 +550,16 @@
<dc:Bounds x="778" y="854" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_0e2p0xs_di" bpmnElement="ServiceTask_0e2p0xs">
+ <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" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="530" y="99" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
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 ee6af61d0f..101a355c2f 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
@@ -81,6 +81,45 @@ public class WorkflowActionBBTasks {
execution.setVariable(G_CURRENT_SEQUENCE, currentSequence);
}
}
+
+ public void updateFlowStatistics(DelegateExecution execution) {
+ int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE);
+ if(currentSequence > 1) {
+ InfraActiveRequests request = this.getUpdatedRequest(execution, currentSequence);
+ requestDbclient.updateInfraActiveRequests(request);
+ }
+ }
+
+ protected InfraActiveRequests getUpdatedRequest(DelegateExecution execution, int currentSequence) {
+ List<ExecuteBuildingBlock> flowsToExecute = (List<ExecuteBuildingBlock>) execution
+ .getVariable("flowsToExecute");
+ String requestId = (String) execution.getVariable(G_REQUEST_ID);
+ InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
+ ExecuteBuildingBlock completedBB = flowsToExecute.get(currentSequence - 2);
+ ExecuteBuildingBlock nextBB = flowsToExecute.get(currentSequence - 1);
+ int completedBBs = currentSequence - 1;
+ int totalBBs = flowsToExecute.size();
+ int remainingBBs = totalBBs - completedBBs;
+ String statusMessage = this.getStatusMessage(completedBB.getBuildingBlock().getBpmnFlowName(),
+ nextBB.getBuildingBlock().getBpmnFlowName(), completedBBs, remainingBBs);
+ Long percentProgress = this.getPercentProgress(completedBBs, totalBBs);
+ request.setStatusMessage(statusMessage);
+ request.setProgress(percentProgress);
+ request.setLastModifiedBy("CamundaBPMN");
+ return request;
+ }
+
+ protected Long getPercentProgress(int completedBBs, int totalBBs) {
+ double ratio = (completedBBs / (totalBBs * 1.0));
+ int percentProgress = (int) (ratio * 95);
+ return new Long(percentProgress + 5);
+ }
+
+ protected String getStatusMessage(String completedBB, String nextBB, int completedBBs, int remainingBBs) {
+ return "Execution of " + completedBB + " has completed successfully, next invoking " + nextBB
+ + " (Execution Path progress: BBs completed = " + completedBBs + "; BBs remaining = " + remainingBBs
+ + ").";
+ }
public void sendSyncAck(DelegateExecution execution) {
final String requestId = (String) execution.getVariable(G_REQUEST_ID);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java
index 501e64f4d4..87852e9922 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java
@@ -27,6 +27,7 @@ import org.onap.so.bpmn.infrastructure.flowspecific.tasks.AssignNetworkBBUtils;
import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetup;
import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils;
import org.onap.so.client.adapter.network.mapper.NetworkAdapterObjectMapper;
+import org.onap.so.client.db.request.RequestsDbClient;
import org.onap.so.client.orchestration.AAICollectionResources;
import org.onap.so.client.orchestration.AAIInstanceGroupResources;
import org.onap.so.client.orchestration.AAINetworkResources;
@@ -108,6 +109,9 @@ public abstract class BaseTaskTest extends TestDataSetup {
@MockBean
protected CatalogDbClient catalogDbClient;
+ @MockBean
+ protected RequestsDbClient requestsDbClient;
+
@Mock
protected BBInputSetupUtils bbSetupUtils;
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 d856b5e184..27173b7502 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
@@ -37,6 +37,7 @@ import org.junit.rules.ExpectedException;
import org.onap.so.bpmn.BaseTaskTest;
import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
+import org.onap.so.db.request.beans.InfraActiveRequests;
import org.springframework.beans.factory.annotation.Autowired;
public class WorkflowActionBBTasksTest extends BaseTaskTest {
@@ -80,6 +81,32 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
}
@Test
+ public void getUpdatedRequestTest() throws Exception{
+ List<ExecuteBuildingBlock> flowsToExecute = new ArrayList();
+ ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock();
+ BuildingBlock bb1 = new BuildingBlock();
+ bb1.setBpmnFlowName("CreateNetworkBB");
+ flowsToExecute.add(ebb1);
+ ebb1.setBuildingBlock(bb1);
+ ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock();
+ BuildingBlock bb2 = new BuildingBlock();
+ bb2.setBpmnFlowName("ActivateNetworkBB");
+ flowsToExecute.add(ebb2);
+ ebb2.setBuildingBlock(bb2);
+ String requestId = "requestId";
+ execution.setVariable("mso-request-id", requestId);
+ execution.setVariable("flowsToExecute", flowsToExecute);
+ int currentSequence = 2;
+ String expectedStatusMessage = "Execution of CreateNetworkBB has completed successfully, next invoking ActivateNetworkBB (Execution Path progress: BBs completed = 1; BBs remaining = 1).";
+ Long expectedLong = new Long(52);
+ InfraActiveRequests mockedRequest = new InfraActiveRequests();
+ when(requestsDbClient.getInfraActiveRequestbyRequestId(requestId)).thenReturn(mockedRequest);
+ InfraActiveRequests actual = workflowActionBBTasks.getUpdatedRequest(execution, currentSequence);
+ assertEquals(expectedStatusMessage, actual.getStatusMessage());
+ assertEquals(expectedLong, actual.getProgress());
+ }
+
+ @Test
public void select2BBTest() throws Exception{
String gAction = "Delete-Network-Collection";
execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");