aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-tasks
diff options
context:
space:
mode:
authorSteve Smokowski <ss835w@att.com>2020-01-30 13:48:14 +0000
committerGerrit Code Review <gerrit@onap.org>2020-01-30 13:48:14 +0000
commit6ee552c89912b1dba08bf725b948ffef3d6ab56b (patch)
treec9fcd15bfdd23c554269c47c1490b87e9653c697 /bpmn/so-bpmn-tasks
parent45ed5d0171736bebe16d57adcb6f890156cd5cf7 (diff)
parente2dde44b2d8ace388b862d73bac654bfc9ca52af (diff)
Merge "Updated to send back actual exception message"
Diffstat (limited to 'bpmn/so-bpmn-tasks')
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java6
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java25
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroAssign.json3
3 files changed, 30 insertions, 4 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
index ffcda2b135..80c6f0b969 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
@@ -431,7 +431,7 @@ public class WorkflowAction {
execution.setVariable("isRollbackComplete", false);
} catch (Exception ex) {
- buildAndThrowException(execution, "Exception in execution list. ", ex);
+ buildAndThrowException(execution, "Exception while setting execution list. ", ex);
}
}
@@ -1562,8 +1562,8 @@ public class WorkflowAction {
protected void buildAndThrowException(DelegateExecution execution, String msg, Exception ex) {
logger.error(msg, ex);
- execution.setVariable(WORKFLOW_ACTION_ERROR_MESSAGE, msg);
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, msg);
+ execution.setVariable(WORKFLOW_ACTION_ERROR_MESSAGE, msg + ex.getMessage());
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, msg + ex.getMessage());
}
protected void buildAndThrowException(DelegateExecution execution, String msg) {
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
index cc4a5ce04e..8e47c34cb0 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
@@ -36,8 +36,11 @@ import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.mockito.ArgumentMatchers.anyObject;
import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.ArgumentMatchers.isA;
import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.when;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
@@ -224,6 +227,28 @@ public class WorkflowActionTest extends BaseTaskTest {
assertEqualsBulkFlowName(ebbs, "AssignServiceInstanceBB", "ActivateServiceInstanceBB");
}
+ @Test
+ public void selectExecutionListDuplicateNameExceptionTest() throws Exception {
+ String gAction = "createInstance";
+ execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
+ String bpmnRequest =
+ new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroAssign.json")));
+ execution.setVariable("bpmnRequest", bpmnRequest);
+ execution.setVariable("aLaCarte", true);
+ execution.setVariable("apiVersion", "7");
+ execution.setVariable("requestUri", "v6/serviceInstances");
+ execution.setVariable("requestAction", gAction);
+
+ doThrow(new DuplicateNameException(
+ "serviceInstance with name (instanceName) and different version id (3c40d244-808e-42ca-b09a-256d83d19d0a) already exists. The name must be unique."))
+ .when(SPY_workflowAction).validateResourceIdInAAI(anyString(), eq(WorkflowType.SERVICE),
+ eq("test"), any(RequestDetails.class), any(WorkflowResourceIds.class));
+
+ 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.");
+ }
+
/**
* SERVICE MACRO TESTS
*/
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroAssign.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroAssign.json
index 39e87f19f1..1dd475cad4 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroAssign.json
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroAssign.json
@@ -24,7 +24,8 @@
"productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
"source": "VID",
"suppressRollback": true,
- "requestorId": "xxxxxx"
+ "requestorId": "xxxxxx",
+ "instanceName": "test"
},
"requestParameters": {
"subscriptionServiceType": "VMX",