--- /dev/null
+package org.openecomp.mso.bpmn.infrastructure.scripts\r
+\r
+import org.camunda.bpm.engine.ProcessEngineServices\r
+import org.camunda.bpm.engine.RepositoryService\r
+import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity\r
+import org.camunda.bpm.engine.repository.ProcessDefinition\r
+import org.camunda.bpm.engine.runtime.Execution\r
+import org.junit.Before\r
+import org.junit.Rule\r
+import org.junit.Test\r
+import org.mockito.MockitoAnnotations\r
+import org.openecomp.mso.bpmn.common.scripts.MsoUtils\r
+import org.openecomp.mso.bpmn.core.WorkflowException\r
+import org.openecomp.mso.bpmn.core.json.JsonUtils\r
+import org.openecomp.mso.bpmn.common.scripts.VidUtils\r
+\r
+import static org.junit.Assert.*;\r
+import static org.mockito.Mockito.*\r
+\r
+import com.github.tomakehurst.wiremock.junit.WireMockRule\r
+\r
+class CreateGenericAlaCarteServiceInstanceTest {\r
+ \r
+ @Rule\r
+ public WireMockRule wireMockRule = new WireMockRule(8090);\r
+ \r
+ String Prefix="CRENI_"\r
+ def utils = new MsoUtils()\r
+ JsonUtils jsonUtil = new JsonUtils()\r
+ VidUtils vidUtils = new VidUtils()\r
+ \r
+\r
+String jsonIncomingRequest =\r
+"""{\r
+ "service": {\r
+ "name": "so_test4",\r
+ "description": "so_test2",\r
+ "serviceDefId": "60c3e96e-0970-4871-b6e0-3b6de7561519",\r
+ "templateId": "592f9437-a9c0-4303-b9f6-c445bb7e9814",\r
+ "parameters": {\r
+ "globalSubscriberId": "123457",\r
+ "subscriberName": "Customer1",\r
+ "serviceType": "voLTE",\r
+ "templateName": "voLTE Service:1.0",\r
+ "resources": [\r
+ {\r
+ "resourceName": "vIMS",\r
+ "resourceDefId": "60c3e96e-0970-4871-b6e0-3b6de7561516",\r
+ "resourceId": "60c3e96e-0970-4871-b6e0-3b6de7561512",\r
+ "nsParameters": {\r
+ "locationConstraints": [\r
+ {\r
+ "vnfProfileId": "zte-vBAS-1.0",\r
+ "locationConstraints": {\r
+ "vimId": "4050083f-465f-4838-af1e-47a545222ad0"\r
+ }\r
+ },\r
+ {\r
+ "vnfProfileId": "zte-vMME-1.0",\r
+ "locationConstraints": {\r
+ "vimId": "4050083f-465f-4838-af1e-47a545222ad0"\r
+ }\r
+ }\r
+ ],\r
+ "additionalParamForNs": {}\r
+ }\r
+ },\r
+ {\r
+ "resourceName": "vEPC",\r
+ "resourceDefId": "61c3e96e-0970-4871-b6e0-3b6de7561516",\r
+ "resourceId": "62c3e96e-0970-4871-b6e0-3b6de7561512",\r
+ "nsParameters": {\r
+ "locationConstraints": [\r
+ {\r
+ "vnfProfileId": "zte-CSCF-1.0",\r
+ "locationConstraints": {\r
+ "vimId": "4050083f-465f-4838-af1e-47a545222ad1"\r
+ }\r
+ }\r
+ ],\r
+ "additionalParamForNs": {}\r
+ }\r
+ },\r
+ {\r
+ "resourceName": "underlayvpn",\r
+ "resourceDefId": "60c3e96e-0970-4871-b6e0-3b6de7561513",\r
+ "resourceId": "60c3e96e-0970-4871-b6e0-3b6de7561514",\r
+ "nsParameters": {\r
+ "locationConstraints": [],\r
+ "additionalParamForNs": {\r
+ "externalDataNetworkName": "Flow_out_net",\r
+ "m6000_mng_ip": "181.18.20.2",\r
+ "externalCompanyFtpDataNetworkName": "Flow_out_net",\r
+ "externalPluginManageNetworkName": "plugin_net_2014",\r
+ "externalManageNetworkName": "mng_net_2017",\r
+ "sfc_data_network": "sfc_data_net_2016",\r
+ "NatIpRange": "210.1.1.10-210.1.1.20",\r
+ "location": "4050083f-465f-4838-af1e-47a545222ad0",\r
+ "sdncontroller": "9b9f02c0-298b-458a-bc9c-be3692e4f35e"\r
+ }\r
+ }\r
+ },\r
+ {\r
+ "resourceName": "overlayvpn",\r
+ "resourceDefId": "60c3e96e-0970-4871-b6e0-3b6de7561517",\r
+ "resourceId": "60c3e96e-0970-4871-b6e0-3b6de7561518",\r
+ "nsParameters": {\r
+ "locationConstraints": [],\r
+ "additionalParamForNs": {\r
+ "externalDataNetworkName": "Flow_out_net",\r
+ "m6000_mng_ip": "181.18.20.2",\r
+ "externalCompanyFtpDataNetworkName": "Flow_out_net",\r
+ "externalPluginManageNetworkName": "plugin_net_2014",\r
+ "externalManageNetworkName": "mng_net_2017",\r
+ "sfc_data_network": "sfc_data_net_2016",\r
+ "NatIpRange": "210.1.1.10-210.1.1.20",\r
+ "location": "4050083f-465f-4838-af1e-47a545222ad0",\r
+ "sdncontroller": "9b9f02c0-298b-458a-bc9c-be3692e4f35e"\r
+ }\r
+ }\r
+ }\r
+ ]\r
+ }\r
+ }\r
+}"""\r
+\r
+ @Before\r
+ public void init()\r
+ {\r
+ MockitoAnnotations.initMocks(this)\r
+ \r
+ }\r
+\r
+ public void initializeVariables(Execution mockExecution) {\r
+ \r
+ verify(mockExecution).setVariable(Prefix + "Success", false)\r
+ \r
+ verify(mockExecution).setVariable(Prefix + "CompleteMsoProcessRequest", "")\r
+ verify(mockExecution).setVariable(Prefix + "FalloutHandlerRequest", "")\r
+ verify(mockExecution).setVariable(Prefix + "isSilentSuccess", false)\r
+ \r
+ }\r
+ \r
+ @Test\r
+ //@Ignore \r
+ public void preProcessRequest() {\r
+ \r
+ println "************ preProcessRequest() ************* " \r
+ ExecutionEntity mockExecution = mock(ExecutionEntity.class)\r
+ // Initialize prerequisite variables\r
+ when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true")\r
+ when(mockExecution.getVariable("bpmnRequest")).thenReturn(jsonIncomingRequest)\r
+ try{\r
+ \r
+ // preProcessRequest(Execution execution) \r
+ CreateGenericALaCarteServiceInstance createGenericALaCarteServiceInstance = new CreateGenericALaCarteServiceInstance()\r
+ createGenericALaCarteServiceInstance.preProcessRequest(mockExecution)\r
+\r
+ verify(mockExecution).getVariable("isDebugLogEnabled")\r
+ verify(mockExecution).setVariable("prefix", Prefix)\r
+ \r
+ initializeVariables(mockExecution)\r
+ //verify(mockExecution).setVariable(Prefix + "Success", false)\r
+ }catch(Exception e){\r
+ //ignore\r
+ } \r
+ }\r
+ }
\ No newline at end of file