summaryrefslogtreecommitdiffstats
path: root/bpmn/MSOInfrastructureBPMN/src/test
diff options
context:
space:
mode:
authorseshukm <seshu.kumar.m@huawei.com>2017-11-07 10:40:32 +0530
committerseshukm <seshu.kumar.m@huawei.com>2017-11-07 10:41:47 +0530
commit8e39c221c4c2e72f8f08bfe78278beefc189088c (patch)
treed1b31d297e9ddf835bbcd9994e7113c4909fb6b2 /bpmn/MSOInfrastructureBPMN/src/test
parent8d496b4f1516d25e39bbd909cb7185e74a453cc6 (diff)
fix for delete e2e svc subprocess groovy test
IssueId : SO-281 Change-Id: I01ec11410b5ee97f28f780ca08a6860f482b88ea Signed-off-by: seshukm <seshu.kumar.m@huawei.com>
Diffstat (limited to 'bpmn/MSOInfrastructureBPMN/src/test')
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceTest.groovy137
1 files changed, 137 insertions, 0 deletions
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceTest.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceTest.groovy
new file mode 100644
index 0000000000..1e56984621
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceTest.groovy
@@ -0,0 +1,137 @@
+package org.openecomp.mso.bpmn.infrastructure.scripts
+
+import com.github.tomakehurst.wiremock.junit.WireMockRule
+import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
+import org.junit.Before
+import org.junit.BeforeClass
+import org.junit.Rule
+import org.junit.Test
+import org.mockito.MockitoAnnotations
+import org.openecomp.mso.bpmn.infrastructure.scripts.DoCustomDeleteE2EServiceInstance
+import org.openecomp.mso.bpmn.mock.FileUtil
+import org.openecomp.mso.bpmn.vcpe.scripts.GroovyTestBase
+
+import static org.mockito.Mockito.verify
+import static org.mockito.Mockito.when
+import static org.mockito.Mockito.when
+import static org.mockito.Mockito.when
+import static org.mockito.Mockito.when
+import static org.mockito.Mockito.when
+import static org.mockito.Mockito.when
+import static org.mockito.Mockito.when
+
+class DoCustomDeleteE2EServiceInstanceTest extends GroovyTestBase {
+
+ private static String request
+
+ @Rule
+ public WireMockRule wireMockRule = new WireMockRule(GroovyTestBase.PORT)
+
+ String Prefix = "CVRCS_"
+ String RbType = "DCRENI_"
+
+ @BeforeClass
+ public static void setUpBeforeClass() {
+ request = FileUtil.readResourceFile("__files/InfrastructureFlows/DeleteCustomE2EService.json")
+ }
+
+ @Before
+ public void init()
+ {
+ MockitoAnnotations.initMocks(this)
+ }
+ public DoCustomDeleteE2EServiceInstanceTest(){
+ super("DoCustomDeleteE2EServiceInstance")
+ }
+
+ @Test
+ public void preProcessRequestTest(){
+
+ ExecutionEntity mex = setupMock()
+ def map = setupMap(mex)
+ initPreProcess(mex)
+
+ DoCustomDeleteE2EServiceInstance instance = new DoCustomDeleteE2EServiceInstance()
+ instance.preProcessRequest(mex)
+ verify(mex).setVariable("sdncCallbackUrl", "/mso/sdncadapter/")
+ verify(mex).setVariable("siParamsXml", "")
+ }
+
+ @Test
+ public void postProcessAAIGETTest(){
+ ExecutionEntity mex = setupMock()
+ def map = setupMap(mex)
+ initPreProcess(mex)
+ when(mex.getVariable("GENGS_SuccessIndicator")).thenReturn(true)
+
+ String aaiGetResponse = FileUtil.readResourceFile("__files/GenericFlows/aaiGetResponse.xml")
+ when(mex.getVariable("GENGS_service")).thenReturn(aaiGetResponse)
+ DoCustomDeleteE2EServiceInstance instance = new DoCustomDeleteE2EServiceInstance()
+ instance.postProcessAAIGET(mex)
+ verify(mex).setVariable("subscriptionServiceType", "e2eserviceInstance/delete")
+ }
+
+ @Test
+ public void preInitResourcesOperStatusTest(){
+ ExecutionEntity mex = setupMock()
+ def map = setupMap(mex)
+ initPreProcess(mex)
+ when(mex.getVariable("serviceRelationShip")).thenReturn("[{\"resourceInstanceId\":\"3333\",\"resourceType\":\"overlay\"},{\"resourceInstanceId\":\"4444\",\"resourceType\":\"underlay\"},{\"resourceInstanceId\":\"1111\",\"resourceType\":\"vIMS\"},{\"resourceInstanceId\":\"222\",\"resourceType\":\"vEPC\"}]")
+ DoCustomDeleteE2EServiceInstance instance = new DoCustomDeleteE2EServiceInstance()
+ instance.preInitResourcesOperStatus(mex)
+ verify(mex).setVariable("CVFMI_dbAdapterEndpoint", "http://localhost:8080/mso")
+ }
+
+ @Test
+ public void preResourceDeleteTest() {
+ ExecutionEntity mex = setupMock()
+ def map = setupMap(mex)
+ initPreProcess(mex)
+ when(mex.getVariable("serviceRelationShip")).thenReturn("[{\"resourceInstanceId\":\"3333\",\"resourceType\":\"overlay\"},{\"resourceInstanceId\":\"4444\",\"resourceType\":\"underlay\"},{\"resourceInstanceId\":\"1111\",\"resourceType\":\"vIMS\"},{\"resourceInstanceId\":\"222\",\"resourceType\":\"vEPC\"}]")
+ DoCustomDeleteE2EServiceInstance instance = new DoCustomDeleteE2EServiceInstance()
+ instance.preResourceDelete(mex,"overlay")
+ verify(mex).setVariable("resourceType", "overlay")
+ }
+
+
+ @Test
+ public void postProcessSDNCDeleteTest(){
+ ExecutionEntity mex = setupMock()
+ def map = setupMap(mex)
+ initPreProcess(mex)
+ when(mex.getVariable("SDNCA_SuccessIndicator")).thenReturn("true")
+ when(mex.getVariable("DDELSI_sdncResponseSuccess")).thenReturn("true")
+ when(mex.getVariable("prefix")).thenReturn("DDELSI_")
+ DoCustomDeleteE2EServiceInstance instance = new DoCustomDeleteE2EServiceInstance()
+ String response = FileUtil.readResourceFile("__files/GenericFlows/SDNCDeleteResponse.xml")
+ String method = "deleteE2E";
+ instance.postProcessSDNCDelete(mex, response, method)
+ verify(mex).setVariable("DDELSI_sdncRequestDataResponseCode", "0")
+ }
+
+ @Test
+ public void postProcessAAIDELTest() {
+ ExecutionEntity mex = setupMock()
+ def map = setupMap(mex)
+ initPreProcess(mex)
+ when(mex.getVariable("GENDS_SuccessIndicator")).thenReturn("true")
+ DoCustomDeleteE2EServiceInstance instance = new DoCustomDeleteE2EServiceInstance()
+ instance.postProcessAAIDEL(mex)
+ }
+
+ private void initPreProcess(ExecutionEntity mex) {
+ when(mex.getVariable(GroovyTestBase.DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("bpmnRequest")).thenReturn(request)
+ when(mex.getVariable("mso-request-id")).thenReturn("mri")
+ when(mex.getVariable("serviceType")).thenReturn("VoLTE")
+ when(mex.getVariable("serviceInstanceId")).thenReturn("e151059a-d924-4629-845f-264db19e50b4")
+ when(mex.getVariable("requestAction")).thenReturn("ra")
+ when(mex.getVariable("operationId")).thenReturn("59960003992")
+ when(mex.getVariable("URN_mso_workflow_sdncadapter_callback")).thenReturn("/mso/sdncadapter/")
+ when(mex.getVariable("GENGS_FoundIndicator")).thenReturn("true")
+ when(mex.getVariable("GENGS_siResourceLink")).thenReturn("/service-subscription/e2eserviceInstance/delete/service-instances/")
+ when(mex.getVariable("globalSubscriberId")).thenReturn("4993921112123")
+ when(mex.getVariable("GENGS_service")).thenReturn("test3434")
+ when(mex.getVariable("URN_mso_openecomp_adapters_db_endpoint")).thenReturn("http://localhost:8080/mso")
+ }
+}