1 package org.openecomp.mso.bpmn.infrastructure.scripts
\r
3 import org.camunda.bpm.engine.ProcessEngineServices
\r
4 import org.camunda.bpm.engine.RepositoryService
\r
5 import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
\r
6 import org.camunda.bpm.engine.repository.ProcessDefinition
\r
7 import org.camunda.bpm.engine.runtime.Execution
\r
8 import org.junit.Before
\r
9 import org.junit.Rule
\r
10 import org.junit.Test
\r
11 import org.mockito.MockitoAnnotations
\r
12 import org.openecomp.mso.bpmn.common.scripts.MsoUtils
\r
13 import org.openecomp.mso.bpmn.core.WorkflowException
\r
14 import org.openecomp.mso.bpmn.core.json.JsonUtils
\r
15 import org.openecomp.mso.bpmn.common.scripts.VidUtils
\r
17 import static org.junit.Assert.*;
\r
18 import static org.mockito.Mockito.*
\r
20 import com.github.tomakehurst.wiremock.junit.WireMockRule
\r
22 class CreateGenericAlaCarteServiceInstanceTest {
\r
25 public WireMockRule wireMockRule = new WireMockRule(8090);
\r
27 String Prefix="CRENI_"
\r
28 def utils = new MsoUtils()
\r
29 JsonUtils jsonUtil = new JsonUtils()
\r
30 VidUtils vidUtils = new VidUtils()
\r
33 String jsonIncomingRequest =
\r
37 "description": "so_test2",
\r
38 "serviceDefId": "60c3e96e-0970-4871-b6e0-3b6de7561519",
\r
39 "templateId": "592f9437-a9c0-4303-b9f6-c445bb7e9814",
\r
41 "globalSubscriberId": "123457",
\r
42 "subscriberName": "Customer1",
\r
43 "serviceType": "voLTE",
\r
44 "templateName": "voLTE Service:1.0",
\r
47 "resourceName": "vIMS",
\r
48 "resourceDefId": "60c3e96e-0970-4871-b6e0-3b6de7561516",
\r
49 "resourceId": "60c3e96e-0970-4871-b6e0-3b6de7561512",
\r
51 "locationConstraints": [
\r
53 "vnfProfileId": "zte-vBAS-1.0",
\r
54 "locationConstraints": {
\r
55 "vimId": "4050083f-465f-4838-af1e-47a545222ad0"
\r
59 "vnfProfileId": "zte-vMME-1.0",
\r
60 "locationConstraints": {
\r
61 "vimId": "4050083f-465f-4838-af1e-47a545222ad0"
\r
65 "additionalParamForNs": {}
\r
69 "resourceName": "vEPC",
\r
70 "resourceDefId": "61c3e96e-0970-4871-b6e0-3b6de7561516",
\r
71 "resourceId": "62c3e96e-0970-4871-b6e0-3b6de7561512",
\r
73 "locationConstraints": [
\r
75 "vnfProfileId": "zte-CSCF-1.0",
\r
76 "locationConstraints": {
\r
77 "vimId": "4050083f-465f-4838-af1e-47a545222ad1"
\r
81 "additionalParamForNs": {}
\r
85 "resourceName": "underlayvpn",
\r
86 "resourceDefId": "60c3e96e-0970-4871-b6e0-3b6de7561513",
\r
87 "resourceId": "60c3e96e-0970-4871-b6e0-3b6de7561514",
\r
89 "locationConstraints": [],
\r
90 "additionalParamForNs": {
\r
91 "externalDataNetworkName": "Flow_out_net",
\r
92 "m6000_mng_ip": "181.18.20.2",
\r
93 "externalCompanyFtpDataNetworkName": "Flow_out_net",
\r
94 "externalPluginManageNetworkName": "plugin_net_2014",
\r
95 "externalManageNetworkName": "mng_net_2017",
\r
96 "sfc_data_network": "sfc_data_net_2016",
\r
97 "NatIpRange": "210.1.1.10-210.1.1.20",
\r
98 "location": "4050083f-465f-4838-af1e-47a545222ad0",
\r
99 "sdncontroller": "9b9f02c0-298b-458a-bc9c-be3692e4f35e"
\r
104 "resourceName": "overlayvpn",
\r
105 "resourceDefId": "60c3e96e-0970-4871-b6e0-3b6de7561517",
\r
106 "resourceId": "60c3e96e-0970-4871-b6e0-3b6de7561518",
\r
108 "locationConstraints": [],
\r
109 "additionalParamForNs": {
\r
110 "externalDataNetworkName": "Flow_out_net",
\r
111 "m6000_mng_ip": "181.18.20.2",
\r
112 "externalCompanyFtpDataNetworkName": "Flow_out_net",
\r
113 "externalPluginManageNetworkName": "plugin_net_2014",
\r
114 "externalManageNetworkName": "mng_net_2017",
\r
115 "sfc_data_network": "sfc_data_net_2016",
\r
116 "NatIpRange": "210.1.1.10-210.1.1.20",
\r
117 "location": "4050083f-465f-4838-af1e-47a545222ad0",
\r
118 "sdncontroller": "9b9f02c0-298b-458a-bc9c-be3692e4f35e"
\r
130 MockitoAnnotations.initMocks(this)
\r
134 public void initializeVariables(Execution mockExecution) {
\r
136 verify(mockExecution).setVariable(Prefix + "Success", false)
\r
138 verify(mockExecution).setVariable(Prefix + "CompleteMsoProcessRequest", "")
\r
139 verify(mockExecution).setVariable(Prefix + "FalloutHandlerRequest", "")
\r
140 verify(mockExecution).setVariable(Prefix + "isSilentSuccess", false)
\r
146 public void preProcessRequest() {
\r
148 println "************ preProcessRequest() ************* "
\r
149 ExecutionEntity mockExecution = mock(ExecutionEntity.class)
\r
150 // Initialize prerequisite variables
\r
151 when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true")
\r
152 when(mockExecution.getVariable("bpmnRequest")).thenReturn(jsonIncomingRequest)
\r
155 // preProcessRequest(Execution execution)
\r
156 CreateGenericALaCarteServiceInstance createGenericALaCarteServiceInstance = new CreateGenericALaCarteServiceInstance()
\r
157 createGenericALaCarteServiceInstance.preProcessRequest(mockExecution)
\r
159 verify(mockExecution).getVariable("isDebugLogEnabled")
\r
160 verify(mockExecution).setVariable("prefix", Prefix)
\r
162 initializeVariables(mockExecution)
\r
163 //verify(mockExecution).setVariable(Prefix + "Success", false)
\r
164 }catch(Exception e){
\r