summaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
authorElena Kuleshov <evn@att.com>2019-07-26 02:34:19 -0400
committerElena Kuleshov <evn@att.com>2019-07-26 02:51:35 -0400
commit8ad30f496f930ac942b7fa85cda99da0b4e62494 (patch)
treee8e5119365e97b08f6a153302cf7c6616c423fd3 /bpmn
parent5128f152409017604d97b1e2f711a77a4c3acdf3 (diff)
Use BuildingBlockExecution for PauseForManualTasks
Fix variable settings and execution object usage for manual tasks. Issue-ID: SO-2113 Signed-off-by: Kuleshov, Elena <evn@att.com> Change-Id: I3fa24d70b46658ce5afcdc843d5482e157641112
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/PauseForManualTaskActivity.bpmn10
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/PauseForManualTaskActivityTest.java3
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java7
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasks.java9
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasksTest.java16
5 files changed, 29 insertions, 16 deletions
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/PauseForManualTaskActivity.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/PauseForManualTaskActivity.bpmn
index fb9704d294..884ec209aa 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/PauseForManualTaskActivity.bpmn
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/PauseForManualTaskActivity.bpmn
@@ -22,11 +22,11 @@
</bpmn2:userTask>
<bpmn2:sequenceFlow id="SequenceFlow_0b84ki5" sourceRef="UpdateDbStatusToPendingManualTask" targetRef="CreateExternalTicket" />
<bpmn2:sequenceFlow id="SequenceFlow_14cyk9v" sourceRef="UpdateDbStatusToInProgress" targetRef="PauseForManualTaskActivity_End" />
- <bpmn2:serviceTask id="UpdateDbStatusToPendingManualTask" name="Update Infra DB Status to PENDING_MANUAL_TASK" camunda:expression="${ManualHandlingTasks.updateRequestDbStatus(execution,&#34;PENDING_MANUAL_TASK&#34;)}">
+ <bpmn2:serviceTask id="UpdateDbStatusToPendingManualTask" name="Update Infra DB Status to PENDING_MANUAL_TASK" camunda:expression="${ManualHandlingTasks.updateRequestDbStatus(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)),&#34;PENDING_MANUAL_TASK&#34;)}">
<bpmn2:incoming>SequenceFlow_0jav6cu</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_0b84ki5</bpmn2:outgoing>
</bpmn2:serviceTask>
- <bpmn2:serviceTask id="UpdateDbStatusToInProgress" name="Update Infra DB Status to IN_PROGRESS" camunda:expression="${ManualHandlingTasks.updateRequestDbStatus(execution, &#34;IN_PROGRESS&#34;)}">
+ <bpmn2:serviceTask id="UpdateDbStatusToInProgress" name="Update Infra DB Status to IN_PROGRESS" camunda:expression="${ManualHandlingTasks.updateRequestDbStatus(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)), &#34;IN_PROGRESS&#34;)}">
<bpmn2:incoming>SequenceFlow_192yimz</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_14cyk9v</bpmn2:outgoing>
</bpmn2:serviceTask>
@@ -37,12 +37,12 @@
<bpmn2:timeDuration xsi:type="bpmn2:tFormalExpression"><![CDATA[${execution.getVariable("taskTimeout")}]]></bpmn2:timeDuration>
</bpmn2:timerEventDefinition>
</bpmn2:boundaryEvent>
- <bpmn2:serviceTask id="CreateExternalTicket" name="Create ExternalTicket" camunda:expression="${ManualHandlingTasks.createExternalTicket(execution)}">
+ <bpmn2:serviceTask id="CreateExternalTicket" name="Create ExternalTicket" camunda:expression="${ManualHandlingTasks.createExternalTicket(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
<bpmn2:incoming>SequenceFlow_0b84ki5</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_0igra4l</bpmn2:outgoing>
</bpmn2:serviceTask>
<bpmn2:sequenceFlow id="SequenceFlow_01k6zgt" sourceRef="ManualTaskTimer" targetRef="UpdateDBStatusToTimeout" />
- <bpmn2:serviceTask id="UpdateDBStatusToTimeout" name="Update Infra DB Status To TIMEOUT" camunda:expression="${ManualHandlingTasks.updateRequestDbStatus(execution, &#34;TIMEOUT&#34;)}">
+ <bpmn2:serviceTask id="UpdateDBStatusToTimeout" name="Update Infra DB Status To TIMEOUT" camunda:expression="${ManualHandlingTasks.updateRequestDbStatus(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)), &#34;TIMEOUT&#34;)}">
<bpmn2:incoming>SequenceFlow_01k6zgt</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_16bjdgj</bpmn2:outgoing>
</bpmn2:serviceTask>
@@ -147,4 +147,4 @@
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
-</bpmn2:definitions>
+</bpmn2:definitions> \ No newline at end of file
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/PauseForManualTaskActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/PauseForManualTaskActivityTest.java
index 484f9b8506..c0b0094f20 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/PauseForManualTaskActivityTest.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/PauseForManualTaskActivityTest.java
@@ -35,6 +35,7 @@ import org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.onap.so.bpmn.BaseBPMNTest;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
public class PauseForManualTaskActivityTest extends BaseBPMNTest {
@@ -85,7 +86,7 @@ public class PauseForManualTaskActivityTest extends BaseBPMNTest {
@Test
public void rainyDayPauseForManualTask_Test() throws Exception {
doThrow(new BpmnError("7000", "TESTING ERRORS")).when(manualHandlingTasks)
- .createExternalTicket((any(DelegateExecution.class)));
+ .createExternalTicket((any(BuildingBlockExecution.class)));
ProcessInstance pi = runtimeService.startProcessInstanceByKey("PauseForManualTaskActivity", variables);
assertThat(pi).isNotNull().isStarted()
.hasPassedInOrder("PauseForManualTaskActivity_Start", "UpdateDbStatusToPendingManualTask",
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java
index 775e3213d4..638ecefa49 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java
@@ -22,6 +22,7 @@
package org.onap.so.bpmn.infrastructure.activity;
+import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
@@ -99,6 +100,12 @@ public class ExecuteActivity implements JavaDelegate {
variables.put("retryCount", 1);
variables.put("aLaCarte", true);
+ execution.getVariables().forEach((key, value) -> {
+ if (value instanceof Serializable) {
+ variables.put(key, (Serializable) value);
+ }
+ });
+
ProcessInstanceWithVariables buildingBlockResult =
runtimeService.createProcessInstanceByKey("ExecuteBuildingBlock").setVariables(variables)
.executeWithVariablesInReturn();
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasks.java
index 17089be571..7e45c3b640 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasks.java
@@ -27,6 +27,7 @@ import org.camunda.bpm.engine.TaskService;
import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.engine.delegate.DelegateTask;
import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.ticket.ExternalTicket;
import org.onap.so.db.request.beans.InfraActiveRequests;
@@ -46,7 +47,7 @@ public class ManualHandlingTasks {
private static final String TASK_TYPE_FALLOUT = "fallout";
public static final String VNF_TYPE = "vnfType";
public static final String SERVICE_TYPE = "serviceType";
- public static final String MSO_REQUEST_ID = "msoRequestId";
+ public static final String MSO_REQUEST_ID = "mso-request-id";
public static final String REQUESTOR_ID = "requestorId";
public static final String ERROR_CODE = "errorCode";
public static final String VALID_RESPONSES = "validResponses";
@@ -120,7 +121,7 @@ public class ManualHandlingTasks {
String originalRequestId = (String) execution.getVariable(MSO_REQUEST_ID);
String originalRequestorId = (String) execution.getVariable(REQUESTOR_ID);
String description = (String) execution.getVariable(DESCRIPTION);
- String timeout = (String) execution.getVariable("taskTimeout");
+ String timeout = "";
String errorSource = "";
String errorCode = "";
String errorMessage = "";
@@ -188,7 +189,7 @@ public class ManualHandlingTasks {
}
- public void createExternalTicket(DelegateExecution execution) {
+ public void createExternalTicket(BuildingBlockExecution execution) {
try {
ExternalTicket ticket = new ExternalTicket();
@@ -218,7 +219,7 @@ public class ManualHandlingTasks {
}
- public void updateRequestDbStatus(DelegateExecution execution, String status) {
+ public void updateRequestDbStatus(BuildingBlockExecution execution, String status) {
try {
String requestId = (String) execution.getVariable(MSO_REQUEST_ID);
InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasksTest.java
index 9677f8e8f3..b40195c07b 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasksTest.java
@@ -38,6 +38,8 @@ import org.junit.Test;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.onap.so.bpmn.BaseTaskTest;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.common.DelegateExecutionImpl;
import org.onap.so.db.request.beans.InfraActiveRequests;
public class ManualHandlingTasksTest extends BaseTaskTest {
@@ -56,11 +58,13 @@ public class ManualHandlingTasksTest extends BaseTaskTest {
@Mock
private DelegateTask task;
- private DelegateExecution delegateExecution;
+ @Mock
+ private BuildingBlockExecution buildingBlockExecution;
@Before
public void before() throws Exception {
delegateExecution = new DelegateExecutionFake();
+ buildingBlockExecution = new DelegateExecutionImpl(delegateExecution);
}
@Test
@@ -99,18 +103,18 @@ public class ManualHandlingTasksTest extends BaseTaskTest {
@Test
public void updateRequestDbStatus_Test() throws Exception {
InfraActiveRequests mockedRequest = new InfraActiveRequests();
- delegateExecution.setVariable("msoRequestId", "testMsoRequestId");
+ buildingBlockExecution.setVariable("mso-request-id", "msoRequestId");
when(requestsDbClient.getInfraActiveRequestbyRequestId(any(String.class))).thenReturn(mockedRequest);
doNothing().when(requestsDbClient).updateInfraActiveRequests(any(InfraActiveRequests.class));
- manualHandlingTasks.updateRequestDbStatus(delegateExecution, "IN_PROGRESS");
+ manualHandlingTasks.updateRequestDbStatus(buildingBlockExecution, "IN_PROGRESS");
verify(requestsDbClient, times(1)).updateInfraActiveRequests(any(InfraActiveRequests.class));
assertEquals(mockedRequest.getRequestStatus(), "IN_PROGRESS");
}
@Test
public void createExternalTicket_Test() throws Exception {
- delegateExecution.setVariable("msoRequestId", ("testMsoRequestId"));
- delegateExecution.setVariable("vnfType", "testVnfType");
- manualHandlingTasks.createExternalTicket(delegateExecution);
+ buildingBlockExecution.setVariable("mso-request-id", ("testMsoRequestId"));
+ buildingBlockExecution.setVariable("vnfType", "testVnfType");
+ manualHandlingTasks.createExternalTicket(buildingBlockExecution);
}
}