97f714d98dfaab0644531d893ae6a084f9dda239
[so.git] /
1 /*
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20 package org.openecomp.mso.bpmn.vcpe.scripts
21
22
23 import org.camunda.bpm.engine.ProcessEngineServices
24 import org.camunda.bpm.engine.RepositoryService
25 import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
26 import org.camunda.bpm.engine.repository.ProcessDefinition
27 import org.camunda.bpm.engine.runtime.Execution
28 import org.junit.Before
29 import org.junit.BeforeClass
30 import org.junit.Rule
31 import org.junit.Test
32 import org.junit.Ignore
33 import org.mockito.MockitoAnnotations
34 import org.camunda.bpm.engine.delegate.BpmnError
35 import org.openecomp.mso.bpmn.core.WorkflowException
36 import org.openecomp.mso.bpmn.mock.FileUtil
37
38 import static com.github.tomakehurst.wiremock.client.WireMock.aResponse
39 import static com.github.tomakehurst.wiremock.client.WireMock.delete
40 import static com.github.tomakehurst.wiremock.client.WireMock.get
41 import static com.github.tomakehurst.wiremock.client.WireMock.patch
42 import static com.github.tomakehurst.wiremock.client.WireMock.put
43 import static com.github.tomakehurst.wiremock.client.WireMock.stubFor
44 import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching
45 import static org.junit.Assert.*;
46 import static org.mockito.Mockito.*
47 import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteAllottedResource
48 import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetAllottedResource
49 import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchAllottedResource
50 import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockQueryAllottedResourceById
51
52 import java.util.Map
53
54 import org.openecomp.mso.bpmn.core.RollbackData
55 import org.openecomp.mso.bpmn.vcpe.scripts.MapSetter
56
57 import com.github.tomakehurst.wiremock.junit.WireMockRule
58
59 class DoDeleteAllottedResourceTXCTest extends GroovyTestBase {
60         
61         @Rule
62         public WireMockRule wireMockRule = new WireMockRule(PORT)
63
64         String Prefix = "DDARTXC_"
65
66         @BeforeClass
67         public static void setUpBeforeClass() {
68                 super.setUpBeforeClass()
69         }
70           
71     @Before
72         public void init()
73         {
74                 MockitoAnnotations.initMocks(this)
75         }
76         
77         public DoDeleteAllottedResourceTXCTest() {
78                 super("DoDeleteAllottedResourceTXC")
79         }
80         
81         
82         // ***** preProcessRequest *****
83                         
84         @Test
85 //      @Ignore  
86         public void preProcessRequest() {
87                 ExecutionEntity mex = setupMock()
88                 initPreProcess(mex)
89                 
90                 DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
91                 DoDeleteAllottedResourceTXC.preProcessRequest(mex)
92
93                 verify(mex).getVariable(DBGFLAG)
94                 verify(mex).setVariable("prefix", Prefix)
95                 verify(mex).setVariable("sdncCallbackUrl", "sdncurn")
96                                 
97                 assertTrue(checkMissingPreProcessRequest("URN_mso_workflow_sdncadapter_callback"))
98                 assertTrue(checkMissingPreProcessRequest("serviceInstanceId"))
99                 assertTrue(checkMissingPreProcessRequest("allottedResourceId"))
100         }
101                         
102         @Test
103 //      @Ignore  
104         public void preProcessRequest_BpmnError() {
105                 ExecutionEntity mex = setupMock()
106                 initPreProcess(mex)
107                 
108                 when(mex.getVariable("serviceInstanceId")).thenThrow(new BpmnError("expected exception"))
109                 
110                 DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
111                 
112                 assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceTXC.preProcessRequest(mex) }))
113         }
114                         
115         @Test
116 //      @Ignore  
117         public void preProcessRequest_Ex() {
118                 ExecutionEntity mex = setupMock()
119                 initPreProcess(mex)
120                 
121                 when(mex.getVariable("serviceInstanceId")).thenThrow(new RuntimeException("expected exception"))
122                 
123                 DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
124                 
125                 assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceTXC.preProcessRequest(mex) }))
126         }
127         
128         
129         // ***** getAaiAR *****
130         
131         @Test
132 //      @Ignore
133         public void getAaiAR() {
134                 MockQueryAllottedResourceById(ARID, "GenericFlows/getARUrlById.xml")
135                 MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml")
136                 
137                 ExecutionEntity mex = setupMock()
138                 initGetAaiAR(mex)
139                 
140                 DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
141                 DoDeleteAllottedResourceTXC.getAaiAR(mex)
142                 
143                 verify(mex).setVariable("parentServiceInstanceId", INST)
144         }
145         
146         @Test
147 //      @Ignore
148         public void getAaiAR_EmptyResponse() {
149                 
150                 // note: empty result-link
151                 wireMockRule
152                         .stubFor(get(urlMatching("/aai/.*/search/.*"))
153                                         .willReturn(aResponse()
154                                                 .withStatus(200)
155                                                 .withHeader("Content-Type", "text/xml")
156                                                 .withBody("<result-data></result-data>")))
157                         
158                 MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml")
159                 
160                 ExecutionEntity mex = setupMock()
161                 initGetAaiAR(mex)
162                 
163                 DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
164                 
165                 assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceTXC.getAaiAR(mex) }))
166         }
167         
168         
169         // ***** updateAaiAROrchStatus *****
170         
171         @Test
172 //      @Ignore
173         public void updateAaiAROrchStatus() {
174                 ExecutionEntity mex = setupMock()
175                 initUpdateAaiAROrchStatus(mex)
176                 
177                 MockPatchAllottedResource(CUST, SVC, INST, ARID)
178                                         
179                 DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
180                 DoDeleteAllottedResourceTXC.updateAaiAROrchStatus(mex, "success")
181         }
182         
183         
184         // ***** buildSDNCRequest *****
185         
186         @Test
187 //      @Ignore
188         public void buildSDNCRequest() {
189                 ExecutionEntity mex = setupMock()
190                 initBuildSDNCRequest(mex)
191                 
192                 DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
193                 
194                 String result = DoDeleteAllottedResourceTXC.buildSDNCRequest(mex, "myact", "myreq")
195                 
196                 assertTrue(result.indexOf("<sdncadapter:RequestId>myreq</") >= 0)
197                 assertTrue(result.indexOf("<sdncadapter:SvcAction>myact</") >= 0)
198                 assertTrue(result.indexOf("<allotted-resource-id>ari</") >= 0)
199                 assertTrue(result.indexOf("<sdncadapter:SvcInstanceId>sii</") >= 0)
200                 assertTrue(result.indexOf("<service-instance-id>psii</") >= 0)
201                 assertTrue(result.indexOf("<parent-service-instance-id>psii</") >= 0)
202                 assertTrue(result.indexOf("<sdncadapter:CallbackUrl>scu</") >= 0)
203                 assertTrue(result.indexOf("<request-id>mri</") >= 0)
204                 assertTrue(result.indexOf("<model-invariant-uuid/>") >= 0)
205                 assertTrue(result.indexOf("<model-uuid/>") >= 0)
206                 assertTrue(result.indexOf("<model-customization-uuid/>") >= 0)
207                 assertTrue(result.indexOf("<model-version/>") >= 0)
208                 assertTrue(result.indexOf("<model-name/>") >= 0)
209         }
210         
211         @Test
212 //      @Ignore
213         public void buildSDNCRequest_Ex() {
214                 ExecutionEntity mex = setupMock()
215                 initBuildSDNCRequest(mex)
216                 
217                 when(mex.getVariable("allottedResourceId")).thenThrow(new RuntimeException("expected exception"))
218                 
219                 DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
220                 
221                 assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceTXC.buildSDNCRequest(mex, "myact", "myreq") }))
222         }
223         
224         
225         // ***** preProcessSDNCUnassign *****
226         
227         @Test
228 //      @Ignore
229         public void preProcessSDNCUnassign() {
230                 ExecutionEntity mex = setupMock()
231                 def map = setupMap(mex)
232                 initPreProcessSDNC(mex)
233                                         
234                 DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
235                 DoDeleteAllottedResourceTXC.preProcessSDNCUnassign(mex)
236                 
237                 def req = map.get("sdncUnassignRequest")
238                 
239                 assertTrue(req.indexOf("<sdncadapter:SvcAction>unassign</") >= 0)
240                 assertTrue(req.indexOf("<request-action>DeleteTunnelXConnInstance</") >= 0)
241                 assertTrue(req.indexOf("<sdncadapter:RequestId>") >= 0)
242         }
243         
244         @Test
245 //      @Ignore
246         public void preProcessSDNCUnassign_BpmnError() {
247                 ExecutionEntity mex = setupMock()
248                 initPreProcessSDNC(mex)
249                 
250                 when(mex.getVariable("allottedResourceId")).thenThrow(new BpmnError("expected exception"))
251                                         
252                 DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
253                 
254                 assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceTXC.preProcessSDNCUnassign(mex) }))
255         }
256         
257         @Test
258 //      @Ignore
259         public void preProcessSDNCUnassign_Ex() {
260                 ExecutionEntity mex = setupMock()
261                 initPreProcessSDNC(mex)
262                 
263                 when(mex.getVariable("allottedResourceId")).thenThrow(new RuntimeException("expected exception"))
264                                         
265                 DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
266                 
267                 assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceTXC.preProcessSDNCUnassign(mex) }))
268         }
269         
270         
271         // ***** preProcessSDNCDelete *****
272         
273         @Test
274 //      @Ignore
275         public void preProcessSDNCDelete() {
276                 ExecutionEntity mex = setupMock()
277                 def map = setupMap(mex)
278                 initPreProcessSDNC(mex)
279                                         
280                 DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
281                 DoDeleteAllottedResourceTXC.preProcessSDNCDelete(mex)
282                 
283                 def req = map.get("sdncDeleteRequest")
284                 
285                 assertTrue(req.indexOf("<sdncadapter:SvcAction>delete</") >= 0)
286                 assertTrue(req.indexOf("<request-action>DeleteTunnelXConnInstance</") >= 0)
287                 assertTrue(req.indexOf("<sdncadapter:RequestId>") >= 0)
288         }
289         
290         @Test
291 //      @Ignore
292         public void preProcessSDNCDelete_BpmnError() {
293                 ExecutionEntity mex = setupMock()
294                 initPreProcessSDNC(mex)
295                 
296                 when(mex.getVariable("allottedResourceId")).thenThrow(new BpmnError("expected exception"))
297                                         
298                 DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
299                 
300                 assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceTXC.preProcessSDNCDelete(mex) }))
301         }
302         
303         @Test
304 //      @Ignore
305         public void preProcessSDNCDelete_Ex() {
306                 ExecutionEntity mex = setupMock()
307                 initPreProcessSDNC(mex)
308                 
309                 when(mex.getVariable("allottedResourceId")).thenThrow(new RuntimeException("expected exception"))
310                                         
311                 DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
312                 
313                 assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceTXC.preProcessSDNCDelete(mex) }))
314         }
315         
316         
317         // ***** preProcessSDNCDeactivate *****
318         
319         @Test
320 //      @Ignore
321         public void preProcessSDNCDeactivate() {
322                 ExecutionEntity mex = setupMock()
323                 def map = setupMap(mex)
324                 initPreProcessSDNC(mex)
325                                         
326                 DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
327                 DoDeleteAllottedResourceTXC.preProcessSDNCDeactivate(mex)
328                 
329                 def req = map.get("sdncDeactivateRequest")
330                 
331                 assertTrue(req.indexOf("<sdncadapter:SvcAction>deactivate</") >= 0)
332                 assertTrue(req.indexOf("<request-action>DeleteTunnelXConnInstance</") >= 0)
333                 assertTrue(req.indexOf("<sdncadapter:RequestId>") >= 0)
334         }
335         
336         @Test
337 //      @Ignore
338         public void preProcessSDNCDeactivate_BpmnError() {
339                 ExecutionEntity mex = setupMock()
340                 initPreProcessSDNC(mex)
341                 
342                 when(mex.getVariable("allottedResourceId")).thenThrow(new BpmnError("expected exception"))
343                                         
344                 DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
345                 
346                 assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceTXC.preProcessSDNCDeactivate(mex) }))
347         }
348         
349         @Test
350 //      @Ignore
351         public void preProcessSDNCDeactivate_Ex() {
352                 ExecutionEntity mex = setupMock()
353                 initPreProcessSDNC(mex)
354                 
355                 when(mex.getVariable("allottedResourceId")).thenThrow(new RuntimeException("expected exception"))
356                                         
357                 DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
358                 
359                 assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceTXC.preProcessSDNCDeactivate(mex) }))
360         }
361         
362         
363         // ***** validateSDNCResp *****
364         
365         @Test
366 //      @Ignore
367         public void validateSDNCResp() {
368                 ExecutionEntity mex = setupMock()
369                 def data = initValidateSDNCResp(mex)
370                 def resp = initValidateSDNCResp_Resp(200)
371                 
372                 when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(true)
373                 
374                 DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
375                 
376                 DoDeleteAllottedResourceTXC.validateSDNCResp(mex, resp, "create")
377                 
378                 verify(mex).getVariable("WorkflowException")
379                 verify(mex).getVariable("SDNCA_SuccessIndicator")               
380                 verify(mex).getVariable(Prefix+"sdncResponseSuccess")
381                 
382                 verify(mex, never()).getVariable(Prefix + "sdncRequestDataResponseCode")
383                 verify(mex, never()).setVariable("wasDeleted", false)
384         }
385         
386         @Test
387 //      @Ignore
388         public void validateSDNCResp_Fail404_Deactivate_FailNotFound() {
389                 ExecutionEntity mex = setupMock()
390                 def data = initValidateSDNCResp(mex)
391                 
392                 def resp = initValidateSDNCResp_Resp(404)
393                 when(mex.getVariable(Prefix+"sdncRequestDataResponseCode")).thenReturn("404")
394                 when(mex.getVariable("failNotFound")).thenReturn("true")
395                 
396                 DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
397                 
398                 assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceTXC.validateSDNCResp(mex, resp, "deactivate")}))
399         }
400         
401         @Test
402 //      @Ignore
403         public void validateSDNCResp_Fail404_Deactivate() {
404                 ExecutionEntity mex = setupMock()
405                 def data = initValidateSDNCResp(mex)
406                 
407                 def resp = initValidateSDNCResp_Resp(404)
408                 when(mex.getVariable(Prefix+"sdncRequestDataResponseCode")).thenReturn("404")
409                 
410                 DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
411                 
412                 DoDeleteAllottedResourceTXC.validateSDNCResp(mex, resp, "deactivate")
413                 
414                 verify(mex).setVariable("ARNotFoundInSDNC", true)
415                 verify(mex).setVariable("wasDeleted", false)
416         }
417         
418         @Test
419 //      @Ignore
420         public void validateSDNCResp_Fail404() {
421                 ExecutionEntity mex = setupMock()
422                 def data = initValidateSDNCResp(mex)
423                 
424                 def resp = initValidateSDNCResp_Resp(404)
425                 when(mex.getVariable(Prefix+"sdncRequestDataResponseCode")).thenReturn("404")
426                 
427                 DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
428                 
429                 assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceTXC.validateSDNCResp(mex, resp, "create")}))
430         }
431         
432         @Test
433 //      @Ignore
434         public void validateSDNCResp_Deactivate() {
435                 ExecutionEntity mex = setupMock()
436                 def data = initValidateSDNCResp(mex)
437                 def resp = initValidateSDNCResp_Resp(200)
438                 
439                 DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
440                 
441                 assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceTXC.validateSDNCResp(mex, resp, "deactivate")}))
442         }
443         
444         @Test
445 //      @Ignore
446         public void validateSDNCResp_BpmnError() {
447                 ExecutionEntity mex = setupMock()
448                 initValidateSDNCResp(mex)
449                 def resp = initValidateSDNCResp_Resp(200)
450                 
451                 when(mex.getVariable("WorkflowException")).thenThrow(new BpmnError("expected exception"))
452                 
453                 DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
454                 
455                 assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceTXC.validateSDNCResp(mex, resp, "create") }))
456         }
457         
458         @Test
459 //      @Ignore
460         public void validateSDNCResp_Ex() {
461                 ExecutionEntity mex = setupMock()
462                 initValidateSDNCResp(mex)
463                 def resp = initValidateSDNCResp_Resp(200)
464                 
465                 when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception"))
466                 
467                 DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
468                 
469                 assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceTXC.validateSDNCResp(mex, resp, "create") }))
470         }
471                         
472         @Test
473 //      @Ignore  
474         public void deleteAaiAR() {
475                 ExecutionEntity mex = setupMock()
476                 initDeleteAaiAR(mex)
477                 
478                 MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml")
479                 MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS)
480                 
481                 DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
482                 DoDeleteAllottedResourceTXC.deleteAaiAR(mex)
483         }
484                         
485         @Test
486 //      @Ignore  
487         public void deleteAaiAR_NoArPath() {
488                 ExecutionEntity mex = setupMock()
489                 initDeleteAaiAR(mex)
490                 
491                 MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml")
492                 MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS)
493                         
494                 when(mex.getVariable("aaiARPath")).thenReturn("")
495                 
496                 DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
497                 
498                 assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceTXC.deleteAaiAR(mex) }))
499         }
500                         
501         @Test
502 //      @Ignore  
503         public void deleteAaiAR_BpmnError() {
504                 ExecutionEntity mex = setupMock()
505                 initDeleteAaiAR(mex)
506                 
507                 MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml")
508                 MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS)
509                         
510                 when(mex.getVariable("aaiARPath")).thenThrow(new BpmnError("expected exception"))
511                 
512                 DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
513                 
514                 assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceTXC.deleteAaiAR(mex) }))
515         }
516                         
517         @Test
518 //      @Ignore  
519         public void deleteAaiAR_Ex() {
520                 ExecutionEntity mex = setupMock()
521                 initDeleteAaiAR(mex)
522                 
523                 MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml")
524                 MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS)
525                         
526                 when(mex.getVariable("aaiARPath")).thenThrow(new RuntimeException("expected exception"))
527                 
528                 DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
529                 
530                 assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceTXC.deleteAaiAR(mex) }))
531         }
532         
533         private boolean checkMissingPreProcessRequest(String fieldnm) {
534                 ExecutionEntity mex = setupMock()
535                 initPreProcess(mex)
536                                                                 
537                 DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
538                 
539                 when(mex.getVariable(fieldnm)).thenReturn("")
540                 
541                 return doBpmnError( { _ -> DoDeleteAllottedResourceTXC.preProcessRequest(mex) })
542         }
543         
544         private void initPreProcess(ExecutionEntity mex) {
545                 when(mex.getVariable(DBGFLAG)).thenReturn("true")
546                 when(mex.getVariable("URN_mso_workflow_sdncadapter_callback")).thenReturn("sdncurn")
547                 when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
548                 when(mex.getVariable("allottedResourceId")).thenReturn("ari")
549         }
550         
551         private void initGetAaiAR(ExecutionEntity mex) {
552                 when(mex.getVariable(DBGFLAG)).thenReturn("true")
553                 when(mex.getVariable("allottedResourceType")).thenReturn("TXC")
554                 when(mex.getVariable("allottedResourceRole")).thenReturn("TXC")
555                 when(mex.getVariable("allottedResourceId")).thenReturn(ARID)
556                 when(mex.getVariable("CSI_service")).thenReturn(FileUtil.readResourceFile("__files/VCPE/DoDeleteAllottedResourceTXC/getAR.xml"))
557                 when(mex.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn(urnProps.get("mso.workflow.global.default.aai.namespace"))
558                 when(mex.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn(urnProps.get("mso.workflow.global.default.aai.version"))
559                 when(mex.getVariable("URN_mso_workflow_default_aai_v8_nodes_query_uri")).thenReturn(urnProps.get("mso.workflow.default.aai.v8.nodes-query.uri"))
560                 when(mex.getVariable("URN_aai_endpoint")).thenReturn(aaiUriPfx)
561                 when(mex.getVariable("aaiARPath")).thenReturn(aaiUriPfx + "/aai/v9/business/customers/customer/"+CUST+"/service-subscriptions/service-subscription/"+SVC+"/service-instances/service-instance/"+INST+"/allotted-resources/allotted-resource/"+ARID)
562                 when(mex.getVariable("aaiAROrchStatus")).thenReturn("Active")
563         }
564         
565         private initUpdateAaiAROrchStatus(ExecutionEntity mex) {
566                 when(mex.getVariable(DBGFLAG)).thenReturn("true")
567                 when(mex.getVariable("aaiARPath")).thenReturn(aaiUriPfx + "/aai/v9/business/customers/customer/"+CUST+"/service-subscriptions/service-subscription/"+SVC+"/service-instances/service-instance/"+INST+"/allotted-resources/allotted-resource/"+ARID)
568         }
569         
570         private initBuildSDNCRequest(ExecutionEntity mex) {
571                 when(mex.getVariable(DBGFLAG)).thenReturn("true")
572                 when(mex.getVariable("allottedResourceId")).thenReturn("ari")
573                 when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
574                 when(mex.getVariable("parentServiceInstanceId")).thenReturn("psii")
575                 when(mex.getVariable("sdncCallbackUrl")).thenReturn("scu")
576                 when(mex.getVariable("msoRequestId")).thenReturn("mri")
577         }
578         
579         private initPreProcessSDNC(ExecutionEntity mex) {
580                 when(mex.getVariable(DBGFLAG)).thenReturn("true")
581         }
582         
583         private initValidateSDNCResp(ExecutionEntity mex) {
584                 when(mex.getVariable(DBGFLAG)).thenReturn("true")
585                 when(mex.getVariable("prefix")).thenReturn(Prefix)
586                 when(mex.getVariable("SDNCA_SuccessIndicator")).thenReturn(true)
587         }
588         
589         private String initValidateSDNCResp_Resp(int code) {
590                 return "<response-data>&lt;response-code&gt;${code}&lt;/response-code&gt;</response-data>"
591         }
592         
593         private initDeleteAaiAR(ExecutionEntity mex) {
594                 when(mex.getVariable(DBGFLAG)).thenReturn("true")
595                 when(mex.getVariable("aaiARPath")).thenReturn(aaiUriPfx + "/aai/v9/business/customers/customer/"+CUST+"/service-subscriptions/service-subscription/"+SVC+"/service-instances/service-instance/"+INST+"/allotted-resources/allotted-resource/"+ARID)
596                 when(mex.getVariable("aaiARResourceVersion")).thenReturn("myvers")
597                 when(mex.getVariable("URN_aai_endpoint")).thenReturn(aaiUriPfx)
598         }
599                 
600 }