ensure default flags are set on execution 70/114570/1
authorMnushkin, Dmitry <dmitry.mnushkin@att.com>
Tue, 3 Nov 2020 19:38:18 +0000 (14:38 -0500)
committerBenjamin, Max (mb388a) <mb388a@att.com>
Tue, 3 Nov 2020 19:38:19 +0000 (14:38 -0500)
ensure default flags are set on execution

Issue-ID: SO-3362
Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com>
Change-Id: I6b579cb8d26ab6a8e12c44372101bfb37480e12f

bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java

index 7c4f735..8f150b3 100644 (file)
@@ -178,6 +178,7 @@ public class WorkflowAction {
 
     public void selectExecutionList(DelegateExecution execution) throws Exception {
         try {
+            fillExecutionDefault(execution);
             final String bpmnRequest = (String) execution.getVariable(BBConstants.G_BPMN_REQUEST);
             ServiceInstancesRequest sIRequest =
                     new ObjectMapper().readValue(bpmnRequest, ServiceInstancesRequest.class);
@@ -1871,12 +1872,15 @@ public class WorkflowAction {
         return generatedResourceId;
     }
 
-    private void fillExecution(DelegateExecution execution, boolean suppressRollback, String resourceId,
-            WorkflowType resourceType) {
+    private void fillExecutionDefault(DelegateExecution execution) {
         execution.setVariable("sentSyncResponse", false);
         execution.setVariable(HOMING, false);
         execution.setVariable("calledHoming", false);
         execution.setVariable(BBConstants.G_ISTOPLEVELFLOW, true);
+    }
+
+    private void fillExecution(DelegateExecution execution, boolean suppressRollback, String resourceId,
+            WorkflowType resourceType) {
         execution.setVariable("suppressRollback", suppressRollback);
         execution.setVariable("resourceId", resourceId);
         execution.setVariable("resourceType", resourceType);
index 50ff074..7f22c51 100644 (file)
@@ -243,6 +243,10 @@ public class WorkflowActionTest extends BaseTaskTest {
         SPY_workflowAction.selectExecutionList(execution);
         assertEquals(execution.getVariable("WorkflowActionErrorMessage"),
                 "Exception while setting execution list. serviceInstance with name (instanceName) and different version id (3c40d244-808e-42ca-b09a-256d83d19d0a) already exists. The name must be unique.");
+
+        // verify default values are present in failure case
+        assertEquals(true, execution.getVariable("isTopLevelFlow"));
+        assertEquals(false, execution.getVariable("sentSyncResponse"));
     }
 
     /**