diff options
author | Plummer, Brittany <brittany.plummer@att.com> | 2020-01-29 17:12:04 -0500 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@att.com> | 2020-01-29 17:12:05 -0500 |
commit | e2dde44b2d8ace388b862d73bac654bfc9ca52af (patch) | |
tree | 1423d8d6dc50e7ae8a138675f838bc0cd31992ba /bpmn/so-bpmn-tasks/src/test/java/org/onap | |
parent | 4b9193ca1a42a7781ef59a2d724200adcd6439ec (diff) |
Updated to send back actual exception message
Updated to send back actual exception message
Updated exception to include message
Issue-ID: SO-2619
Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com>
Change-Id: Id4ac60dee682b6b6e18c6ccbabcc60a61c2a1db7
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/test/java/org/onap')
-rw-r--r-- | bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java | 25 |
1 files changed, 25 insertions, 0 deletions
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 */ |