f91a39c85606ceb0c87c20c2635af871bd7e868a
[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 \r
22 \r
23 import org.camunda.bpm.engine.ProcessEngineServices\r
24 import org.camunda.bpm.engine.RepositoryService\r
25 import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity\r
26 import org.camunda.bpm.engine.repository.ProcessDefinition\r
27 import org.camunda.bpm.engine.runtime.Execution\r
28 import org.junit.Before
29 import org.junit.BeforeClass\r
30 import org.junit.Rule\r
31 import org.junit.Test
32 import org.junit.Ignore\r
33 import org.mockito.MockitoAnnotations
34 import org.camunda.bpm.engine.delegate.BpmnError\r
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.*;\r
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\r
58 \r
59 class DoDeleteAllottedResourceBRGTest extends GroovyTestBase {\r
60         \r
61         @Rule\r
62         public WireMockRule wireMockRule = new WireMockRule(PORT)
63 \r
64         String Prefix = "DDARBRG_"\r
65
66         @BeforeClass
67         public static void setUpBeforeClass() {
68                 super.setUpBeforeClass()
69         }
70           \r
71     @Before\r
72         public void init()\r
73         {\r
74                 MockitoAnnotations.initMocks(this)\r
75         }
76         
77         public DoDeleteAllottedResourceBRGTest() {
78                 super("DoDeleteAllottedResourceBRG")
79         }
80         
81         
82         // ***** preProcessRequest *****\r
83                         \r
84         @Test\r
85 //      @Ignore  \r
86         public void preProcessRequest() {\r
87                 ExecutionEntity mex = setupMock()
88                 initPreProcess(mex)
89                 \r
90                 DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()\r
91                 DoDeleteAllottedResourceBRG.preProcessRequest(mex)\r
92 \r
93                 verify(mex).getVariable(DBGFLAG)\r
94                 verify(mex).setVariable("prefix", Prefix)
95                 verify(mex).setVariable("sdncCallbackUrl", "sdncurn")\r
96                                 
97                 assertTrue(checkMissingPreProcessRequest("URN_mso_workflow_sdncadapter_callback"))
98                 assertTrue(checkMissingPreProcessRequest("serviceInstanceId"))
99                 assertTrue(checkMissingPreProcessRequest("allottedResourceId"))\r
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                 DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
111                 
112                 assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceBRG.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                 DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
124                 
125                 assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceBRG.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/DoDeleteAllottedResourceBRG/arGetById.xml")
136                 
137                 ExecutionEntity mex = setupMock()
138                 initGetAaiAR(mex)
139                 
140                 DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
141                 DoDeleteAllottedResourceBRG.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/DoDeleteAllottedResourceBRG/arGetById.xml")
159                 
160                 ExecutionEntity mex = setupMock()
161                 initGetAaiAR(mex)
162                 
163                 DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
164                 
165                 assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceBRG.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                 DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
180                 DoDeleteAllottedResourceBRG.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                 DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
193                 
194                 String result = DoDeleteAllottedResourceBRG.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                 DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
220                 
221                 assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceBRG.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                 DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
235                 DoDeleteAllottedResourceBRG.preProcessSDNCUnassign(mex)
236                 
237                 def req = map.get("sdncUnassignRequest")
238                 
239                 assertTrue(req.indexOf("<sdncadapter:SvcAction>unassign</") >= 0)
240                 assertTrue(req.indexOf("<request-action>DeleteBRGInstance</") >= 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                 DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
253                 
254                 assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceBRG.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                 DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
266                 
267                 assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceBRG.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                 DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
281                 DoDeleteAllottedResourceBRG.preProcessSDNCDelete(mex)
282                 
283                 def req = map.get("sdncDeleteRequest")
284                 
285                 assertTrue(req.indexOf("<sdncadapter:SvcAction>delete</") >= 0)
286                 assertTrue(req.indexOf("<request-action>DeleteBRGInstance</") >= 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                 DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
299                 
300                 assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceBRG.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                 DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
312                 
313                 assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceBRG.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                 DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
327                 DoDeleteAllottedResourceBRG.preProcessSDNCDeactivate(mex)
328                 
329                 def req = map.get("sdncDeactivateRequest")
330                 
331                 assertTrue(req.indexOf("<sdncadapter:SvcAction>deactivate</") >= 0)
332                 assertTrue(req.indexOf("<request-action>DeleteBRGInstance</") >= 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                 DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
345                 
346                 assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceBRG.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                 DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
358                 
359                 assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceBRG.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                 DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
375                 
376                 DoDeleteAllottedResourceBRG.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                 DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
397                 
398                 assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceBRG.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                 DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
411                 
412                 DoDeleteAllottedResourceBRG.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                 DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
428                 
429                 assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceBRG.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                 DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
440                 
441                 assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceBRG.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                 DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
454                 
455                 assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceBRG.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                 DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
468                 
469                 assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceBRG.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/DoDeleteAllottedResourceBRG/arGetById.xml")
479                 MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS)
480                 
481                 DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
482                 DoDeleteAllottedResourceBRG.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/DoDeleteAllottedResourceBRG/arGetById.xml")
492                 MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS)
493                         
494                 when(mex.getVariable("aaiARPath")).thenReturn("")
495                 
496                 DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
497                 
498                 assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceBRG.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/DoDeleteAllottedResourceBRG/arGetById.xml")
508                 MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS)
509                         
510                 when(mex.getVariable("aaiARPath")).thenThrow(new BpmnError("expected exception"))
511                 
512                 DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
513                 
514                 assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceBRG.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/DoDeleteAllottedResourceBRG/arGetById.xml")
524                 MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS)
525                         
526                 when(mex.getVariable("aaiARPath")).thenThrow(new RuntimeException("expected exception"))
527                 
528                 DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
529                 
530                 assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceBRG.deleteAaiAR(mex) }))
531         }
532         
533         private boolean checkMissingPreProcessRequest(String fieldnm) {
534                 ExecutionEntity mex = setupMock()
535                 initPreProcess(mex)
536                                                                 
537                 DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
538                 
539                 when(mex.getVariable(fieldnm)).thenReturn("")
540                 
541                 return doBpmnError( { _ -> DoDeleteAllottedResourceBRG.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("BRG")
554                 when(mex.getVariable("allottedResourceRole")).thenReturn("BRG")
555                 when(mex.getVariable("allottedResourceId")).thenReturn(ARID)
556                 when(mex.getVariable("CSI_service")).thenReturn(FileUtil.readResourceFile("__files/VCPE/DoDeleteAllottedResourceBRG/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         }\r
599                 \r
600 }