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