From cd805e236b7e7ae75164c245e0366878c484503d Mon Sep 17 00:00:00 2001 From: Chittaranjan Sardar Date: Wed, 24 Jan 2018 12:57:55 +0530 Subject: Same Service names under two different Customers SO is not allowing to create services with same name with in different customers. Change-Id: I2ce83f3d6c8d999f88154a1ac50330a8b6d50118 Issue-ID: SO-382 Signed-off-by: Chittaranjan Sardar --- .../mso/bpmn/common/GenericGetServiceTest.java | 55 ++++++++++++++++++++++ .../GenericFlows/getSIUrlByNameMultiCustomer.xml | 11 +++++ 2 files changed, 66 insertions(+) create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getSIUrlByNameMultiCustomer.xml (limited to 'bpmn/MSOCommonBPMN/src/test') diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericGetServiceTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericGetServiceTest.java index b1172837cf..82cceb0b70 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericGetServiceTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericGetServiceTest.java @@ -482,6 +482,61 @@ public class GenericGetServiceTest extends WorkflowTest { assertEquals(expectedWorkflowException, workflowException); } + @Test + @Deployment(resources = {"subprocess/GenericGetService.bpmn"}) + public void testGenericGetService_success_serviceInstance_byNameServicePresent() throws Exception{ + + MockNodeQueryServiceInstanceByName("1604-MVM-26", "GenericFlows/getSIUrlByNameMultiCustomer.xml"); + MockGetServiceInstance("XyCorporation", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml"); + + Map variables = new HashMap(); + setVariablesInstance(variables, null, "1604-MVM-26", "XyCorporation", null); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator"); + String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator"); + String resourceLink = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_resourceLink"); + String response = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowResponse"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException"); + String siUrlResponseCode = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainSIUrlResponseCode"); + + assertEquals("true", successIndicator); + assertEquals("true", found); + assertNotNull(resourceLink); + assertNotNull(response); + assertEquals("200", siUrlResponseCode); + assertEquals(null, workflowException); + } + + @Test + @Deployment(resources = {"subprocess/GenericGetService.bpmn"}) + public void testGenericGetService_success_serviceInstance_byNameServiceNotPresent() throws Exception{ + + MockNodeQueryServiceInstanceByName("1604-MVM-26", "GenericFlows/getSIUrlByNameMultiCustomer.xml"); + MockGetServiceInstance("CorporationNotPresent", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml"); + + Map variables = new HashMap(); + setVariablesInstance(variables, null, "1604-MVM-26", "CorporationNotPresent", null); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator"); + String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator"); + String resourceLink = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_resourceLink"); + String response = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowResponse"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException"); + String siUrlResponseCode = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainSIUrlResponseCode"); + + assertEquals("true", successIndicator); + assertEquals("false", found); + assertEquals(null, resourceLink); + assertEquals(" ", response); + assertEquals("200", siUrlResponseCode); + assertEquals(null, workflowException); + } private void setVariablesInstance(Map variables, String siId, String siName, String globalCustId, String serviceType) { variables.put("isDebugLogEnabled", "true"); diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getSIUrlByNameMultiCustomer.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getSIUrlByNameMultiCustomer.xml new file mode 100644 index 0000000000..fce47fcd0d --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getSIUrlByNameMultiCustomer.xml @@ -0,0 +1,11 @@ + + + + service-instance + /aai/v11/business/customers/customer/AbcBank/service-subscriptions/service-subscription/ABC-ST/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET + + + service-instance + /aai/v11/business/customers/customer/XyCorporation/service-subscriptions/service-subscription/XY-ST/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET + + \ No newline at end of file -- cgit 1.2.3-korg