summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSeshu Kumar M <seshu.kumar.m@huawei.com>2021-08-06 04:39:49 +0000
committerGerrit Code Review <gerrit@onap.org>2021-08-06 04:39:49 +0000
commita05a1eb8cbb0dd76d22a4c74d0b0c94752179b97 (patch)
treeefaa1f334b3f8cd6568eb4b309651f5919cc3e26
parente159a45c79b2cc532cf2456e50ac6d6159f79f73 (diff)
parentaced60c11508e1267580492b95372f0b088e2ad9 (diff)
Merge "Enable WorkflowActionBB to skip last building block"
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/FlowManipulatorListenerRunner.java3
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn53
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java19
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java2
4 files changed, 57 insertions, 20 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/FlowManipulatorListenerRunner.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/FlowManipulatorListenerRunner.java
index 054cc378ef..c6d92cc9ab 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/FlowManipulatorListenerRunner.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/FlowManipulatorListenerRunner.java
@@ -60,6 +60,9 @@ public class FlowManipulatorListenerRunner extends ListenerRunner {
int sequenceBeforeFlowManipulator;
do {
sequenceBeforeFlowManipulator = execution.getVariable(BBConstants.G_CURRENT_SEQUENCE);
+ if (sequenceBeforeFlowManipulator >= flowsToExecute.size()) {
+ break;
+ }
ExecuteBuildingBlock currentBB = flowsToExecute.get(execution.getCurrentSequence());
List<PreFlowManipulator> filtered = filterListeners(flowManipulators,
(item -> item.shouldRunFor(currentBB.getBuildingBlock().getBpmnFlowName(),
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 5fd9701880..6fb7b5b5b4 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="3.1.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="3.6.0">
<bpmn:process id="WorkflowActionBB" name="WorkflowActionBB" isExecutable="true">
<bpmn:extensionElements>
<camunda:executionListener class="org.onap.so.bpmn.core.plugins.AsyncTaskExecutorListener" event="end" />
@@ -30,7 +30,7 @@
<camunda:in source="rollbackTargetState" target="rollbackTargetState" />
<camunda:out source="rollbackTargetState" target="rollbackTargetState" />
</bpmn:extensionElements>
- <bpmn:incoming>SequenceFlow_0mew9im</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_0duoleg</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_1hsqed1</bpmn:outgoing>
</bpmn:callActivity>
<bpmn:sequenceFlow id="SequenceFlow_0mqrkxv" sourceRef="Task_SelectBB" targetRef="ServiceTask_0e2p0xs" />
@@ -183,7 +183,7 @@
<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:sequenceFlow id="SequenceFlow_0mew9im" sourceRef="ServiceTask_0e2p0xs" targetRef="ExclusiveGateway_10j89d1" />
<bpmn:sequenceFlow id="SequenceFlow_0kf5sen" name="yes" sourceRef="ExclusiveGateway_isTopLevelFlowC" targetRef="Task_UpdateRequestComplete" />
<bpmn:sequenceFlow id="SequenceFlow_1tfizxf" sourceRef="Task_PreValidateWorkflow" targetRef="Task_SelectBB" />
<bpmn:serviceTask id="Task_PreValidateWorkflow" name="PreValidate Workflow" camunda:expression="${WorkflowValidatorRunner.preValidate(execution.getVariable(&#34;requestAction&#34;), execution)}">
@@ -193,6 +193,7 @@
</bpmn:serviceTask>
<bpmn:serviceTask id="ServiceTask_0lbkcyp" name="Post Processing Execute BB" camunda:expression="${WorkflowActionBBTasks.postProcessingExecuteBB(execution)}">
<bpmn:incoming>SequenceFlow_1hsqed1</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_1knplug</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_1fftixk</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:sequenceFlow id="SequenceFlow_1hsqed1" sourceRef="Call_ExecuteBB" targetRef="ServiceTask_0lbkcyp" />
@@ -211,6 +212,15 @@
<bpmn:incoming>SequenceFlow_0ilo6lo</bpmn:incoming>
</bpmn:endEvent>
<bpmn:sequenceFlow id="SequenceFlow_0ilo6lo" name="yes" sourceRef="ExclusiveGateway_1dez26n" targetRef="EndEvent_12f15tu" />
+ <bpmn:exclusiveGateway id="ExclusiveGateway_10j89d1" default="SequenceFlow_0duoleg">
+ <bpmn:incoming>SequenceFlow_0mew9im</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0duoleg</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_1knplug</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:sequenceFlow id="SequenceFlow_0duoleg" sourceRef="ExclusiveGateway_10j89d1" targetRef="Call_ExecuteBB" />
+ <bpmn:sequenceFlow id="SequenceFlow_1knplug" name="completed = true" sourceRef="ExclusiveGateway_10j89d1" targetRef="ServiceTask_0lbkcyp">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("completed")==true}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
</bpmn:process>
<bpmn:error id="Error_0kd2o2a" name="java.lang.Exception" errorCode="java.lang.Exception" />
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
@@ -235,11 +245,11 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="CallActivity_03m7z4y_di" bpmnElement="Call_ExecuteBB">
- <dc:Bounds x="1150" y="356" width="100" height="80" />
+ <dc:Bounds x="1200" y="356" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0mqrkxv_di" bpmnElement="SequenceFlow_0mqrkxv">
<di:waypoint x="929" y="396" />
- <di:waypoint x="990" y="396" />
+ <di:waypoint x="960" y="396" />
<bpmndi:BPMNLabel>
<dc:Bounds x="324.5" y="105" width="90" height="0" />
</bpmndi:BPMNLabel>
@@ -531,11 +541,11 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ServiceTask_0e2p0xs_di" bpmnElement="ServiceTask_0e2p0xs">
- <dc:Bounds x="990" y="356" width="100" height="80" />
+ <dc:Bounds x="960" y="356" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0mew9im_di" bpmnElement="SequenceFlow_0mew9im">
- <di:waypoint x="1090" y="396" />
- <di:waypoint x="1150" y="396" />
+ <di:waypoint x="1060" y="396" />
+ <di:waypoint x="1105" y="396" />
<bpmndi:BPMNLabel>
<dc:Bounds x="530" y="99" width="0" height="12" />
</bpmndi:BPMNLabel>
@@ -561,17 +571,17 @@
<dc:Bounds x="670" y="356" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_0lbkcyp_di" bpmnElement="ServiceTask_0lbkcyp">
- <dc:Bounds x="1325" y="356" width="100" height="80" />
+ <dc:Bounds x="1350" y="356" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1hsqed1_di" bpmnElement="SequenceFlow_1hsqed1">
- <di:waypoint x="1250" y="396" />
- <di:waypoint x="1325" y="396" />
+ <di:waypoint x="1300" y="396" />
+ <di:waypoint x="1350" y="396" />
<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 x="1425" y="396" />
+ <di:waypoint x="1450" y="396" />
<di:waypoint x="1501" y="396" />
<bpmndi:BPMNLabel>
<dc:Bounds x="873" y="99" width="0" height="12" />
@@ -618,6 +628,25 @@
<dc:Bounds x="727" y="173" width="18" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ExclusiveGateway_10j89d1_di" bpmnElement="ExclusiveGateway_10j89d1" isMarkerVisible="true">
+ <dc:Bounds x="1105" y="371" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1100" y="428" width="60" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0duoleg_di" bpmnElement="SequenceFlow_0duoleg">
+ <di:waypoint x="1155" y="396" />
+ <di:waypoint x="1200" y="396" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1knplug_di" bpmnElement="SequenceFlow_1knplug">
+ <di:waypoint x="1130" y="371" />
+ <di:waypoint x="1130" y="330" />
+ <di:waypoint x="1400" y="330" />
+ <di:waypoint x="1400" y="356" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1224" y="312" width="83" height="14" />
+ </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 cd151bafea..b76cf1eb5f 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
@@ -111,13 +111,15 @@ public class WorkflowActionBBTasks {
}
int currentSequence = (int) execution.getVariable(BBConstants.G_CURRENT_SEQUENCE);
- ExecuteBuildingBlock ebb = flowsToExecute.get(currentSequence);
-
- execution.setVariable("buildingBlock", ebb);
- currentSequence++;
- execution.setVariable(COMPLETED, currentSequence >= flowsToExecute.size());
- execution.setVariable(BBConstants.G_CURRENT_SEQUENCE, currentSequence);
-
+ boolean completed = false;
+ if (currentSequence < flowsToExecute.size()) {
+ ExecuteBuildingBlock ebb = flowsToExecute.get(currentSequence);
+ execution.setVariable("buildingBlock", ebb);
+ execution.setVariable(BBConstants.G_CURRENT_SEQUENCE, currentSequence + 1);
+ } else {
+ completed = true;
+ }
+ execution.setVariable(COMPLETED, completed);
} catch (Exception e) {
workflowAction.buildAndThrowException(execution, "Internal Error occured during selectBB", e);
}
@@ -425,6 +427,9 @@ public class WorkflowActionBBTasks {
final boolean aLaCarte = (boolean) execution.getVariable(BBConstants.G_ALACARTE);
int currentSequence = (int) execution.getVariable(BBConstants.G_CURRENT_SEQUENCE);
logger.debug("Current Sequence: {}", currentSequence);
+ if (currentSequence >= flowsToExecute.size()) {
+ execution.setVariable(COMPLETED, true);
+ }
ExecuteBuildingBlock ebb = flowsToExecute.get(currentSequence - 1);
String bbFlowName = ebb.getBuildingBlock().getBpmnFlowName();
if ("ActivateVfModuleBB".equalsIgnoreCase(bbFlowName) && aLaCarte
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 5cd3055b5f..cbb746d514 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
@@ -149,7 +149,7 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
workflowActionBBTasks.selectBB(execution);
boolean success = (boolean) execution.getVariable("completed");
int currentSequence = (int) execution.getVariable("gCurrentSequence");
- assertTrue(success);
+ assertFalse(success);
assertEquals(1, currentSequence);
}