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