Add junit test coverage and fix bugs in VCPE 11/18311/1
authorJim Hahn <jrh3@att.com>
Wed, 11 Oct 2017 15:49:51 +0000 (11:49 -0400)
committerJim Hahn <jrh3@att.com>
Wed, 11 Oct 2017 15:49:51 +0000 (11:49 -0400)
Added additional junit tests for VCPE and fixed bugs that were found while
testing.

Change-Id: Icb6a0c936a16b775ff553c11cb07a4348bd9ebfc
Issue-ID: SO-210
Signed-off-by: Jim Hahn <jrh3@att.com>
93 files changed:
bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/BPMNUtil.java
bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy [moved from bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/vcpe/scripts/CreateVcpeResCustService.groovy with 68% similarity]
bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy [moved from bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/vcpe/scripts/DeleteVcpeResCustService.groovy with 68% similarity]
bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy [moved from bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/vcpe/scripts/DoCreateAllottedResourceBRG.groovy with 93% similarity]
bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollback.groovy [moved from bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/vcpe/scripts/DoCreateAllottedResourceBRGRollback.groovy with 86% similarity]
bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy [moved from bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/vcpe/scripts/DoCreateAllottedResourceTXC.groovy with 92% similarity]
bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollback.groovy [moved from bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/vcpe/scripts/DoCreateAllottedResourceTXCRollback.groovy with 86% similarity]
bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy [moved from bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy with 88% similarity]
bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy [moved from bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy with 88% similarity]
bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/vcpe/workflow/WorkflowAsyncVcpeResource.java
bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVcpeResCustService.bpmn
bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteVcpeResCustService.bpmn
bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateAllottedResourceBRG.bpmn
bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateAllottedResourceBRGRollback.bpmn
bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateAllottedResourceTXC.bpmn
bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateAllottedResourceTXCRollback.bpmn
bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy [new file with mode: 0644]
bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DeleteVcpeResCustServiceTest.groovy [new file with mode: 0644]
bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollbackTest.groovy [new file with mode: 0644]
bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGTest.groovy
bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollbackTest.groovy [new file with mode: 0644]
bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCTest.groovy [new file with mode: 0644]
bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRGTest.groovy [new file with mode: 0644]
bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXCTest.groovy [new file with mode: 0644]
bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/GroovyTestBase.groovy [new file with mode: 0644]
bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/MapGetter.groovy [new file with mode: 0644]
bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/MapSetter.groovy [new file with mode: 0644]
bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/AbstractTestBase.java [new file with mode: 0644]
bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/CreateVcpeResCustServiceTest.java
bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DeleteVcpeResCustServiceTest.java [new file with mode: 0644]
bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceBRGRollbackTest.java
bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceBRGTest.java
bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceTXCRollbackTest.java
bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceTXCTest.java
bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoDeleteAllottedResourceBRGTest.java
bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoDeleteAllottedResourceTXCTest.java
bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/DoCreateAllottedResourceBRG.bpmn [new file with mode: 0644]
bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/DoCreateAllottedResourceBRGRollback.bpmn [new file with mode: 0644]
bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/DoCreateAllottedResourceTXC.bpmn [new file with mode: 0644]
bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/DoCreateServiceInstanceRollback.bpmn [new file with mode: 0644]
bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/DoCreateVnfAndModules.bpmn [new file with mode: 0644]
bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/DoCreateVnfAndModulesRollback.bpmn [new file with mode: 0644]
bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/DoDeleteVnfAndModules.bpmn [new file with mode: 0644]
bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/Homing.bpmn [new file with mode: 0644]
bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getNotFound.xml [new file with mode: 0644]
bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateServiceInstance/createServiceInstance_AAIResponse_success.xml [deleted file]
bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryBRGCallback.xml [new file with mode: 0644]
bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryTXCCallback.xml [new file with mode: 0644]
bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/arGetById.xml [new file with mode: 0644]
bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json [moved from bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogServiceResourcesData.json with 67% similarity]
bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/getCatalogServiceResourcesNoData.json [moved from bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogServiceResourcesDataServiceInstanceOnly.json with 66% similarity]
bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/getCustomer.xml [new file with mode: 0644]
bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/request.json [moved from bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/request.json with 88% similarity]
bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/requestNoSIName.json [new file with mode: 0644]
bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/requestNoSINameNoRollback.json [new file with mode: 0644]
bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/arGetBRGById.xml [new file with mode: 0644]
bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/arGetTXCById.xml [new file with mode: 0644]
bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getBRGArUrlById.xml [moved from bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getARUrlById.xml with 87% similarity]
bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getSI.xml [new file with mode: 0644]
bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getSIAfterDelArs.xml [new file with mode: 0644]
bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getTXCArUrlById.xml [moved from bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getParentSIUrlById.xml with 61% similarity]
bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/request.json [new file with mode: 0644]
bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/serviceToDelete.xml [new file with mode: 0644]
bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getAR.xml
bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getArBrg.xml
bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getArBrg2.xml [new file with mode: 0644]
bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getSIandAR.xml [moved from bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getParentServiceInstance.xml with 61% similarity]
bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml
bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getAR.xml [new file with mode: 0644]
bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getArTxc.xml [new file with mode: 0644]
bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getArTxc2.xml [new file with mode: 0644]
bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getSIandAR.xml [new file with mode: 0644]
bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml
bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoDeleteAllottedResourceBRG/arGetById.xml
bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoDeleteAllottedResourceTXC/arGetById.xml
bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/VNFAdapterRestCreateCallback.xml [deleted file]
bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/createServiceInstance_genericQueryByInstance_AAIResponse_200.xml [deleted file]
bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogNetworkData.json [deleted file]
bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogServiceResourcesDataNoNetwork.json [deleted file]
bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogServiceResourcesDataNoNetworkVnf.json [deleted file]
bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogServiceResourcesDataServiceAllotted.json [deleted file]
bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogServiceResourcesServiceNetwork.json [deleted file]
bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogServiceResourcesServiceVnf.json [deleted file]
bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogVcpe.json [deleted file]
bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogVnfData.json [deleted file]
bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCustomer.xml [deleted file]
bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getNetwork.xml [deleted file]
bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/serviceDecompositionATMFW.json [deleted file]
bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyCreateCallback.xml [moved from bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/SDNCTopologyCreateCallback.xml with 100% similarity]
bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyDeactivateCallback.xml [moved from bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/SDNCTopologyDeactivateCallback.xml with 100% similarity]
bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyDeactivateCallbackNotFound.xml [new file with mode: 0644]
bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyDeleteCallback.xml [moved from bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/SDNCTopologyDeleteCallback.xml with 100% similarity]
bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyUnassignCallback.xml [moved from bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/SDNCTopologyUnassignCallback.xml with 100% similarity]

index 9057904..f60d984 100644 (file)
@@ -21,6 +21,9 @@
 package org.openecomp.mso.bpmn.common;\r
 \r
 import static org.junit.Assert.assertEquals;\r
+import static org.junit.Assert.assertNotNull;\r
+import static org.junit.Assert.assertNull;\r
+import static org.junit.Assert.assertTrue;\r
 import static org.junit.Assert.fail;\r
 import static org.mockito.Matchers.any;\r
 import static org.mockito.Mockito.doAnswer;\r
@@ -77,7 +80,18 @@ public class BPMNUtil {
                            .getValue();\r
                return (T) responseData;\r
        }\r
+\r
+       \r
+       public static void assertAnyProcessInstanceFinished(ProcessEngineServices processEngineServices, String processDefinitionID) {\r
+               String pID = getProcessInstanceId(processEngineServices,\r
+                               processDefinitionID);\r
+               assertNotNull(pID);\r
+           assertTrue(processEngineServices.getHistoryService().createHistoricProcessInstanceQuery().processInstanceId(pID).finished().count() > 0);\r
+       }\r
        \r
+       public static void assertNoProcessInstance(ProcessEngineServices processEngineServices, String processDefinitionID) {\r
+               assertNull(getProcessInstanceId(processEngineServices, processDefinitionID));\r
+       }\r
        \r
        public static void assertProcessInstanceFinished(ProcessEngineServices processEngineServices, String pid) {\r
            assertEquals(1, processEngineServices.getHistoryService().createHistoricProcessInstanceQuery().processInstanceId(pid).finished().count());\r
@@ -1,5 +1,21 @@
 /*\r
- * Ã‚© 2016 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property.\r
+ * ============LICENSE_START=======================================================\r
+ * ONAP - SO\r
+ * ================================================================================\r
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
+ * ================================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ * \r
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ * \r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ============LICENSE_END=========================================================\r
  */\r
 package org.openecomp.mso.bpmn.vcpe.scripts;\r
 \r
@@ -33,6 +49,8 @@ import org.springframework.web.util.UriUtils;
  */\r
 public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {\r
 \r
+       private static final String DebugFlag = "isDebugLogEnabled"\r
+\r
        String Prefix="CVRCS_"\r
        ExceptionUtil exceptionUtil = new ExceptionUtil()\r
        JsonUtils jsonUtil = new JsonUtils()\r
@@ -50,8 +68,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
                execution.setVariable("globalSubscriberId", "")\r
                execution.setVariable("serviceInstanceName", "")\r
                execution.setVariable("msoRequestId", "")\r
-               execution.setVariable("CVRCS_NetworksCreatedCount", 0)\r
-               execution.setVariable("CVRCS_VnfsCreatedCount", 0)\r
+               execution.setVariable(Prefix+"VnfsCreatedCount", 0)\r
                execution.setVariable("productFamilyId", "")\r
                execution.setVariable("brgWanMacAddress", "")\r
 \r
@@ -67,7 +84,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
         * @param execution\r
         */\r
        public void preProcessRequest (Execution execution) {\r
-               def isDebugEnabled=execution.getVariable("isDebugLogEnabled")\r
+               def isDebugEnabled=execution.getVariable(DebugFlag)\r
                execution.setVariable("prefix",Prefix)\r
 \r
                utils.log("DEBUG", " ***** Inside preProcessRequest CreateVcpeResCustService Request ***** ", isDebugEnabled)\r
@@ -105,10 +122,9 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
                        \r
                        String source = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.source")\r
                        if ((source == null) || (source.isEmpty())) {\r
-                               execution.setVariable("source", "VID")\r
-                       } else {\r
-                               execution.setVariable("source", source)\r
+                               source = "VID"\r
                        }\r
+                       execution.setVariable("source", source)\r
 \r
                        // extract globalSubscriberId\r
                        String globalSubscriberId = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.subscriberInfo.globalSubscriberId")\r
@@ -173,7 +189,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
                                        <source>${source}</source>\r
                                   </request-info>"""\r
 \r
-                       execution.setVariable("CVRCS_requestInfo", requestInfo)\r
+                       execution.setVariable(Prefix+"requestInfo", requestInfo)\r
 \r
                        utils.log("DEBUG", " ***** Completed preProcessRequest CreateVcpeResCustService Request ***** ", isDebugEnabled)\r
 \r
@@ -186,8 +202,8 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
                }\r
        }\r
 \r
-       public void sendSyncResponse (Execution execution) {\r
-               def isDebugEnabled=execution.getVariable("isDebugLogEnabled")\r
+       public void sendSyncResponse(Execution execution) {\r
+               def isDebugEnabled=execution.getVariable(DebugFlag)\r
 \r
                utils.log("DEBUG", " ***** Inside sendSyncResponse of CreateVcpeResCustService ***** ", isDebugEnabled)\r
 \r
@@ -211,7 +227,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
        //\r
        // *******************************\r
        public void prepareDecomposeService(Execution execution) {\r
-               def isDebugEnabled=execution.getVariable("isDebugLogEnabled")\r
+               def isDebugEnabled=execution.getVariable(DebugFlag)\r
 \r
                try {\r
                        utils.log("DEBUG", " ***** Inside prepareDecomposeService of CreateVcpeResCustService ***** ", isDebugEnabled)\r
@@ -234,7 +250,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
        //\r
        // *******************************\r
        public void prepareCreateServiceInstance(Execution execution) {\r
-               def isDebugEnabled=execution.getVariable("isDebugLogEnabled")\r
+               def isDebugEnabled=execution.getVariable(DebugFlag)\r
 \r
                try {\r
                        utils.log("DEBUG", " ***** Inside prepareCreateServiceInstance of CreateVcpeResCustService ***** ", isDebugEnabled)\r
@@ -266,10 +282,9 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
 \r
        public void postProcessServiceInstanceCreate (Execution execution){\r
                def method = getClass().getSimpleName() + '.postProcessServiceInstanceCreate(' +'execution=' + execution.getId() +')'\r
-               def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')\r
+               def isDebugLogEnabled = execution.getVariable(DebugFlag)\r
                logDebug('Entered ' + method, isDebugLogEnabled)\r
 \r
-               String source = execution.getVariable("source")\r
                String requestId = execution.getVariable("mso-request-id")\r
                String serviceInstanceId = execution.getVariable("serviceInstanceId")\r
                String serviceInstanceName = execution.getVariable("serviceInstanceName")\r
@@ -289,8 +304,8 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
                        </soapenv:Body>\r
                        </soapenv:Envelope>\r
                        """\r
-                       execution.setVariable("CVRCS_setUpdateDbInstancePayload", payload)\r
-                       utils.logAudit("CVRCS_setUpdateDbInstancePayload: " + payload)\r
+                       execution.setVariable(Prefix+"setUpdateDbInstancePayload", payload)\r
+                       utils.logAudit(Prefix+"setUpdateDbInstancePayload: " + payload)\r
                        logDebug('Exited ' + method, isDebugLogEnabled)\r
 \r
                } catch (BpmnError e) {\r
@@ -303,28 +318,13 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
 \r
 \r
        public void processDecomposition (Execution execution) {\r
-               def isDebugEnabled=execution.getVariable("isDebugLogEnabled")\r
+               def isDebugEnabled=execution.getVariable(DebugFlag)\r
 \r
-               utils.log("DEBUG", " ***** Inside getDataFromDecomposition() of CreateVcpeResCustService ***** ", isDebugEnabled)\r
+               utils.log("DEBUG", " ***** Inside processDecomposition() of CreateVcpeResCustService ***** ", isDebugEnabled)\r
 \r
                try {\r
 \r
                        ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")\r
-                       List<NetworkResource> networkList = serviceDecomposition.getServiceNetworks()\r
-\r
-\r
-                       execution.setVariable("networkList", networkList)\r
-                       execution.setVariable("networkListString", networkList.toString())\r
-\r
-                       utils.log("DEBUG", "networkList: "+ networkList, isDebugEnabled)\r
-\r
-                       if (networkList != null && networkList.size() > 0) {\r
-                               execution.setVariable("CVRCS_NetworksCount", networkList.size())\r
-                               utils.log("DEBUG", "networks to create: "+ networkList.size(), isDebugEnabled)\r
-                       } else {\r
-                               execution.setVariable("CVRCS_NetworksCount", 0)\r
-                               utils.log("DEBUG", "no networks to create based upon serviceDecomposition content", isDebugEnabled)\r
-                       }\r
 \r
                        // VNFs\r
                        List<VnfResource> vnfList = serviceDecomposition.getServiceVnfs()\r
@@ -333,7 +333,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
 \r
                        String vnfModelInfoString = ""\r
                        if (vnfList != null && vnfList.size() > 0) {\r
-                               execution.setVariable("CVRCS_VNFsCount", vnfList.size())\r
+                               execution.setVariable(Prefix+"VNFsCount", vnfList.size())\r
                                utils.log("DEBUG", "vnfs to create: "+ vnfList.size(), isDebugEnabled)\r
                                ModelInfo vnfModelInfo = vnfList[0].getModelInfo()\r
 \r
@@ -341,7 +341,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
                                String vnfModelInfoWithRoot = vnfModelInfo.toString()\r
                                vnfModelInfoString = jsonUtil.getJsonValue(vnfModelInfoWithRoot, "modelInfo")\r
                        } else {\r
-                                       execution.setVariable("CVRCS_VNFsCount", 0)\r
+                                       execution.setVariable(Prefix+"VNFsCount", 0)\r
                                        utils.log("DEBUG", "no vnfs to create based upon serviceDecomposition content", isDebugEnabled)\r
                        }\r
 \r
@@ -349,111 +349,18 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
                        execution.setVariable("vnfModelInfoString", vnfModelInfoString)\r
                        utils.log("DEBUG", " vnfModelInfoString :" + vnfModelInfoString, isDebugEnabled)\r
 \r
-                       utils.log("DEBUG", " ***** Completed getDataFromDecomposition() of CreateVcpeResCustService ***** ", isDebugEnabled)\r
+                       utils.log("DEBUG", " ***** Completed processDecomposition() of CreateVcpeResCustService ***** ", isDebugEnabled)\r
                } catch (Exception ex) {\r
                        sendSyncError(execution)\r
-                  String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. getDataFromDecomposition() - " + ex.getMessage()\r
+                  String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. processDecomposition() - " + ex.getMessage()\r
                   utils.log("DEBUG", exceptionMessage, isDebugEnabled)\r
                   exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)\r
                }\r
        }\r
 \r
-       // *******************************\r
-       //     Generate Network request Section\r
-       // *******************************\r
-       public void prepareNetworkCreate (Execution execution) {\r
-               def isDebugEnabled=execution.getVariable("isDebugLogEnabled")\r
-\r
-               try {\r
-                       utils.log("DEBUG", " ***** Inside preparenNetworkCreate of CreateVcpeResCustService ***** ", isDebugEnabled)\r
-\r
-\r
-                       String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest")\r
-\r
-                       List<NetworkResource> networkList = execution.getVariable("networkList")\r
-                       utils.log("DEBUG", "networkList: "+ networkList, isDebugEnabled)\r
-\r
-                       Integer networksCreatedCount = execution.getVariable("CVRCS_NetworksCreatedCount")\r
-                       String networkModelInfoString = ""\r
-\r
-                       if (networkList != null) {\r
-                               utils.log("DEBUG", " getting model info for network # :" + networksCreatedCount, isDebugEnabled)\r
-                               ModelInfo networkModelInfo = networkList[networksCreatedCount.intValue()].getModelInfo()\r
-                               //Currently use String representation in JSON format as an input\r
-                               //execution.setVariable("networkModelInfo", networkModelInfo)\r
-                               networkModelInfoString = networkModelInfo.toJsonStringNoRootName()\r
-                       } else {\r
-                               String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected number of networks to create - " + ex.getMessage()\r
-                               exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)\r
-                       }\r
-\r
-                       //Currently use String representation in JSON format as an input\r
-                       execution.setVariable("networkModelInfo", networkModelInfoString)\r
-                       utils.log("DEBUG", " networkModelInfoString :" + networkModelInfoString, isDebugEnabled)\r
-\r
-                       // extract cloud configuration\r
-                       String lcpCloudRegionId = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.cloudConfiguration.lcpCloudRegionId")\r
-                       execution.setVariable("lcpCloudRegionId", lcpCloudRegionId)\r
-                       utils.log("DEBUG","lcpCloudRegionId: "+ lcpCloudRegionId, isDebugEnabled)\r
-                       String tenantId = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.cloudConfiguration.tenantId")\r
-                       execution.setVariable("tenantId", tenantId)\r
-                       utils.log("DEBUG","tenantId: "+ tenantId, isDebugEnabled)\r
-\r
-                       String sdncVersion = execution.getVariable("sdncVersion")\r
-                       utils.log("DEBUG","sdncVersion: "+ sdncVersion, isDebugEnabled)\r
-\r
-//                     List<VnfResource> vnfList = execution.getVariable("vnfList")\r
-//                     utils.log("DEBUG", "vnfList: "+ vnfList.toString(), isDebugEnabled)\r
-//\r
-//                     String vnfModelInfo = execution.getVariable("vnfModelInfo")\r
-//                     utils.log("DEBUG", "vnfModelInfo: "+ vnfModelInfo, isDebugEnabled)\r
-\r
-                       utils.log("DEBUG", " ***** Completed preparenNetworkCreate of CreateVcpeResCustService ***** ", isDebugEnabled)\r
-               } catch (Exception ex) {\r
-                       // try error in method block\r
-                       String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected Error from method prepareNetworkCreate() - " + ex.getMessage()\r
-                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)\r
-               }\r
-        }\r
-\r
-       // *******************************\r
-       //     Validate Network request Section -> increment count\r
-       // *******************************\r
-       public void validateNetworkCreate (Execution execution) {\r
-               def isDebugEnabled=execution.getVariable("isDebugLogEnabled")\r
-\r
-               try {\r
-                       utils.log("DEBUG", " ***** Inside validateNetworkCreate of CreateVcpeResCustService ***** ", isDebugEnabled)\r
-\r
-                       Integer networksCreatedCount = execution.getVariable("CVRCS_NetworksCreatedCount")\r
-                       networksCreatedCount++\r
-                       execution.setVariable("CVRCS_NetworksCreatedCount", networksCreatedCount)\r
-\r
-                       execution.setVariable("DCRENI_rollbackData"+networksCreatedCount, execution.getVariable("DCRENI_rollbackData"))\r
-\r
-                       utils.log("DEBUG", "networksCreatedCount: "+ networksCreatedCount, isDebugEnabled)\r
-                       utils.log("DEBUG", "DCRENI_rollbackData N : "+ execution.getVariable("DCRENI_rollbackData"+networksCreatedCount), isDebugEnabled)\r
-\r
-//                     JSONArray vnfList = execution.getVariable("vnfList")\r
-//                     utils.log("DEBUG", "vnfList: "+ vnfList, isDebugEnabled)\r
-\r
-                       String vnfModelInfo = execution.getVariable("vnfModelInfo")\r
-                       utils.log("DEBUG", "vnfModelInfo: "+ vnfModelInfo, isDebugEnabled)\r
-\r
-                       List<NetworkResource> networkList = execution.getVariable("networkList")\r
-                       utils.log("DEBUG", "networkList: "+ networkList, isDebugEnabled)\r
-\r
-                       utils.log("DEBUG", " ***** Completed validateNetworkCreate of CreateVcpeResCustService ***** "+" network # "+networksCreatedCount, isDebugEnabled)\r
-               } catch (Exception ex) {\r
-                       // try error in method block\r
-                       String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected Error from method validateNetworkCreate() - " + ex.getMessage()\r
-                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)\r
-               }\r
-        }\r
-\r
 \r
        public void prepareCreateAllottedResourceTXC(Execution execution) {\r
-               def isDebugEnabled=execution.getVariable("isDebugLogEnabled")\r
+               def isDebugEnabled=execution.getVariable(DebugFlag)\r
 \r
                try {\r
                        utils.log("DEBUG", " ***** Inside prepareCreateAllottedResourceTXC of CreateVcpeResCustService ***** ", isDebugEnabled)\r
@@ -467,13 +374,6 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
                        String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest")\r
                        ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")\r
 \r
-                       //parentServiceInstanceId\r
-                       //The parentServiceInstanceId will be a Landing Network service.  This value will have been provided to the calling flow by SNIRO query (homing solution).\r
-                       //serviceDecomposition.getServiceNetworks()\r
-\r
-                       //For 1707, the vIPR Tenant OAM flow will use the BRG allotted resource parent service ID (since it is known that the security zone also comes from the vIPR FW).\r
-                       //Beyond 1707, this would need to be captured somehow in TOSCA model and also provided by SNIRO.\r
-\r
                        //allottedResourceModelInfo\r
                        //allottedResourceRole\r
                        //The model Info parameters are a JSON structure as defined in the Service Instantiation API.\r
@@ -486,34 +386,20 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
 \r
                                        utils.log("DEBUG", " getting model info for AllottedResource # :" + allottedResource.toJsonString(), isDebugEnabled)\r
                                        utils.log("DEBUG", " allottedResource.getAllottedResourceType() :" + allottedResource.getAllottedResourceType(), isDebugEnabled)\r
-                                       if(allottedResource.getAllottedResourceType() != null && allottedResource.getAllottedResourceType().equalsIgnoreCase("TunnelXConn")){\r
+                                       if("TunnelXConn".equalsIgnoreCase(allottedResource.getAllottedResourceType())){\r
                                                //set create flag to true\r
                                                execution.setVariable("createTXCAR", true)\r
                                                ModelInfo allottedResourceModelInfo = allottedResource.getModelInfo()\r
                                                execution.setVariable("allottedResourceModelInfoTXC", allottedResourceModelInfo.toJsonString())\r
                                                execution.setVariable("allottedResourceRoleTXC", allottedResource.getAllottedResourceRole())\r
                                                execution.setVariable("allottedResourceTypeTXC", allottedResource.getAllottedResourceType())\r
-                                               \r
-                                               //from Homing Solution. This is the infraServiceInstanceId in the BRG Allotted Resource decomposition structure.\r
+                                               //After decomposition and homing BBs, there should be an allotted resource object in the decomposition that represents the TXC,\r
+                                               //and in its homingSolution section should be found the infraServiceInstanceId (i.e. infraServiceInstanceId in TXC Allotted Resource structure) (which the Homing BB would have populated).\r
                                                execution.setVariable("parentServiceInstanceIdTXC", allottedResource.getHomingSolution().getServiceInstanceId())\r
                                        }
                                }\r
                        }\r
 \r
-                       //Populate with the A&AI network ID (l3-network object) for the Tenant OAM network that was created in prior step\r
-                       //String sourceNetworkId = execution.getVariable("networkId")\r
-                       //execution.setVariable("sourceNetworkId", sourceNetworkId)\r
-                       //Populate with the network-role (from A&AI l3-network object) for the Tenant OAM network from prior step\r
-                       \r
-                       //List<NetworkResource> networkResources = serviceDecomposition.getServiceNetworks()\r
-                       //if (networkResources != null) {\r
-                               //Iterator iter = networkResources.iterator();\r
-                               //while (iter.hasNext()){\r
-                                       //NetworkResource networkResource = (NetworkResource)iter.next();\r
-                                       //execution.setVariable("sourceNetworkRole", networkResource.getNetworkRole())\r
-                               //}\r
-                       //}\r
-\r
                        //unit test only\r
                        String allottedResourceId = execution.getVariable("allottedResourceId")\r
                        execution.setVariable("allottedResourceIdTXC", allottedResourceId)\r
@@ -527,7 +413,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
                }\r
         }\r
        public void prepareCreateAllottedResourceBRG(Execution execution) {\r
-               def isDebugEnabled=execution.getVariable("isDebugLogEnabled")\r
+               def isDebugEnabled=execution.getVariable(DebugFlag)\r
 \r
                try {\r
                        utils.log("DEBUG", " ***** Inside prepareCreateAllottedResourceBRG of CreateVcpeResCustService ***** ", isDebugEnabled)\r
@@ -541,13 +427,6 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
                        String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest")\r
                        ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")\r
 \r
-                       //parentServiceInstanceId\r
-                       //The parentServiceInstanceId will be a Landing Network service.  This value will have been provided to the calling flow by SNIRO query (homing solution).\r
-                       //serviceDecomposition.getServiceNetworks()\r
-\r
-                       //For 1707, the vIPR Tenant OAM flow will use the BRG allotted resource parent service ID (since it is known that the security zone also comes from the vIPR FW).\r
-                       //Beyond 1707, this would need to be captured somehow in TOSCA model and also provided by SNIRO.\r
-\r
                        //allottedResourceModelInfo\r
                        //allottedResourceRole\r
                        //The model Info parameters are a JSON structure as defined in the Service Instantiation API.\r
@@ -560,38 +439,20 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
 \r
                                        utils.log("DEBUG", " getting model info for AllottedResource # :" + allottedResource.toJsonString(), isDebugEnabled)\r
                                        utils.log("DEBUG", " allottedResource.getAllottedResourceType() :" + allottedResource.getAllottedResourceType(), isDebugEnabled)\r
-                                       if (allottedResource.getAllottedResourceType() != null && allottedResource.getAllottedResourceType().equalsIgnoreCase("BRG")) {\r
+                                       if("BRG".equalsIgnoreCase(allottedResource.getAllottedResourceType())){\r
                                                //set create flag to true\r
                                                execution.setVariable("createBRGAR", true)\r
                                                ModelInfo allottedResourceModelInfo = allottedResource.getModelInfo()\r
                                                execution.setVariable("allottedResourceModelInfoBRG", allottedResourceModelInfo.toJsonString())\r
                                                execution.setVariable("allottedResourceRoleBRG", allottedResource.getAllottedResourceRole())\r
                                                execution.setVariable("allottedResourceTypeBRG", allottedResource.getAllottedResourceType())\r
-                                               //For 1707, the vIPR Tenant OAM flow will use the BRG allotted resource parent service ID (since it is known that the security zone also comes from the vIPR FW).\r
-                                               //This Id should be taken from the homing solution for the BRG resource. \r
-                                               //After decomposition and homing BBs, there should be an allotted resource object in the decomposition that represents the BRG, \r
+                                               //After decomposition and homing BBs, there should be an allotted resource object in the decomposition that represents the BRG,\r
                                                //and in its homingSolution section should be found the infraServiceInstanceId (i.e. infraServiceInstanceId in BRG Allotted Resource structure) (which the Homing BB would have populated).\r
-                                               \r
-                                               //from Homing Solution. This is the infraServiceInstanceId in the BRG Allotted Resource decomposition structure.\r
                                                execution.setVariable("parentServiceInstanceIdBRG", allottedResource.getHomingSolution().getServiceInstanceId())\r
                                        }\r
                                }\r
                        }\r
 \r
-                       //Populate with the A&AI network ID (l3-network object) for the Tenant OAM network that was created in prior step\r
-                       //String sourceNetworkId = execution.getVariable("networkId")\r
-                       //execution.setVariable("sourceNetworkId", sourceNetworkId)\r
-                       //Populate with the network-role (from A&AI l3-network object) for the Tenant OAM network from prior step\r
-                       \r
-                       //List<NetworkResource> networkResources = serviceDecomposition.getServiceNetworks()\r
-                       //if (networkResources != null) {\r
-                               //Iterator iter = networkResources.iterator();\r
-                               //while (iter.hasNext()){\r
-                                       //NetworkResource networkResource = (NetworkResource)iter.next();\r
-                                       //execution.setVariable("sourceNetworkRole", networkResource.getNetworkRole())\r
-                               //}\r
-                       //}\r
-\r
                        //unit test only\r
                        String allottedResourceId = execution.getVariable("allottedResourceId")\r
                        execution.setVariable("allottedResourceIdBRG", allottedResourceId)\r
@@ -611,7 +472,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
        //     Generate Network request Section\r
        // *******************************\r
        public void prepareVnfAndModulesCreate (Execution execution) {\r
-               def isDebugEnabled=execution.getVariable("isDebugLogEnabled")\r
+               def isDebugEnabled=execution.getVariable(DebugFlag)\r
 \r
                try {\r
                        utils.log("DEBUG", " ***** Inside prepareVnfAndModulesCreate of CreateVcpeResCustService ***** ", isDebugEnabled)\r
@@ -634,7 +495,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
 \r
                        List<VnfResource> vnfList = execution.getVariable("vnfList")\r
 \r
-                       Integer vnfsCreatedCount = execution.getVariable("CVRCS_VnfsCreatedCount")\r
+                       Integer vnfsCreatedCount = execution.getVariable(Prefix+"VnfsCreatedCount")\r
                        String vnfModelInfoString = null;\r
 \r
                        if (vnfList != null && vnfList.size() > 0 ) {\r
@@ -673,15 +534,15 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
        //     Validate Vnf request Section -> increment count\r
        // *******************************\r
        public void validateVnfCreate (Execution execution) {\r
-               def isDebugEnabled=execution.getVariable("isDebugLogEnabled")\r
+               def isDebugEnabled=execution.getVariable(DebugFlag)\r
 \r
                try {\r
                        utils.log("DEBUG", " ***** Inside validateVnfCreate of CreateVcpeResCustService ***** ", isDebugEnabled)\r
 \r
-                       Integer vnfsCreatedCount = execution.getVariable("CVRCS_VnfsCreatedCount")\r
+                       Integer vnfsCreatedCount = execution.getVariable(Prefix+"VnfsCreatedCount")\r
                        vnfsCreatedCount++\r
 \r
-                       execution.setVariable("CVRCS_VnfsCreatedCount", vnfsCreatedCount)\r
+                       execution.setVariable(Prefix+"VnfsCreatedCount", vnfsCreatedCount)\r
 \r
                        utils.log("DEBUG", " ***** Completed validateVnfCreate of CreateVcpeResCustService ***** "+" vnf # "+vnfsCreatedCount, isDebugEnabled)\r
                } catch (Exception ex) {\r
@@ -691,38 +552,11 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
                }\r
         }\r
 \r
-       // *******************************\r
-       //     Validate Network request Section -> decrement count\r
-       // *******************************\r
-       public void validateNetworkRollback (Execution execution) {\r
-               def isDebugEnabled=execution.getVariable("isDebugLogEnabled")\r
-\r
-               try {\r
-                       utils.log("DEBUG", " ***** Inside validateNetworkRollback of CreateVcpeResCustService ***** ", isDebugEnabled)\r
-\r
-                       Integer networksCreatedCount = execution.getVariable("CVRCS_NetworksCreatedCount")\r
-                       networksCreatedCount--\r
-\r
-                       execution.setVariable("CVRCS_NetworksCreatedCount", networksCreatedCount)\r
-\r
-                       execution.setVariable("DCRENI_rollbackData", execution.getVariable("DCRENI_rollbackData"+networksCreatedCount))\r
-\r
-                       utils.log("DEBUG", " ***** Completed validateNetworkRollback of CreateVcpeResCustService ***** "+" network # "+networksCreatedCount, isDebugEnabled)\r
-               } catch (Exception ex) {\r
-                       // try error in method block\r
-                       String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected Error from method validateNetworkRollback() - " + ex.getMessage()\r
-                       //exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)\r
-                       utils.log("DEBUG", exceptionMessage, isDebugEnabled)\r
-                       execution.setVariable("CVRCS_NetworksCreatedCount", 0)\r
-                       utils.log("ERROR", exceptionMessage, true)\r
-               }\r
-        }\r
-\r
        // *****************************************\r
        //     Prepare Completion request Section\r
        // *****************************************\r
        public void postProcessResponse (Execution execution) {\r
-               def isDebugEnabled=execution.getVariable("isDebugLogEnabled")\r
+               def isDebugEnabled=execution.getVariable(DebugFlag)\r
 \r
                utils.log("DEBUG", " ***** Inside postProcessResponse of CreateVcpeResCustService ***** ", isDebugEnabled)\r
 \r
@@ -748,8 +582,8 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
                        String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest)\r
 \r
                        utils.logAudit(xmlMsoCompletionRequest)\r
-                       execution.setVariable("CVRCS_Success", true)\r
-                       execution.setVariable("CVRCS_CompleteMsoProcessRequest", xmlMsoCompletionRequest)\r
+                       execution.setVariable(Prefix+"Success", true)\r
+                       execution.setVariable(Prefix+"CompleteMsoProcessRequest", xmlMsoCompletionRequest)\r
                        utils.log("DEBUG", " SUCCESS flow, going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest, isDebugEnabled)\r
                } catch (BpmnError e) {\r
                        throw e;\r
@@ -761,7 +595,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
        }\r
 \r
        public void preProcessRollback (Execution execution) {\r
-               def isDebugEnabled=execution.getVariable("isDebugLogEnabled")\r
+               def isDebugEnabled=execution.getVariable(DebugFlag)\r
                utils.log("DEBUG"," ***** preProcessRollback of CreateVcpeResCustService ***** ", isDebugEnabled)\r
                try {\r
 \r
@@ -782,7 +616,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
        }\r
 \r
        public void postProcessRollback (Execution execution) {\r
-               def isDebugEnabled=execution.getVariable("isDebugLogEnabled")\r
+               def isDebugEnabled=execution.getVariable(DebugFlag)\r
                utils.log("DEBUG"," ***** postProcessRollback of CreateVcpeResCustService ***** ", isDebugEnabled)\r
                String msg = ""\r
                try {\r
@@ -802,19 +636,19 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
        }\r
 \r
        public void prepareFalloutRequest(Execution execution){\r
-               def isDebugEnabled=execution.getVariable("isDebugLogEnabled")\r
+               def isDebugEnabled=execution.getVariable(DebugFlag)\r
 \r
                utils.log("DEBUG", " *** STARTED CreateVcpeResCustService prepareFalloutRequest Process *** ", isDebugEnabled)\r
 \r
                try {\r
                        WorkflowException wfex = execution.getVariable("WorkflowException")\r
                        utils.log("DEBUG", " Incoming Workflow Exception: " + wfex.toString(), isDebugEnabled)\r
-                       String requestInfo = execution.getVariable("CVRCS_requestInfo")\r
+                       String requestInfo = execution.getVariable(Prefix+"requestInfo")\r
                        utils.log("DEBUG", " Incoming Request Info: " + requestInfo, isDebugEnabled)\r
 \r
                        //TODO. hmmm. there is no way to UPDATE error message.\r
 //                     String errorMessage = wfex.getErrorMessage()\r
-//                     boolean successIndicator = execution.getVariable("DCRESI_rollbackSuccessful")\r
+//                     boolean successIndicator = execution.getVariable("DCRESI_rolledBack")\r
 //                     if (successIndicator){\r
 //                             errorMessage = errorMessage + ". Rollback successful."\r
 //                     } else {\r
@@ -823,7 +657,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
 \r
                        String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo)\r
 \r
-                       execution.setVariable("CVRCS_falloutRequest", falloutRequest)\r
+                       execution.setVariable(Prefix+"falloutRequest", falloutRequest)\r
 \r
                } catch (Exception ex) {\r
                        utils.log("DEBUG", "Error Occured in CreateVcpeResCustService prepareFalloutRequest Process " + ex.getMessage(), isDebugEnabled)\r
@@ -834,15 +668,15 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
 \r
 \r
        public void sendSyncError (Execution execution) {\r
-               def isDebugEnabled=execution.getVariable("isDebugLogEnabled")\r
+               def isDebugEnabled=execution.getVariable(DebugFlag)\r
                execution.setVariable("prefix", Prefix)\r
 \r
                utils.log("DEBUG", " ***** Inside sendSyncError() of CreateVcpeResCustService ***** ", isDebugEnabled)\r
 \r
                try {\r
                        String errorMessage = ""\r
-                       if (execution.getVariable("WorkflowException") instanceof WorkflowException) {\r
-                               WorkflowException wfe = execution.getVariable("WorkflowException")\r
+                       def wfe = execution.getVariable("WorkflowException")\r
+                       if (wfe instanceof WorkflowException) {\r
                                errorMessage = wfe.getErrorMessage()\r
                        } else {\r
                                errorMessage = "Sending Sync Error."\r
@@ -862,20 +696,20 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
        }\r
 \r
        public void processJavaException(Execution execution){\r
-               def isDebugEnabled=execution.getVariable("isDebugLogEnabled")\r
+               def isDebugEnabled=execution.getVariable(DebugFlag)\r
                execution.setVariable("prefix",Prefix)\r
                try{\r
                        utils.log("DEBUG", "Caught a Java Exception", isDebugEnabled)\r
                        utils.log("DEBUG", "Started processJavaException Method", isDebugEnabled)\r
                        utils.log("DEBUG", "Variables List: " + execution.getVariables(), isDebugEnabled)\r
-                       execution.setVariable("CRESI_unexpectedError", "Caught a Java Lang Exception")  // Adding this line temporarily until this flows error handling gets updated\r
+                       execution.setVariable(Prefix+"unexpectedError", "Caught a Java Lang Exception")  // Adding this line temporarily until this flows error handling gets updated\r
                        exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Caught a Java Lang Exception")\r
                }catch(BpmnError b){\r
                        utils.log("ERROR", "Rethrowing MSOWorkflowException", isDebugEnabled)\r
                        throw b\r
                }catch(Exception e){\r
                        utils.log("DEBUG", "Caught Exception during processJavaException Method: " + e, isDebugEnabled)\r
-                       execution.setVariable("CRESI_unexpectedError", "Exception in processJavaException method")  // Adding this line temporarily until this flows error handling gets updated\r
+                       execution.setVariable(Prefix+"unexpectedError", "Exception in processJavaException method")  // Adding this line temporarily until this flows error handling gets updated\r
                        exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Exception in processJavaException method")\r
                }\r
                utils.log("DEBUG", "Completed processJavaException Method", isDebugEnabled)\r
@@ -1,5 +1,21 @@
 /*\r
- * Ã‚© 2016 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property.\r
+ * ============LICENSE_START=======================================================\r
+ * ONAP - SO\r
+ * ================================================================================\r
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
+ * ================================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ * \r
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ * \r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ============LICENSE_END=========================================================\r
  */\r
 package org.openecomp.mso.bpmn.vcpe.scripts\r
 \r
@@ -33,7 +49,9 @@ import org.springframework.web.util.UriUtils;
  */\r
 public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor {\r
 \r
-       String Prefix="DELVAS_"\r
+       private static final String DebugFlag = "isDebugLogEnabled"\r
+\r
+       String Prefix = "DVRCS_"\r
        ExceptionUtil exceptionUtil = new ExceptionUtil()\r
        JsonUtils jsonUtil = new JsonUtils()\r
        VidUtils vidUtils = new VidUtils()\r
@@ -49,10 +67,8 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor {
 \r
                execution.setVariable("DeleteVcpeResCustServiceRequest", "")\r
                execution.setVariable("msoRequestId", "")\r
-               execution.setVariable("DELVAS_vnfsDeletedCount", 0)\r
-               execution.setVariable("DELVAS_vnfsCount", 0)\r
-               execution.setVariable("DELVAS_networksCount", 0)\r
-               execution.setVariable("DELVAS_networksDeletedCount", 0)\r
+               execution.setVariable(Prefix+"vnfsDeletedCount", 0)\r
+               execution.setVariable(Prefix+"vnfsCount", 0)\r
        }\r
 \r
        // **************************************************\r
@@ -63,7 +79,7 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor {
         * @param execution\r
         */\r
        public void preProcessRequest (Execution execution) {\r
-               def isDebugEnabled=execution.getVariable("isDebugLogEnabled")\r
+               def isDebugEnabled=execution.getVariable(DebugFlag)\r
                execution.setVariable("prefix",Prefix)\r
 \r
                utils.log("DEBUG", " ***** Inside preProcessRequest DeleteVcpeResCustService Request ***** ", isDebugEnabled)\r
@@ -93,10 +109,9 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor {
 \r
                        String source = jsonUtil.getJsonValue(DeleteVcpeResCustServiceRequest, "requestDetails.requestInfo.source")\r
                        if ((source == null) || (source.isEmpty())) {\r
-                               execution.setVariable("source", "VID")\r
-                       } else {\r
-                               execution.setVariable("source", source)\r
+                               source = "VID"\r
                        }\r
+                       execution.setVariable("source", source)\r
 \r
                        // extract globalSubscriberId\r
                        String globalSubscriberId = jsonUtil.getJsonValue(DeleteVcpeResCustServiceRequest, "requestDetails.subscriberInfo.globalSubscriberId")\r
@@ -139,7 +154,7 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor {
                                        <source>${source}</source>\r
                                   </request-info>"""\r
 \r
-                       execution.setVariable("DELVAS_requestInfo", requestInfo)\r
+                       execution.setVariable(Prefix+"requestInfo", requestInfo)\r
                        \r
                        //Setting for Generic Sub Flows\r
                        execution.setVariable("GENGS_type", "service-instance")\r
@@ -154,8 +169,8 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor {
                }\r
        }\r
 \r
-       public void sendSyncResponse (Execution execution) {\r
-               def isDebugEnabled=execution.getVariable("isDebugLogEnabled")\r
+       public void sendSyncResponse(Execution execution) {\r
+               def isDebugEnabled=execution.getVariable(DebugFlag)\r
 \r
                utils.log("DEBUG", " ***** Inside sendSyncResponse of DeleteVcpeResCustService ***** ", isDebugEnabled)\r
 \r
@@ -169,13 +184,13 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor {
                        utils.log("DEBUG", " sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse, isDebugEnabled)\r
                        sendWorkflowResponse(execution, 202, syncResponse)\r
                } catch (Exception ex) {\r
-                       String exceptionMessage = "Bpmn error encountered in DeleteVcpeResCustService flow. Unexpected from method preProcessRequest() - " + ex.getMessage()^M
+                       String exceptionMessage = "Bpmn error encountered in DeleteVcpeResCustService flow. Unexpected from method preProcessRequest() - " + ex.getMessage()
                        exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)\r
                }\r
        }\r
 \r
-       public void prepareServiceDelete (Execution execution) {\r
-               def isDebugEnabled=execution.getVariable("isDebugLogEnabled")\r
+       public void prepareServiceDelete(Execution execution) {\r
+               def isDebugEnabled=execution.getVariable(DebugFlag)\r
                utils.log("DEBUG", " ***** Inside prepareServiceInstanceDelete() of DeleteVcpeResCustService ***** ", isDebugEnabled)\r
                \r
                try {\r
@@ -198,8 +213,8 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor {
                        utils.log("DEBUG", "serviceInstanceAaiRecord: "+serviceInstanceAaiRecord, isDebugEnabled)\r
                        \r
                        // determine if AR needs to be deleted\r
-                       boolean DELVAS_TunnelXConn = false\r
-                       boolean DELVAS_BRG = false\r
+                       boolean DVRCS_TunnelXConn = false\r
+                       boolean DVRCS_BRG = false\r
                        String TXC_allottedResourceId\r
                        String BRG_allottedResourceId\r
                        XmlParser xmlParser = new XmlParser()\r
@@ -208,32 +223,31 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor {
                        if (arList != null) {\r
                                def groovy.util.NodeList ars = utils.getIdenticalChildren(arList, 'allotted-resource')\r
                                for (groovy.util.Node ar in ars) {\r
-                                       def groovy.util.Node type = utils.getChildNode(ar, 'type')\r
-                                       if ((type != null) && (type.text().equals('TunnelXConn'))) {\r
+                                       def type = utils.getChildNodeText(ar, 'type')\r
+                                       if ("TunnelXConn".equals(type)) {\r
                                                utils.log("DEBUG","TunnelXConn AR found", isDebugEnabled)\r
-                                               def groovy.util.Node id = utils.getChildNode(ar, 'id')\r
+                                               def id = utils.getChildNodeText(ar, 'id')\r
                                                if (id != null){\r
-                                                       DELVAS_TunnelXConn = true\r
+                                                       DVRCS_TunnelXConn = true\r
                                                        TXC_allottedResourceId = id\r
                                                }\r
-                                       }\r
-                                       if ((type != null) && (type.text().equals('BRG'))) {\r
+                                       } else if ("BRG".equals(type)) {\r
                                                utils.log("DEBUG","FW AR found", isDebugEnabled)\r
-                                               def groovy.util.Node id = utils.getChildNode(ar, 'id')\r
+                                               def id = utils.getChildNodeText(ar, 'id')\r
                                                if (id != null){\r
-                                                       DELVAS_BRG = true\r
+                                                       DVRCS_BRG = true\r
                                                        BRG_allottedResourceId = id\r
                                                }\r
                                        }\r
                                }\r
                        }\r
-                       execution.setVariable("DELVAS_TunnelXConn", DELVAS_TunnelXConn)\r
-                       utils.log("DEBUG", "DELVAS_TunnelXConn : " + DELVAS_TunnelXConn, isDebugEnabled)\r
+                       execution.setVariable(Prefix+"TunnelXConn", DVRCS_TunnelXConn)\r
+                       utils.log("DEBUG", Prefix+"TunnelXConn : " + DVRCS_TunnelXConn, isDebugEnabled)\r
                        execution.setVariable("TXC_allottedResourceId", TXC_allottedResourceId)\r
                        utils.log("DEBUG", "TXC_allottedResourceId : " + TXC_allottedResourceId, isDebugEnabled)\r
                        \r
-                       execution.setVariable("DELVAS_BRG", DELVAS_BRG)\r
-                       utils.log("DEBUG", "DELVAS_BRG : " + DELVAS_BRG, isDebugEnabled)\r
+                       execution.setVariable(Prefix+"BRG", DVRCS_BRG)\r
+                       utils.log("DEBUG", Prefix+"BRG : " + DVRCS_BRG, isDebugEnabled)\r
                        execution.setVariable("BRG_allottedResourceId", BRG_allottedResourceId)\r
                        utils.log("DEBUG", "BRG_allottedResourceId : " + BRG_allottedResourceId, isDebugEnabled)\r
                \r
@@ -246,7 +260,6 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor {
                        utils.log("DEBUG", " relationship string - " + relationship, isDebugEnabled)\r
                        \r
                        int vnfsCount = 0\r
-                       int networksCount = 0\r
                        \r
                        if (relationship != null && relationship.length() > 0){\r
                                relationship = relationship.trim().replace("tag0:","").replace(":tag0","")\r
@@ -254,29 +267,20 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor {
                                // Check if Network TableREf is present, then build a List of network policy\r
                                List relatedVnfIdList = networkUtils.getRelatedVnfIdList(relationship)\r
                                vnfsCount = relatedVnfIdList.size()\r
-                               execution.setVariable("DELVAS_vnfsCount", vnfsCount)\r
-                               utils.log("DEBUG", " DELVAS_vnfsCount : " + vnfsCount, isDebugEnabled)\r
-                               execution.setVariable("DELVAS_relatedVnfIdList", relatedVnfIdList)\r
-                               \r
-                               // Check if Network TableREf is present, then build a List of network policy\r
-                               List relatedNetworkIdList = networkUtils.getRelatedNetworkIdList(relationship)\r
-                               networksCount = relatedNetworkIdList.size()\r
-                               execution.setVariable("DELVAS_networksCount", networksCount)\r
-                               utils.log("DEBUG", " DELVAS_networksCount : " + networksCount, isDebugEnabled)\r
-                               execution.setVariable("DELVAS_relatedNetworkIdList", relatedNetworkIdList)\r
+                               execution.setVariable(Prefix+"vnfsCount", vnfsCount)\r
+                               utils.log("DEBUG", " "+Prefix+"vnfsCount : " + vnfsCount, isDebugEnabled)\r
+                               execution.setVariable(Prefix+"relatedVnfIdList", relatedVnfIdList)\r
                        } else {\r
-                               execution.setVariable("DELVAS_vnfsCount", 0)\r
-                               utils.log("DEBUG", " DELVAS_vnfsCount : " + vnfsCount, isDebugEnabled)\r
-                               execution.setVariable("DELVAS_networksCount", 0)\r
-                               utils.log("DEBUG", " DELVAS_networksCount : " + networksCount, isDebugEnabled)\r
+                               execution.setVariable(Prefix+"vnfsCount", 0)\r
+                               utils.log("DEBUG", " "+Prefix+"vnfsCount : " + vnfsCount, isDebugEnabled)\r
                        }\r
                        \r
-                       utils.log("DEBUG", " ***** Completed prepareServiceInstanceDelete() of DeleteVcpeCusRestService ***** ", isDebugEnabled)\r
+                       utils.log("DEBUG", " ***** Completed prepareServiceInstanceDelete() of DeleteVcpeResCustService ***** ", isDebugEnabled)\r
                } catch (BpmnError e){\r
                        throw e;\r
                } catch (Exception ex) {\r
                        sendSyncError(execution)\r
-                  String exceptionMessage = "Bpmn error encountered in DeleteVcpeCusRestService flow. prepareServiceInstanceDelete() - " + ex.getMessage()\r
+                  String exceptionMessage = "Bpmn error encountered in DeleteVcpeResCustService flow. prepareServiceInstanceDelete() - " + ex.getMessage()\r
                   utils.log("DEBUG", exceptionMessage, isDebugEnabled)\r
                   exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)\r
                }\r
@@ -287,13 +291,12 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor {
        //     \r
        // *******************************\r
        public void prepareVnfAndModulesDelete (Execution execution) {\r
-               def isDebugEnabled=execution.getVariable("isDebugLogEnabled")\r
+               def isDebugEnabled=execution.getVariable(DebugFlag)\r
+               utils.log("DEBUG", " ***** Inside prepareVnfAndModulesDelete of DeleteVcpeResCustService ***** ", isDebugEnabled)\r
 \r
                try {\r
-                       utils.log("DEBUG", " ***** Inside prepareVnfAndModulesDelete of DeleteServiceInstanceMacro ***** ", isDebugEnabled)\r
-\r
-                       List vnfList = execution.getVariable("DELVAS_relatedVnfIdList")\r
-                       Integer vnfsDeletedCount = execution.getVariable("DELVAS_vnfsDeletedCount")\r
+                       List vnfList = execution.getVariable(Prefix+"relatedVnfIdList")\r
+                       int vnfsDeletedCount = execution.getVariable(Prefix+"vnfsDeletedCount")\r
                        String vnfModelInfoString = ""\r
                        String vnfId = ""\r
                        if (vnfList.size() > 0 ) {\r
@@ -303,10 +306,10 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor {
                        execution.setVariable("vnfId", vnfId)\r
                        utils.log("DEBUG", "need to delete vnfId:" + vnfId, isDebugEnabled)\r
 \r
-                       utils.log("DEBUG", " ***** Completed prepareVnfAndModulesDelete of DeleteServiceInstanceMacro ***** ", isDebugEnabled)\r
+                       utils.log("DEBUG", " ***** Completed prepareVnfAndModulesDelete of DeleteVcpeResCustService ***** ", isDebugEnabled)\r
                } catch (Exception ex) {\r
                        // try error in method block\r
-                       String exceptionMessage = "Bpmn error encountered in DeleteServiceInstanceMacro flow. Unexpected Error from method prepareVnfAndModulesDelete() - " + ex.getMessage()\r
+                       String exceptionMessage = "Bpmn error encountered in DeleteVcpeResCustService flow. Unexpected Error from method prepareVnfAndModulesDelete() - " + ex.getMessage()\r
                        exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)\r
                }\r
         }\r
@@ -315,70 +318,19 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor {
        //     Validate Vnf request Section -> increment count\r
        // *******************************\r
        public void validateVnfDelete (Execution execution) {\r
-               def isDebugEnabled=execution.getVariable("isDebugLogEnabled")\r
+               def isDebugEnabled=execution.getVariable(DebugFlag)\r
+               utils.log("DEBUG", " ***** Inside validateVnfDelete of DeleteVcpeResCustService ***** ", isDebugEnabled)\r
 \r
                try {\r
-                       utils.log("DEBUG", " ***** Inside validateVnfDelete of DeleteVcpeCusRestService ***** ", isDebugEnabled)\r
-\r
-                       String vnfsDeletedCount = execution.getVariable("DELVAS_vnfsDeletedCount")\r
+                       int vnfsDeletedCount = execution.getVariable(Prefix+"vnfsDeletedCount")\r
                        vnfsDeletedCount++\r
                        \r
-                       execution.setVariable("DELVAS_vnfsDeletedCount", vnfsDeletedCount)\r
-                       \r
-                       utils.log("DEBUG", " ***** Completed validateVnfDelete of DeleteVcpeCusRestService ***** "+" vnf # "+vnfsDeletedCount, isDebugEnabled)\r
-               } catch (Exception ex) {\r
-                       // try error in method block\r
-                       String exceptionMessage = "Bpmn error encountered in DeleteVcpeCusRestService flow. Unexpected Error from method validateVnfDelete() - " + ex.getMessage()\r
-                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)\r
-               }\r
-        }\r
-       \r
-       // *******************************\r
-       //     Generate Network request Section\r
-       // *******************************\r
-       public void prepareNetworkDelete (Execution execution) {\r
-               def isDebugEnabled=execution.getVariable("isDebugLogEnabled")\r
-\r
-               try {\r
-                       utils.log("DEBUG", " ***** Inside prepareNetworkDelete of DeleteVcpeCusRestService ***** ", isDebugEnabled)\r
-\r
-                       List networkList = execution.getVariable("DELVAS_relatedNetworkIdList")\r
-                       Integer networksDeletedCount = execution.getVariable("DELVAS_networksDeletedCount")\r
-\r
-                       String networkId = ""\r
-                       if (networkList.size() > 0) {\r
-                               networkId = networkList.get(networksDeletedCount.intValue())\r
-                       }\r
-                                                       \r
-                       execution.setVariable("networkId", networkId)\r
-                       utils.log("DEBUG", "need to delete networkId:" + networkId, isDebugEnabled)\r
-                       \r
-                       utils.log("DEBUG", " ***** Completed prepareNetworkDelete of DeleteVcpeCusRestService ***** ", isDebugEnabled)\r
-               } catch (Exception ex) {\r
-                       // try error in method block\r
-                       String exceptionMessage = q"Bpmn error encountered in DeleteVcpeCusRestService flow. Unexpected Error from method prepareNetworkDelete() - " + ex.getMessage()\r
-                       exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)\r
-               }\r
-        }\r
-       \r
-       // *******************************\r
-       //     Validate Network request Section\r
-       // *******************************\r
-       public void validateNetworkDelete (Execution execution) {\r
-               def isDebugEnabled=execution.getVariable("isDebugLogEnabled")\r
-\r
-               try {\r
-                       utils.log("DEBUG", " ***** Inside validateNetworkDelete of DeleteVcpeCusRestService ***** ", isDebugEnabled)\r
-\r
-                       Integer networksDeletedCount = execution.getVariable("DELVAS_networksDeletedCount")\r
-                       networksDeletedCount++\r
-                       \r
-                       execution.setVariable("DELVAS_networksDeletedCount", networksDeletedCount)\r
+                       execution.setVariable(Prefix+"vnfsDeletedCount", vnfsDeletedCount)\r
                        \r
-                       utils.log("DEBUG", " ***** Completed validateNetworkDelete of DeleteVcpeCusRestService ***** ", isDebugEnabled)\r
+                       utils.log("DEBUG", " ***** Completed validateVnfDelete of DeleteVcpeResCustService ***** "+" vnf # "+vnfsDeletedCount, isDebugEnabled)\r
                } catch (Exception ex) {\r
                        // try error in method block\r
-                       String exceptionMessage = "Bpmn error encountered in DeleteVcpeCusRestService flow. Unexpected Error from method validateNetworkDelete() - " + ex.getMessage()\r
+                       String exceptionMessage = "Bpmn error encountered in DeleteVcpeResCustService flow. Unexpected Error from method validateVnfDelete() - " + ex.getMessage()\r
                        exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)\r
                }\r
         }\r
@@ -388,8 +340,8 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor {
        //     Prepare Completion request Section\r
        // *****************************************\r
        public void postProcessResponse (Execution execution) {\r
-               def isDebugEnabled=execution.getVariable("isDebugLogEnabled")\r
-               utils.log("DEBUG", " ***** Inside postProcessResponse of DeleteVcpeCusRestService ***** ", isDebugEnabled)\r
+               def isDebugEnabled=execution.getVariable(DebugFlag)\r
+               utils.log("DEBUG", " ***** Inside postProcessResponse of DeleteVcpeResCustService ***** ", isDebugEnabled)\r
 \r
                try {\r
                        String source = execution.getVariable("source")\r
@@ -411,8 +363,8 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor {
                        String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest)\r
 \r
                        utils.logAudit(xmlMsoCompletionRequest)\r
-                       execution.setVariable("DELVAS_Success", true)\r
-                       execution.setVariable("DELVAS_CompleteMsoProcessRequest", xmlMsoCompletionRequest)\r
+                       execution.setVariable(Prefix+"Success", true)\r
+                       execution.setVariable(Prefix+"CompleteMsoProcessRequest", xmlMsoCompletionRequest)\r
                        utils.log("DEBUG", " SUCCESS flow, going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest, isDebugEnabled)\r
                } catch (BpmnError e) {\r
                throw e;\r
@@ -425,29 +377,29 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor {
        }\r
 \r
        public void prepareFalloutRequest(Execution execution){\r
-               def isDebugEnabled=execution.getVariable("isDebugLogEnabled")\r
-               utils.log("DEBUG", " *** STARTED DeleteVcpeCusRestService prepareFalloutRequest Process *** ", isDebugEnabled)\r
+               def isDebugEnabled=execution.getVariable(DebugFlag)\r
+               utils.log("DEBUG", " *** STARTED DeleteVcpeResCustService prepareFalloutRequest Process *** ", isDebugEnabled)\r
 \r
                try {\r
                        WorkflowException wfex = execution.getVariable("WorkflowException")\r
                        utils.log("DEBUG", " Incoming Workflow Exception: " + wfex.toString(), isDebugEnabled)\r
-                       String requestInfo = execution.getVariable("DELVAS_requestInfo")\r
+                       String requestInfo = execution.getVariable(Prefix+"requestInfo")\r
                        utils.log("DEBUG", " Incoming Request Info: " + requestInfo, isDebugEnabled)\r
 \r
                        String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo)\r
 \r
-                       execution.setVariable("DELVAS_falloutRequest", falloutRequest)\r
+                       execution.setVariable(Prefix+"falloutRequest", falloutRequest)\r
                } catch (Exception ex) {\r
-                       utils.log("DEBUG", "Error Occured in DeleteVcpeCusRestService prepareFalloutRequest Process " + ex.getMessage(), isDebugEnabled)\r
-                       exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DeleteVcpeCusRestService prepareFalloutRequest Process")\r
+                       utils.log("DEBUG", "Error Occured in DeleteVcpeResCustService prepareFalloutRequest Process " + ex.getMessage(), isDebugEnabled)\r
+                       exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DeleteVcpeResCustService prepareFalloutRequest Process")\r
                }\r
-               utils.log("DEBUG", "*** COMPLETED DeleteVcpeCusRestService prepareFalloutRequest Process ***", isDebugEnabled)\r
+               utils.log("DEBUG", "*** COMPLETED DeleteVcpeResCustService prepareFalloutRequest Process ***", isDebugEnabled)\r
        }\r
 \r
 \r
        public void sendSyncError (Execution execution) {\r
-               def isDebugEnabled=execution.getVariable("isDebugLogEnabled")\r
-               utils.log("DEBUG", " ***** Inside sendSyncError() of DeleteServiceInstanceInfra ***** ", isDebugEnabled)\r
+               def isDebugEnabled=execution.getVariable(DebugFlag)\r
+               utils.log("DEBUG", " ***** Inside sendSyncError() of DeleteVcpeResCustService ***** ", isDebugEnabled)\r
 \r
                try {\r
                        String errorMessage = ""\r
@@ -472,20 +424,20 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor {
        }\r
 \r
        public void processJavaException(Execution execution){\r
-               def isDebugEnabled=execution.getVariable("isDebugLogEnabled")\r
+               def isDebugEnabled=execution.getVariable(DebugFlag)\r
                execution.setVariable("prefix",Prefix)\r
                try{\r
                        utils.log("DEBUG", "Caught a Java Exception", isDebugEnabled)\r
                        utils.log("DEBUG", "Started processJavaException Method", isDebugEnabled)\r
                        utils.log("DEBUG", "Variables List: " + execution.getVariables(), isDebugEnabled)\r
-                       execution.setVariable("DELVAS_unexpectedError", "Caught a Java Lang Exception")  // Adding this line temporarily until this flows error handling gets updated\r
+                       execution.setVariable(Prefix+"unexpectedError", "Caught a Java Lang Exception")  // Adding this line temporarily until this flows error handling gets updated\r
                        exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Caught a Java Lang Exception")\r
                }catch(BpmnError b){\r
                        utils.log("ERROR", "Rethrowing MSOWorkflowException", isDebugEnabled)\r
                        throw b\r
                }catch(Exception e){\r
                        utils.log("DEBUG", "Caught Exception during processJavaException Method: " + e, isDebugEnabled)\r
-                       execution.setVariable("DELVAS_unexpectedError", "Exception in processJavaException method")  // Adding this line temporarily until this flows error handling gets updated\r
+                       execution.setVariable(Prefix+"unexpectedError", "Exception in processJavaException method")  // Adding this line temporarily until this flows error handling gets updated\r
                        exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Exception in processJavaException method")\r
                }\r
                utils.log("DEBUG", "Completed processJavaException Method", isDebugEnabled)\r
@@ -1,5 +1,21 @@
 /*
- * Â© 2016 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property.
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
  */
 package org.openecomp.mso.bpmn.vcpe.scripts;
 
@@ -48,13 +64,15 @@ import static org.apache.commons.lang3.StringUtils.*
  */
 public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{
 
+       private static final String DebugFlag = "isDebugLogEnabled"
+
        String Prefix="DCARBRG_"
        ExceptionUtil exceptionUtil = new ExceptionUtil()
        JsonUtils jsonUtil = new JsonUtils()
 
        public void preProcessRequest (Execution execution) {
 
-               def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+               def isDebugEnabled = execution.getVariable(DebugFlag)
                String msg = ""
                utils.log("DEBUG"," ***** preProcessRequest *****",  isDebugEnabled)
 
@@ -125,7 +143,7 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{
 
        public void getAaiAR (Execution execution) {
 
-               def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+               def isDebugEnabled = execution.getVariable(DebugFlag)
                utils.log("DEBUG"," ***** getAaiAR ***** ", isDebugEnabled)
 
                String arType = execution.getVariable("allottedResourceType")
@@ -163,7 +181,7 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{
 
        public void createAaiAR(Execution execution) {
 
-               def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+               def isDebugEnabled=execution.getVariable(DebugFlag)
                utils.log("DEBUG"," ***** createAaiAR ***** ", isDebugEnabled)
                String msg = ""
 
@@ -285,7 +303,7 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{
 
        public String buildSDNCRequest(Execution execution, String action, String sdncRequestId) {
 
-               def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+               def isDebugEnabled = execution.getVariable(DebugFlag)
                String msg = ""
                utils.log("DEBUG"," ***** buildSDNCRequest *****", isDebugEnabled)
                String sdncReq = null
@@ -387,7 +405,7 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{
 
        public void preProcessSDNCAssign(Execution execution) {
 
-               def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+               def isDebugEnabled = execution.getVariable(DebugFlag)
                String msg = ""
                utils.log("DEBUG"," ***** preProcessSDNCAssign *****", isDebugEnabled)
 
@@ -417,7 +435,7 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{
 
        public void preProcessSDNCCreate(Execution execution) {
 
-               def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+               def isDebugEnabled = execution.getVariable(DebugFlag)
                String msg = ""
                utils.log("DEBUG"," ***** preProcessSDNCCreate *****", isDebugEnabled)
 
@@ -447,7 +465,7 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{
 
        public void preProcessSDNCActivate(Execution execution) {
 
-               def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+               def isDebugEnabled = execution.getVariable(DebugFlag)
                String msg = ""
                utils.log("DEBUG"," ***** preProcessSDNCActivate *****", isDebugEnabled)
 
@@ -477,7 +495,7 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{
 
        public void validateSDNCResp(Execution execution, String response, String method){
 
-               def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled")
+               def isDebugLogEnabled=execution.getVariable(DebugFlag)
                utils.log("DEBUG", " *** ValidateSDNCResponse Process*** ", isDebugLogEnabled)
                String msg = ""
 
@@ -516,7 +534,7 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{
        }
 
        public void preProcessSDNCGet(Execution execution){
-               def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled")
+               def isDebugLogEnabled = execution.getVariable(DebugFlag)
                utils.log("DEBUG", "*** preProcessSDNCGet *** ", isDebugLogEnabled)
                try{
 
@@ -576,7 +594,7 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{
        }
        
        public void updateAaiAROrchStatus(Execution execution, String status){
-               def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+               def isDebugEnabled = execution.getVariable(DebugFlag)
                utils.log("DEBUG", " *** updateAaiAROrchStatus *** ", isDebugEnabled)
                String aaiARPath = execution.getVariable("aaiARPath") //set during query (existing AR) or create
                AllottedResourceUtils arUtils = new AllottedResourceUtils(this)
@@ -586,7 +604,7 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{
        
        public void generateOutputs(Execution execution)
        {
-               def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+               def isDebugEnabled=execution.getVariable(DebugFlag)
                utils.log("DEBUG"," ***** generateOutputs ***** ", isDebugEnabled)
                try {
                        String sdncGetResponse = execution.getVariable("enhancedCallbackRequestData") //unescaped
@@ -608,7 +626,7 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{
        }
 
        public void preProcessRollback (Execution execution) {
-               def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+               def isDebugEnabled=execution.getVariable(DebugFlag)
                utils.log("DEBUG"," ***** preProcessRollback ***** ", isDebugEnabled)
                try {
 
@@ -629,7 +647,7 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{
        }
 
        public void postProcessRollback (Execution execution) {
-               def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+               def isDebugEnabled=execution.getVariable(DebugFlag)
                utils.log("DEBUG"," ***** postProcessRollback ***** ", isDebugEnabled)
                String msg = ""
                try {
@@ -1,5 +1,21 @@
 /*
- * Â© 2016 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property.
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
  */
 package org.openecomp.mso.bpmn.vcpe.scripts;
 
@@ -37,12 +53,14 @@ import static org.apache.commons.lang3.StringUtils.*
  */
 public class DoCreateAllottedResourceBRGRollback extends AbstractServiceTaskProcessor{
 
+       private static final String DebugFlag = "isDebugLogEnabled"
+
        String Prefix="DCARBRGRB_"
        ExceptionUtil exceptionUtil = new ExceptionUtil()
 
        public void preProcessRequest (Execution execution) {
                
-               def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+               def isDebugEnabled = execution.getVariable(DebugFlag)
                String msg = ""
                utils.log("DEBUG"," ***** preProcessRequest *****",  isDebugEnabled)
                execution.setVariable("prefix", Prefix)
@@ -114,7 +132,7 @@ public class DoCreateAllottedResourceBRGRollback extends AbstractServiceTaskProc
 
        // aaiARPath set during query (existing AR)
        public void updateAaiAROrchStatus(Execution execution, String status){
-               def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+               def isDebugEnabled = execution.getVariable(DebugFlag)
                String msg = null;
                utils.log("DEBUG", " *** updateAaiAROrchStatus ***", isDebugEnabled)
                AllottedResourceUtils arUtils = new AllottedResourceUtils(this)
@@ -137,7 +155,7 @@ public class DoCreateAllottedResourceBRGRollback extends AbstractServiceTaskProc
 
        public void validateSDNCResp(Execution execution, String response, String method){
 
-               def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled")
+               def isDebugLogEnabled=execution.getVariable(DebugFlag)
                utils.log("DEBUG", " *** ValidateSDNCResponse Process*** ", isDebugLogEnabled)
                String msg = ""
 
@@ -160,24 +178,24 @@ public class DoCreateAllottedResourceBRGRollback extends AbstractServiceTaskProc
                                throw new BpmnError("MSOWorkflowException")
                        }
                } catch (BpmnError e) {
-                       if (e.getErrorCode() == 404)
+                       if ("404".contentEquals(e.getErrorCode()))
                        {
                                msg = "SDNC rollback " + method + " returned a 404. Proceding with rollback"
-                               utils.log("DEBUG", msg, isDebugEnabled)
+                               utils.log("DEBUG", msg, isDebugLogEnabled)
                        }
                        else {
                                throw e;
                        }
                } catch(Exception ex) {
                        msg = "Exception in validateSDNCResp. " + ex.getMessage()
-                       utils.log("DEBUG", msg, isDebugEnabled)
+                       utils.log("DEBUG", msg, isDebugLogEnabled)
                        exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
                }
                logDebug(" *** Exit ValidateSDNCResp Process*** ", isDebugLogEnabled)
        }
 
        public void deleteAaiAR(Execution execution){
-               def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled")
+               def isDebugLogEnabled = execution.getVariable(DebugFlag)
                try{
                        utils.log("DEBUG", " *** deleteAaiAR *** ", isDebugLogEnabled)
                        AllottedResourceUtils arUtils = new AllottedResourceUtils(this)
@@ -198,7 +216,7 @@ public class DoCreateAllottedResourceBRGRollback extends AbstractServiceTaskProc
        }
        
        public void postProcessRequest(Execution execution) {
-               def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+               def isDebugEnabled=execution.getVariable(DebugFlag)
                utils.log("DEBUG"," ***** postProcessRequest ***** ", isDebugEnabled)
                String msg = ""
                try {
@@ -222,7 +240,7 @@ public class DoCreateAllottedResourceBRGRollback extends AbstractServiceTaskProc
        }
        
        public void processRollbackException(Execution execution){
-               def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+               def isDebugEnabled=execution.getVariable(DebugFlag)
                utils.log("DEBUG"," ***** processRollbackException ***** ", isDebugEnabled)
                try{
                        utils.log("DEBUG", "Caught an Exception in DoCreateAllottedResourceRollback", isDebugEnabled)
@@ -241,7 +259,7 @@ public class DoCreateAllottedResourceBRGRollback extends AbstractServiceTaskProc
        }
 
        public void processRollbackJavaException(Execution execution){
-               def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+               def isDebugEnabled=execution.getVariable(DebugFlag)
                utils.log("DEBUG"," ***** processRollbackJavaException ***** ", isDebugEnabled)
                try{
                        execution.setVariable("rollbackData", null)
@@ -1,5 +1,21 @@
 /*
- * Â© 2016 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property.
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
  */
 package org.openecomp.mso.bpmn.vcpe.scripts;
 
@@ -49,13 +65,15 @@ import static org.apache.commons.lang3.StringUtils.*
  */
 public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{
 
+       private static final String DebugFlag = "isDebugLogEnabled"
+
        String Prefix="DCARTXC_"
        ExceptionUtil exceptionUtil = new ExceptionUtil()
        JsonUtils jsonUtil = new JsonUtils()
 
        public void preProcessRequest (Execution execution) {
 
-               def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+               def isDebugEnabled = execution.getVariable(DebugFlag)
                String msg = ""
                utils.log("DEBUG"," ***** preProcessRequest *****",  isDebugEnabled)
 
@@ -116,7 +134,7 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{
 
        public void getAaiAR (Execution execution) {
 
-               def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+               def isDebugEnabled = execution.getVariable(DebugFlag)
                utils.log("DEBUG"," ***** getAaiAR ***** ", isDebugEnabled)
 
                String arType = execution.getVariable("allottedResourceType")
@@ -154,7 +172,7 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{
 
        public void createAaiAR(Execution execution) {
 
-               def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+               def isDebugEnabled=execution.getVariable(DebugFlag)
                utils.log("DEBUG"," ***** createAaiAR ***** ", isDebugEnabled)
                String msg = ""
 
@@ -276,7 +294,7 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{
 
        public String buildSDNCRequest(Execution execution, String action, String sdncRequestId) {
 
-               def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+               def isDebugEnabled = execution.getVariable(DebugFlag)
                String msg = ""
                utils.log("DEBUG"," ***** buildSDNCRequest *****", isDebugEnabled)
                String sdncReq = null
@@ -375,7 +393,7 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{
 
        public void preProcessSDNCAssign(Execution execution) {
 
-               def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+               def isDebugEnabled = execution.getVariable(DebugFlag)
                String msg = ""
                utils.log("DEBUG"," ***** preProcessSDNCAssign *****", isDebugEnabled)
 
@@ -405,7 +423,7 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{
 
        public void preProcessSDNCCreate(Execution execution) {
 
-               def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+               def isDebugEnabled = execution.getVariable(DebugFlag)
                String msg = ""
                utils.log("DEBUG"," ***** preProcessSDNCCreate *****", isDebugEnabled)
 
@@ -435,7 +453,7 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{
 
        public void preProcessSDNCActivate(Execution execution) {
 
-               def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+               def isDebugEnabled = execution.getVariable(DebugFlag)
                String msg = ""
                utils.log("DEBUG"," ***** preProcessSDNCActivate *****", isDebugEnabled)
 
@@ -465,7 +483,7 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{
 
        public void validateSDNCResp(Execution execution, String response, String method){
 
-               def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled")
+               def isDebugLogEnabled=execution.getVariable(DebugFlag)
                utils.log("DEBUG", " *** ValidateSDNCResponse Process*** ", isDebugLogEnabled)
                String msg = ""
 
@@ -497,14 +515,14 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{
                        throw e;
                } catch(Exception ex) {
                        msg = "Exception in validateSDNCResp. " + ex.getMessage()
-                       utils.log("DEBUG", msg, isDebugEnabled)
+                       utils.log("DEBUG", msg, isDebugLogEnabled)
                        exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
                }
                logDebug(" *** Exit ValidateSDNCResp Process*** ", isDebugLogEnabled)
        }
 
        public void preProcessSDNCGet(Execution execution){
-               def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled")
+               def isDebugLogEnabled = execution.getVariable(DebugFlag)
                utils.log("DEBUG", "*** preProcessSDNCGet *** ", isDebugLogEnabled)
                try{
 
@@ -564,7 +582,7 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{
        }
        
        public void updateAaiAROrchStatus(Execution execution, String status){
-               def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+               def isDebugEnabled = execution.getVariable(DebugFlag)
                utils.log("DEBUG", " *** updateAaiAROrchStatus *** ", isDebugEnabled)
                String aaiARPath = execution.getVariable("aaiARPath") //set during query (existing AR) or create
                AllottedResourceUtils arUtils = new AllottedResourceUtils(this)
@@ -574,7 +592,7 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{
        
        public void generateOutputs(Execution execution)
        {
-               def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+               def isDebugEnabled=execution.getVariable(DebugFlag)
                utils.log("DEBUG"," ***** generateOutputs ***** ", isDebugEnabled)
                try {
                        String sdncGetResponse = execution.getVariable("enhancedCallbackRequestData") //unescaped
@@ -583,11 +601,12 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{
                        arData = utils.removeXmlNamespaces(arData)
                
                        String txca = utils.getNodeXml(arData, "tunnelxconn-assignments")
+                       execution.setVariable("vni", utils.getNodeText1(txca, "vni"))
+                       execution.setVariable("vgmuxBearerIP", utils.getNodeText1(txca, "vgmux_bearer_ip"))
+                       execution.setVariable("vgmuxLanIP", utils.getNodeText1(txca, "vgmux_lan_ip"))
+                       
                        String ari = utils.getNodeXml(arData, "allotted-resource-identifiers")
                        execution.setVariable("allotedResourceName", utils.getNodeText1(ari, "allotted-resource-name"))
-                       execution.setVariable("vni", utils.getNodeText1(ari, "vni"))
-                       execution.setVariable("vgmuxBearerIp", utils.getNodeText1(ari, "vgmux_bearer_ip"))
-                       execution.setVariable("vgmuxLanIP", utils.getNodeText1(ari, "vgmux_lan_ip"))
                } catch (BpmnError e) {
                        utils.log("DEBUG", "BPMN Error in generateOutputs ", isDebugEnabled)
                } catch(Exception ex) {
@@ -599,7 +618,7 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{
        }
 
        public void preProcessRollback (Execution execution) {
-               def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+               def isDebugEnabled=execution.getVariable(DebugFlag)
                utils.log("DEBUG"," ***** preProcessRollback ***** ", isDebugEnabled)
                try {
 
@@ -620,7 +639,7 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{
        }
 
        public void postProcessRollback (Execution execution) {
-               def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+               def isDebugEnabled=execution.getVariable(DebugFlag)
                utils.log("DEBUG"," ***** postProcessRollback ***** ", isDebugEnabled)
                String msg = ""
                try {
@@ -1,5 +1,21 @@
 /*
- * Â© 2016 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property.
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
  */
 package org.openecomp.mso.bpmn.vcpe.scripts;
 
@@ -37,12 +53,14 @@ import static org.apache.commons.lang3.StringUtils.*
  */
 public class DoCreateAllottedResourceTXCRollback extends AbstractServiceTaskProcessor{
 
+       private static final String DebugFlag = "isDebugLogEnabled"
+
        String Prefix="DCARTXCRB_"
        ExceptionUtil exceptionUtil = new ExceptionUtil()
 
        public void preProcessRequest (Execution execution) {
                
-               def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+               def isDebugEnabled = execution.getVariable(DebugFlag)
                String msg = ""
                utils.log("DEBUG"," ***** preProcessRequest *****",  isDebugEnabled)
                execution.setVariable("prefix", Prefix)
@@ -114,7 +132,7 @@ public class DoCreateAllottedResourceTXCRollback extends AbstractServiceTaskProc
 
        // aaiARPath set during query (existing AR)
        public void updateAaiAROrchStatus(Execution execution, String status){
-               def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+               def isDebugEnabled = execution.getVariable(DebugFlag)
                String msg = null;
                utils.log("DEBUG", " *** updateAaiAROrchStatus ***", isDebugEnabled)
                AllottedResourceUtils arUtils = new AllottedResourceUtils(this)
@@ -137,7 +155,7 @@ public class DoCreateAllottedResourceTXCRollback extends AbstractServiceTaskProc
 
        public void validateSDNCResp(Execution execution, String response, String method){
 
-               def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled")
+               def isDebugLogEnabled=execution.getVariable(DebugFlag)
                utils.log("DEBUG", " *** ValidateSDNCResponse Process*** ", isDebugLogEnabled)
                String msg = ""
 
@@ -160,24 +178,24 @@ public class DoCreateAllottedResourceTXCRollback extends AbstractServiceTaskProc
                                throw new BpmnError("MSOWorkflowException")
                        }
                } catch (BpmnError e) {
-                       if (e.getErrorCode() == 404)
+                       if ("404".contentEquals(e.getErrorCode()))
                        {
                                msg = "SDNC rollback " + method + " returned a 404. Proceding with rollback"
-                               utils.log("DEBUG", msg, isDebugEnabled)
+                               utils.log("DEBUG", msg, isDebugLogEnabled)
                        }
                        else {
                                throw e;
                        }
                } catch(Exception ex) {
                        msg = "Exception in validateSDNCResp. " + ex.getMessage()
-                       utils.log("DEBUG", msg, isDebugEnabled)
+                       utils.log("DEBUG", msg, isDebugLogEnabled)
                        exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
                }
                logDebug(" *** Exit ValidateSDNCResp Process*** ", isDebugLogEnabled)
        }
 
        public void deleteAaiAR(Execution execution){
-               def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled")
+               def isDebugLogEnabled = execution.getVariable(DebugFlag)
                try{
                        utils.log("DEBUG", " *** deleteAaiAR *** ", isDebugLogEnabled)
                        AllottedResourceUtils arUtils = new AllottedResourceUtils(this)
@@ -198,7 +216,7 @@ public class DoCreateAllottedResourceTXCRollback extends AbstractServiceTaskProc
        }
        
        public void postProcessRequest(Execution execution) {
-               def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+               def isDebugEnabled=execution.getVariable(DebugFlag)
                utils.log("DEBUG"," ***** postProcessRequest ***** ", isDebugEnabled)
                String msg = ""
                try {
@@ -222,7 +240,7 @@ public class DoCreateAllottedResourceTXCRollback extends AbstractServiceTaskProc
        }
        
        public void processRollbackException(Execution execution){
-               def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+               def isDebugEnabled=execution.getVariable(DebugFlag)
                utils.log("DEBUG"," ***** processRollbackException ***** ", isDebugEnabled)
                try{
                        utils.log("DEBUG", "Caught an Exception in DoCreateAllottedResourceRollback", isDebugEnabled)
@@ -241,7 +259,7 @@ public class DoCreateAllottedResourceTXCRollback extends AbstractServiceTaskProc
        }
 
        public void processRollbackJavaException(Execution execution){
-               def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+               def isDebugEnabled=execution.getVariable(DebugFlag)
                utils.log("DEBUG"," ***** processRollbackJavaException ***** ", isDebugEnabled)
                try{
                        execution.setVariable("rollbackData", null)
@@ -1,5 +1,21 @@
 /*
- * Â© 2016 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property.
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
  */
 package org.openecomp.mso.bpmn.vcpe.scripts;
 
@@ -41,12 +57,14 @@ import static org.apache.commons.lang3.StringUtils.*
  */
 public class DoDeleteAllottedResourceBRG extends AbstractServiceTaskProcessor{
 
+       private static final String DebugFlag = "isDebugLogEnabled"
+
        String Prefix="DDARBRG_"
        ExceptionUtil exceptionUtil = new ExceptionUtil()
 
        public void preProcessRequest (Execution execution) {
 
-               def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+               def isDebugEnabled = execution.getVariable(DebugFlag)
                String msg = ""
                utils.log("DEBUG"," ***** preProcessRequest *****",  isDebugEnabled)
 
@@ -88,7 +106,7 @@ public class DoDeleteAllottedResourceBRG extends AbstractServiceTaskProcessor{
 
        public void getAaiAR (Execution execution) {
 
-               def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+               def isDebugEnabled = execution.getVariable(DebugFlag)
                utils.log("DEBUG"," ***** getAaiAR ***** ", isDebugEnabled)
 
                String allottedResourceId = execution.getVariable("allottedResourceId")
@@ -117,7 +135,7 @@ public class DoDeleteAllottedResourceBRG extends AbstractServiceTaskProcessor{
 
        // aaiARPath set during query (existing AR)
        public void updateAaiAROrchStatus(Execution execution, String status){
-               def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+               def isDebugEnabled = execution.getVariable(DebugFlag)
                utils.log("DEBUG", " *** updateAaiAROrchStatus *** ", isDebugEnabled)
                AllottedResourceUtils arUtils = new AllottedResourceUtils(this)
                String aaiARPath = execution.getVariable("aaiARPath") //set during query (existing AR) 
@@ -127,7 +145,7 @@ public class DoDeleteAllottedResourceBRG extends AbstractServiceTaskProcessor{
 
        public String buildSDNCRequest(Execution execution, String action, String sdncRequestId) {
 
-               def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+               def isDebugEnabled = execution.getVariable(DebugFlag)
                String msg = ""
                utils.log("DEBUG"," ***** buildSDNCRequest *****", isDebugEnabled)
                String sdncReq = null
@@ -213,7 +231,7 @@ public class DoDeleteAllottedResourceBRG extends AbstractServiceTaskProcessor{
 
        public void preProcessSDNCUnassign(Execution execution) {
 
-               def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+               def isDebugEnabled = execution.getVariable(DebugFlag)
                String msg = ""
                utils.log("DEBUG"," ***** preProcessSDNCUnassign *****", isDebugEnabled)
 
@@ -234,7 +252,7 @@ public class DoDeleteAllottedResourceBRG extends AbstractServiceTaskProcessor{
 
        public void preProcessSDNCDelete(Execution execution) {
 
-               def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+               def isDebugEnabled = execution.getVariable(DebugFlag)
                String msg = ""
                utils.log("DEBUG"," ***** preProcessSDNCDelete *****", isDebugEnabled)
 
@@ -255,7 +273,7 @@ public class DoDeleteAllottedResourceBRG extends AbstractServiceTaskProcessor{
 
        public void preProcessSDNCDeactivate(Execution execution) {
 
-               def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+               def isDebugEnabled = execution.getVariable(DebugFlag)
                String msg = ""
                utils.log("DEBUG"," ***** preProcessSDNCDeactivate *****", isDebugEnabled)
 
@@ -276,7 +294,7 @@ public class DoDeleteAllottedResourceBRG extends AbstractServiceTaskProcessor{
 
        public void validateSDNCResp(Execution execution, String response, String method){
 
-               def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled")
+               def isDebugLogEnabled=execution.getVariable(DebugFlag)
                utils.log("DEBUG", " *** ValidateSDNCResponse Process*** ", isDebugLogEnabled)
                String msg = ""
 
@@ -302,7 +320,7 @@ public class DoDeleteAllottedResourceBRG extends AbstractServiceTaskProcessor{
                                        if ("true".equals(execution.getVariable("failNotFound")))
                                        {
                                                msg = "Allotted Resource Not found in SDNC"
-                                               utils.log("DEBUG", msg, isDebugEnabled)
+                                               utils.log("DEBUG", msg, isDebugLogEnabled)
                                                exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
                                        }
                                        else
@@ -319,14 +337,14 @@ public class DoDeleteAllottedResourceBRG extends AbstractServiceTaskProcessor{
                        throw e;
                } catch(Exception ex) {
                        msg = "Exception in validateSDNCResp. " + ex.getMessage()
-                       utils.log("DEBUG", msg, isDebugEnabled)
+                       utils.log("DEBUG", msg, isDebugLogEnabled)
                        exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
                }
                logDebug(" *** Exit ValidateSDNCResp Process*** ", isDebugLogEnabled)
        }
 
        public void deleteAaiAR(Execution execution){
-               def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled")
+               def isDebugLogEnabled = execution.getVariable(DebugFlag)
                try{
                        utils.log("DEBUG", " *** deleteAaiAR *** ", isDebugLogEnabled)
                        AllottedResourceUtils arUtils = new AllottedResourceUtils(this)
@@ -1,5 +1,21 @@
 /*
- * Â© 2016 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property.
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
  */
 package org.openecomp.mso.bpmn.vcpe.scripts;
 
@@ -41,12 +57,14 @@ import static org.apache.commons.lang3.StringUtils.*
  */
 public class DoDeleteAllottedResourceTXC extends AbstractServiceTaskProcessor{
 
+       private static final String DebugFlag = "isDebugLogEnabled"
+
        String Prefix="DDARTXC_"
        ExceptionUtil exceptionUtil = new ExceptionUtil()
 
        public void preProcessRequest (Execution execution) {
 
-               def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+               def isDebugEnabled = execution.getVariable(DebugFlag)
                String msg = ""
                utils.log("DEBUG"," ***** preProcessRequest *****",  isDebugEnabled)
 
@@ -88,7 +106,7 @@ public class DoDeleteAllottedResourceTXC extends AbstractServiceTaskProcessor{
 
        public void getAaiAR (Execution execution) {
 
-               def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+               def isDebugEnabled = execution.getVariable(DebugFlag)
                utils.log("DEBUG"," ***** getAaiAR ***** ", isDebugEnabled)
 
                String allottedResourceId = execution.getVariable("allottedResourceId")
@@ -117,7 +135,7 @@ public class DoDeleteAllottedResourceTXC extends AbstractServiceTaskProcessor{
 
        // aaiARPath set during query (existing AR)
        public void updateAaiAROrchStatus(Execution execution, String status){
-               def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+               def isDebugEnabled = execution.getVariable(DebugFlag)
                utils.log("DEBUG", " *** updateAaiAROrchStatus *** ", isDebugEnabled)
                AllottedResourceUtils arUtils = new AllottedResourceUtils(this)
                String aaiARPath = execution.getVariable("aaiARPath") //set during query (existing AR) 
@@ -127,7 +145,7 @@ public class DoDeleteAllottedResourceTXC extends AbstractServiceTaskProcessor{
 
        public String buildSDNCRequest(Execution execution, String action, String sdncRequestId) {
 
-               def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+               def isDebugEnabled = execution.getVariable(DebugFlag)
                String msg = ""
                utils.log("DEBUG"," ***** buildSDNCRequest *****", isDebugEnabled)
                String sdncReq = null
@@ -213,7 +231,7 @@ public class DoDeleteAllottedResourceTXC extends AbstractServiceTaskProcessor{
 
        public void preProcessSDNCUnassign(Execution execution) {
 
-               def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+               def isDebugEnabled = execution.getVariable(DebugFlag)
                String msg = ""
                utils.log("DEBUG"," ***** preProcessSDNCUnassign *****", isDebugEnabled)
 
@@ -234,7 +252,7 @@ public class DoDeleteAllottedResourceTXC extends AbstractServiceTaskProcessor{
 
        public void preProcessSDNCDelete(Execution execution) {
 
-               def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+               def isDebugEnabled = execution.getVariable(DebugFlag)
                String msg = ""
                utils.log("DEBUG"," ***** preProcessSDNCDelete *****", isDebugEnabled)
 
@@ -255,7 +273,7 @@ public class DoDeleteAllottedResourceTXC extends AbstractServiceTaskProcessor{
 
        public void preProcessSDNCDeactivate(Execution execution) {
 
-               def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+               def isDebugEnabled = execution.getVariable(DebugFlag)
                String msg = ""
                utils.log("DEBUG"," ***** preProcessSDNCDeactivate *****", isDebugEnabled)
 
@@ -276,7 +294,7 @@ public class DoDeleteAllottedResourceTXC extends AbstractServiceTaskProcessor{
 
        public void validateSDNCResp(Execution execution, String response, String method){
 
-               def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled")
+               def isDebugLogEnabled=execution.getVariable(DebugFlag)
                utils.log("DEBUG", " *** ValidateSDNCResponse Process*** ", isDebugLogEnabled)
                String msg = ""
 
@@ -302,7 +320,7 @@ public class DoDeleteAllottedResourceTXC extends AbstractServiceTaskProcessor{
                                        if ("true".equals(execution.getVariable("failNotFound")))
                                        {
                                                msg = "Allotted Resource Not found in SDNC"
-                                               utils.log("DEBUG", msg, isDebugEnabled)
+                                               utils.log("DEBUG", msg, isDebugLogEnabled)
                                                exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
                                        }
                                        else
@@ -319,14 +337,14 @@ public class DoDeleteAllottedResourceTXC extends AbstractServiceTaskProcessor{
                        throw e;
                } catch(Exception ex) {
                        msg = "Exception in validateSDNCResp. " + ex.getMessage()
-                       utils.log("DEBUG", msg, isDebugEnabled)
+                       utils.log("DEBUG", msg, isDebugLogEnabled)
                        exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
                }
                logDebug(" *** Exit ValidateSDNCResp Process*** ", isDebugLogEnabled)
        }
 
        public void deleteAaiAR(Execution execution){
-               def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled")
+               def isDebugLogEnabled = execution.getVariable(DebugFlag)
                try{
                        utils.log("DEBUG", " *** deleteAaiAR *** ", isDebugLogEnabled)
                        AllottedResourceUtils arUtils = new AllottedResourceUtils(this)
index b11a1d0..f1224da 100644 (file)
@@ -1,4 +1,4 @@
-/*-\r
+/*\r
  * ============LICENSE_START=======================================================\r
  * ONAP - SO\r
  * ================================================================================\r
@@ -7,9 +7,9 @@
  * Licensed under the Apache License, Version 2.0 (the "License");\r
  * you may not use this file except in compliance with the License.\r
  * You may obtain a copy of the License at\r
- *\r
+ * \r
  *      http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
+ * \r
  * Unless required by applicable law or agreed to in writing, software\r
  * distributed under the License is distributed on an "AS IS" BASIS,\r
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
@@ -17,7 +17,6 @@
  * limitations under the License.\r
  * ============LICENSE_END=========================================================\r
  */\r
-\r
 package org.openecomp.mso.bpmn.vcpe.workflow;\r
 \r
 import javax.ws.rs.Path;\r
@@ -39,9 +38,8 @@ import org.openecomp.mso.bpmn.common.workflow.service.WorkflowAsyncResource;
  */\r
 @Path("/async")\r
 public class WorkflowAsyncVcpeResource extends WorkflowAsyncResource {\r
-\r
-       @Override       \r
+       \r
        protected ProcessEngineServices getProcessEngineServices() {\r
-               return pes4junit.orElse(ProcessEngines.getProcessEngine("vcpe"));\r
+        return pes4junit.orElse(ProcessEngines.getProcessEngine("vcpe"));\r
        }\r
 }\r
index c893690..02f7f48 100644 (file)
@@ -164,7 +164,7 @@ CreateVcpeResCustService.prepareFalloutRequest(execution)]]></bpmn2:script>
         <bpmn2:extensionElements>
           <camunda:in source="DCRESI_rollbackData" target="rollbackData" />
           <camunda:in source="msoRequestId" target="msoRequestId" />
-          <camunda:out source="rollbackSuccessful" target="DCRESI_rollbackSuccessful" />
+          <camunda:out source="rolledBack" target="DCRESI_rolledBack" />
           <camunda:out source="rollbackError" target="DCRESI_rollbackError" />
           <camunda:in source="sdncVersion" target="sdncVersion" />
         </bpmn2:extensionElements>
@@ -221,8 +221,8 @@ CreateVcpeResCustService.postProcessRollback(execution)]]></bpmn2:script>
           <camunda:in source="msoRequestId" target="msoRequestId" />
           <camunda:in source="DCARBRG_rollbackData" target="rollbackData" />
           <camunda:in source="sdncVersion" target="sdncVersion" />
-          <camunda:out source="rollbackSuccessful" target="DCARCR_rollbackSuccessful" />
-          <camunda:out source="rollbackError" target="DCARCR_rollbackError" />
+          <camunda:out source="rolledBack" target="DCARBRG_rolledBack" />
+          <camunda:out source="rollbackError" target="DCARBRG_rollbackError" />
         </bpmn2:extensionElements>
         <bpmn2:incoming>SequenceFlow_0orpdrl</bpmn2:incoming>
         <bpmn2:outgoing>SequenceFlow_1t3cnnx</bpmn2:outgoing>
@@ -254,7 +254,7 @@ CreateVcpeResCustService.postProcessRollback(execution)]]></bpmn2:script>
         <bpmn2:outgoing>SequenceFlow_0dr2fem</bpmn2:outgoing>
       </bpmn2:exclusiveGateway>
       <bpmn2:sequenceFlow id="SequenceFlow_1sim44y" name="Yes" sourceRef="ExclusiveGateway_1mjdcct" targetRef="InclusiveGateway_131ozdf">
-        <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{ execution.getVariable("DCARBRG_rollbackSuccessful") == true }]]></bpmn2:conditionExpression>
+        <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{ execution.getVariable("DCARBRG_rolledBack") == true }]]></bpmn2:conditionExpression>
       </bpmn2:sequenceFlow>
       <bpmn2:sequenceFlow id="SequenceFlow_0dr2fem" name="No" sourceRef="ExclusiveGateway_1mjdcct" targetRef="InclusiveGateway_1xenadu" />
       <bpmn2:exclusiveGateway id="ExclusiveGateway_05dg1m1" name="Rollback success?" default="SequenceFlow_1mbymcu">
@@ -263,7 +263,7 @@ CreateVcpeResCustService.postProcessRollback(execution)]]></bpmn2:script>
         <bpmn2:outgoing>SequenceFlow_1mbymcu</bpmn2:outgoing>
       </bpmn2:exclusiveGateway>
       <bpmn2:sequenceFlow id="SequenceFlow_1quvahv" name="Yes" sourceRef="ExclusiveGateway_05dg1m1" targetRef="InclusiveGateway_142br6v">
-        <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{ execution.getVariable("DCRENI_rollbackData") != null }]]></bpmn2:conditionExpression>
+        <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{ execution.getVariable("DCVAM_rolledBack") ==true }]]></bpmn2:conditionExpression>
       </bpmn2:sequenceFlow>
       <bpmn2:sequenceFlow id="SequenceFlow_1mbymcu" name="No" sourceRef="ExclusiveGateway_05dg1m1" targetRef="InclusiveGateway_0m9f5ka" />
       <bpmn2:exclusiveGateway id="ExclusiveGateway_0y7gtd9" name="rollback failed?" default="SequenceFlow_12dakwh">
@@ -291,8 +291,8 @@ CreateVcpeResCustService.postProcessRollback(execution)]]></bpmn2:script>
           <camunda:in source="msoRequestId" target="msoRequestId" />
           <camunda:in source="DCARTXC_rollbackData" target="rollbackData" />
           <camunda:in source="sdncVersion" target="sdncVersion" />
-          <camunda:out source="rollbackSuccessful" target="DCARBRG_rollbackSuccessful" />
-          <camunda:out source="rollbackError" target="DCARBRG_rollbackError" />
+          <camunda:out source="rolledBack" target="DCARTXC_rolledBack" />
+          <camunda:out source="rollbackError" target="DCARTXC_rollbackError" />
         </bpmn2:extensionElements>
         <bpmn2:incoming>SequenceFlow_1sl79hn</bpmn2:incoming>
         <bpmn2:outgoing>SequenceFlow_0ne9n0g</bpmn2:outgoing>
@@ -300,7 +300,7 @@ CreateVcpeResCustService.postProcessRollback(execution)]]></bpmn2:script>
       <bpmn2:sequenceFlow id="SequenceFlow_1sl79hn" name="Yes" sourceRef="ExclusiveGateway_1kvn1pz" targetRef="CallActivity_071yaf8">
         <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("DCARTXC_rollbackData") != null }]]></bpmn2:conditionExpression>
       </bpmn2:sequenceFlow>
-      <bpmn2:exclusiveGateway id="ExclusiveGateway_0y158bb" name="Rollback success?">
+      <bpmn2:exclusiveGateway id="ExclusiveGateway_0y158bb" name="Rollback success?" default="SequenceFlow_00by7l7">
         <bpmn2:incoming>SequenceFlow_0ne9n0g</bpmn2:incoming>
         <bpmn2:outgoing>SequenceFlow_00by7l7</bpmn2:outgoing>
         <bpmn2:outgoing>SequenceFlow_17cz98f</bpmn2:outgoing>
@@ -311,13 +311,13 @@ CreateVcpeResCustService.postProcessRollback(execution)]]></bpmn2:script>
       </bpmn2:sequenceFlow>
       <bpmn2:sequenceFlow id="SequenceFlow_00by7l7" name="No" sourceRef="ExclusiveGateway_0y158bb" targetRef="InclusiveGateway_0m9f5ka" />
       <bpmn2:sequenceFlow id="SequenceFlow_17cz98f" name="Yes" sourceRef="ExclusiveGateway_0y158bb" targetRef="ExclusiveGateway_05indeh">
-        <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{ execution.getVariable("DCARTXC_rollbackSuccessful") == true }]]></bpmn2:conditionExpression>
+        <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{ execution.getVariable("DCARTXC_rolledBack") == true }]]></bpmn2:conditionExpression>
       </bpmn2:sequenceFlow>
       <bpmn2:callActivity id="CallActivity_1cl4iu4" name="DoRollback&#10;VNF and Modules&#10;" calledElement="DoCreateVnfAndModulesRollback">
         <bpmn2:extensionElements>
           <camunda:in source="msoRequestId" target="msoRequestId" />
           <camunda:in source="DCVAM_rollbackData" target="rollbackData" />
-          <camunda:out source="rollbackSuccessful" target="DCVAM_rollbackSuccessful" />
+          <camunda:out source="rolledBack" target="DCVAM_rolledBack" />
           <camunda:out source="rollbackError" target="DCVAM_rollbackError" />
           <camunda:in source="sdncVersion" target="sdncVersion" />
         </bpmn2:extensionElements>
@@ -369,7 +369,7 @@ CreateVcpeResCustService.prepareCreateServiceInstance(execution)]]></bpmn2:scrip
       <bpmn2:outgoing>SequenceFlow_13uceka</bpmn2:outgoing>
     </bpmn2:serviceTask>
     <bpmn2:sequenceFlow id="SequenceFlow_13uceka" sourceRef="updateInfraRequest" targetRef="IntermediateThrowEvent_1as6hoa" />
-    <bpmn2:scriptTask id="ScriptTask_1qd3uwb" name="PostProcess&#10;Create&#10;Service&#10;" scriptFormat="groovy">
+    <bpmn2:scriptTask id="ScriptTask_1qd3uwb" name="Post Process&#10;Create&#10;Service&#10;" scriptFormat="groovy">
       <bpmn2:incoming>SequenceFlow_1ky2sv9</bpmn2:incoming>
       <bpmn2:outgoing>SequenceFlow_0vj46ej</bpmn2:outgoing>
       <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.vcpe.scripts.*\r
@@ -448,11 +448,11 @@ CreateVcpeResCustService.prepareCreateAllottedResourceTXC(execution)]]></bpmn2:s
         <camunda:in source="serviceDecomposition" target="serviceDecomposition" />
         <camunda:in source="subscriberInfo" target="subscriberInfo" />
       </bpmn2:extensionElements>
-      <bpmn2:incoming>SequenceFlow_17g05fd</bpmn2:incoming>
+      <bpmn2:incoming>SequenceFlow_11efpvh</bpmn2:incoming>
       <bpmn2:outgoing>SequenceFlow_1jbuf1t</bpmn2:outgoing>
     </bpmn2:callActivity>
     <bpmn2:sequenceFlow id="SequenceFlow_1jbuf1t" sourceRef="Task_1l0uvof" targetRef="IntermediateThrowEvent_0prlju0" />
-    <bpmn2:sequenceFlow id="SequenceFlow_17g05fd" sourceRef="DecomposeService" targetRef="Task_1l0uvof" />
+    <bpmn2:sequenceFlow id="SequenceFlow_17g05fd" sourceRef="DecomposeService" targetRef="ScriptTask_0lpv2da" />
     <bpmn2:intermediateCatchEvent id="IntermediateCatchEvent_17pzn7m" name="CreateAllottedResourcesBRG">
       <bpmn2:outgoing>SequenceFlow_15vce9o</bpmn2:outgoing>
       <bpmn2:linkEventDefinition name="CreateAllottedResourcesBRG" />
@@ -542,7 +542,7 @@ CreateVcpeResCustService.prepareCreateAllottedResourceBRG(execution)]]></bpmn2:s
     <bpmn2:scriptTask id="ScriptTask_0n1k77c" name="Prepare to Create VNF" scriptFormat="groovy">
       <bpmn2:incoming>SequenceFlow_0p75l97</bpmn2:incoming>
       <bpmn2:outgoing>SequenceFlow_0ws7fjn</bpmn2:outgoing>
-      <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infra.scripts.*
+      <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.vcpe.scripts.*
 def CreateVcpeResCustService= new CreateVcpeResCustService()
 CreateVcpeResCustService.prepareVnfAndModulesCreate(execution)]]></bpmn2:script>
     </bpmn2:scriptTask>
@@ -560,12 +560,12 @@ CreateVcpeResCustService.prepareVnfAndModulesCreate(execution)]]></bpmn2:script>
       <bpmn2:outgoing>SequenceFlow_13iuk3s</bpmn2:outgoing>
     </bpmn2:exclusiveGateway>
     <bpmn2:exclusiveGateway id="ExclusiveGateway_1hlbkue">
-      <bpmn2:incoming>SequenceFlow_1mkdhw9</bpmn2:incoming>
       <bpmn2:incoming>SequenceFlow_13iuk3s</bpmn2:incoming>
+      <bpmn2:incoming>SequenceFlow_0k5vcuu</bpmn2:incoming>
       <bpmn2:outgoing>SequenceFlow_1ufio7c</bpmn2:outgoing>
     </bpmn2:exclusiveGateway>
     <bpmn2:sequenceFlow id="SequenceFlow_0ws7fjn" sourceRef="ScriptTask_0n1k77c" targetRef="CallActivity_1els13v" />
-    <bpmn2:sequenceFlow id="SequenceFlow_1mkdhw9" name="in 1702 scope only one VNF will be created - if needed" sourceRef="CallActivity_1els13v" targetRef="ExclusiveGateway_1hlbkue">
+    <bpmn2:sequenceFlow id="SequenceFlow_1mkdhw9" name="in 1702 scope only one VNF will be created - if needed" sourceRef="CallActivity_1els13v" targetRef="ScriptTask_18w0jud">
       <bpmn2:documentation>in 1702 scope only one VNF will be created</bpmn2:documentation>
     </bpmn2:sequenceFlow>
     <bpmn2:sequenceFlow id="SequenceFlow_0p75l97" name="Yes" sourceRef="ExclusiveGateway_0yae9sb" targetRef="ScriptTask_0n1k77c">
@@ -600,6 +600,22 @@ CreateVcpeResCustService.prepareVnfAndModulesCreate(execution)]]></bpmn2:script>
       <bpmn2:outgoing>SequenceFlow_1cgpklo</bpmn2:outgoing>
     </bpmn2:callActivity>
     <bpmn2:sequenceFlow id="SequenceFlow_1cgpklo" sourceRef="CallActivity_1ymzucb" targetRef="ExclusiveGateway_074qh5g" />
+    <bpmn2:scriptTask id="ScriptTask_0lpv2da" name="PostProcess&#10;Decompose&#10;Service&#10;" scriptFormat="groovy">
+      <bpmn2:incoming>SequenceFlow_17g05fd</bpmn2:incoming>
+      <bpmn2:outgoing>SequenceFlow_11efpvh</bpmn2:outgoing>
+      <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.vcpe.scripts.*
+def CreateVcpeResCustService = new CreateVcpeResCustService()
+CreateVcpeResCustService.processDecomposition(execution)]]></bpmn2:script>
+    </bpmn2:scriptTask>
+    <bpmn2:sequenceFlow id="SequenceFlow_11efpvh" sourceRef="ScriptTask_0lpv2da" targetRef="Task_1l0uvof" />
+    <bpmn2:scriptTask id="ScriptTask_18w0jud" name="Post Process Create VNF" scriptFormat="groovy">
+      <bpmn2:incoming>SequenceFlow_1mkdhw9</bpmn2:incoming>
+      <bpmn2:outgoing>SequenceFlow_0k5vcuu</bpmn2:outgoing>
+      <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.vcpe.scripts.*
+def CreateVcpeResCustService= new CreateVcpeResCustService()
+CreateVcpeResCustService.validateVnfCreate(execution)]]></bpmn2:script>
+    </bpmn2:scriptTask>
+    <bpmn2:sequenceFlow id="SequenceFlow_0k5vcuu" sourceRef="ScriptTask_18w0jud" targetRef="ExclusiveGateway_1hlbkue" />
   </bpmn2:process>
   <bpmn2:error id="Error_2" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
   <bpmn2:error id="Error_1" name="java.lang.Exception" errorCode="java.lang.Exception" />
@@ -730,82 +746,82 @@ CreateVcpeResCustService.prepareVnfAndModulesCreate(execution)]]></bpmn2:script>
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="SubProcess_0s6hpty_di" bpmnElement="SubProcess_0s6hpty" isExpanded="true">
-        <dc:Bounds x="-261" y="1650" width="1482" height="1528" />
+        <dc:Bounds x="-266" y="1649" width="1482" height="1528" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="ExclusiveGateway_1vwgs6p_di" bpmnElement="ExclusiveGateway_1vwgs6p" isMarkerVisible="true">
-        <dc:Bounds x="55" y="2972" width="50" height="50" />
+        <dc:Bounds x="50" y="2971" width="50" height="50" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="42" y="3032" width="79" height="12" />
+          <dc:Bounds x="38" y="3031" width="78" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="StartEvent_1bwmffk_di" bpmnElement="StartEvent_1bwmffk">
-        <dc:Bounds x="-58" y="2980" width="36" height="36" />
+        <dc:Bounds x="-63" y="2979" width="36" height="36" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="-65" y="3021" width="53" height="12" />
+          <dc:Bounds x="-69" y="3020" width="51" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="ExclusiveGateway_0ydrtdx_di" bpmnElement="ExclusiveGateway_0ydrtdx" isMarkerVisible="true">
-        <dc:Bounds x="55" y="2889" width="50" height="50" />
+        <dc:Bounds x="50" y="2888" width="50" height="50" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="-11" y="2904" width="48" height="12" />
+          <dc:Bounds x="-15" y="2903" width="46" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="ExclusiveGateway_1kvn1pz_di" bpmnElement="ExclusiveGateway_1kvn1pz" isMarkerVisible="true">
-        <dc:Bounds x="182" y="1822" width="50" height="50" />
+        <dc:Bounds x="177" y="1821" width="50" height="50" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="114" y="1816" width="80" height="12" />
+          <dc:Bounds x="110" y="1815" width="78" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="CallActivity_0jw5tqa_di" bpmnElement="CallActivity_0jw5tqa">
-        <dc:Bounds x="1028" y="2946" width="100" height="80" />
+        <dc:Bounds x="1023" y="2945" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="EndEvent_04xute7_di" bpmnElement="EndEvent_04xute7">
-        <dc:Bounds x="1165" y="2968" width="36" height="36" />
+        <dc:Bounds x="1160" y="2967" width="36" height="36" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="1138" y="3009" width="90" height="0" />
+          <dc:Bounds x="1133" y="3008" width="90" height="0" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="ScriptTask_0yk02h3_di" bpmnElement="ScriptTask_0yk02h3">
-        <dc:Bounds x="896" y="2946" width="100" height="80" />
+        <dc:Bounds x="891" y="2945" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="SequenceFlow_0zpbskl_di" bpmnElement="SequenceFlow_0zpbskl">
-        <di:waypoint xsi:type="dc:Point" x="80" y="2972" />
-        <di:waypoint xsi:type="dc:Point" x="80" y="2939" />
+        <di:waypoint xsi:type="dc:Point" x="75" y="2971" />
+        <di:waypoint xsi:type="dc:Point" x="75" y="2938" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="85" y="2959" width="21" height="12" />
+          <dc:Bounds x="81" y="2958" width="19" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_0dhf2js_di" bpmnElement="SequenceFlow_0dhf2js">
-        <di:waypoint xsi:type="dc:Point" x="105" y="2997" />
-        <di:waypoint xsi:type="dc:Point" x="739" y="2997" />
-        <di:waypoint xsi:type="dc:Point" x="739" y="2939" />
+        <di:waypoint xsi:type="dc:Point" x="100" y="2996" />
+        <di:waypoint xsi:type="dc:Point" x="734" y="2996" />
+        <di:waypoint xsi:type="dc:Point" x="734" y="2938" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="144" y="3002" width="16" height="12" />
+          <dc:Bounds x="140" y="3001" width="14" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_1sx5llu_di" bpmnElement="SequenceFlow_1sx5llu">
-        <di:waypoint xsi:type="dc:Point" x="105" y="2914" />
-        <di:waypoint xsi:type="dc:Point" x="410" y="2914" />
-        <di:waypoint xsi:type="dc:Point" x="410" y="2914" />
-        <di:waypoint xsi:type="dc:Point" x="714" y="2914" />
+        <di:waypoint xsi:type="dc:Point" x="100" y="2913" />
+        <di:waypoint xsi:type="dc:Point" x="405" y="2913" />
+        <di:waypoint xsi:type="dc:Point" x="405" y="2913" />
+        <di:waypoint xsi:type="dc:Point" x="709" y="2913" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="423" y="2918" width="21" height="12" />
+          <dc:Bounds x="419" y="2917" width="19" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_02o4yqx_di" bpmnElement="SequenceFlow_02o4yqx">
-        <di:waypoint xsi:type="dc:Point" x="80" y="2889" />
-        <di:waypoint xsi:type="dc:Point" x="80" y="2867" />
+        <di:waypoint xsi:type="dc:Point" x="75" y="2888" />
+        <di:waypoint xsi:type="dc:Point" x="75" y="2866" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="90" y="2872" width="16" height="12" />
+          <dc:Bounds x="86" y="2871" width="14" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_19mxskt_di" bpmnElement="SequenceFlow_19mxskt">
-        <di:waypoint xsi:type="dc:Point" x="207" y="1822" />
-        <di:waypoint xsi:type="dc:Point" x="207" y="1726" />
-        <di:waypoint xsi:type="dc:Point" x="686" y="1726" />
-        <di:waypoint xsi:type="dc:Point" x="686" y="1942" />
+        <di:waypoint xsi:type="dc:Point" x="202" y="1821" />
+        <di:waypoint xsi:type="dc:Point" x="202" y="1725" />
+        <di:waypoint xsi:type="dc:Point" x="681" y="1725" />
+        <di:waypoint xsi:type="dc:Point" x="681" y="1941" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="395.6421052631579" y="1705" width="16" height="12" />
+          <dc:Bounds x="392" y="1704" width="14" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ScriptTask_1gacz45_di" bpmnElement="prepareCreateService_scriptTask">
@@ -830,41 +846,41 @@ CreateVcpeResCustService.prepareVnfAndModulesCreate(execution)]]></bpmn2:script>
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="CallActivity_0oh7wzu_di" bpmnElement="DoRollbackService_CallActivity">
-        <dc:Bounds x="981" y="1927" width="100" height="80" />
+        <dc:Bounds x="976" y="1926" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="InclusiveGateway_0foywso_di" bpmnElement="InclusiveGateway_0foywso">
-        <dc:Bounds x="714" y="2889" width="50" height="50" />
+        <dc:Bounds x="709" y="2888" width="50" height="50" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="694" y="2944" width="90" height="0" />
+          <dc:Bounds x="689" y="2943" width="90" height="0" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="SequenceFlow_1f1hd3l_di" bpmnElement="SequenceFlow_1f1hd3l">
-        <di:waypoint xsi:type="dc:Point" x="1031" y="2007" />
-        <di:waypoint xsi:type="dc:Point" x="1031" y="2104" />
+        <di:waypoint xsi:type="dc:Point" x="1026" y="2006" />
+        <di:waypoint xsi:type="dc:Point" x="1026" y="2103" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="1001" y="2056" width="90" height="0" />
+          <dc:Bounds x="996" y="2055" width="90" height="0" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_0jg47xm_di" bpmnElement="SequenceFlow_0jg47xm">
-        <di:waypoint xsi:type="dc:Point" x="764" y="2914" />
-        <di:waypoint xsi:type="dc:Point" x="946" y="2914" />
-        <di:waypoint xsi:type="dc:Point" x="946" y="2946" />
+        <di:waypoint xsi:type="dc:Point" x="759" y="2913" />
+        <di:waypoint xsi:type="dc:Point" x="941" y="2913" />
+        <di:waypoint xsi:type="dc:Point" x="941" y="2945" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="810" y="2899" width="90" height="0" />
+          <dc:Bounds x="805" y="2898" width="90" height="0" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_0807ukc_di" bpmnElement="SequenceFlow_0807ukc">
-        <di:waypoint xsi:type="dc:Point" x="996" y="2986" />
-        <di:waypoint xsi:type="dc:Point" x="1028" y="2986" />
+        <di:waypoint xsi:type="dc:Point" x="991" y="2985" />
+        <di:waypoint xsi:type="dc:Point" x="1023" y="2985" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="967" y="2971" width="90" height="0" />
+          <dc:Bounds x="962" y="2970" width="90" height="0" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_19yywk8_di" bpmnElement="SequenceFlow_19yywk8">
-        <di:waypoint xsi:type="dc:Point" x="1128" y="2986" />
-        <di:waypoint xsi:type="dc:Point" x="1165" y="2986" />
+        <di:waypoint xsi:type="dc:Point" x="1123" y="2985" />
+        <di:waypoint xsi:type="dc:Point" x="1160" y="2985" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="1102" y="2971" width="90" height="0" />
+          <dc:Bounds x="1097" y="2970" width="90" height="0" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="IntermediateThrowEvent_0prlju0_di" bpmnElement="IntermediateThrowEvent_0prlju0">
@@ -881,17 +897,17 @@ CreateVcpeResCustService.prepareVnfAndModulesCreate(execution)]]></bpmn2:script>
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ExclusiveGateway_05indeh_di" bpmnElement="ExclusiveGateway_05indeh" isMarkerVisible="true">
-        <dc:Bounds x="661" y="1942" width="50" height="50" />
+        <dc:Bounds x="656" y="1941" width="50" height="50" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="721" y="1924" width="85" height="24" />
+          <dc:Bounds x="718" y="1923" width="82" height="24" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="SequenceFlow_0sezboq_di" bpmnElement="SequenceFlow_0sezboq">
-        <di:waypoint xsi:type="dc:Point" x="686" y="1992" />
-        <di:waypoint xsi:type="dc:Point" x="686" y="2129" />
-        <di:waypoint xsi:type="dc:Point" x="1006" y="2129" />
+        <di:waypoint xsi:type="dc:Point" x="681" y="1991" />
+        <di:waypoint xsi:type="dc:Point" x="681" y="2128" />
+        <di:waypoint xsi:type="dc:Point" x="1001" y="2128" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="693" y="2046" width="16" height="12" />
+          <dc:Bounds x="689" y="2045" width="14" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ServiceTask_16yhzej_di" bpmnElement="updateInfraRequest">
@@ -922,31 +938,31 @@ CreateVcpeResCustService.prepareVnfAndModulesCreate(execution)]]></bpmn2:script>
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ScriptTask_17doerz_di" bpmnElement="ScriptTask_17doerz">
-        <dc:Bounds x="30" y="2787" width="100" height="80" />
+        <dc:Bounds x="25" y="2786" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="SequenceFlow_0zq7i3q_di" bpmnElement="SequenceFlow_0zq7i3q">
-        <di:waypoint xsi:type="dc:Point" x="-22" y="2998" />
-        <di:waypoint xsi:type="dc:Point" x="25" y="2998" />
-        <di:waypoint xsi:type="dc:Point" x="25" y="2997" />
-        <di:waypoint xsi:type="dc:Point" x="55" y="2997" />
+        <di:waypoint xsi:type="dc:Point" x="-27" y="2997" />
+        <di:waypoint xsi:type="dc:Point" x="20" y="2997" />
+        <di:waypoint xsi:type="dc:Point" x="20" y="2996" />
+        <di:waypoint xsi:type="dc:Point" x="50" y="2996" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="-51" y="2999" width="90" height="0" />
+          <dc:Bounds x="-56" y="2998" width="90" height="0" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="InclusiveGateway_0m9f5ka_di" bpmnElement="InclusiveGateway_0m9f5ka">
-        <dc:Bounds x="1006" y="2104" width="50" height="50" />
+        <dc:Bounds x="1001" y="2103" width="50" height="50" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="986" y="2159" width="90" height="0" />
+          <dc:Bounds x="981" y="2158" width="90" height="0" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="ScriptTask_0wyub4x_di" bpmnElement="ScriptTask_0wyub4x">
-        <dc:Bounds x="689" y="2787" width="100" height="80" />
+        <dc:Bounds x="684" y="2786" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="SequenceFlow_1rabks0_di" bpmnElement="SequenceFlow_1rabks0">
-        <di:waypoint xsi:type="dc:Point" x="739" y="2867" />
-        <di:waypoint xsi:type="dc:Point" x="739" y="2889" />
+        <di:waypoint xsi:type="dc:Point" x="734" y="2866" />
+        <di:waypoint xsi:type="dc:Point" x="734" y="2888" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="709" y="2878" width="90" height="0" />
+          <dc:Bounds x="704" y="2877" width="90" height="0" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="CallActivity_0w2alah_di" bpmnElement="DecomposeService">
@@ -986,42 +1002,42 @@ CreateVcpeResCustService.prepareVnfAndModulesCreate(execution)]]></bpmn2:script>
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ExclusiveGateway_06gq6em_di" bpmnElement="ExclusiveGateway_06gq6em" isMarkerVisible="true">
-        <dc:Bounds x="55" y="2604" width="50" height="50" />
+        <dc:Bounds x="50" y="2603" width="50" height="50" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="-33" y="2619" width="82" height="12" />
+          <dc:Bounds x="-37" y="2618" width="80" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="CallActivity_1bpuf2p_di" bpmnElement="CallActivity_1bpuf2p">
-        <dc:Bounds x="157" y="2519" width="100" height="80" />
+        <dc:Bounds x="152" y="2518" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="InclusiveGateway_131ozdf_di" bpmnElement="InclusiveGateway_131ozdf">
-        <dc:Bounds x="55" y="2432" width="50" height="50" />
+        <dc:Bounds x="50" y="2431" width="50" height="50" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="35" y="2487" width="90" height="0" />
+          <dc:Bounds x="30" y="2486" width="90" height="0" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="SequenceFlow_0orpdrl_di" bpmnElement="SequenceFlow_0orpdrl">
-        <di:waypoint xsi:type="dc:Point" x="105" y="2629" />
-        <di:waypoint xsi:type="dc:Point" x="207" y="2629" />
-        <di:waypoint xsi:type="dc:Point" x="207" y="2599" />
+        <di:waypoint xsi:type="dc:Point" x="100" y="2628" />
+        <di:waypoint xsi:type="dc:Point" x="202" y="2628" />
+        <di:waypoint xsi:type="dc:Point" x="202" y="2598" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="145" y="2614" width="21" height="12" />
+          <dc:Bounds x="141" y="2613" width="19" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_1t3cnnx_di" bpmnElement="SequenceFlow_1t3cnnx">
-        <di:waypoint xsi:type="dc:Point" x="207" y="2519" />
-        <di:waypoint xsi:type="dc:Point" x="207" y="2482" />
+        <di:waypoint xsi:type="dc:Point" x="202" y="2518" />
+        <di:waypoint xsi:type="dc:Point" x="202" y="2481" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="177" y="2501" width="90" height="0" />
+          <dc:Bounds x="172" y="2500" width="90" height="0" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_0ya1cr3_di" bpmnElement="SequenceFlow_0ya1cr3">
-        <di:waypoint xsi:type="dc:Point" x="80" y="2604" />
-        <di:waypoint xsi:type="dc:Point" x="80" y="2543" />
-        <di:waypoint xsi:type="dc:Point" x="80" y="2543" />
-        <di:waypoint xsi:type="dc:Point" x="80" y="2482" />
+        <di:waypoint xsi:type="dc:Point" x="75" y="2603" />
+        <di:waypoint xsi:type="dc:Point" x="75" y="2542" />
+        <di:waypoint xsi:type="dc:Point" x="75" y="2542" />
+        <di:waypoint xsi:type="dc:Point" x="75" y="2481" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="92" y="2509" width="16" height="12" />
+          <dc:Bounds x="88" y="2508" width="14" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ExclusiveGateway_1oudh6l_di" bpmnElement="ExclusiveGateway_1oudh6l" isMarkerVisible="true">
@@ -1061,63 +1077,63 @@ CreateVcpeResCustService.prepareVnfAndModulesCreate(execution)]]></bpmn2:script>
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ExclusiveGateway_14tl857_di" bpmnElement="ExclusiveGateway_14tl857" isMarkerVisible="true">
-        <dc:Bounds x="55" y="2283" width="50" height="50" />
+        <dc:Bounds x="50" y="2282" width="50" height="50" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="-31" y="2298" width="80" height="12" />
+          <dc:Bounds x="-24" y="2297" width="57" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="InclusiveGateway_142br6v_di" bpmnElement="InclusiveGateway_142br6v">
-        <dc:Bounds x="55" y="2104" width="50" height="50" />
+        <dc:Bounds x="50" y="2103" width="50" height="50" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="35" y="2159" width="90" height="0" />
+          <dc:Bounds x="30" y="2158" width="90" height="0" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="SequenceFlow_1kpdu1j_di" bpmnElement="SequenceFlow_1kpdu1j">
-        <di:waypoint xsi:type="dc:Point" x="80" y="2283" />
-        <di:waypoint xsi:type="dc:Point" x="80" y="2154" />
+        <di:waypoint xsi:type="dc:Point" x="75" y="2282" />
+        <di:waypoint xsi:type="dc:Point" x="75" y="2153" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="87" y="2219" width="16" height="12" />
+          <dc:Bounds x="83" y="2218" width="14" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ExclusiveGateway_1mjdcct_di" bpmnElement="ExclusiveGateway_1mjdcct" isMarkerVisible="true">
-        <dc:Bounds x="182" y="2432" width="50" height="50" />
+        <dc:Bounds x="177" y="2431" width="50" height="50" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="183" y="2394" width="48" height="24" />
+          <dc:Bounds x="178" y="2393" width="48" height="24" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="SequenceFlow_1sim44y_di" bpmnElement="SequenceFlow_1sim44y">
-        <di:waypoint xsi:type="dc:Point" x="182" y="2457" />
-        <di:waypoint xsi:type="dc:Point" x="105" y="2457" />
+        <di:waypoint xsi:type="dc:Point" x="177" y="2456" />
+        <di:waypoint xsi:type="dc:Point" x="100" y="2456" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="111" y="2432" width="21" height="12" />
+          <dc:Bounds x="107" y="2431" width="19" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_0dr2fem_di" bpmnElement="SequenceFlow_0dr2fem">
-        <di:waypoint xsi:type="dc:Point" x="231" y="2458" />
-        <di:waypoint xsi:type="dc:Point" x="739" y="2458" />
-        <di:waypoint xsi:type="dc:Point" x="739" y="2696" />
+        <di:waypoint xsi:type="dc:Point" x="226" y="2457" />
+        <di:waypoint xsi:type="dc:Point" x="734" y="2457" />
+        <di:waypoint xsi:type="dc:Point" x="734" y="2695" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="320" y="2437" width="16" height="12" />
+          <dc:Bounds x="316" y="2436" width="14" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ExclusiveGateway_05dg1m1_di" bpmnElement="ExclusiveGateway_05dg1m1" isMarkerVisible="true">
-        <dc:Bounds x="182" y="2104" width="50" height="50" />
+        <dc:Bounds x="177" y="2103" width="50" height="50" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="183" y="2065" width="48" height="24" />
+          <dc:Bounds x="178" y="2064" width="48" height="24" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="SequenceFlow_1quvahv_di" bpmnElement="SequenceFlow_1quvahv">
-        <di:waypoint xsi:type="dc:Point" x="182" y="2129" />
-        <di:waypoint xsi:type="dc:Point" x="105" y="2129" />
+        <di:waypoint xsi:type="dc:Point" x="177" y="2128" />
+        <di:waypoint xsi:type="dc:Point" x="100" y="2128" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="133" y="2104" width="21" height="12" />
+          <dc:Bounds x="129" y="2103" width="19" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_1mbymcu_di" bpmnElement="SequenceFlow_1mbymcu">
-        <di:waypoint xsi:type="dc:Point" x="232" y="2129" />
-        <di:waypoint xsi:type="dc:Point" x="1006" y="2129" />
+        <di:waypoint xsi:type="dc:Point" x="227" y="2128" />
+        <di:waypoint xsi:type="dc:Point" x="1001" y="2128" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="294" y="2098" width="16" height="12" />
+          <dc:Bounds x="290" y="2097" width="14" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="IntermediateCatchEvent_1i1nwfx_di" bpmnElement="IntermediateCatchEvent_1i1nwfx">
@@ -1140,85 +1156,85 @@ CreateVcpeResCustService.prepareVnfAndModulesCreate(execution)]]></bpmn2:script>
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="CallActivity_07nu6s6_di" bpmnElement="Task_1l0uvof">
-        <dc:Bounds x="687" y="348" width="100" height="80" />
+        <dc:Bounds x="856" y="348" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="SequenceFlow_1jbuf1t_di" bpmnElement="SequenceFlow_1jbuf1t">
-        <di:waypoint xsi:type="dc:Point" x="787" y="388" />
+        <di:waypoint xsi:type="dc:Point" x="956" y="388" />
         <di:waypoint xsi:type="dc:Point" x="1056" y="388" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="922" y="373" width="0" height="0" />
+          <dc:Bounds x="961" y="373" width="90" height="0" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_17g05fd_di" bpmnElement="SequenceFlow_17g05fd">
         <di:waypoint xsi:type="dc:Point" x="567" y="388" />
-        <di:waypoint xsi:type="dc:Point" x="687" y="388" />
+        <di:waypoint xsi:type="dc:Point" x="658" y="388" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="627" y="373" width="0" height="0" />
+          <dc:Bounds x="567.5" y="373" width="90" height="0" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ExclusiveGateway_0y7gtd9_di" bpmnElement="ExclusiveGateway_0y7gtd9" isMarkerVisible="true">
-        <dc:Bounds x="55" y="2696" width="50" height="50" />
+        <dc:Bounds x="50" y="2695" width="50" height="50" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="-36" y="2709" width="76" height="12" />
+          <dc:Bounds x="-39" y="2708" width="72" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="SequenceFlow_0ftzjjm_di" bpmnElement="SequenceFlow_0ftzjjm">
-        <di:waypoint xsi:type="dc:Point" x="80" y="2787" />
-        <di:waypoint xsi:type="dc:Point" x="80" y="2746" />
+        <di:waypoint xsi:type="dc:Point" x="75" y="2786" />
+        <di:waypoint xsi:type="dc:Point" x="75" y="2745" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="50" y="2767" width="90" height="0" />
+          <dc:Bounds x="45" y="2766" width="90" height="0" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_12dakwh_di" bpmnElement="SequenceFlow_12dakwh">
-        <di:waypoint xsi:type="dc:Point" x="80" y="2696" />
-        <di:waypoint xsi:type="dc:Point" x="80" y="2654" />
+        <di:waypoint xsi:type="dc:Point" x="75" y="2695" />
+        <di:waypoint xsi:type="dc:Point" x="75" y="2653" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="87" y="2667" width="16" height="12" />
+          <dc:Bounds x="83" y="2666" width="14" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="InclusiveGateway_1xenadu_di" bpmnElement="InclusiveGateway_1xenadu">
-        <dc:Bounds x="714" y="2696" width="50" height="50" />
+        <dc:Bounds x="709" y="2695" width="50" height="50" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="694" y="2751" width="90" height="0" />
+          <dc:Bounds x="689" y="2750" width="90" height="0" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="SequenceFlow_1lv5ld6_di" bpmnElement="SequenceFlow_1lv5ld6">
-        <di:waypoint xsi:type="dc:Point" x="1031" y="2154" />
-        <di:waypoint xsi:type="dc:Point" x="1031" y="2721" />
-        <di:waypoint xsi:type="dc:Point" x="764" y="2721" />
+        <di:waypoint xsi:type="dc:Point" x="1026" y="2153" />
+        <di:waypoint xsi:type="dc:Point" x="1026" y="2720" />
+        <di:waypoint xsi:type="dc:Point" x="759" y="2720" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="1001" y="2438" width="90" height="0" />
+          <dc:Bounds x="996" y="2437" width="90" height="0" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_0dvsqpp_di" bpmnElement="SequenceFlow_0dvsqpp">
-        <di:waypoint xsi:type="dc:Point" x="739" y="2746" />
-        <di:waypoint xsi:type="dc:Point" x="739" y="2787" />
+        <di:waypoint xsi:type="dc:Point" x="734" y="2745" />
+        <di:waypoint xsi:type="dc:Point" x="734" y="2786" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="709" y="2767" width="90" height="0" />
+          <dc:Bounds x="704" y="2766" width="90" height="0" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_09nn9a9_di" bpmnElement="SequenceFlow_09nn9a9">
-        <di:waypoint xsi:type="dc:Point" x="105" y="2721" />
-        <di:waypoint xsi:type="dc:Point" x="428" y="2721" />
-        <di:waypoint xsi:type="dc:Point" x="428" y="2721" />
-        <di:waypoint xsi:type="dc:Point" x="714" y="2721" />
+        <di:waypoint xsi:type="dc:Point" x="100" y="2720" />
+        <di:waypoint xsi:type="dc:Point" x="423" y="2720" />
+        <di:waypoint xsi:type="dc:Point" x="423" y="2720" />
+        <di:waypoint xsi:type="dc:Point" x="709" y="2720" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="148" y="2694" width="21" height="12" />
+          <dc:Bounds x="144" y="2693" width="19" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_027lz43_di" bpmnElement="SequenceFlow_027lz43">
-        <di:waypoint xsi:type="dc:Point" x="80" y="2432" />
-        <di:waypoint xsi:type="dc:Point" x="80" y="2333" />
+        <di:waypoint xsi:type="dc:Point" x="75" y="2431" />
+        <di:waypoint xsi:type="dc:Point" x="75" y="2332" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="50" y="2373" width="90" height="0" />
+          <dc:Bounds x="45" y="2372" width="90" height="0" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_0t3mtod_di" bpmnElement="SequenceFlow_0t3mtod">
-        <di:waypoint xsi:type="dc:Point" x="80" y="2104" />
-        <di:waypoint xsi:type="dc:Point" x="80" y="1847" />
-        <di:waypoint xsi:type="dc:Point" x="182" y="1847" />
+        <di:waypoint xsi:type="dc:Point" x="75" y="2103" />
+        <di:waypoint xsi:type="dc:Point" x="75" y="1846" />
+        <di:waypoint xsi:type="dc:Point" x="177" y="1846" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="50" y="1966" width="90" height="0" />
+          <dc:Bounds x="45" y="1965" width="90" height="0" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="IntermediateCatchEvent_17pzn7m_di" bpmnElement="IntermediateCatchEvent_17pzn7m">
@@ -1313,10 +1329,10 @@ CreateVcpeResCustService.prepareVnfAndModulesCreate(execution)]]></bpmn2:script>
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="CallActivity_1els13v_di" bpmnElement="CallActivity_1els13v">
-        <dc:Bounds x="617" y="942" width="100" height="80" />
+        <dc:Bounds x="586" y="942" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="ScriptTask_0n1k77c_di" bpmnElement="ScriptTask_0n1k77c">
-        <dc:Bounds x="450" y="942" width="100" height="80" />
+        <dc:Bounds x="413" y="942" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="IntermediateThrowEvent_1xsowxp_di" bpmnElement="IntermediateThrowEvent_1xsowxp">
         <dc:Bounds x="1027" y="1031" width="36" height="36" />
@@ -1343,28 +1359,25 @@ CreateVcpeResCustService.prepareVnfAndModulesCreate(execution)]]></bpmn2:script>
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="SequenceFlow_0ws7fjn_di" bpmnElement="SequenceFlow_0ws7fjn">
-        <di:waypoint xsi:type="dc:Point" x="550" y="983" />
-        <di:waypoint xsi:type="dc:Point" x="580" y="983" />
-        <di:waypoint xsi:type="dc:Point" x="580" y="981" />
-        <di:waypoint xsi:type="dc:Point" x="617" y="981" />
+        <di:waypoint xsi:type="dc:Point" x="513" y="982" />
+        <di:waypoint xsi:type="dc:Point" x="586" y="982" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="550" y="982" width="0" height="12" />
+          <dc:Bounds x="504.5" y="961" width="90" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_1mkdhw9_di" bpmnElement="SequenceFlow_1mkdhw9">
-        <di:waypoint xsi:type="dc:Point" x="717" y="982" />
-        <di:waypoint xsi:type="dc:Point" x="917" y="982" />
-        <di:waypoint xsi:type="dc:Point" x="917" y="1024" />
+        <di:waypoint xsi:type="dc:Point" x="686" y="982" />
+        <di:waypoint xsi:type="dc:Point" x="749" y="982" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="803" y="929" width="87" height="48" />
+          <dc:Bounds x="888.7571646117599" y="923.4934735403681" width="84" height="48" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_0p75l97_di" bpmnElement="SequenceFlow_0p75l97">
         <di:waypoint xsi:type="dc:Point" x="351" y="1040" />
         <di:waypoint xsi:type="dc:Point" x="351" y="982" />
-        <di:waypoint xsi:type="dc:Point" x="450" y="982" />
+        <di:waypoint xsi:type="dc:Point" x="413" y="982" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="361" y="1015" width="21" height="12" />
+          <dc:Bounds x="362" y="1015" width="19" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_1ufio7c_di" bpmnElement="SequenceFlow_1ufio7c">
@@ -1391,69 +1404,68 @@ CreateVcpeResCustService.prepareVnfAndModulesCreate(execution)]]></bpmn2:script>
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="CallActivity_071yaf8_di" bpmnElement="CallActivity_071yaf8">
-        <dc:Bounds x="326" y="1807" width="100" height="80" />
+        <dc:Bounds x="321" y="1806" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="SequenceFlow_1sl79hn_di" bpmnElement="SequenceFlow_1sl79hn">
-        <di:waypoint xsi:type="dc:Point" x="232" y="1847" />
-        <di:waypoint xsi:type="dc:Point" x="261" y="1847" />
-        <di:waypoint xsi:type="dc:Point" x="261" y="1847" />
-        <di:waypoint xsi:type="dc:Point" x="326" y="1847" />
+        <di:waypoint xsi:type="dc:Point" x="227" y="1846" />
+        <di:waypoint xsi:type="dc:Point" x="256" y="1846" />
+        <di:waypoint xsi:type="dc:Point" x="256" y="1846" />
+        <di:waypoint xsi:type="dc:Point" x="321" y="1846" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="275.2413793103448" y="1827" width="21" height="12" />
+          <dc:Bounds x="271" y="1826" width="19" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ExclusiveGateway_0y158bb_di" bpmnElement="ExclusiveGateway_0y158bb" isMarkerVisible="true">
-        <dc:Bounds x="526" y="1822" width="50" height="50" />
+        <dc:Bounds x="521" y="1821" width="50" height="50" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="527" y="1783" width="48" height="24" />
+          <dc:Bounds x="522" y="1782" width="48" height="24" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="SequenceFlow_0ne9n0g_di" bpmnElement="SequenceFlow_0ne9n0g">
-        <di:waypoint xsi:type="dc:Point" x="426" y="1847" />
-        <di:waypoint xsi:type="dc:Point" x="526" y="1847" />
+        <di:waypoint xsi:type="dc:Point" x="421" y="1846" />
+        <di:waypoint xsi:type="dc:Point" x="521" y="1846" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="476" y="1826" width="0" height="12" />
+          <dc:Bounds x="426" y="1825" width="90" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_1a7e8l1_di" bpmnElement="SequenceFlow_1a7e8l1">
-        <di:waypoint xsi:type="dc:Point" x="711" y="1967" />
-        <di:waypoint xsi:type="dc:Point" x="981" y="1967" />
+        <di:waypoint xsi:type="dc:Point" x="706" y="1966" />
+        <di:waypoint xsi:type="dc:Point" x="976" y="1966" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="836" y="1946" width="21" height="12" />
+          <dc:Bounds x="832" y="1945" width="19" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_00by7l7_di" bpmnElement="SequenceFlow_00by7l7">
-        <di:waypoint xsi:type="dc:Point" x="551" y="1872" />
-        <di:waypoint xsi:type="dc:Point" x="551" y="2129" />
-        <di:waypoint xsi:type="dc:Point" x="1006" y="2129" />
+        <di:waypoint xsi:type="dc:Point" x="546" y="1871" />
+        <di:waypoint xsi:type="dc:Point" x="546" y="2128" />
+        <di:waypoint xsi:type="dc:Point" x="1001" y="2128" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="558" y="1995" width="16" height="12" />
+          <dc:Bounds x="554" y="1994" width="14" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_17cz98f_di" bpmnElement="SequenceFlow_17cz98f">
-        <di:waypoint xsi:type="dc:Point" x="551" y="1872" />
-        <di:waypoint xsi:type="dc:Point" x="551" y="1967" />
-        <di:waypoint xsi:type="dc:Point" x="661" y="1967" />
+        <di:waypoint xsi:type="dc:Point" x="559" y="1858" />
+        <di:waypoint xsi:type="dc:Point" x="668" y="1954" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="556" y="1914" width="21" height="12" />
+          <dc:Bounds x="614.8182269768699" y="1888.8734385586085" width="19" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="CallActivity_1cl4iu4_di" bpmnElement="CallActivity_1cl4iu4">
-        <dc:Bounds x="157" y="2194" width="100" height="80" />
+        <dc:Bounds x="152" y="2193" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="SequenceFlow_1mpsdaj_di" bpmnElement="SequenceFlow_1mpsdaj">
-        <di:waypoint xsi:type="dc:Point" x="207" y="2194" />
-        <di:waypoint xsi:type="dc:Point" x="207" y="2154" />
+        <di:waypoint xsi:type="dc:Point" x="202" y="2193" />
+        <di:waypoint xsi:type="dc:Point" x="202" y="2153" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="222" y="2168" width="0" height="12" />
+          <dc:Bounds x="172" y="2167" width="90" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_007p8k3_di" bpmnElement="SequenceFlow_007p8k3">
-        <di:waypoint xsi:type="dc:Point" x="105" y="2308" />
-        <di:waypoint xsi:type="dc:Point" x="207" y="2308" />
-        <di:waypoint xsi:type="dc:Point" x="207" y="2274" />
+        <di:waypoint xsi:type="dc:Point" x="100" y="2307" />
+        <di:waypoint xsi:type="dc:Point" x="202" y="2307" />
+        <di:waypoint xsi:type="dc:Point" x="202" y="2273" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="146" y="2287" width="21" height="12" />
+          <dc:Bounds x="142" y="2286" width="19" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="CallActivity_1ymzucb_di" bpmnElement="CallActivity_1ymzucb">
@@ -1467,6 +1479,27 @@ CreateVcpeResCustService.prepareVnfAndModulesCreate(execution)]]></bpmn2:script>
           <dc:Bounds x="474" y="715" width="90" height="0" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="ScriptTask_0lpv2da_di" bpmnElement="ScriptTask_0lpv2da">
+        <dc:Bounds x="658" y="348" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_11efpvh_di" bpmnElement="SequenceFlow_11efpvh">
+        <di:waypoint xsi:type="dc:Point" x="758" y="388" />
+        <di:waypoint xsi:type="dc:Point" x="856" y="388" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="807" y="367" width="0" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="ScriptTask_18w0jud_di" bpmnElement="ScriptTask_18w0jud">
+        <dc:Bounds x="749" y="942" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_0k5vcuu_di" bpmnElement="SequenceFlow_0k5vcuu">
+        <di:waypoint xsi:type="dc:Point" x="849" y="982" />
+        <di:waypoint xsi:type="dc:Point" x="917" y="982" />
+        <di:waypoint xsi:type="dc:Point" x="917" y="1024" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="883" y="961" width="0" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
     </bpmndi:BPMNPlane>
   </bpmndi:BPMNDiagram>
 </bpmn2:definitions>
index 39fcd66..38e1d43 100644 (file)
@@ -22,9 +22,9 @@ DeleteVcpeResCustService.preProcessRequest(execution)
 ]]></bpmn2:script>
     </bpmn2:scriptTask>
     <bpmn2:sequenceFlow id="SequenceFlow_7" name="" sourceRef="preProcessRequest_ScriptTask" targetRef="sendSyncAckResponse_ScriptTask" />
-    <bpmn2:intermediateCatchEvent id="IntermediateCatchEvent_3" name="vCPE-CUSREST">
+    <bpmn2:intermediateCatchEvent id="IntermediateCatchEvent_3" name="vCPE-RESCUST">
       <bpmn2:outgoing>SequenceFlow_10o22u2</bpmn2:outgoing>
-      <bpmn2:linkEventDefinition id="_LinkEventDefinition_37" name="vCPE-CUSREST" />
+      <bpmn2:linkEventDefinition id="_LinkEventDefinition_37" name="vCPE-RESCUST" />
     </bpmn2:intermediateCatchEvent>
     <bpmn2:scriptTask id="postProcessAndCompletionRequest_ScriptTask" name="Post Process &#38; Completion Request" scriptFormat="groovy">
       <bpmn2:incoming>SequenceFlow_12ilko1</bpmn2:incoming>
@@ -38,7 +38,7 @@ DeleteVcpeResCustService.postProcessResponse(execution)]]></bpmn2:script>
       <bpmn2:extensionElements>
         <camunda:in variables="all" />
         <camunda:out variables="all" />
-        <camunda:in source="DELVAS_CompleteMsoProcessRequest" target="CompleteMsoProcessRequest" />
+        <camunda:in source="DVRCS_CompleteMsoProcessRequest" target="CompleteMsoProcessRequest" />
         <camunda:in source="requestId" target="requestId" />
         <camunda:in source="serviceInstanceId" target="serviceInstanceId" />
         <camunda:out source="CMSO_ResponseCode" target="CMSO_ResponseCode" />
@@ -73,8 +73,8 @@ execution.setVariable("DeleteVcpeResCustServiceSuccessIndicator", true)]]></bpmn
         <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming>
         <bpmn2:outgoing>SequenceFlow_5</bpmn2:outgoing>
         <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.vcpe.scripts.*
-def DeleteServiceInstanceInfra = new DeleteServiceInstanceInfra()
-DeleteServiceInstanceInfra.processJavaException(execution)]]></bpmn2:script>
+def DeleteVcpeResCustService = new DeleteVcpeResCustService()
+DeleteVcpeResCustService.processJavaException(execution)]]></bpmn2:script>
       </bpmn2:scriptTask>
       <bpmn2:sequenceFlow id="SequenceFlow_5" name="" sourceRef="ScriptTask_1" targetRef="EndEvent_1" />
     </bpmn2:subProcess>
@@ -108,7 +108,7 @@ DeleteServiceInstanceInfra.processJavaException(execution)]]></bpmn2:script>
       </bpmn2:startEvent>
       <bpmn2:callActivity id="CallActivity_0jw5tqa" name="Call FalloutHandlerV1" calledElement="FalloutHandler">
         <bpmn2:extensionElements>
-          <camunda:in source="DELVAS_falloutRequest" target="FalloutHandlerRequest" />
+          <camunda:in source="DVRCS_falloutRequest" target="FalloutHandlerRequest" />
           <camunda:in source="msoRequestId" target="mso-request-id" />
           <camunda:in source="serviceInstanceId" target="mso-service-instance-id" />
           <camunda:out source="FH_ResponseCode" target="FH_ResponseCode" />
@@ -185,9 +185,9 @@ DeleteVcpeResCustService.prepareServiceDelete(execution)]]></bpmn2:script>
       <bpmn2:incoming>SequenceFlow_05cjs89</bpmn2:incoming>
       <bpmn2:outgoing>SequenceFlow_0snq0kw</bpmn2:outgoing>
     </bpmn2:callActivity>
-    <bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_0i8bmrc" name="GoToVCPE-CUSREST">
+    <bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_0i8bmrc" name="GoToVCPE-RESCUST">
       <bpmn2:incoming>SequenceFlow_0zaircn</bpmn2:incoming>
-      <bpmn2:linkEventDefinition name="vCPE-CUSREST" />
+      <bpmn2:linkEventDefinition name="vCPE-RESCUST" />
     </bpmn2:intermediateThrowEvent>
     <bpmn2:intermediateCatchEvent id="IntermediateCatchEvent_04bw3vy" name="DeleteBRG">
       <bpmn2:outgoing>SequenceFlow_09i2jj0</bpmn2:outgoing>
@@ -214,7 +214,7 @@ DeleteVcpeResCustService.prepareServiceDelete(execution)]]></bpmn2:script>
       <bpmn2:outgoing>SequenceFlow_0zaircn</bpmn2:outgoing>
     </bpmn2:exclusiveGateway>
     <bpmn2:sequenceFlow id="SequenceFlow_05cjs89" name="Yes" sourceRef="ExclusiveGateway_0gw5gmo" targetRef="CallActivity_1yap348">
-      <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{ execution.getVariable("DELVAS_BRG") == null || execution.getVariable("DELVAS_BRG") == true }]]></bpmn2:conditionExpression>
+      <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{ execution.getVariable("DVRCS_BRG") == null || execution.getVariable("DVRCS_BRG") == true }]]></bpmn2:conditionExpression>
     </bpmn2:sequenceFlow>
     <bpmn2:sequenceFlow id="SequenceFlow_0snq0kw" sourceRef="CallActivity_1yap348" targetRef="ExclusiveGateway_1hmeube" />
     <bpmn2:sequenceFlow id="SequenceFlow_09i2jj0" sourceRef="IntermediateCatchEvent_04bw3vy" targetRef="ExclusiveGateway_0gw5gmo" />
@@ -223,7 +223,7 @@ DeleteVcpeResCustService.prepareServiceDelete(execution)]]></bpmn2:script>
     <bpmn2:sequenceFlow id="SequenceFlow_1jjh8rv" sourceRef="ExclusiveGateway_1hmeube" targetRef="IntermediateThrowEvent_19nq9li" />
     <bpmn2:sequenceFlow id="SequenceFlow_0nk8vsb" name="No" sourceRef="ExclusiveGateway_12i24vc" targetRef="ExclusiveGateway_0190r3n" />
     <bpmn2:sequenceFlow id="SequenceFlow_0npvfo3" name="Yes" sourceRef="ExclusiveGateway_12i24vc" targetRef="CallActivity_00g5q0n">
-      <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{ execution.getVariable("DELVAS_TunnelXConn") == null || execution.getVariable("DELVAS_TunnelXConn") == true }]]></bpmn2:conditionExpression>
+      <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{ execution.getVariable("DVRCS_TunnelXConn") == null || execution.getVariable("DVRCS_TunnelXConn") == true }]]></bpmn2:conditionExpression>
     </bpmn2:sequenceFlow>
     <bpmn2:callActivity id="CallActivity_00g5q0n" name="Delete TXC Allotted Resources&#10;" calledElement="DoDeleteAllottedResourceTXC">
       <bpmn2:extensionElements>
@@ -261,9 +261,9 @@ DeleteVcpeResCustService.prepareServiceDelete(execution)]]></bpmn2:script>
       <bpmn2:incoming>SequenceFlow_1yamcyn</bpmn2:incoming>
       <bpmn2:incoming>SequenceFlow_19cxgtm</bpmn2:incoming>
       <bpmn2:outgoing>SequenceFlow_128485i</bpmn2:outgoing>
-      <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infra.scripts.*
-def DeleteGenericMacroServiceNetworkVnf= new DeleteGenericMacroServiceNetworkVnf()
-DeleteGenericMacroServiceNetworkVnf.prepareVnfAndModulesDelete(execution)]]></bpmn2:script>
+      <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.vcpe.scripts.*
+def DeleteVcpeResCustService= new DeleteVcpeResCustService()
+DeleteVcpeResCustService.prepareVnfAndModulesDelete(execution)]]></bpmn2:script>
     </bpmn2:scriptTask>
     <bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_1ks536f" name="GoToDeleteTXC">
       <bpmn2:incoming>SequenceFlow_1lfph6u</bpmn2:incoming>
@@ -286,9 +286,9 @@ DeleteGenericMacroServiceNetworkVnf.prepareVnfAndModulesDelete(execution)]]></bp
     <bpmn2:scriptTask id="ScriptTask_0wqfeak" name="Validate VNF delete" scriptFormat="groovy">
       <bpmn2:incoming>SequenceFlow_04fys47</bpmn2:incoming>
       <bpmn2:outgoing>SequenceFlow_1o5cutr</bpmn2:outgoing>
-      <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infra.scripts.*
-def DeleteGenericMacroServiceNetworkVnf= new DeleteGenericMacroServiceNetworkVnf()
-DeleteGenericMacroServiceNetworkVnf.validateVnfDelete(execution)]]></bpmn2:script>
+      <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.vcpe.scripts.*
+def DeleteVcpeResCustService= new DeleteVcpeResCustService()
+DeleteVcpeResCustService.validateVnfDelete(execution)]]></bpmn2:script>
     </bpmn2:scriptTask>
     <bpmn2:exclusiveGateway id="ExclusiveGateway_14hjmu4" name="Delete Additional VNFs?" default="SequenceFlow_10scc5r">
       <bpmn2:incoming>SequenceFlow_1o5cutr</bpmn2:incoming>
@@ -298,10 +298,10 @@ DeleteGenericMacroServiceNetworkVnf.validateVnfDelete(execution)]]></bpmn2:scrip
     <bpmn2:sequenceFlow id="SequenceFlow_128485i" sourceRef="ScriptTask_1csw2q1" targetRef="CallActivity_14j22w3" />
     <bpmn2:sequenceFlow id="SequenceFlow_04fys47" sourceRef="CallActivity_14j22w3" targetRef="ScriptTask_0wqfeak" />
     <bpmn2:sequenceFlow id="SequenceFlow_1yamcyn" name="Yes" sourceRef="ExclusiveGateway_0io2vo5" targetRef="ScriptTask_1csw2q1">
-      <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("DELGMSNV_vnfsCount") > 0}]]></bpmn2:conditionExpression>
+      <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("DVRCS_vnfsCount") > 0}]]></bpmn2:conditionExpression>
     </bpmn2:sequenceFlow>
     <bpmn2:sequenceFlow id="SequenceFlow_19cxgtm" name="Yes" sourceRef="ExclusiveGateway_14hjmu4" targetRef="ScriptTask_1csw2q1">
-      <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("DELGMSNV_vnfsDeletedCountt") < execution.getVariable("DELGMSNV_vnfsCount")}]]></bpmn2:conditionExpression>
+      <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("DVRCS_vnfsDeletedCount") < execution.getVariable("DVRCS_vnfsCount")}]]></bpmn2:conditionExpression>
     </bpmn2:sequenceFlow>
     <bpmn2:sequenceFlow id="SequenceFlow_1lfph6u" sourceRef="ExclusiveGateway_1bm1vby" targetRef="IntermediateThrowEvent_1ks536f" />
     <bpmn2:sequenceFlow id="SequenceFlow_1ofw0fi" sourceRef="IntermediateCatchEvent_0hy32qu" targetRef="ExclusiveGateway_0io2vo5" />
@@ -748,7 +748,7 @@ DeleteGenericMacroServiceNetworkVnf.validateVnfDelete(execution)]]></bpmn2:scrip
         <di:waypoint xsi:type="dc:Point" x="974" y="866" />
         <di:waypoint xsi:type="dc:Point" x="1059" y="866" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="972.5" y="841" width="0" height="12" />
+          <dc:Bounds x="971.5" y="845" width="90" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_1ofw0fi_di" bpmnElement="SequenceFlow_1ofw0fi">
index c1cb102..a35371e 100644 (file)
@@ -16,7 +16,7 @@ dcar.preProcessRequest(execution)]]></bpmn2:script>
     <bpmn2:scriptTask id="buildWorkflowException" name="Create Workflow Exception" scriptFormat="groovy">
       <bpmn2:incoming>notFound</bpmn2:incoming>
       <bpmn2:outgoing>SequenceFlow_6</bpmn2:outgoing>
-      <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.utils.*
+      <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
 ExceptionUtil exceptionUtil = new ExceptionUtil()
 exceptionUtil.buildWorkflowException(execution, 404, "Input Service Instance Id Not Found in AAI")]]></bpmn2:script>
     </bpmn2:scriptTask>
@@ -207,7 +207,7 @@ dcar.validateSDNCResp(execution, response, "activate" )]]></bpmn2:script>
     <bpmn2:scriptTask id="ScriptTask_1hzsbck" name="Create Workflow Exception" scriptFormat="groovy">
       <bpmn2:incoming>SequenceFlow_0f7u5pu</bpmn2:incoming>
       <bpmn2:outgoing>SequenceFlow_16o7col</bpmn2:outgoing>
-      <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.utils.*
+      <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
 
 ExceptionUtil exceptionUtil = new ExceptionUtil()
 exceptionUtil.buildWorkflowException(execution, 404, "BRG alloted resource Parent ServiceInstance:"  +  
index 380f4fd..698c7b7 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_DkzPAHB4EeaJwpcpVN5gXw" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
+<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_DkzPAHB4EeaJwpcpVN5gXw" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.9.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
   <bpmn2:process id="DoCreateAllottedResourceBRGRollback" name="DoCreateAllottedResourceBRGRollback" isExecutable="true">
     <bpmn2:startEvent id="StartEvent_1">
       <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing>
@@ -55,7 +55,6 @@ rbk.validateSDNCResp(execution, response, "deactivate" )]]></bpmn2:script>
     </bpmn2:callActivity>
     <bpmn2:scriptTask id="postProcessSDNCDelete" name="PostProcess SDNC Delete" scriptFormat="groovy">
       <bpmn2:incoming>SequenceFlow_0eb41vb</bpmn2:incoming>
-      <bpmn2:incoming>SequenceFlow_149adfw</bpmn2:incoming>
       <bpmn2:outgoing>SequenceFlow_0sh1u69</bpmn2:outgoing>
       <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.vcpe.scripts.*
 
@@ -78,7 +77,6 @@ rbk.validateSDNCResp(execution, response, "delete" )]]></bpmn2:script>
     </bpmn2:callActivity>
     <bpmn2:scriptTask id="PostProcessSDNCUnassign" name="PostProcess SDNC Unassign" scriptFormat="groovy">
       <bpmn2:incoming>SequenceFlow_1s7yieq</bpmn2:incoming>
-      <bpmn2:incoming>SequenceFlow_041l824</bpmn2:incoming>
       <bpmn2:outgoing>SequenceFlow_00i7x43</bpmn2:outgoing>
       <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.vcpe.scripts.*
 
@@ -110,6 +108,7 @@ rbk.processRollbackException(execution)]]></bpmn2:script>
     <bpmn2:scriptTask id="DeleteAAIAR" name="Delete AAI AR " scriptFormat="groovy">
       <bpmn2:incoming>SequenceFlow_00i7x43</bpmn2:incoming>
       <bpmn2:incoming>SequenceFlow_13mhe5h</bpmn2:incoming>
+      <bpmn2:incoming>SequenceFlow_0m483td</bpmn2:incoming>
       <bpmn2:outgoing>SequenceFlow_03bkrg4</bpmn2:outgoing>
       <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.vcpe.scripts.*
 
@@ -118,6 +117,7 @@ rbk.deleteAaiAR(execution)]]></bpmn2:script>
     </bpmn2:scriptTask>
     <bpmn2:exclusiveGateway id="DeleteSDNC" name="Delete SDNC?&#10;" default="SequenceFlow_0m483st">
       <bpmn2:incoming>SequenceFlow_0c5h00o</bpmn2:incoming>
+      <bpmn2:incoming>SequenceFlow_0dzz8fp</bpmn2:incoming>
       <bpmn2:outgoing>SequenceFlow_0m483rd</bpmn2:outgoing>
       <bpmn2:outgoing>SequenceFlow_0m483st</bpmn2:outgoing>
     </bpmn2:exclusiveGateway>
@@ -143,7 +143,7 @@ rbk.updateAaiAROrchStatus(execution, "PendingDelete")]]></bpmn2:script>
     <bpmn2:sequenceFlow id="SequenceFlow_0m483rd" name="Yes" sourceRef="DeleteSDNC" targetRef="SDNCDelete">
       <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("deleteSdnc" ) == "true"}]]></bpmn2:conditionExpression>
     </bpmn2:sequenceFlow>
-    <bpmn2:sequenceFlow id="SequenceFlow_0m483st" name="No" sourceRef="DeleteSDNC" targetRef="IntermediateThrowEvent_0apj7jy" />
+    <bpmn2:sequenceFlow id="SequenceFlow_0m483st" name="No" sourceRef="DeleteSDNC" targetRef="ExclusiveGateway_0mys1pj" />
     <bpmn2:sequenceFlow id="SequenceFlow_0bfuk6l" sourceRef="initialization" targetRef="ExclusiveGateway_1txpz34" />
     <bpmn2:sequenceFlow id="SequenceFlow_0xm9g9s" name="No" sourceRef="ExclusiveGateway_1086eg7" targetRef="IntermediateThrowEvent_0lwqzlv" />
     <bpmn2:subProcess id="SubProcess_0g5bd80" name="Java Exception Handling Sub Process" triggeredByEvent="true">
@@ -175,6 +175,7 @@ rbk.postProcessRequest(execution)]]></bpmn2:script>
     </bpmn2:scriptTask>
     <bpmn2:exclusiveGateway id="ExclusiveGateway_0mys1pj" name="Unassign SDNC?" default="SequenceFlow_0m483td">
       <bpmn2:incoming>SequenceFlow_0sh1u69</bpmn2:incoming>
+      <bpmn2:incoming>SequenceFlow_0m483st</bpmn2:incoming>
       <bpmn2:outgoing>SequenceFlow_04hdt5s</bpmn2:outgoing>
       <bpmn2:outgoing>SequenceFlow_0m483td</bpmn2:outgoing>
     </bpmn2:exclusiveGateway>
@@ -195,11 +196,7 @@ rbk.postProcessRequest(execution)]]></bpmn2:script>
       <bpmn2:incoming>SequenceFlow_0xm9g9s</bpmn2:incoming>
       <bpmn2:linkEventDefinition name="AAI Delete" />
     </bpmn2:intermediateThrowEvent>
-    <bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_0mdm7ig" name="To AAI Delete">
-      <bpmn2:incoming>SequenceFlow_0m483td</bpmn2:incoming>
-      <bpmn2:linkEventDefinition name="AAI Delete" />
-    </bpmn2:intermediateThrowEvent>
-    <bpmn2:sequenceFlow id="SequenceFlow_0m483td" name="No" sourceRef="ExclusiveGateway_0mys1pj" targetRef="IntermediateThrowEvent_0mdm7ig" />
+    <bpmn2:sequenceFlow id="SequenceFlow_0m483td" name="No" sourceRef="ExclusiveGateway_0mys1pj" targetRef="DeleteAAIAR" />
     <bpmn2:intermediateCatchEvent id="IntermediateCatchEvent_0kdn6a5" name="AAI Delete">
       <bpmn2:outgoing>SequenceFlow_13mhe5h</bpmn2:outgoing>
       <bpmn2:linkEventDefinition name="AAI Delete" />
@@ -222,25 +219,7 @@ rbk.postProcessRequest(execution)]]></bpmn2:script>
     <bpmn2:sequenceFlow id="SequenceFlow_1fvfplx" name="Yes" sourceRef="ExclusiveGateway_0vw18rq" targetRef="SDNCDeactivate">
       <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("deactivateSdnc" ) == "true"}]]></bpmn2:conditionExpression>
     </bpmn2:sequenceFlow>
-    <bpmn2:sequenceFlow id="SequenceFlow_0dzz8fp" name="No" sourceRef="ExclusiveGateway_0vw18rq" targetRef="IntermediateThrowEvent_1vkyj76" />
-    <bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_1vkyj76" name="To SDNC Delete">
-      <bpmn2:incoming>SequenceFlow_0dzz8fp</bpmn2:incoming>
-      <bpmn2:linkEventDefinition name="SDNC Delete" />
-    </bpmn2:intermediateThrowEvent>
-    <bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_0apj7jy" name="To SDNC Unassign">
-      <bpmn2:incoming>SequenceFlow_0m483st</bpmn2:incoming>
-      <bpmn2:linkEventDefinition name="SDNC Unassign" />
-    </bpmn2:intermediateThrowEvent>
-    <bpmn2:intermediateCatchEvent id="IntermediateCatchEvent_1dkzo0o" name="SDNC Delete">
-      <bpmn2:outgoing>SequenceFlow_149adfw</bpmn2:outgoing>
-      <bpmn2:linkEventDefinition name="SDNC Delete" />
-    </bpmn2:intermediateCatchEvent>
-    <bpmn2:intermediateCatchEvent id="IntermediateCatchEvent_0vz52ri" name="SDNC Unassign">
-      <bpmn2:outgoing>SequenceFlow_041l824</bpmn2:outgoing>
-      <bpmn2:linkEventDefinition name="SDNC Unassign" />
-    </bpmn2:intermediateCatchEvent>
-    <bpmn2:sequenceFlow id="SequenceFlow_149adfw" sourceRef="IntermediateCatchEvent_1dkzo0o" targetRef="postProcessSDNCDelete" />
-    <bpmn2:sequenceFlow id="SequenceFlow_041l824" sourceRef="IntermediateCatchEvent_0vz52ri" targetRef="PostProcessSDNCUnassign" />
+    <bpmn2:sequenceFlow id="SequenceFlow_0dzz8fp" name="No" sourceRef="ExclusiveGateway_0vw18rq" targetRef="DeleteSDNC" />
   </bpmn2:process>
   <bpmn2:error id="Error_1" name="Java Lang Exception" errorCode="java.lang.Exception" />
   <bpmn2:error id="Error_2" name="MSO Workflow Exception" errorCode="MSOWorkflowException" />
@@ -413,11 +392,12 @@ rbk.postProcessRequest(execution)]]></bpmn2:script>
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_0ue1x4e_di" bpmnElement="SequenceFlow_0m483st">
-        <di:waypoint xsi:type="dc:Point" x="223" y="810" />
-        <di:waypoint xsi:type="dc:Point" x="224" y="836" />
-        <di:waypoint xsi:type="dc:Point" x="224" y="868" />
+        <di:waypoint xsi:type="dc:Point" x="222" y="811" />
+        <di:waypoint xsi:type="dc:Point" x="222" y="889" />
+        <di:waypoint xsi:type="dc:Point" x="355" y="889" />
+        <di:waypoint xsi:type="dc:Point" x="481" y="796" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="205" y="825.0864835800907" width="14" height="14" />
+          <dc:Bounds x="227.96243516445685" y="823.5028190473831" width="14" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_0bfuk6l_di" bpmnElement="SequenceFlow_0bfuk6l">
@@ -522,17 +502,13 @@ rbk.postProcessRequest(execution)]]></bpmn2:script>
           <dc:Bounds x="473" y="277" width="67" height="14" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="IntermediateThrowEvent_0mdm7ig_di" bpmnElement="IntermediateThrowEvent_0mdm7ig">
-        <dc:Bounds x="476" y="872" width="36" height="36" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="460" y="911" width="67" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="SequenceFlow_0m483td_di" bpmnElement="SequenceFlow_0m483td">
         <di:waypoint xsi:type="dc:Point" x="495" y="810" />
-        <di:waypoint xsi:type="dc:Point" x="494" y="872" />
+        <di:waypoint xsi:type="dc:Point" x="495" y="890" />
+        <di:waypoint xsi:type="dc:Point" x="640" y="890" />
+        <di:waypoint xsi:type="dc:Point" x="787" y="809" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="510" y="803" width="14" height="14" />
+          <dc:Bounds x="502.01898797901157" y="825.6730723011344" width="14" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="IntermediateCatchEvent_0kdn6a5_di" bpmnElement="IntermediateCatchEvent_0kdn6a5">
@@ -587,47 +563,11 @@ rbk.postProcessRequest(execution)]]></bpmn2:script>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_0dzz8fp_di" bpmnElement="SequenceFlow_0dzz8fp">
         <di:waypoint xsi:type="dc:Point" x="-54" y="810" />
-        <di:waypoint xsi:type="dc:Point" x="-54" y="863" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="-46" y="792.5" width="14" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNShape id="IntermediateThrowEvent_1vkyj76_di" bpmnElement="IntermediateThrowEvent_1vkyj76">
-        <dc:Bounds x="-72" y="863" width="36" height="36" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="-78" y="901" width="79" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="IntermediateThrowEvent_0apj7jy_di" bpmnElement="IntermediateThrowEvent_0apj7jy">
-        <dc:Bounds x="206" y="871" width="36" height="36" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="200" y="908" width="47" height="26" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="IntermediateCatchEvent_1dkzo0o_di" bpmnElement="IntermediateCatchEvent_1dkzo0o">
-        <dc:Bounds x="341" y="876" width="36" height="36" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="325" y="916" width="65" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="IntermediateCatchEvent_0vz52ri_di" bpmnElement="IntermediateCatchEvent_0vz52ri">
-        <dc:Bounds x="622" y="872" width="36" height="36" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="599" y="912" width="80" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_149adfw_di" bpmnElement="SequenceFlow_149adfw">
-        <di:waypoint xsi:type="dc:Point" x="359" y="876" />
-        <di:waypoint xsi:type="dc:Point" x="359" y="825" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="374" y="850.5" width="0" height="0" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_041l824_di" bpmnElement="SequenceFlow_041l824">
-        <di:waypoint xsi:type="dc:Point" x="640" y="872" />
-        <di:waypoint xsi:type="dc:Point" x="640" y="825" />
+        <di:waypoint xsi:type="dc:Point" x="-54" y="894" />
+        <di:waypoint xsi:type="dc:Point" x="93" y="894" />
+        <di:waypoint xsi:type="dc:Point" x="208" y="797" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="655" y="848.5" width="0" height="0" />
+          <dc:Bounds x="-43.999999999999986" y="825" width="14" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
     </bpmndi:BPMNPlane>
index 7978ea6..178534f 100644 (file)
@@ -16,7 +16,7 @@ dcar.preProcessRequest(execution)]]></bpmn2:script>
     <bpmn2:scriptTask id="buildWorkflowException" name="Create Workflow Exception" scriptFormat="groovy">
       <bpmn2:incoming>notFound</bpmn2:incoming>
       <bpmn2:outgoing>SequenceFlow_6</bpmn2:outgoing>
-      <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.utils.*
+      <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
 ExceptionUtil exceptionUtil = new ExceptionUtil()
 exceptionUtil.buildWorkflowException(execution, 404, "Input Service Instance Id Not Found in AAI")]]></bpmn2:script>
     </bpmn2:scriptTask>
@@ -207,7 +207,7 @@ dcar.validateSDNCResp(execution, response, "activate" )]]></bpmn2:script>
     <bpmn2:scriptTask id="ScriptTask_1hzsbck" name="Create Workflow Exception" scriptFormat="groovy">
       <bpmn2:incoming>SequenceFlow_0f7u5pu</bpmn2:incoming>
       <bpmn2:outgoing>SequenceFlow_16o7col</bpmn2:outgoing>
-      <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.utils.*
+      <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
 
 ExceptionUtil exceptionUtil = new ExceptionUtil()
 exceptionUtil.buildWorkflowException(execution, 404, "TunnelXConn alloted resource Parent ServiceInstance:"  +  
index 1c31913..595d7f5 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_DkzPAHB4EeaJwpcpVN5gXw" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
+<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_DkzPAHB4EeaJwpcpVN5gXw" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.9.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
   <bpmn2:process id="DoCreateAllottedResourceTXCRollback" name="DoCreateAllottedResourceTXCRollback" isExecutable="true">
     <bpmn2:startEvent id="StartEvent_1">
       <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing>
@@ -55,7 +55,6 @@ rbk.validateSDNCResp(execution, response, "deactivate" )]]></bpmn2:script>
     </bpmn2:callActivity>
     <bpmn2:scriptTask id="postProcessSDNCDelete" name="PostProcess SDNC Delete" scriptFormat="groovy">
       <bpmn2:incoming>SequenceFlow_0eb41vb</bpmn2:incoming>
-      <bpmn2:incoming>SequenceFlow_149adfw</bpmn2:incoming>
       <bpmn2:outgoing>SequenceFlow_0sh1u69</bpmn2:outgoing>
       <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.vcpe.scripts.*
 
@@ -78,7 +77,6 @@ rbk.validateSDNCResp(execution, response, "delete" )]]></bpmn2:script>
     </bpmn2:callActivity>
     <bpmn2:scriptTask id="PostProcessSDNCUnassign" name="PostProcess SDNC Unassign" scriptFormat="groovy">
       <bpmn2:incoming>SequenceFlow_1s7yieq</bpmn2:incoming>
-      <bpmn2:incoming>SequenceFlow_041l824</bpmn2:incoming>
       <bpmn2:outgoing>SequenceFlow_00i7x43</bpmn2:outgoing>
       <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.vcpe.scripts.*
 
@@ -110,6 +108,7 @@ rbk.processRollbackException(execution)]]></bpmn2:script>
     <bpmn2:scriptTask id="DeleteAAIAR" name="Delete AAI AR " scriptFormat="groovy">
       <bpmn2:incoming>SequenceFlow_00i7x43</bpmn2:incoming>
       <bpmn2:incoming>SequenceFlow_13mhe5h</bpmn2:incoming>
+      <bpmn2:incoming>SequenceFlow_0m483td</bpmn2:incoming>
       <bpmn2:outgoing>SequenceFlow_03bkrg4</bpmn2:outgoing>
       <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.vcpe.scripts.*
 
@@ -118,6 +117,7 @@ rbk.deleteAaiAR(execution)]]></bpmn2:script>
     </bpmn2:scriptTask>
     <bpmn2:exclusiveGateway id="DeleteSDNC" name="Delete SDNC?&#10;" default="SequenceFlow_0m483st">
       <bpmn2:incoming>SequenceFlow_0c5h00o</bpmn2:incoming>
+      <bpmn2:incoming>SequenceFlow_0dzz8fp</bpmn2:incoming>
       <bpmn2:outgoing>SequenceFlow_0m483rd</bpmn2:outgoing>
       <bpmn2:outgoing>SequenceFlow_0m483st</bpmn2:outgoing>
     </bpmn2:exclusiveGateway>
@@ -143,7 +143,7 @@ rbk.updateAaiAROrchStatus(execution, "PendingDelete")]]></bpmn2:script>
     <bpmn2:sequenceFlow id="SequenceFlow_0m483rd" name="Yes" sourceRef="DeleteSDNC" targetRef="SDNCDelete">
       <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("deleteSdnc" ) == "true"}]]></bpmn2:conditionExpression>
     </bpmn2:sequenceFlow>
-    <bpmn2:sequenceFlow id="SequenceFlow_0m483st" name="No" sourceRef="DeleteSDNC" targetRef="IntermediateThrowEvent_0apj7jy" />
+    <bpmn2:sequenceFlow id="SequenceFlow_0m483st" name="No" sourceRef="DeleteSDNC" targetRef="ExclusiveGateway_0mys1pj" />
     <bpmn2:sequenceFlow id="SequenceFlow_0bfuk6l" sourceRef="initialization" targetRef="ExclusiveGateway_1txpz34" />
     <bpmn2:sequenceFlow id="SequenceFlow_0xm9g9s" name="No" sourceRef="ExclusiveGateway_1086eg7" targetRef="IntermediateThrowEvent_0lwqzlv" />
     <bpmn2:subProcess id="SubProcess_0g5bd80" name="Java Exception Handling Sub Process" triggeredByEvent="true">
@@ -175,6 +175,7 @@ rbk.postProcessRequest(execution)]]></bpmn2:script>
     </bpmn2:scriptTask>
     <bpmn2:exclusiveGateway id="ExclusiveGateway_0mys1pj" name="Unassign SDNC?" default="SequenceFlow_0m483td">
       <bpmn2:incoming>SequenceFlow_0sh1u69</bpmn2:incoming>
+      <bpmn2:incoming>SequenceFlow_0m483st</bpmn2:incoming>
       <bpmn2:outgoing>SequenceFlow_04hdt5s</bpmn2:outgoing>
       <bpmn2:outgoing>SequenceFlow_0m483td</bpmn2:outgoing>
     </bpmn2:exclusiveGateway>
@@ -195,11 +196,7 @@ rbk.postProcessRequest(execution)]]></bpmn2:script>
       <bpmn2:incoming>SequenceFlow_0xm9g9s</bpmn2:incoming>
       <bpmn2:linkEventDefinition name="AAI Delete" />
     </bpmn2:intermediateThrowEvent>
-    <bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_0mdm7ig" name="To AAI Delete">
-      <bpmn2:incoming>SequenceFlow_0m483td</bpmn2:incoming>
-      <bpmn2:linkEventDefinition name="AAI Delete" />
-    </bpmn2:intermediateThrowEvent>
-    <bpmn2:sequenceFlow id="SequenceFlow_0m483td" name="No" sourceRef="ExclusiveGateway_0mys1pj" targetRef="IntermediateThrowEvent_0mdm7ig" />
+    <bpmn2:sequenceFlow id="SequenceFlow_0m483td" name="No" sourceRef="ExclusiveGateway_0mys1pj" targetRef="DeleteAAIAR" />
     <bpmn2:intermediateCatchEvent id="IntermediateCatchEvent_0kdn6a5" name="AAI Delete">
       <bpmn2:outgoing>SequenceFlow_13mhe5h</bpmn2:outgoing>
       <bpmn2:linkEventDefinition name="AAI Delete" />
@@ -222,25 +219,7 @@ rbk.postProcessRequest(execution)]]></bpmn2:script>
     <bpmn2:sequenceFlow id="SequenceFlow_1fvfplx" name="Yes" sourceRef="ExclusiveGateway_0vw18rq" targetRef="SDNCDeactivate">
       <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("deactivateSdnc" ) == "true"}]]></bpmn2:conditionExpression>
     </bpmn2:sequenceFlow>
-    <bpmn2:sequenceFlow id="SequenceFlow_0dzz8fp" name="No" sourceRef="ExclusiveGateway_0vw18rq" targetRef="IntermediateThrowEvent_1vkyj76" />
-    <bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_1vkyj76" name="To SDNC Delete">
-      <bpmn2:incoming>SequenceFlow_0dzz8fp</bpmn2:incoming>
-      <bpmn2:linkEventDefinition name="SDNC Delete" />
-    </bpmn2:intermediateThrowEvent>
-    <bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_0apj7jy" name="To SDNC Unassign">
-      <bpmn2:incoming>SequenceFlow_0m483st</bpmn2:incoming>
-      <bpmn2:linkEventDefinition name="SDNC Unassign" />
-    </bpmn2:intermediateThrowEvent>
-    <bpmn2:intermediateCatchEvent id="IntermediateCatchEvent_1dkzo0o" name="SDNC Delete">
-      <bpmn2:outgoing>SequenceFlow_149adfw</bpmn2:outgoing>
-      <bpmn2:linkEventDefinition name="SDNC Delete" />
-    </bpmn2:intermediateCatchEvent>
-    <bpmn2:intermediateCatchEvent id="IntermediateCatchEvent_0vz52ri" name="SDNC Unassign">
-      <bpmn2:outgoing>SequenceFlow_041l824</bpmn2:outgoing>
-      <bpmn2:linkEventDefinition name="SDNC Unassign" />
-    </bpmn2:intermediateCatchEvent>
-    <bpmn2:sequenceFlow id="SequenceFlow_149adfw" sourceRef="IntermediateCatchEvent_1dkzo0o" targetRef="postProcessSDNCDelete" />
-    <bpmn2:sequenceFlow id="SequenceFlow_041l824" sourceRef="IntermediateCatchEvent_0vz52ri" targetRef="PostProcessSDNCUnassign" />
+    <bpmn2:sequenceFlow id="SequenceFlow_0dzz8fp" name="No" sourceRef="ExclusiveGateway_0vw18rq" targetRef="DeleteSDNC" />
   </bpmn2:process>
   <bpmn2:error id="Error_1" name="Java Lang Exception" errorCode="java.lang.Exception" />
   <bpmn2:error id="Error_2" name="MSO Workflow Exception" errorCode="MSOWorkflowException" />
@@ -413,11 +392,12 @@ rbk.postProcessRequest(execution)]]></bpmn2:script>
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_0ue1x4e_di" bpmnElement="SequenceFlow_0m483st">
-        <di:waypoint xsi:type="dc:Point" x="223" y="810" />
-        <di:waypoint xsi:type="dc:Point" x="224" y="836" />
-        <di:waypoint xsi:type="dc:Point" x="224" y="868" />
+        <di:waypoint xsi:type="dc:Point" x="222" y="811" />
+        <di:waypoint xsi:type="dc:Point" x="222" y="891" />
+        <di:waypoint xsi:type="dc:Point" x="358" y="891" />
+        <di:waypoint xsi:type="dc:Point" x="481" y="796" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="205" y="825.0864835800907" width="14" height="14" />
+          <dc:Bounds x="232.20103151493018" y="822.2200886262924" width="14" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_0bfuk6l_di" bpmnElement="SequenceFlow_0bfuk6l">
@@ -522,17 +502,13 @@ rbk.postProcessRequest(execution)]]></bpmn2:script>
           <dc:Bounds x="473" y="277" width="67" height="14" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="IntermediateThrowEvent_0mdm7ig_di" bpmnElement="IntermediateThrowEvent_0mdm7ig">
-        <dc:Bounds x="476" y="872" width="36" height="36" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="460" y="911" width="67" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="SequenceFlow_0m483td_di" bpmnElement="SequenceFlow_0m483td">
         <di:waypoint xsi:type="dc:Point" x="495" y="810" />
-        <di:waypoint xsi:type="dc:Point" x="494" y="872" />
+        <di:waypoint xsi:type="dc:Point" x="495" y="890" />
+        <di:waypoint xsi:type="dc:Point" x="639" y="890" />
+        <di:waypoint xsi:type="dc:Point" x="787" y="802" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="510" y="803" width="14" height="14" />
+          <dc:Bounds x="503.0189879790115" y="823.6755392339563" width="14" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="IntermediateCatchEvent_0kdn6a5_di" bpmnElement="IntermediateCatchEvent_0kdn6a5">
@@ -587,47 +563,11 @@ rbk.postProcessRequest(execution)]]></bpmn2:script>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_0dzz8fp_di" bpmnElement="SequenceFlow_0dzz8fp">
         <di:waypoint xsi:type="dc:Point" x="-54" y="810" />
-        <di:waypoint xsi:type="dc:Point" x="-54" y="863" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="-46" y="792.5" width="14" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNShape id="IntermediateThrowEvent_1vkyj76_di" bpmnElement="IntermediateThrowEvent_1vkyj76">
-        <dc:Bounds x="-72" y="863" width="36" height="36" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="-78" y="901" width="79" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="IntermediateThrowEvent_0apj7jy_di" bpmnElement="IntermediateThrowEvent_0apj7jy">
-        <dc:Bounds x="206" y="871" width="36" height="36" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="200" y="908" width="47" height="26" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="IntermediateCatchEvent_1dkzo0o_di" bpmnElement="IntermediateCatchEvent_1dkzo0o">
-        <dc:Bounds x="341" y="876" width="36" height="36" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="325" y="916" width="65" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="IntermediateCatchEvent_0vz52ri_di" bpmnElement="IntermediateCatchEvent_0vz52ri">
-        <dc:Bounds x="622" y="872" width="36" height="36" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="599" y="912" width="80" height="14" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_149adfw_di" bpmnElement="SequenceFlow_149adfw">
-        <di:waypoint xsi:type="dc:Point" x="359" y="876" />
-        <di:waypoint xsi:type="dc:Point" x="359" y="825" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="374" y="850.5" width="0" height="0" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_041l824_di" bpmnElement="SequenceFlow_041l824">
-        <di:waypoint xsi:type="dc:Point" x="640" y="872" />
-        <di:waypoint xsi:type="dc:Point" x="640" y="825" />
+        <di:waypoint xsi:type="dc:Point" x="-54" y="892" />
+        <di:waypoint xsi:type="dc:Point" x="92" y="892" />
+        <di:waypoint xsi:type="dc:Point" x="208" y="797" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="655" y="848.5" width="0" height="0" />
+          <dc:Bounds x="-48.00000000000003" y="827" width="14" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
     </bpmndi:BPMNPlane>
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy
new file mode 100644 (file)
index 0000000..c5eff73
--- /dev/null
@@ -0,0 +1,1198 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.mso.bpmn.vcpe.scripts
+\r
+\r
+import org.camunda.bpm.engine.ProcessEngineServices\r
+import org.camunda.bpm.engine.RepositoryService\r
+import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity\r
+import org.camunda.bpm.engine.repository.ProcessDefinition\r
+import org.camunda.bpm.engine.runtime.Execution\r
+import org.junit.Before
+import org.junit.BeforeClass\r
+import org.junit.Rule\r
+import org.junit.Test
+import org.junit.Ignore\r
+import org.mockito.MockitoAnnotations
+import org.camunda.bpm.engine.delegate.BpmnError\r
+import org.openecomp.mso.bpmn.core.WorkflowException
+import org.openecomp.mso.bpmn.mock.FileUtil
+
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse
+import static com.github.tomakehurst.wiremock.client.WireMock.get
+import static com.github.tomakehurst.wiremock.client.WireMock.patch
+import static com.github.tomakehurst.wiremock.client.WireMock.put
+import static com.github.tomakehurst.wiremock.client.WireMock.stubFor
+import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching
+import static org.junit.Assert.*;\r
+import static org.mockito.Mockito.*
+import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetAllottedResource
+import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition
+import org.openecomp.mso.bpmn.core.domain.VnfResource
+import org.openecomp.mso.bpmn.core.domain.AllottedResource
+import org.openecomp.mso.bpmn.core.domain.ModelInfo
+import org.openecomp.mso.bpmn.core.domain.HomingSolution
+import org.openecomp.mso.bpmn.core.RollbackData
+import org.openecomp.mso.bpmn.vcpe.scripts.MapGetter
+import org.openecomp.mso.bpmn.vcpe.scripts.MapSetter
+
+import com.github.tomakehurst.wiremock.junit.WireMockRule\r
+\r
+class CreateVcpeResCustServiceTest extends GroovyTestBase {
+       
+       private static String request\r
+       \r
+       @Rule\r
+       public WireMockRule wireMockRule = new WireMockRule(PORT)
+\r
+       String Prefix = "CVRCS_"
+       String RbType = "DCRENI_"\r
+
+       @BeforeClass
+       public static void setUpBeforeClass() {
+               super.setUpBeforeClass()
+               request = FileUtil.readResourceFile("__files/VCPE/CreateVcpeResCustService/request.json")
+       }
+         \r
+    @Before\r
+       public void init()\r
+       {\r
+               MockitoAnnotations.initMocks(this)\r
+       }
+       
+       public CreateVcpeResCustServiceTest() {
+               super("CreateVcpeResCustService")
+       }
+       
+       
+       // ***** preProcessRequest *****\r
+                       \r
+       @Test\r
+//     @Ignore  \r
+       public void preProcessRequest() {\r
+               ExecutionEntity mex = setupMock()
+               def map = setupMap(mex)
+               initPreProcess(mex)
+               \r
+               CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()\r
+               CreateVcpeResCustService.preProcessRequest(mex)\r
+\r
+               verify(mex).getVariable(DBGFLAG)\r
+               verify(mex).setVariable("prefix", Prefix)
+               verify(mex).setVariable("createVcpeServiceRequest", request)
+               verify(mex).setVariable("msoRequestId", "mri")
+               assertEquals("sii", map.get("serviceInstanceId"))
+               verify(mex).setVariable("requestAction", "ra")
+               verify(mex).setVariable("source", "VID")
+               verify(mex).setVariable("globalSubscriberId", CUST)
+               verify(mex).setVariable("globalCustomerId", CUST)
+               verify(mex).setVariable("subscriptionServiceType", SVC)
+               verify(mex).setVariable("disableRollback", "false")
+               verify(mex).setVariable("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb")              
+               assertTrue(map.containsKey("subscriberInfo"))
+               
+               verify(mex).setVariable("brgWanMacAddress", "brgmac")
+               assertTrue(map.containsKey("serviceInputParams"))
+               assertTrue(map.containsKey(Prefix+"requestInfo"))
+               
+               def reqinfo = map.get(Prefix+"requestInfo")
+               assertTrue(reqinfo.indexOf("<request-id>mri</") >= 0)
+               assertTrue(reqinfo.indexOf("<source>VID</") >= 0)\r
+       }
+                       
+       @Test
+//     @Ignore  
+       public void preProcessRequest_EmptyParts() {
+               ExecutionEntity mex = setupMock()
+               def map = setupMap(mex)
+               initPreProcess(mex)
+               
+               def req = request
+                                       .replace('"source"', '"sourceXXX"')
+                                       .replace('"BRG_WAN_MAC_Address"', '"BRG_WAN_MAC_AddressXXX"')
+               
+               when(mex.getVariable("bpmnRequest")).thenReturn(req)
+               when(mex.getVariable("serviceInstanceId")).thenReturn(null)
+               
+               CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+               CreateVcpeResCustService.preProcessRequest(mex)
+
+               verify(mex).getVariable(DBGFLAG)
+               verify(mex).setVariable("prefix", Prefix)
+               verify(mex).setVariable("createVcpeServiceRequest", req)
+               verify(mex).setVariable("msoRequestId", "mri")
+               assertNotNull(map.get("serviceInstanceId"))
+               assertFalse(map.get("serviceInstanceId").isEmpty())
+               verify(mex).setVariable("requestAction", "ra")
+               verify(mex).setVariable("source", "VID")
+               verify(mex).setVariable("globalSubscriberId", CUST)
+               verify(mex).setVariable("globalCustomerId", CUST)
+               verify(mex).setVariable("subscriptionServiceType", SVC)
+               verify(mex).setVariable("disableRollback", "false")
+               verify(mex).setVariable("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb")
+               assertTrue(map.containsKey("subscriberInfo"))
+               
+               assertEquals("", map.get("brgWanMacAddress"))
+               assertTrue(map.containsKey("serviceInputParams"))
+               assertTrue(map.containsKey(Prefix+"requestInfo"))
+               
+               def reqinfo = map.get(Prefix+"requestInfo")
+               println reqinfo
+               assertTrue(reqinfo.indexOf("<request-id>mri</") >= 0)
+               assertTrue(reqinfo.indexOf("<source>VID</") >= 0)
+       }
+                       
+       @Test
+//     @Ignore  
+       public void preProcessRequest_MissingSubscriberId() {
+               ExecutionEntity mex = setupMock()
+               def map = setupMap(mex)
+               initPreProcess(mex)
+               
+               def req = request
+                                       .replace('"globalSubscriberId"', '"globalSubscriberIdXXX"')
+               
+               when(mex.getVariable("bpmnRequest")).thenReturn(req)
+               when(mex.getVariable("serviceInstanceId")).thenReturn(null)
+               
+               CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+               
+               assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.preProcessRequest(mex) }))
+       }
+                       
+       @Test
+//     @Ignore  
+       public void preProcessRequest_BpmnError() {
+               ExecutionEntity mex = setupMock()
+               initPreProcess(mex)
+               
+               when(mex.getVariable("bpmnRequest")).thenThrow(new BpmnError("expected exception"))
+               
+               CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+               
+               assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.preProcessRequest(mex) }))
+       }
+                       
+       @Test
+//     @Ignore  
+       public void preProcessRequest_Ex() {
+               ExecutionEntity mex = setupMock()
+               initPreProcess(mex)
+               
+               when(mex.getVariable("bpmnRequest")).thenThrow(new RuntimeException("expected exception"))
+               
+               CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+               
+               assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.preProcessRequest(mex) }))
+       }
+       
+       // ***** sendSyncResponse *****
+                       
+       @Test
+//     @Ignore  
+       public void sendSyncResponse() {
+               ExecutionEntity mex = setupMock()
+               def map = setupMap(mex)
+               initSendSyncResponse(mex)
+               
+               CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+               CreateVcpeResCustService.sendSyncResponse(mex)
+
+               verify(mex, times(2)).getVariable(DBGFLAG)
+               
+               verify(mex).setVariable(processName+"WorkflowResponseSent", "true")
+               
+               assertEquals("202", map.get(processName+"ResponseCode"))
+               assertEquals("Success", map.get(processName+"Status"))
+               
+               def resp = map.get(processName+"Response")
+               
+               assertTrue(resp.indexOf('"instanceId":"sii"') >= 0)
+               assertTrue(resp.indexOf('"requestId":"mri"') >= 0)
+       }
+                       
+       @Test
+//     @Ignore  
+       public void sendSyncResponse_Ex() {
+               ExecutionEntity mex = setupMock()
+               initSendSyncResponse(mex)
+               
+               when(mex.getVariable("serviceInstanceId")).thenThrow(new RuntimeException("expected exception"))
+               
+               CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+               
+               assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.sendSyncResponse(mex) }))
+       }
+       
+       
+       // ***** prepareDecomposeService *****
+                       
+       @Test
+//     @Ignore  
+       public void prepareDecomposeService() {
+               ExecutionEntity mex = setupMock()
+               initPrepareDecomposeService(mex)
+               
+               CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+               CreateVcpeResCustService.prepareDecomposeService(mex)
+
+               verify(mex).getVariable(DBGFLAG)
+               verify(mex).setVariable("serviceModelInfo", "mi")
+       }
+                       
+       @Test
+//     @Ignore  
+       public void prepareDecomposeService_Ex() {
+               ExecutionEntity mex = setupMock()
+               initPrepareDecomposeService(mex)
+               
+               when(mex.getVariable("createVcpeServiceRequest")).thenThrow(new RuntimeException("expected exception"))
+               
+               CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+               
+               assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.prepareDecomposeService(mex) }))
+       }
+       
+       
+       // ***** prepareCreateServiceInstance *****
+                       
+       @Test
+//     @Ignore  
+       public void prepareCreateServiceInstance() {
+               ExecutionEntity mex = setupMock()
+               initPrepareCreateServiceInstance(mex)
+               
+               CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+               CreateVcpeResCustService.prepareCreateServiceInstance(mex)
+
+               verify(mex).getVariable(DBGFLAG)
+               verify(mex).setVariable("serviceInstanceName", "VCPE1")
+               verify(mex).setVariable("serviceDecompositionString", "mydecomp")
+       }
+                       
+       @Test
+//     @Ignore  
+       public void prepareCreateServiceInstance_Ex() {
+               ExecutionEntity mex = setupMock()
+               initPrepareCreateServiceInstance(mex)
+               
+               when(mex.getVariable("createVcpeServiceRequest")).thenThrow(new RuntimeException("expected exception"))
+               
+               CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+               
+               assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.prepareCreateServiceInstance(mex) }))
+       }
+       
+       
+       // ***** postProcessServiceInstanceCreate *****
+                       
+       @Test
+//     @Ignore  
+       public void postProcessServiceInstanceCreate() {
+               ExecutionEntity mex = setupMock()
+               def map = setupMap(mex)
+               initPostProcessServiceInstanceCreate(mex)
+               
+               CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+               CreateVcpeResCustService.postProcessServiceInstanceCreate(mex)
+
+               verify(mex).getVariable(DBGFLAG)
+               
+               def reqinfo = map.get(Prefix+"setUpdateDbInstancePayload")
+               
+               assertTrue(reqinfo.indexOf("<requestId>mri</") >= 0)
+               assertTrue(reqinfo.indexOf("<serviceInstanceId>sii</") >= 0)
+               assertTrue(reqinfo.indexOf("<serviceInstanceName>sin</") >= 0)
+       }
+                       
+       @Test
+//     @Ignore  
+       public void postProcessServiceInstanceCreate_BpmnError() {
+               ExecutionEntity mex = setupMock()
+               initPostProcessServiceInstanceCreate(mex)
+               
+               doThrow(new BpmnError("expected exception")).when(mex).setVariable(endsWith("setUpdateDbInstancePayload"), any())
+               
+               CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+               
+               assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.postProcessServiceInstanceCreate(mex) }))
+       }
+                       
+       @Test
+//     @Ignore  
+       public void postProcessServiceInstanceCreate_Ex() {
+               ExecutionEntity mex = setupMock()
+               initPostProcessServiceInstanceCreate(mex)
+               
+               doThrow(new RuntimeException("expected exception")).when(mex).setVariable(endsWith("setUpdateDbInstancePayload"), any())
+               
+               CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+               
+               assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.postProcessServiceInstanceCreate(mex) }))
+       }
+       
+       
+       // ***** processDecomposition *****
+                       
+       @Test
+//     @Ignore  
+       public void processDecomposition() {
+               ExecutionEntity mex = setupMock()
+               def svcdecomp = initProcessDecomposition(mex, true, true)
+               
+               CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+               CreateVcpeResCustService.processDecomposition(mex)
+
+               verify(mex).getVariable(DBGFLAG)
+               
+               verify(mex).setVariable("vnfList", svcdecomp.getServiceVnfs())
+               verify(mex).setVariable("vnfListString", '[myvnf, myvnf2, myvnf3]')
+               verify(mex).setVariable(Prefix+"VNFsCount", 3)
+               
+               verify(mex).setVariable("vnfModelInfo", "mymodel")
+               verify(mex).setVariable("vnfModelInfoString", "mymodel")
+       }
+                       
+       @Test
+//     @Ignore  
+       public void processDecomposition_EmptyNet_EmptyVnf() {
+               ExecutionEntity mex = setupMock()
+               def svcdecomp = initProcessDecomposition(mex, true, true)
+               
+               when(svcdecomp.getServiceVnfs()).thenReturn(new LinkedList<VnfResource>())
+               
+               CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+               CreateVcpeResCustService.processDecomposition(mex)
+
+               verify(mex).getVariable(DBGFLAG)
+               
+               verify(mex).setVariable("vnfList", svcdecomp.getServiceVnfs())
+               verify(mex).setVariable("vnfListString", '[]')
+               verify(mex).setVariable(Prefix+"VNFsCount", 0)
+               
+               verify(mex).setVariable("vnfModelInfo", "")
+               verify(mex).setVariable("vnfModelInfoString", "")
+       }
+                       
+       @Test
+//     @Ignore  
+       public void processDecomposition_Ex() {
+               ExecutionEntity mex = setupMock()
+               def svcdecomp = initProcessDecomposition(mex, true, true)
+               
+               when(svcdecomp.getServiceVnfs()).thenThrow(new RuntimeException("expected exception"))
+               
+               CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+               
+               assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.processDecomposition(mex) }))
+       }
+       
+       
+       // ***** prepareCreateAllottedResourceTXC *****
+                       
+       @Test
+//     @Ignore  
+       public void prepareCreateAllottedResourceTXC() {
+               ExecutionEntity mex = setupMock()
+               initPrepareCreateAllottedResourceTXC(mex)
+               
+               CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+               CreateVcpeResCustService.prepareCreateAllottedResourceTXC(mex)
+
+               verify(mex).getVariable(DBGFLAG)
+               
+               verify(mex).setVariable("createTXCAR", true)
+               verify(mex).setVariable("allottedResourceModelInfoTXC", "modelB")
+               verify(mex).setVariable("allottedResourceRoleTXC", "TXCr")
+               verify(mex).setVariable("allottedResourceTypeTXC", "TunnelXConn")
+               verify(mex).setVariable("parentServiceInstanceIdTXC", "homeB")
+       }
+                       
+       @Test
+//     @Ignore  
+       public void prepareCreateAllottedResourceTXC_NullArList() {
+               ExecutionEntity mex = setupMock()
+               def svcdecomp = initPrepareCreateAllottedResourceTXC(mex)
+               
+               when(svcdecomp.getServiceAllottedResources()).thenReturn(null)
+               
+               CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+               CreateVcpeResCustService.prepareCreateAllottedResourceTXC(mex)
+
+               verify(mex).getVariable(DBGFLAG)
+               
+               verify(mex, never()).setVariable("createTXCAR", true)
+               verify(mex, never()).setVariable("allottedResourceModelInfoTXC", "modelB")
+               verify(mex, never()).setVariable("allottedResourceRoleTXC", "TXCr")
+               verify(mex, never()).setVariable("allottedResourceTypeTXC", "TunnelXConn")
+               verify(mex, never()).setVariable("parentServiceInstanceIdTXC", "homeB")
+       }
+                       
+       @Test
+//     @Ignore  
+       public void prepareCreateAllottedResourceTXC_Ex() {
+               ExecutionEntity mex = setupMock()
+               initPrepareCreateAllottedResourceTXC(mex)
+               
+               when(mex.getVariable("createVcpeServiceRequest")).thenThrow(new RuntimeException("expected exception"))
+               
+               CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+               
+               assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.prepareCreateAllottedResourceTXC(mex) }))
+       }
+       
+       
+       // ***** prepareCreateAllottedResourceBRG *****
+                       
+       @Test
+//     @Ignore  
+       public void prepareCreateAllottedResourceBRG() {
+               ExecutionEntity mex = setupMock()
+               initPrepareCreateAllottedResourceBRG(mex)
+               
+               CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+               CreateVcpeResCustService.prepareCreateAllottedResourceBRG(mex)
+
+               verify(mex).getVariable(DBGFLAG)
+               
+               verify(mex).setVariable("createBRGAR", true)
+               verify(mex).setVariable("allottedResourceModelInfoBRG", "modelB")
+               verify(mex).setVariable("allottedResourceRoleBRG", "BRGr")
+               verify(mex).setVariable("allottedResourceTypeBRG", "BRG")
+               verify(mex).setVariable("parentServiceInstanceIdBRG", "homeB")
+       }
+                       
+       @Test
+//     @Ignore  
+       public void prepareCreateAllottedResourceBRG_NullArList() {
+               ExecutionEntity mex = setupMock()
+               def svcdecomp = initPrepareCreateAllottedResourceBRG(mex)
+               
+               when(svcdecomp.getServiceAllottedResources()).thenReturn(null)
+               
+               CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+               CreateVcpeResCustService.prepareCreateAllottedResourceBRG(mex)
+
+               verify(mex).getVariable(DBGFLAG)
+               
+               verify(mex, never()).setVariable("createBRGAR", true)
+               verify(mex, never()).setVariable("allottedResourceModelInfoBRG", "modelB")
+               verify(mex, never()).setVariable("allottedResourceRoleBRG", "BRGr")
+               verify(mex, never()).setVariable("allottedResourceTypeBRG", "BRG")
+               verify(mex, never()).setVariable("parentServiceInstanceIdBRG", "homeB")
+       }
+                       
+       @Test
+//     @Ignore  
+       public void prepareCreateAllottedResourceBRG_Ex() {
+               ExecutionEntity mex = setupMock()
+               initPrepareCreateAllottedResourceBRG(mex)
+               
+               when(mex.getVariable("createVcpeServiceRequest")).thenThrow(new RuntimeException("expected exception"))
+               
+               CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+               
+               assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.prepareCreateAllottedResourceBRG(mex) }))
+       }
+       
+       
+       // ***** prepareVnfAndModulesCreate *****
+                       
+       @Test
+//     @Ignore  
+       public void prepareVnfAndModulesCreate() {
+               ExecutionEntity mex = setupMock()
+               initPrepareVnfAndModulesCreate(mex)
+               
+               CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+               CreateVcpeResCustService.prepareVnfAndModulesCreate(mex)
+
+               verify(mex).getVariable(DBGFLAG)
+               
+               verify(mex).setVariable("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb")
+               verify(mex).setVariable("lcpCloudRegionId", "mdt1")
+               verify(mex).setVariable("tenantId", "8b1df54faa3b49078e3416e21370a3ba")
+       }
+                       
+       @Test
+//     @Ignore  
+       public void prepareVnfAndModulesCreate_EmptyList() {
+               ExecutionEntity mex = setupMock()
+               initPrepareVnfAndModulesCreate(mex)
+               
+               when(mex.getVariable("vnfList")).thenReturn(new LinkedList<VnfResource>())
+               
+               CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+               CreateVcpeResCustService.prepareVnfAndModulesCreate(mex)
+
+               verify(mex).getVariable(DBGFLAG)
+               
+               verify(mex).setVariable("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb")
+               verify(mex).setVariable("lcpCloudRegionId", "mdt1")
+               verify(mex).setVariable("tenantId", "8b1df54faa3b49078e3416e21370a3ba")
+       }
+                       
+       @Test
+//     @Ignore  
+       public void prepareVnfAndModulesCreate_NullList() {
+               ExecutionEntity mex = setupMock()
+               initPrepareVnfAndModulesCreate(mex)
+               
+               when(mex.getVariable("vnfList")).thenReturn(null)
+               
+               CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+               CreateVcpeResCustService.prepareVnfAndModulesCreate(mex)
+
+               verify(mex).getVariable(DBGFLAG)
+               
+               verify(mex).setVariable("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb")
+               verify(mex).setVariable("lcpCloudRegionId", "mdt1")
+               verify(mex).setVariable("tenantId", "8b1df54faa3b49078e3416e21370a3ba")
+       }
+                       
+       @Test
+//     @Ignore  
+       public void prepareVnfAndModulesCreate_Ex() {
+               ExecutionEntity mex = setupMock()
+               initPrepareVnfAndModulesCreate(mex)
+               
+               when(mex.getVariable("vnfList")).thenThrow(new RuntimeException("expected exception"))
+               
+               CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+               
+               assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.prepareVnfAndModulesCreate(mex) }))
+       }
+       
+       
+       // ***** validateVnfCreate *****
+                       
+       @Test
+//     @Ignore  
+       public void validateVnfCreate() {
+               ExecutionEntity mex = setupMock()
+               initValidateVnfCreate(mex)
+               
+               CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+               CreateVcpeResCustService.validateVnfCreate(mex)
+
+               verify(mex).getVariable(DBGFLAG)
+               
+               verify(mex).setVariable(Prefix+"VnfsCreatedCount", 3)
+       }
+                       
+       @Test
+//     @Ignore  
+       public void validateVnfCreate_Ex() {
+               ExecutionEntity mex = setupMock()
+               initValidateVnfCreate(mex)
+               
+               when(mex.getVariable(Prefix+"VnfsCreatedCount")).thenThrow(new RuntimeException("expected exception"))
+               
+               CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+               
+               assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.validateVnfCreate(mex) }))
+       }
+       
+       
+       // ***** postProcessResponse *****
+                       
+       @Test
+//     @Ignore  
+       public void postProcessResponse() {
+               ExecutionEntity mex = setupMock()
+               def map = setupMap(mex)
+               initPostProcessResponse(mex)
+               
+               CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+               CreateVcpeResCustService.postProcessResponse(mex)
+
+               verify(mex).getVariable(DBGFLAG)
+               
+               verify(mex).setVariable(Prefix+"Success", true)
+               
+               def reqinfo = map.get(Prefix+"CompleteMsoProcessRequest")
+               
+               assertTrue(reqinfo.indexOf("request-id>mri</") >= 0)
+               assertTrue(reqinfo.indexOf("source>mysrc</") >= 0)
+               assertTrue(reqinfo.indexOf("serviceInstanceId>sii</") >= 0)
+       }
+                       
+       @Test
+//     @Ignore  
+       public void postProcessResponse_BpmnError() {
+               ExecutionEntity mex = setupMock()
+               def map = setupMap(mex)
+               initPostProcessResponse(mex)
+               
+               when(mex.getVariable("source")).thenThrow(new BpmnError("expected exception"))
+               
+               CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+               
+               assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.postProcessResponse(mex) }))
+       }
+                       
+       @Test
+//     @Ignore  
+       public void postProcessResponse_Ex() {
+               ExecutionEntity mex = setupMock()
+               def map = setupMap(mex)
+               initPostProcessResponse(mex)
+               
+               when(mex.getVariable("source")).thenThrow(new RuntimeException("expected exception"))
+               
+               CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+               
+               assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.postProcessResponse(mex) }))
+       }
+       
+       
+       // ***** preProcessRollback *****
+                       
+       @Test
+//     @Ignore  
+       public void preProcessRollback() {
+               ExecutionEntity mex = setupMock()
+               def wfe = initPreProcessRollback(mex)
+               
+               CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+               CreateVcpeResCustService.preProcessRollback(mex)
+
+               verify(mex).getVariable(DBGFLAG)
+               
+               verify(mex).setVariable("prevWorkflowException", wfe)
+       }
+                       
+       @Test
+//     @Ignore  
+       public void preProcessRollback_NullWfe() {
+               ExecutionEntity mex = setupMock()
+               def map = setupMap(mex)
+               def wfe = initPreProcessRollback(mex)
+               
+               when(mex.getVariable("WorkflowException")).thenReturn(null)
+               
+               CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+               CreateVcpeResCustService.preProcessRollback(mex)
+
+               verify(mex).getVariable(DBGFLAG)
+               
+               assertFalse(map.containsKey("prevWorkflowException"))
+       }
+                       
+       @Test
+//     @Ignore  
+       public void preProcessRollback_BpmnError() {
+               ExecutionEntity mex = setupMock()
+               def map = setupMap(mex)
+               def wfe = initPreProcessRollback(mex)
+               
+               when(mex.getVariable("WorkflowException")).thenThrow(new BpmnError("expected exception"))
+               
+               CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+               CreateVcpeResCustService.preProcessRollback(mex)
+
+               verify(mex).getVariable(DBGFLAG)
+               
+               assertFalse(map.containsKey("prevWorkflowException"))
+       }
+                       
+       @Test
+//     @Ignore  
+       public void preProcessRollback_Ex() {
+               ExecutionEntity mex = setupMock()
+               def map = setupMap(mex)
+               def wfe = initPreProcessRollback(mex)
+               
+               when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception"))
+               
+               CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+               CreateVcpeResCustService.preProcessRollback(mex)
+
+               verify(mex).getVariable(DBGFLAG)
+               
+               assertFalse(map.containsKey("prevWorkflowException"))
+       }
+       
+       
+       // ***** postProcessRollback *****
+                       
+       @Test
+//     @Ignore  
+       public void postProcessRollback() {
+               ExecutionEntity mex = setupMock()
+               def wfe = initPostProcessRollback(mex)
+               
+               CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+               CreateVcpeResCustService.postProcessRollback(mex)
+
+               verify(mex).getVariable(DBGFLAG)
+               
+               verify(mex).setVariable("WorkflowException", wfe)
+       }
+                       
+       @Test
+//     @Ignore  
+       public void postProcessRollback_NullWfe() {
+               ExecutionEntity mex = setupMock()
+               def map = setupMap(mex)
+               def wfe = initPostProcessRollback(mex)
+               
+               when(mex.getVariable("prevWorkflowException")).thenReturn(null)
+               
+               CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+               CreateVcpeResCustService.postProcessRollback(mex)
+
+               verify(mex).getVariable(DBGFLAG)
+               
+               assertFalse(map.containsKey("WorkflowException"))
+       }
+                       
+       @Test
+//     @Ignore  
+       public void postProcessRollback_BpmnError() {
+               ExecutionEntity mex = setupMock()
+               def map = setupMap(mex)
+               def wfe = initPostProcessRollback(mex)
+               
+               when(mex.getVariable("prevWorkflowException")).thenThrow(new BpmnError("expected exception"))
+               
+               CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+               assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.postProcessRollback(mex) }))
+       }
+                       
+       @Test
+//     @Ignore  
+       public void postProcessRollback_Ex() {
+               ExecutionEntity mex = setupMock()
+               def map = setupMap(mex)
+               def wfe = initPostProcessRollback(mex)
+               
+               when(mex.getVariable("prevWorkflowException")).thenThrow(new RuntimeException("expected exception"))
+               
+               CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+               CreateVcpeResCustService.postProcessRollback(mex)
+
+               verify(mex).getVariable(DBGFLAG)
+               
+               assertFalse(map.containsKey("WorkflowException"))
+       }
+       
+       
+       // ***** prepareFalloutRequest *****
+                       
+       @Test
+//     @Ignore  
+       public void prepareFalloutRequest() {
+               ExecutionEntity mex = setupMock()
+               def map = setupMap(mex)
+               initPrepareFalloutRequest(mex)
+               
+               CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+               CreateVcpeResCustService.prepareFalloutRequest(mex)
+
+               verify(mex, times(2)).getVariable(DBGFLAG)
+               
+               def fo = map.get(Prefix+"falloutRequest")
+               
+               assertTrue(fo.indexOf("<hello>world</") >= 0)
+               assertTrue(fo.indexOf("ErrorMessage>mymsg</") >= 0)
+               assertTrue(fo.indexOf("ErrorCode>999</") >= 0)
+       }
+                       
+       @Test
+//     @Ignore  
+       public void prepareFalloutRequest_Ex() {
+               ExecutionEntity mex = setupMock()
+               def map = setupMap(mex)
+               initPrepareFalloutRequest(mex)
+               
+               when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception"))
+               
+               CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+               
+               assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.prepareFalloutRequest(mex) }))
+       }
+       
+       // ***** sendSyncError *****
+                       
+       @Test
+//     @Ignore  
+       public void sendSyncError() {
+               ExecutionEntity mex = setupMock()
+               def map = setupMap(mex)
+               initSendSyncError(mex)
+               
+               CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+               CreateVcpeResCustService.sendSyncError(mex)
+
+               verify(mex, times(2)).getVariable(DBGFLAG)
+               
+               verify(mex).setVariable(processName+"WorkflowResponseSent", "true")
+               
+               assertEquals("500", map.get(processName+"ResponseCode"))
+               assertEquals("Fail", map.get(processName+"Status"))
+               
+               def resp = map.get(processName+"Response")
+               
+               assertTrue(resp.indexOf("ErrorMessage>mymsg</") >= 0)
+               
+               verify(mex).setVariable("WorkflowResponse", resp)
+       }
+                       
+       @Test
+//     @Ignore  
+       public void sendSyncError_NotWfe() {
+               ExecutionEntity mex = setupMock()
+               def map = setupMap(mex)
+               initSendSyncError(mex)
+               
+               when(mex.getVariable("WorkflowException")).thenReturn("not a WFE")
+               
+               CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+               CreateVcpeResCustService.sendSyncError(mex)
+
+               verify(mex, times(2)).getVariable(DBGFLAG)
+               
+               verify(mex).setVariable(processName+"WorkflowResponseSent", "true")
+               
+               assertEquals("500", map.get(processName+"ResponseCode"))
+               assertEquals("Fail", map.get(processName+"Status"))
+               
+               def resp = map.get(processName+"Response")
+               
+               assertTrue(resp.indexOf("ErrorMessage>Sending Sync Error.</") >= 0)
+               
+               verify(mex).setVariable("WorkflowResponse", resp)
+       }
+                       
+       @Test
+//     @Ignore  
+       public void sendSyncError_NullWfe() {
+               ExecutionEntity mex = setupMock()
+               def map = setupMap(mex)
+               initSendSyncError(mex)
+               
+               when(mex.getVariable("WorkflowException")).thenReturn(null)
+               
+               CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+               CreateVcpeResCustService.sendSyncError(mex)
+
+               verify(mex, times(2)).getVariable(DBGFLAG)
+               
+               verify(mex).setVariable(processName+"WorkflowResponseSent", "true")
+               
+               assertEquals("500", map.get(processName+"ResponseCode"))
+               assertEquals("Fail", map.get(processName+"Status"))
+               
+               def resp = map.get(processName+"Response")
+               
+               assertTrue(resp.indexOf("ErrorMessage>Sending Sync Error.</") >= 0)
+               
+               verify(mex).setVariable("WorkflowResponse", resp)
+       }
+                       
+       @Test
+//     @Ignore  
+       public void sendSyncError_Ex() {
+               ExecutionEntity mex = setupMock()
+               def map = setupMap(mex)
+               initSendSyncError(mex)
+               
+               when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception"))
+               
+               CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+               
+               CreateVcpeResCustService.sendSyncError(mex)
+               
+               assertFalse(map.containsKey(processName+"ResponseCode"))
+       }
+       
+       
+       // ***** processJavaException *****
+                       
+       @Test
+//     @Ignore  
+       public void processJavaException() {
+               ExecutionEntity mex = setupMock()
+               def map = setupMap(mex)
+               initProcessJavaException(mex)
+               
+               CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+               
+               assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.processJavaException(mex) }))
+
+               verify(mex, times(2)).getVariable(DBGFLAG)
+               
+               verify(mex).setVariable("prefix", Prefix)
+               
+               def wfe = map.get("WorkflowException")
+               
+               assertEquals("Caught a Java Lang Exception", wfe.getErrorMessage())
+       }
+                       
+       @Test
+//     @Ignore  
+       public void processJavaException_BpmnError() {
+               ExecutionEntity mex = setupMock()
+               def map = setupMap(mex)
+               initProcessJavaException(mex)
+               
+               when(mex.getVariables()).thenThrow(new BpmnError("expected exception"))
+               
+               CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+               
+               assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.processJavaException(mex) }))
+               
+               assertFalse(map.containsKey("WorkflowException"))
+       }
+                       
+       @Test
+//     @Ignore  
+       public void processJavaException_Ex() {
+               ExecutionEntity mex = setupMock()
+               def map = setupMap(mex)
+               initProcessJavaException(mex)
+               
+               when(mex.getVariables()).thenThrow(new RuntimeException("expected exception"))
+               
+               CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+               
+               assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.processJavaException(mex) }))
+               
+               def wfe = map.get("WorkflowException")
+               
+               assertEquals("Exception in processJavaException method", wfe.getErrorMessage())
+       }
+       
+       
+       private void initPreProcess(ExecutionEntity mex) {
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("bpmnRequest")).thenReturn(request)
+               when(mex.getVariable("mso-request-id")).thenReturn("mri")
+               when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
+               when(mex.getVariable("requestAction")).thenReturn("ra")
+       }
+       
+       private initSendSyncResponse(ExecutionEntity mex) {
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("mso-request-id")).thenReturn("mri")
+               when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
+       }
+       
+       private void initPrepareDecomposeService(ExecutionEntity mex) {
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("createVcpeServiceRequest")).thenReturn('{"requestDetails":{"modelInfo":"mi"}}')
+       }
+       
+       private void initPrepareCreateServiceInstance(ExecutionEntity mex) {
+               ServiceDecomposition svcdecomp = mock(ServiceDecomposition.class)
+               
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("createVcpeServiceRequest")).thenReturn(request)
+               when(mex.getVariable("serviceDecomposition")).thenReturn(svcdecomp)
+               
+               when(svcdecomp.toJsonString()).thenReturn("mydecomp")
+       }
+       
+       private void initPostProcessServiceInstanceCreate(ExecutionEntity mex) {
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("mso-request-id")).thenReturn("mri")
+               when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
+               when(mex.getVariable("serviceInstanceName")).thenReturn("sin")
+       }
+       
+       private ServiceDecomposition initProcessDecomposition(ExecutionEntity mex, boolean haveNet, boolean haveVnf) {
+               List<VnfResource> vnflst = new LinkedList<>()
+               if(haveVnf) {
+                       vnflst.add(makeVnf(""))
+                       vnflst.add(makeVnf("2"))
+                       vnflst.add(makeVnf("3"))
+               }
+                       
+               ServiceDecomposition svcdecomp = mock(ServiceDecomposition.class)
+               when(svcdecomp.getServiceVnfs()).thenReturn(vnflst)
+               
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("serviceDecomposition")).thenReturn(svcdecomp)
+               when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
+               when(mex.getVariable("serviceInstanceName")).thenReturn("sin")
+               
+               return svcdecomp
+       }
+       
+       private ServiceDecomposition initPrepareCreateAllottedResourceTXC(ExecutionEntity mex) {
+               ServiceDecomposition svcdecomp = mock(ServiceDecomposition.class)
+               List<AllottedResource> arlst = new LinkedList<>()
+               
+               arlst.add(makeArBRG("A"))
+               arlst.add(makeArTXC("B"))
+               arlst.add(makeArBRG("C"))
+               
+               when(svcdecomp.getServiceAllottedResources()).thenReturn(arlst)
+               
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("createVcpeServiceRequest")).thenReturn(request)
+               when(mex.getVariable("serviceDecomposition")).thenReturn(svcdecomp)
+               when(mex.getVariable("allottedResourceId")).thenReturn(ARID)
+               
+               return svcdecomp
+       }
+       
+       private ServiceDecomposition initPrepareCreateAllottedResourceBRG(ExecutionEntity mex) {
+               ServiceDecomposition svcdecomp = mock(ServiceDecomposition.class)
+               List<AllottedResource> arlst = new LinkedList<>()
+               
+               arlst.add(makeArTXC("A"))
+               arlst.add(makeArBRG("B"))
+               arlst.add(makeArTXC("C"))
+               
+               when(svcdecomp.getServiceAllottedResources()).thenReturn(arlst)
+               
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("createVcpeServiceRequest")).thenReturn(request)
+               when(mex.getVariable("serviceDecomposition")).thenReturn(svcdecomp)
+               when(mex.getVariable("allottedResourceId")).thenReturn(ARID)
+               
+               return svcdecomp
+       }
+       
+       private AllottedResource makeArTXC(String id) {
+               AllottedResource ar = mock(AllottedResource.class)
+               ModelInfo mod = mock(ModelInfo.class)
+               HomingSolution home = mock(HomingSolution.class)
+               
+               when(ar.toJsonString()).thenReturn("json"+id)
+               when(ar.getAllottedResourceType()).thenReturn("TunnelXConn")
+               when(ar.getModelInfo()).thenReturn(mod)
+               when(ar.getAllottedResourceRole()).thenReturn("TXCr")
+               when(ar.getHomingSolution()).thenReturn(home)
+               
+               when(mod.toJsonString()).thenReturn("model"+id)
+               
+               when(home.getServiceInstanceId()).thenReturn("home"+id)
+               
+               return ar
+       }
+       
+       private AllottedResource makeArBRG(String id) {
+               AllottedResource ar = mock(AllottedResource.class)
+               ModelInfo mod = mock(ModelInfo.class)
+               HomingSolution home = mock(HomingSolution.class)
+               
+               when(ar.toJsonString()).thenReturn("json"+id)
+               when(ar.getAllottedResourceType()).thenReturn("BRG")
+               when(ar.getModelInfo()).thenReturn(mod)
+               when(ar.getAllottedResourceRole()).thenReturn("BRGr")
+               when(ar.getHomingSolution()).thenReturn(home)
+               
+               when(mod.toJsonString()).thenReturn("model"+id)
+               
+               when(home.getServiceInstanceId()).thenReturn("home"+id)
+               
+               return ar
+       }
+       
+       private initPrepareVnfAndModulesCreate(ExecutionEntity mex) {
+               
+               List<VnfResource> vnflst = new LinkedList<>()
+               
+               vnflst.add(makeVnf("A"))
+               vnflst.add(makeVnf("B"))
+               vnflst.add(makeVnf("C"))
+               vnflst.add(makeVnf("D"))
+               
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("createVcpeServiceRequest")).thenReturn(request)
+               when(mex.getVariable("vnfList")).thenReturn(vnflst)
+               when(mex.getVariable(Prefix+"VnfsCreatedCount")).thenReturn(2)
+               when(mex.getVariable("vnfModelInfo")).thenReturn("nomodel")
+               when(mex.getVariable("sdncVersion")).thenReturn("myvers")
+       }
+       
+       private VnfResource makeVnf(String id) {                
+               ModelInfo mod = mock(ModelInfo.class)           
+               VnfResource vnf = mock(VnfResource.class)
+               
+               when(mod.toString()).thenReturn('{"modelInfo":"mymodel'+id+'"}')
+               
+               when(vnf.toString()).thenReturn("myvnf"+id)
+               when(vnf.getModelInfo()).thenReturn(mod)
+
+               return vnf              
+       }
+       
+       private initValidateVnfCreate(ExecutionEntity mex) {
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable(Prefix+"VnfsCreatedCount")).thenReturn(2)
+       }
+       
+       private initPostProcessResponse(ExecutionEntity mex) {
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("source")).thenReturn("mysrc")
+               when(mex.getVariable("mso-request-id")).thenReturn("mri")
+               when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
+       }
+       
+       private WorkflowException initPreProcessRollback(ExecutionEntity mex) {
+               WorkflowException wfe = mock(WorkflowException.class)
+               
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("WorkflowException")).thenReturn(wfe)
+               
+               return wfe
+       }
+       
+       private WorkflowException initPostProcessRollback(ExecutionEntity mex) {
+               WorkflowException wfe = mock(WorkflowException.class)
+               
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("prevWorkflowException")).thenReturn(wfe)
+               
+               return wfe
+       }
+       
+       private initPrepareFalloutRequest(ExecutionEntity mex) {
+               WorkflowException wfe = mock(WorkflowException.class)
+               
+               when(wfe.getErrorMessage()).thenReturn("mymsg")
+               when(wfe.getErrorCode()).thenReturn(999)
+               
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("WorkflowException")).thenReturn(wfe)
+               when(mex.getVariable(Prefix+"requestInfo")).thenReturn("<hello>world</hello>")
+               
+               return wfe
+       }
+       
+       private initSendSyncError(ExecutionEntity mex) {
+               WorkflowException wfe = mock(WorkflowException.class)
+               
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("mso-request-id")).thenReturn("mri")
+               when(mex.getVariable("WorkflowException")).thenReturn(wfe)
+               
+               when(wfe.getErrorMessage()).thenReturn("mymsg")
+       }
+       
+       private initProcessJavaException(ExecutionEntity mex) {
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+       }\r
+               \r
+}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DeleteVcpeResCustServiceTest.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DeleteVcpeResCustServiceTest.groovy
new file mode 100644 (file)
index 0000000..df7c0cf
--- /dev/null
@@ -0,0 +1,709 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.mso.bpmn.vcpe.scripts
+\r
+\r
+import org.camunda.bpm.engine.ProcessEngineServices\r
+import org.camunda.bpm.engine.RepositoryService\r
+import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity\r
+import org.camunda.bpm.engine.repository.ProcessDefinition\r
+import org.camunda.bpm.engine.runtime.Execution\r
+import org.junit.Before
+import org.junit.BeforeClass\r
+import org.junit.Rule\r
+import org.junit.Test
+import org.junit.Ignore\r
+import org.mockito.MockitoAnnotations
+import org.camunda.bpm.engine.delegate.BpmnError\r
+import org.openecomp.mso.bpmn.core.WorkflowException
+import org.openecomp.mso.bpmn.mock.FileUtil
+
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse
+import static com.github.tomakehurst.wiremock.client.WireMock.get
+import static com.github.tomakehurst.wiremock.client.WireMock.patch
+import static com.github.tomakehurst.wiremock.client.WireMock.put
+import static com.github.tomakehurst.wiremock.client.WireMock.stubFor
+import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching
+import static org.junit.Assert.*;\r
+import static org.mockito.Mockito.*
+import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetAllottedResource
+import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition
+import org.openecomp.mso.bpmn.core.domain.VnfResource
+import org.openecomp.mso.bpmn.core.domain.AllottedResource
+import org.openecomp.mso.bpmn.core.domain.ModelInfo
+import org.openecomp.mso.bpmn.core.domain.HomingSolution
+import org.openecomp.mso.bpmn.core.RollbackData
+import org.openecomp.mso.bpmn.vcpe.scripts.MapGetter
+import org.openecomp.mso.bpmn.vcpe.scripts.MapSetter
+
+import com.github.tomakehurst.wiremock.junit.WireMockRule\r
+\r
+class DeleteVcpeResCustServiceTest extends GroovyTestBase {
+       
+       private static String request\r
+       \r
+       @Rule\r
+       public WireMockRule wireMockRule = new WireMockRule(PORT)
+\r
+       String Prefix = "DVRCS_"
+       String RbType = "DCRENI_"\r
+
+       @BeforeClass
+       public static void setUpBeforeClass() {
+               super.setUpBeforeClass()
+               request = FileUtil.readResourceFile("__files/VCPE/DeleteVcpeResCustService/request.json")
+       }
+         \r
+    @Before\r
+       public void init()\r
+       {\r
+               MockitoAnnotations.initMocks(this)\r
+       }
+       
+       public DeleteVcpeResCustServiceTest() {
+               super("DeleteVcpeResCustService")
+       }
+       
+       
+       // ***** preProcessRequest *****\r
+                       \r
+       @Test\r
+//     @Ignore  \r
+       public void preProcessRequest() {\r
+               ExecutionEntity mex = setupMock()
+               def map = setupMap(mex)
+               initPreProcess(mex)
+               \r
+               DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()\r
+               DeleteVcpeResCustService.preProcessRequest(mex)\r
+\r
+               verify(mex).getVariable(DBGFLAG)\r
+               verify(mex).setVariable("prefix", Prefix)
+               verify(mex).setVariable("DeleteVcpeResCustServiceRequest", request)
+               verify(mex).setVariable("msoRequestId", "mri")
+               verify(mex).setVariable("requestAction", "ra")
+               verify(mex).setVariable("source", "VID")
+               verify(mex).setVariable("globalSubscriberId", CUST)
+               verify(mex).setVariable("globalCustomerId", CUST)
+               verify(mex).setVariable("disableRollback", "false")
+               verify(mex).setVariable("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb")
+               verify(mex).setVariable("subscriptionServiceType", SVC) 
+               
+               verify(mex).setVariable("lcpCloudRegionId", "mdt1")
+               verify(mex).setVariable("tenantId", "8b1df54faa3b49078e3416e21370a3ba")
+               verify(mex).setVariable("sdncVersion", "1702")
+               verify(mex).setVariable("GENGS_type", "service-instance")
+               assertTrue(map.containsKey(Prefix+"requestInfo"))
+               
+               def reqinfo = map.get(Prefix+"requestInfo")
+               assertTrue(reqinfo.indexOf("<request-id>mri</") >= 0)
+               assertTrue(reqinfo.indexOf("<source>VID</") >= 0)\r
+       }
+                       
+       @Test
+//     @Ignore  
+       public void preProcessRequest_EmptyParts() {
+               ExecutionEntity mex = setupMock()
+               def map = setupMap(mex)
+               initPreProcess(mex)
+               
+               def req = request
+                                       .replace('"source"', '"sourceXXX"')
+               
+               when(mex.getVariable("bpmnRequest")).thenReturn(req)
+               
+               DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
+               DeleteVcpeResCustService.preProcessRequest(mex)
+
+               verify(mex).getVariable(DBGFLAG)
+               verify(mex).setVariable("prefix", Prefix)
+               verify(mex).setVariable("DeleteVcpeResCustServiceRequest", req)
+               verify(mex).setVariable("msoRequestId", "mri")
+               verify(mex).setVariable("requestAction", "ra")
+               verify(mex).setVariable("source", "VID")
+               verify(mex).setVariable("globalSubscriberId", CUST)
+               verify(mex).setVariable("globalCustomerId", CUST)
+               verify(mex).setVariable("disableRollback", "false")
+               verify(mex).setVariable("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb")
+               verify(mex).setVariable("subscriptionServiceType", SVC) 
+               
+               verify(mex).setVariable("lcpCloudRegionId", "mdt1")
+               verify(mex).setVariable("tenantId", "8b1df54faa3b49078e3416e21370a3ba")
+               verify(mex).setVariable("sdncVersion", "1702")
+               verify(mex).setVariable("GENGS_type", "service-instance")
+               assertTrue(map.containsKey(Prefix+"requestInfo"))
+               
+               def reqinfo = map.get(Prefix+"requestInfo")
+               println reqinfo
+               assertTrue(reqinfo.indexOf("<request-id>mri</") >= 0)
+               assertTrue(reqinfo.indexOf("<source>VID</") >= 0)
+       }
+                       
+       @Test
+//     @Ignore  
+       public void preProcessRequest_MissingServiceInstanceId() {
+               ExecutionEntity mex = setupMock()
+               initPreProcess(mex)
+               
+               when(mex.getVariable("serviceInstanceId")).thenReturn(null)
+               
+               DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
+               
+               assertTrue(doBpmnError( { _ -> DeleteVcpeResCustService.preProcessRequest(mex) }))
+       }
+                       
+       @Test
+//     @Ignore  
+       public void preProcessRequest_BpmnError() {
+               ExecutionEntity mex = setupMock()
+               initPreProcess(mex)
+               
+               when(mex.getVariable("bpmnRequest")).thenThrow(new BpmnError("expected exception"))
+               
+               DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
+               
+               assertTrue(doBpmnError( { _ -> DeleteVcpeResCustService.preProcessRequest(mex) }))
+       }
+                       
+       @Test
+//     @Ignore  
+       public void preProcessRequest_Ex() {
+               ExecutionEntity mex = setupMock()
+               initPreProcess(mex)
+               
+               when(mex.getVariable("bpmnRequest")).thenThrow(new RuntimeException("expected exception"))
+               
+               DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
+               
+               assertTrue(doBpmnError( { _ -> DeleteVcpeResCustService.preProcessRequest(mex) }))
+       }
+       
+       private void initPreProcess(ExecutionEntity mex) {
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("bpmnRequest")).thenReturn(request)
+               when(mex.getVariable("mso-request-id")).thenReturn("mri")
+               when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
+               when(mex.getVariable("requestAction")).thenReturn("ra")
+       }
+       
+       // ***** sendSyncResponse *****
+                       
+       @Test
+//     @Ignore  
+       public void sendSyncResponse() {
+               ExecutionEntity mex = setupMock()
+               def map = setupMap(mex)
+               initSendSyncResponse(mex)
+               
+               DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
+               DeleteVcpeResCustService.sendSyncResponse(mex)
+
+               verify(mex, times(2)).getVariable(DBGFLAG)
+               
+               verify(mex).setVariable(processName+"WorkflowResponseSent", "true")
+               
+               assertEquals("202", map.get(processName+"ResponseCode"))
+               assertEquals("Success", map.get(processName+"Status"))
+               
+               def resp = map.get(processName+"Response")
+               
+               assertTrue(resp.indexOf('"instanceId":"sii"') >= 0)
+               assertTrue(resp.indexOf('"requestId":"mri"') >= 0)
+       }
+                       
+       @Test
+//     @Ignore  
+       public void sendSyncResponse_Ex() {
+               ExecutionEntity mex = setupMock()
+               initSendSyncResponse(mex)
+               
+               when(mex.getVariable("serviceInstanceId")).thenThrow(new RuntimeException("expected exception"))
+               
+               DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
+               
+               assertTrue(doBpmnError( { _ -> DeleteVcpeResCustService.sendSyncResponse(mex) }))
+       }
+       
+       private initSendSyncResponse(ExecutionEntity mex) {
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("mso-request-id")).thenReturn("mri")
+               when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
+       }
+       
+       // ***** prepareServiceDelete *****
+                       
+       @Test
+//     @Ignore  
+       public void prepareServiceDelete() {
+               ExecutionEntity mex = setupMock()
+               def map = setupMap(mex)
+               initPrepareServiceDelete(mex)
+               
+               DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
+               DeleteVcpeResCustService.prepareServiceDelete(mex)
+
+               verify(mex).getVariable(DBGFLAG)
+               
+               verify(mex).setVariable(Prefix+"TunnelXConn", true)
+               assertEquals("txcA", map.get("TXC_allottedResourceId"))
+               
+               verify(mex).setVariable(Prefix+"BRG", true)
+               assertEquals("brgB", map.get("BRG_allottedResourceId"))
+               
+               verify(mex).setVariable(Prefix+"vnfsCount", 2)
+               assertNotNull(map.get(Prefix+"relatedVnfIdList"))
+               assertEquals("[vnfX, vnfY]", map.get(Prefix+"relatedVnfIdList").toString())
+               
+               verify(mex, never()).setVariable(processName+"WorkflowResponseSent", "true")
+       }
+                       
+       @Test
+//     @Ignore  
+       public void prepareServiceDelete_NotFound() {
+               ExecutionEntity mex = setupMock()
+               initPrepareServiceDelete(mex)
+               
+               when(mex.getVariable("GENGS_FoundIndicator")).thenReturn(false)
+               
+               DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
+               
+               assertTrue(doBpmnError({ _ -> DeleteVcpeResCustService.prepareServiceDelete(mex) }))
+               
+               verify(mex, never()).setVariable(processName+"WorkflowResponseSent", "true")
+       }
+                       
+       @Test
+//     @Ignore  
+       public void prepareServiceDelete_Empty() {
+               ExecutionEntity mex = setupMock()
+               def map = setupMap(mex)
+               initPrepareServiceDelete(mex)
+               
+               when(mex.getVariable("GENGS_service")).thenReturn("<empty></empty>")
+               
+               DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
+               DeleteVcpeResCustService.prepareServiceDelete(mex)
+
+               verify(mex).getVariable(DBGFLAG)
+               
+               verify(mex).setVariable(Prefix+"TunnelXConn", false)
+               assertNull(map.get("TXC_allottedResourceId"))
+               
+               verify(mex).setVariable(Prefix+"BRG", false)
+               assertNull(map.get("BRG_allottedResourceId"))
+               
+               assertEquals(0, map.get(Prefix+"vnfsCount"))
+               assertFalse(map.containsKey(Prefix+"relatedVnfIdList"))
+               
+               verify(mex, never()).setVariable(processName+"WorkflowResponseSent", "true")
+       }
+                       
+       @Test
+//     @Ignore  
+       public void prepareServiceDelete_BpmnError() {
+               ExecutionEntity mex = setupMock()
+               initPrepareServiceDelete(mex)
+               
+               when(mex.getVariable("GENGS_FoundIndicator")).thenThrow(new BpmnError("expected exception"))
+               
+               DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
+               
+               assertTrue(doBpmnError({ _ -> DeleteVcpeResCustService.prepareServiceDelete(mex) }))
+               
+               verify(mex, never()).setVariable(processName+"WorkflowResponseSent", "true")
+       }
+                       
+       @Test
+//     @Ignore  
+       public void prepareServiceDelete_Ex() {
+               ExecutionEntity mex = setupMock()
+               initPrepareServiceDelete(mex)
+               
+               when(mex.getVariable("GENGS_FoundIndicator")).thenThrow(new RuntimeException("expected exception"))
+               
+               DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
+               
+               assertTrue(doBpmnError({ _ -> DeleteVcpeResCustService.prepareServiceDelete(mex) }))
+               
+               verify(mex).setVariable(processName+"WorkflowResponseSent", "true")
+       }
+       
+       private initPrepareServiceDelete(ExecutionEntity mex) {
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
+               when(mex.getVariable("GENGS_FoundIndicator")).thenReturn(true)
+               when(mex.getVariable("mso-request-id")).thenReturn("mri")
+               when(mex.getVariable("DeleteVcpeResCustServiceRequest")).thenReturn(request)
+               when(mex.getVariable("GENGS_service")).thenReturn(FileUtil.readResourceFile("__files/VCPE/DeleteVcpeResCustService/serviceToDelete.xml"))
+       }
+       
+       // ***** prepareVnfAndModulesDelete *****
+                       
+       @Test
+//     @Ignore  
+       public void prepareVnfAndModulesDelete() {
+               ExecutionEntity mex = setupMock()
+               initPrepareVnfAndModulesDelete(mex)
+               
+               DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
+               DeleteVcpeResCustService.prepareVnfAndModulesDelete(mex)
+
+               verify(mex).getVariable(DBGFLAG)
+               
+               verify(mex).setVariable("vnfId", "vnfB")
+       }
+                       
+       @Test
+//     @Ignore  
+       public void prepareVnfAndModulesDelete_Empty() {
+               ExecutionEntity mex = setupMock()
+               initPrepareVnfAndModulesDelete(mex)
+               
+               when(mex.getVariable(Prefix+"relatedVnfIdList")).thenReturn(new LinkedList())
+               
+               DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
+               DeleteVcpeResCustService.prepareVnfAndModulesDelete(mex)
+
+               verify(mex).getVariable(DBGFLAG)
+               
+               verify(mex).setVariable("vnfId", "")
+       }
+                       
+       @Test
+//     @Ignore  
+       public void prepareVnfAndModulesDelete_Ex() {
+               ExecutionEntity mex = setupMock()
+               initPrepareVnfAndModulesDelete(mex)
+               
+               when(mex.getVariable(Prefix+"relatedVnfIdList")).thenThrow(new RuntimeException("expected exception"))
+               
+               DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
+               
+               assertTrue(doBpmnError({ _ -> DeleteVcpeResCustService.prepareVnfAndModulesDelete(mex) }))
+       }
+       
+       private initPrepareVnfAndModulesDelete(ExecutionEntity mex) {
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable(Prefix+"relatedVnfIdList")).thenReturn(Arrays.asList("vnfA", "vnfB", "vnfC"))
+               when(mex.getVariable(Prefix+"vnfsDeletedCount")).thenReturn(1)
+       }
+       
+       // ***** validateVnfDelete *****
+                       
+       @Test
+//     @Ignore  
+       public void validateVnfDelete() {
+               ExecutionEntity mex = setupMock()
+               initValidateVnfDelete(mex)
+               
+               DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
+               DeleteVcpeResCustService.validateVnfDelete(mex)
+
+               verify(mex).getVariable(DBGFLAG)
+               
+               verify(mex).setVariable(Prefix+"vnfsDeletedCount", 3)
+       }
+                       
+       @Test
+//     @Ignore  
+       public void validateVnfDelete_Ex() {
+               ExecutionEntity mex = setupMock()
+               initValidateVnfDelete(mex)
+               
+               when(mex.getVariable(Prefix+"vnfsDeletedCount")).thenThrow(new RuntimeException("expected exception"))
+               
+               DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
+               
+               assertTrue(doBpmnError({ _ -> DeleteVcpeResCustService.validateVnfDelete(mex) }))
+       }
+       
+       private initValidateVnfDelete(ExecutionEntity mex) {
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable(Prefix+"vnfsDeletedCount")).thenReturn(2)
+       }
+       
+       // ***** postProcessResponse *****
+                       
+       @Test
+//     @Ignore  
+       public void postProcessResponse() {
+               ExecutionEntity mex = setupMock()
+               def map = setupMap(mex)
+               initPostProcessResponse(mex)
+               
+               DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
+               DeleteVcpeResCustService.postProcessResponse(mex)
+
+               verify(mex).getVariable(DBGFLAG)
+               
+               assertEquals(true, map.get(Prefix+"Success"))
+               
+               def req = map.get(Prefix+"CompleteMsoProcessRequest")
+               
+               assertTrue(req.indexOf("<request-id>mri</") >= 0)
+               assertTrue(req.indexOf("<source>mysrc</") >= 0)
+       }
+                       
+       @Test
+//     @Ignore  
+       public void postProcessResponse_BpmnError() {
+               ExecutionEntity mex = setupMock()
+               initPostProcessResponse(mex)
+               
+               when(mex.getVariable("source")).thenThrow(new BpmnError("expected exception"))
+               
+               DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
+               
+               assertTrue(doBpmnError( { _ -> DeleteVcpeResCustService.postProcessResponse(mex) }))
+       }
+                       
+       @Test
+//     @Ignore  
+       public void postProcessResponse_Ex() {
+               ExecutionEntity mex = setupMock()
+               initPostProcessResponse(mex)
+               
+               when(mex.getVariable("source")).thenThrow(new RuntimeException("expected exception"))
+               
+               DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
+               
+               assertTrue(doBpmnError( { _ -> DeleteVcpeResCustService.postProcessResponse(mex) }))
+       }
+       
+       private initPostProcessResponse(ExecutionEntity mex) {
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("source")).thenReturn("mysrc")
+               when(mex.getVariable("msoRequestId")).thenReturn("mri")
+       }
+       
+       
+       // ***** prepareFalloutRequest *****
+                       
+       @Test
+//     @Ignore  
+       public void prepareFalloutRequest() {
+               ExecutionEntity mex = setupMock()
+               def map = setupMap(mex)
+               initPrepareFalloutRequest(mex)
+               
+               DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
+               DeleteVcpeResCustService.prepareFalloutRequest(mex)
+
+               verify(mex, times(2)).getVariable(DBGFLAG)
+               
+               def fo = map.get(Prefix+"falloutRequest")
+               
+               assertTrue(fo.indexOf("<hello>world</") >= 0)
+               assertTrue(fo.indexOf("ErrorMessage>mymsg</") >= 0)
+               assertTrue(fo.indexOf("ErrorCode>999</") >= 0)
+       }
+                       
+       @Test
+//     @Ignore  
+       public void prepareFalloutRequest_Ex() {
+               ExecutionEntity mex = setupMock()
+               def map = setupMap(mex)
+               initPrepareFalloutRequest(mex)
+               
+               when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception"))
+               
+               DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
+               
+               assertTrue(doBpmnError( { _ -> DeleteVcpeResCustService.prepareFalloutRequest(mex) }))
+       }
+       
+       private initPrepareFalloutRequest(ExecutionEntity mex) {
+               WorkflowException wfe = mock(WorkflowException.class)
+               
+               when(wfe.getErrorMessage()).thenReturn("mymsg")
+               when(wfe.getErrorCode()).thenReturn(999)
+               
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("WorkflowException")).thenReturn(wfe)
+               when(mex.getVariable(Prefix+"requestInfo")).thenReturn("<hello>world</hello>")
+               
+               return wfe
+       }
+       
+       // ***** sendSyncError *****
+                       
+       @Test
+//     @Ignore  
+       public void sendSyncError() {
+               ExecutionEntity mex = setupMock()
+               def map = setupMap(mex)
+               initSendSyncError(mex)
+               
+               DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
+               DeleteVcpeResCustService.sendSyncError(mex)
+
+               verify(mex, times(2)).getVariable(DBGFLAG)
+               
+               verify(mex).setVariable(processName+"WorkflowResponseSent", "true")
+               
+               assertEquals("500", map.get(processName+"ResponseCode"))
+               assertEquals("Fail", map.get(processName+"Status"))
+               
+               def resp = map.get(processName+"Response")
+               
+               assertTrue(resp.indexOf("ErrorMessage>mymsg</") >= 0)
+               
+               verify(mex).setVariable("WorkflowResponse", resp)
+       }
+                       
+       @Test
+//     @Ignore  
+       public void sendSyncError_NotWfe() {
+               ExecutionEntity mex = setupMock()
+               def map = setupMap(mex)
+               initSendSyncError(mex)
+               
+               when(mex.getVariable("WorkflowException")).thenReturn("not a WFE")
+               
+               DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
+               DeleteVcpeResCustService.sendSyncError(mex)
+
+               verify(mex, times(2)).getVariable(DBGFLAG)
+               
+               verify(mex).setVariable(processName+"WorkflowResponseSent", "true")
+               
+               assertEquals("500", map.get(processName+"ResponseCode"))
+               assertEquals("Fail", map.get(processName+"Status"))
+               
+               def resp = map.get(processName+"Response")
+               
+               assertTrue(resp.indexOf("ErrorMessage>Sending Sync Error.</") >= 0)
+               
+               verify(mex).setVariable("WorkflowResponse", resp)
+       }
+                       
+       @Test
+//     @Ignore  
+       public void sendSyncError_NullWfe() {
+               ExecutionEntity mex = setupMock()
+               def map = setupMap(mex)
+               initSendSyncError(mex)
+               
+               when(mex.getVariable("WorkflowException")).thenReturn(null)
+               
+               DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
+               DeleteVcpeResCustService.sendSyncError(mex)
+
+               verify(mex, times(2)).getVariable(DBGFLAG)
+               
+               verify(mex).setVariable(processName+"WorkflowResponseSent", "true")
+               
+               assertEquals("500", map.get(processName+"ResponseCode"))
+               assertEquals("Fail", map.get(processName+"Status"))
+               
+               def resp = map.get(processName+"Response")
+               
+               assertTrue(resp.indexOf("ErrorMessage>Sending Sync Error.</") >= 0)
+               
+               verify(mex).setVariable("WorkflowResponse", resp)
+       }
+                       
+       @Test
+//     @Ignore  
+       public void sendSyncError_Ex() {
+               ExecutionEntity mex = setupMock()
+               def map = setupMap(mex)
+               initSendSyncError(mex)
+               
+               when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception"))
+               
+               DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
+               
+               DeleteVcpeResCustService.sendSyncError(mex)
+               
+               assertFalse(map.containsKey(processName+"ResponseCode"))
+       }
+       
+       private initSendSyncError(ExecutionEntity mex) {
+               WorkflowException wfe = mock(WorkflowException.class)
+               
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("mso-request-id")).thenReturn("mri")
+               when(mex.getVariable("WorkflowException")).thenReturn(wfe)
+               
+               when(wfe.getErrorMessage()).thenReturn("mymsg")
+       }
+       
+       
+       // ***** processJavaException *****
+                       
+       @Test
+//     @Ignore  
+       public void processJavaException() {
+               ExecutionEntity mex = setupMock()
+               def map = setupMap(mex)
+               initProcessJavaException(mex)
+               
+               DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
+               
+               assertTrue(doBpmnError( { _ -> DeleteVcpeResCustService.processJavaException(mex) }))
+
+               verify(mex, times(2)).getVariable(DBGFLAG)
+               
+               verify(mex).setVariable("prefix", Prefix)
+               
+               def wfe = map.get("WorkflowException")
+               
+               assertEquals("Caught a Java Lang Exception", wfe.getErrorMessage())
+       }
+                       
+       @Test
+//     @Ignore  
+       public void processJavaException_BpmnError() {
+               ExecutionEntity mex = setupMock()
+               def map = setupMap(mex)
+               initProcessJavaException(mex)
+               
+               when(mex.getVariables()).thenThrow(new BpmnError("expected exception"))
+               
+               DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
+               
+               assertTrue(doBpmnError( { _ -> DeleteVcpeResCustService.processJavaException(mex) }))
+               
+               assertFalse(map.containsKey("WorkflowException"))
+       }
+                       
+       @Test
+//     @Ignore  
+       public void processJavaException_Ex() {
+               ExecutionEntity mex = setupMock()
+               def map = setupMap(mex)
+               initProcessJavaException(mex)
+               
+               when(mex.getVariables()).thenThrow(new RuntimeException("expected exception"))
+               
+               DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
+               
+               assertTrue(doBpmnError( { _ -> DeleteVcpeResCustService.processJavaException(mex) }))
+               
+               def wfe = map.get("WorkflowException")
+               
+               assertEquals("Exception in processJavaException method", wfe.getErrorMessage())
+       }
+       
+       private initProcessJavaException(ExecutionEntity mex) {
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+       }\r
+}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollbackTest.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollbackTest.groovy
new file mode 100644 (file)
index 0000000..af532e7
--- /dev/null
@@ -0,0 +1,653 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.mso.bpmn.vcpe.scripts
+\r
+\r
+import org.camunda.bpm.engine.ProcessEngineServices\r
+import org.camunda.bpm.engine.RepositoryService\r
+import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity\r
+import org.camunda.bpm.engine.repository.ProcessDefinition\r
+import org.camunda.bpm.engine.runtime.Execution\r
+import org.junit.Before
+import org.junit.BeforeClass\r
+import org.junit.Rule\r
+import org.junit.Test
+import org.junit.Ignore\r
+import org.mockito.MockitoAnnotations
+import org.camunda.bpm.engine.delegate.BpmnError\r
+import org.openecomp.mso.bpmn.core.WorkflowException
+import org.openecomp.mso.bpmn.mock.FileUtil
+
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse
+import static com.github.tomakehurst.wiremock.client.WireMock.get
+import static com.github.tomakehurst.wiremock.client.WireMock.stubFor
+import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching
+import static org.junit.Assert.*;\r
+import static org.mockito.Mockito.*
+import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteAllottedResource
+import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetAllottedResource
+import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchAllottedResource
+
+import org.openecomp.mso.bpmn.core.RollbackData
+
+import com.github.tomakehurst.wiremock.junit.WireMockRule\r
+\r
+class DoCreateAllottedResourceBRGRollbackTest extends GroovyTestBase {\r
+       \r
+       @Rule\r
+       public WireMockRule wireMockRule = new WireMockRule(PORT)
+\r
+       String Prefix = "DCARBRGRB_"
+       String RbType = "DCARBRG_"\r
+
+       @BeforeClass
+       public static void setUpBeforeClass() {
+               super.setUpBeforeClass()
+       }
+         \r
+    @Before\r
+       public void init()\r
+       {\r
+               MockitoAnnotations.initMocks(this)\r
+       }
+       
+       public DoCreateAllottedResourceBRGRollbackTest() {
+               super("DoCreateAllottedResourceBRGRollback")
+       }
+       
+       
+       // ***** preProcessRequest *****\r
+                       \r
+       @Test\r
+//     @Ignore  \r
+       public void preProcessRequest() {\r
+               ExecutionEntity mex = setupMock()
+               initPreProcess(mex)
+               \r
+               DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()\r
+               DoCreateAllottedResourceBRGRollback.preProcessRequest(mex)\r
+\r
+               verify(mex).getVariable(DBGFLAG)\r
+               verify(mex).setVariable("prefix", Prefix)
+               verify(mex).setVariable("serviceInstanceId", "sii")
+               verify(mex).setVariable("parentServiceInstanceId", "psii")
+               verify(mex).setVariable("allottedResourceId", "myid")
+               verify(mex).setVariable("rollbackAAI", true)
+               verify(mex).setVariable("aaiARPath", "mypath")
+               verify(mex).setVariable("rollbackSDNC", true)
+               verify(mex).setVariable("deactivateSdnc", "myactivate")
+               verify(mex).setVariable("deleteSdnc", "mycreate")
+               verify(mex).setVariable("unassignSdnc", "true")
+               verify(mex).setVariable("sdncDeactivateRequest", "activatereq")
+               verify(mex).setVariable("sdncDeleteRequest", "createreq")
+               verify(mex).setVariable("sdncUnassignRequest", "assignreq")
+               
+               verify(mex, never()).setVariable("skipRollback", true)\r
+       }
+                       
+       @Test
+//     @Ignore  
+       public void preProcessRequest_RollbackDisabled() {
+               ExecutionEntity mex = setupMock()
+               initPreProcess(mex)
+               
+               when(mex.getVariable("disableRollback")).thenReturn("true")
+               
+               DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
+               DoCreateAllottedResourceBRGRollback.preProcessRequest(mex)
+
+               verify(mex).getVariable(DBGFLAG)
+               verify(mex).setVariable("prefix", Prefix)
+               verify(mex).setVariable("serviceInstanceId", "sii")
+               verify(mex).setVariable("parentServiceInstanceId", "psii")
+               verify(mex).setVariable("allottedResourceId", "myid")
+               verify(mex).setVariable("rollbackAAI", true)
+               verify(mex).setVariable("aaiARPath", "mypath")
+               verify(mex).setVariable("rollbackSDNC", true)
+               verify(mex).setVariable("deactivateSdnc", "myactivate")
+               verify(mex).setVariable("deleteSdnc", "mycreate")
+               verify(mex).setVariable("unassignSdnc", "true")
+               verify(mex).setVariable("sdncDeactivateRequest", "activatereq")
+               verify(mex).setVariable("sdncDeleteRequest", "createreq")
+               verify(mex).setVariable("sdncUnassignRequest", "assignreq")
+               
+               verify(mex).setVariable("skipRollback", true)
+       }
+                       
+       @Test
+//     @Ignore  
+       public void preProcessRequest_NoAAI() {
+               ExecutionEntity mex = setupMock()
+               def data = initPreProcess(mex)
+               
+               when(mex.getVariable("rollbackAAI")).thenReturn(false)
+               data.put(RbType, "rollbackAAI", "false")
+               
+               DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
+               DoCreateAllottedResourceBRGRollback.preProcessRequest(mex)
+
+               verify(mex).getVariable(DBGFLAG)
+               verify(mex).setVariable("prefix", Prefix)
+               verify(mex).setVariable("serviceInstanceId", "sii")
+               verify(mex).setVariable("parentServiceInstanceId", "psii")
+               verify(mex).setVariable("allottedResourceId", "myid")
+               verify(mex, never()).setVariable("rollbackAAI", true)
+               verify(mex, never()).setVariable("aaiARPath", "mypath")
+               verify(mex).setVariable("rollbackSDNC", true)
+               verify(mex).setVariable("deactivateSdnc", "myactivate")
+               verify(mex).setVariable("deleteSdnc", "mycreate")
+               verify(mex).setVariable("unassignSdnc", "true")
+               verify(mex).setVariable("sdncDeactivateRequest", "activatereq")
+               verify(mex).setVariable("sdncDeleteRequest", "createreq")
+               verify(mex).setVariable("sdncUnassignRequest", "assignreq")
+               
+               verify(mex, never()).setVariable("skipRollback", true)
+       }
+                       
+       @Test
+//     @Ignore  
+       public void preProcessRequest_NoAssign() {
+               ExecutionEntity mex = setupMock()
+               def data = initPreProcess(mex)
+               
+               when(mex.getVariable("rollbackSDNC")).thenReturn(false)
+               data.put(RbType, "rollbackSDNCassign", "false")
+               
+               DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
+               DoCreateAllottedResourceBRGRollback.preProcessRequest(mex)
+
+               verify(mex).getVariable(DBGFLAG)
+               verify(mex).setVariable("prefix", Prefix)
+               verify(mex).setVariable("serviceInstanceId", "sii")
+               verify(mex).setVariable("parentServiceInstanceId", "psii")
+               verify(mex).setVariable("allottedResourceId", "myid")
+               verify(mex).setVariable("rollbackAAI", true)
+               verify(mex).setVariable("aaiARPath", "mypath")
+               verify(mex, never()).setVariable("rollbackSDNC", true)
+               verify(mex, never()).setVariable("deactivateSdnc", "myactivate")
+               verify(mex, never()).setVariable("deleteSdnc", "mycreate")
+               verify(mex, never()).setVariable("unassignSdnc", "true")
+               verify(mex, never()).setVariable("sdncDeactivateRequest", "activatereq")
+               verify(mex, never()).setVariable("sdncDeleteRequest", "createreq")
+               verify(mex, never()).setVariable("sdncUnassignRequest", "assignreq")
+               
+               verify(mex, never()).setVariable("skipRollback", true)
+       }
+                       
+       @Test
+//     @Ignore  
+       public void preProcessRequest_NoAAI_NoAssign() {
+               ExecutionEntity mex = setupMock()
+               initPreProcess(mex)
+               
+               when(mex.getVariable("rollbackAAI")).thenReturn(false)
+               when(mex.getVariable("rollbackSDNC")).thenReturn(false)
+               
+               DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
+               DoCreateAllottedResourceBRGRollback.preProcessRequest(mex)
+
+               verify(mex).setVariable("skipRollback", true)
+       }
+                       
+       @Test
+//     @Ignore  
+       public void preProcessRequest_NoRbStructure() {
+               ExecutionEntity mex = setupMock()
+               initPreProcess(mex)
+               
+               when(mex.getVariable("rollbackData")).thenReturn(new RollbackData())
+               
+               DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
+               DoCreateAllottedResourceBRGRollback.preProcessRequest(mex)
+
+               verify(mex).setVariable("skipRollback", true)
+       }
+                       
+       @Test
+//     @Ignore  
+       public void preProcessRequest_NullRb() {
+               ExecutionEntity mex = setupMock()
+               initPreProcess(mex)
+               
+               when(mex.getVariable("rollbackData")).thenReturn(null)
+               
+               DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
+               DoCreateAllottedResourceBRGRollback.preProcessRequest(mex)
+
+               verify(mex).setVariable("skipRollback", true)
+       }
+                       
+       @Test
+//     @Ignore  
+       public void preProcessRequest_BpmnError() {
+               ExecutionEntity mex = setupMock()
+               initPreProcess(mex)
+               
+               when(mex.getVariable("rollbackData")).thenThrow(new BpmnError("expected exception"))
+               
+               DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
+               
+               assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceBRGRollback.preProcessRequest(mex) }))
+       }
+                       
+       @Test
+//     @Ignore  
+       public void preProcessRequest_Ex() {
+               ExecutionEntity mex = setupMock()
+               initPreProcess(mex)
+               
+               when(mex.getVariable("rollbackData")).thenThrow(new RuntimeException("expected exception"))
+               
+               DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
+               
+               assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceBRGRollback.preProcessRequest(mex) }))
+       }
+                       
+       @Test
+//     @Ignore  
+       public void updateAaiAROrchStatus() {
+               ExecutionEntity mex = setupMock()
+               initUpdateAaiAROrchStatus(mex)
+               
+               MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml")
+               MockPatchAllottedResource(CUST, SVC, INST, ARID)
+               
+               DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
+               DoCreateAllottedResourceBRGRollback.updateAaiAROrchStatus(mex, "success")
+       }
+                       
+       @Test
+//     @Ignore  
+       public void updateAaiAROrchStatus_EmptyResponse() {
+               ExecutionEntity mex = setupMock()
+               initUpdateAaiAROrchStatus(mex)
+               
+               wireMockRule
+                       .stubFor(get(urlMatching("/aai/v[0-9]+/.*"))
+                                       .willReturn(aResponse()
+                                               .withStatus(200)))
+               
+               DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
+               
+               assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceBRGRollback.updateAaiAROrchStatus(mex, "success") }))
+       }
+                       
+       @Test
+//     @Ignore  
+       public void updateAaiAROrchStatus_NoArPath() {
+               ExecutionEntity mex = setupMock()
+               initUpdateAaiAROrchStatus(mex)
+               
+               MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml")
+               MockPatchAllottedResource(CUST, SVC, INST, ARID)
+                       
+               when(mex.getVariable("aaiARPath")).thenReturn(null)
+               
+               DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
+               
+               assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceBRGRollback.updateAaiAROrchStatus(mex, "success") }))
+       }
+       
+       
+       // ***** validateSDNCResp *****
+       
+       @Test
+//     @Ignore
+       public void validateSDNCResp() {
+               ExecutionEntity mex = setupMock()
+               initValidateSDNCResp(mex)
+               def resp = initValidateSDNCResp_Resp()
+               
+               when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(true)
+               
+               DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
+               
+               DoCreateAllottedResourceBRGRollback.validateSDNCResp(mex, resp, "create")
+               
+               verify(mex).getVariable("WorkflowException")
+               verify(mex).getVariable("SDNCA_SuccessIndicator")
+       }
+       
+       @Test
+//     @Ignore
+       public void validateSDNCResp_Unsuccessful() {
+               ExecutionEntity mex = setupMock()
+               initValidateSDNCResp(mex)
+               def resp = initValidateSDNCResp_Resp()
+               
+               when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(false)
+               
+               DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
+               
+               assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceBRGRollback.validateSDNCResp(mex, resp, "create") }))
+       }
+       
+       @Test
+//     @Ignore
+       public void validateSDNCResp_BpmnError404() {
+               ExecutionEntity mex = setupMock()
+               initValidateSDNCResp(mex)
+               def resp = initValidateSDNCResp_Resp()
+               when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(true)
+               
+               when(mex.getVariable("WorkflowException")).thenThrow(new BpmnError("404", "expected exception"))
+               
+               DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
+               
+               DoCreateAllottedResourceBRGRollback.validateSDNCResp(mex, resp, "create")
+       }
+       
+       @Test
+//     @Ignore
+       public void validateSDNCResp_BpmnError() {
+               ExecutionEntity mex = setupMock()
+               initValidateSDNCResp(mex)
+               def resp = initValidateSDNCResp_Resp()
+               when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(true)
+               
+               when(mex.getVariable("WorkflowException")).thenThrow(new BpmnError("expected exception"))
+               
+               DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
+               
+               assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceBRGRollback.validateSDNCResp(mex, resp, "create") }))
+       }
+       
+       @Test
+//     @Ignore
+       public void validateSDNCResp_Ex() {
+               ExecutionEntity mex = setupMock()
+               initValidateSDNCResp(mex)
+               def resp = initValidateSDNCResp_Resp()
+               when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(true)
+               
+               when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception"))
+               
+               DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
+               
+               assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceBRGRollback.validateSDNCResp(mex, resp, "create") }))
+       }
+                       
+       @Test
+//     @Ignore  
+       public void deleteAaiAR() {
+               ExecutionEntity mex = setupMock()
+               initDeleteAaiAR(mex)
+               
+               MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml")
+               MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS)
+               
+               DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
+               DoCreateAllottedResourceBRGRollback.deleteAaiAR(mex)
+       }
+                       
+       @Test
+//     @Ignore  
+       public void deleteAaiAR_NoArPath() {
+               ExecutionEntity mex = setupMock()
+               initDeleteAaiAR(mex)
+               
+               MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml")
+               MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS)
+                       
+               when(mex.getVariable("aaiARPath")).thenReturn("")
+               
+               DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
+               
+               assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceBRGRollback.deleteAaiAR(mex) }))
+       }
+                       
+       @Test
+//     @Ignore  
+       public void deleteAaiAR_BpmnError() {
+               ExecutionEntity mex = setupMock()
+               initDeleteAaiAR(mex)
+               
+               MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml")
+               MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS)
+                       
+               when(mex.getVariable("aaiARPath")).thenThrow(new BpmnError("expected exception"))
+               
+               DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
+               
+               assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceBRGRollback.deleteAaiAR(mex) }))
+       }
+                       
+       @Test
+//     @Ignore  
+       public void deleteAaiAR_Ex() {
+               ExecutionEntity mex = setupMock()
+               initDeleteAaiAR(mex)
+               
+               MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml")
+               MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS)
+                       
+               when(mex.getVariable("aaiARPath")).thenThrow(new RuntimeException("expected exception"))
+               
+               DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
+               
+               assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceBRGRollback.deleteAaiAR(mex) }))
+       }
+                       
+       @Test
+//     @Ignore  
+       public void postProcessRequest() {
+               ExecutionEntity mex = setupMock()
+               initPostProcessRequest(mex)
+               
+               DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
+               DoCreateAllottedResourceBRGRollback.postProcessRequest(mex)
+
+               verify(mex).getVariable(DBGFLAG)
+               verify(mex).setVariable("rollbackData", null)
+               verify(mex).setVariable("rolledBack", true)
+       }
+                       
+       @Test
+//     @Ignore  
+       public void postProcessRequest_RolledBack() {
+               ExecutionEntity mex = setupMock()
+               initPostProcessRequest(mex)
+               
+               when(mex.getVariable("skipRollback")).thenReturn(true)
+               
+               DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
+               DoCreateAllottedResourceBRGRollback.postProcessRequest(mex)
+
+               verify(mex).getVariable(DBGFLAG)
+               verify(mex).setVariable("rollbackData", null)
+               verify(mex, never()).setVariable("rolledBack", true)
+       }
+                       
+       @Test
+//     @Ignore  
+       public void postProcessRequest_BpmnError() {
+               ExecutionEntity mex = setupMock()
+               initPostProcessRequest(mex)
+               
+               when(mex.getVariable("skipRollback")).thenThrow(new BpmnError("expected exception"))
+               
+               DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
+               DoCreateAllottedResourceBRGRollback.postProcessRequest(mex)
+
+               verify(mex).getVariable(DBGFLAG)
+               verify(mex).setVariable("rollbackData", null)
+               verify(mex, never()).setVariable("rolledBack", true)
+       }
+                       
+       @Test
+//     @Ignore  
+       public void postProcessRequest_Ex() {
+               ExecutionEntity mex = setupMock()
+               initPostProcessRequest(mex)
+               
+               when(mex.getVariable("skipRollback")).thenThrow(new RuntimeException("expected exception"))
+               
+               DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
+               DoCreateAllottedResourceBRGRollback.postProcessRequest(mex)
+
+               verify(mex).getVariable(DBGFLAG)
+               verify(mex).setVariable("rollbackData", null)
+               verify(mex, never()).setVariable("rolledBack", true)
+       }
+                       
+       @Test
+//     @Ignore  
+       public void processRollbackException() {
+               ExecutionEntity mex = setupMock()
+               initProcessRollbackException(mex)
+               
+               DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
+               DoCreateAllottedResourceBRGRollback.processRollbackException(mex)
+
+               verify(mex).getVariable(DBGFLAG)
+               verify(mex).setVariable("rollbackData", null)
+               verify(mex).setVariable("rolledBack", false)
+               verify(mex).setVariable("rollbackError", "Caught exception in AllottedResource Create Rollback")
+               verify(mex).setVariable("WorkflowException", null)
+       }
+                       
+       @Test
+//     @Ignore  
+       public void processRollbackException_BpmnError() {
+               ExecutionEntity mex = setupMock()
+               initProcessRollbackException(mex)
+               
+               doThrow(new BpmnError("expected exception")).when(mex).setVariable("rollbackData", null)
+               
+               DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
+               DoCreateAllottedResourceBRGRollback.processRollbackException(mex)
+       }
+                       
+       @Test
+//     @Ignore  
+       public void processRollbackException_Ex() {
+               ExecutionEntity mex = setupMock()
+               initProcessRollbackException(mex)
+               
+               doThrow(new RuntimeException("expected exception")).when(mex).setVariable("rollbackData", null)
+               
+               DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
+               DoCreateAllottedResourceBRGRollback.processRollbackException(mex)
+       }
+                       
+       @Test
+//     @Ignore  
+       public void processRollbackJavaException() {
+               ExecutionEntity mex = setupMock()
+               initProcessRollbackException(mex)
+               
+               DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
+               DoCreateAllottedResourceBRGRollback.processRollbackJavaException(mex)
+
+               verify(mex).getVariable(DBGFLAG)
+               verify(mex).setVariable("rollbackData", null)
+               verify(mex).setVariable("rolledBack", false)
+               verify(mex).setVariable("rollbackError", "Caught Java exception in AllottedResource Create Rollback")
+               verify(mex, never()).setVariable("WorkflowException", null)
+       }
+                       
+       @Test
+//     @Ignore  
+       public void processRollbackJavaException_BpmnError() {
+               ExecutionEntity mex = setupMock()
+               initProcessRollbackException(mex)
+               
+               doThrow(new BpmnError("expected exception")).when(mex).setVariable("rollbackData", null)
+               
+               DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
+               DoCreateAllottedResourceBRGRollback.processRollbackJavaException(mex)
+       }
+                       
+       @Test
+//     @Ignore  
+       public void processRollbackJavaException_Ex() {
+               ExecutionEntity mex = setupMock()
+               initProcessRollbackException(mex)
+               
+               doThrow(new RuntimeException("expected exception")).when(mex).setVariable("rollbackData", null)
+               
+               DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback()
+               DoCreateAllottedResourceBRGRollback.processRollbackJavaException(mex)
+       }
+       
+       private RollbackData initPreProcess(ExecutionEntity mex) {
+               def data = new RollbackData()
+               
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("rollbackData")).thenReturn(data)
+               when(mex.getVariable("rollbackAAI")).thenReturn(true)
+               when(mex.getVariable("rollbackSDNC")).thenReturn(true)
+               when(mex.getVariable("disableRollback")).thenReturn("false")
+               
+               data.put("SERVICEINSTANCE", "allottedResourceId", "myid")
+               
+               data.put(RbType, "serviceInstanceId", "sii")
+               data.put(RbType, "parentServiceInstanceId", "psii")
+               
+               data.put(RbType, "rollbackAAI", "true")
+               data.put(RbType, "aaiARPath", "mypath")
+               
+               data.put(RbType, "rollbackSDNCassign", "true")
+               data.put(RbType, "rollbackSDNCactivate", "myactivate")
+               data.put(RbType, "rollbackSDNCcreate", "mycreate")
+               data.put(RbType, "sdncActivateRollbackReq", "activatereq")
+               data.put(RbType, "sdncCreateRollbackReq", "createreq")
+               data.put(RbType, "sdncAssignRollbackReq", "assignreq")
+               
+               return data
+       }
+       
+       private initUpdateAaiAROrchStatus(ExecutionEntity mex) {
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               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)
+               when(mex.getVariable("URN_aai_endpoint")).thenReturn(aaiUriPfx)
+       }
+       
+       private initValidateSDNCResp(ExecutionEntity mex) {
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("prefix")).thenReturn(Prefix)
+               when(mex.getVariable("SDNCA_SuccessIndicator")).thenReturn(true)
+       }
+       
+       private String initValidateSDNCResp_Resp() {
+               return "<response-data>&lt;response-code&gt;200&lt;/response-code&gt;</response-data>"
+       }
+       
+       private initDeleteAaiAR(ExecutionEntity mex) {
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("aaiARResourceVersion")).thenReturn(VERS)
+               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)
+               when(mex.getVariable("URN_aai_endpoint")).thenReturn(aaiUriPfx)
+       }
+       
+       private initPostProcessRequest(ExecutionEntity mex) {
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("skipRollback")).thenReturn(false)
+       }
+       
+       private initProcessRollbackException(ExecutionEntity mex) {
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+       }
+       
+       private initProcessRollbackJavaException(ExecutionEntity mex) {
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+       }\r
+               \r
+}
index f34f84a..1d4d3ea 100644 (file)
@@ -1,3 +1,22 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
 package org.openecomp.mso.bpmn.vcpe.scripts
 \r
 \r
@@ -12,1120 +31,960 @@ import org.junit.Rule
 import org.junit.Test
 import org.junit.Ignore\r
 import org.mockito.MockitoAnnotations
-import org.mockito.ArgumentCaptor
 import org.camunda.bpm.engine.delegate.BpmnError\r
-import org.openecomp.mso.bpmn.common.scripts.MsoUtils\r
 import org.openecomp.mso.bpmn.core.WorkflowException
 import org.openecomp.mso.bpmn.mock.FileUtil
 
 import static com.github.tomakehurst.wiremock.client.WireMock.aResponse
-import static com.github.tomakehurst.wiremock.client.WireMock.get
-import static com.github.tomakehurst.wiremock.client.WireMock.patch
 import static com.github.tomakehurst.wiremock.client.WireMock.put
 import static com.github.tomakehurst.wiremock.client.WireMock.stubFor
 import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching
 import static org.junit.Assert.*;\r
 import static org.mockito.Mockito.*
 import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetAllottedResource
+import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchAllottedResource
+import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutAllottedResource
+import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutAllottedResource_500
+
 import org.openecomp.mso.bpmn.core.RollbackData
+import org.openecomp.mso.bpmn.vcpe.scripts.MapSetter
 
 import com.github.tomakehurst.wiremock.junit.WireMockRule\r
 \r
-class DoCreateAllottedResourceBRGTest  {\r
+class DoCreateAllottedResourceBRGTest extends GroovyTestBase {
        \r
        @Rule\r
-       public WireMockRule wireMockRule = new WireMockRule(28090)\r
-       
-               static def urnProps = new Properties()
-               static def aaiUriPfx
-       \r
-               String Prefix="DCARBRG_"\r
-               def utils = new MsoUtils()\r
+       public WireMockRule wireMockRule = new WireMockRule(PORT)
+\r
+       String Prefix = "DCARBRG_"\r
 
-               @BeforeClass
-               public static void setUpBeforeClass() {
-                       def fr = new FileReader("src/test/resources/mso.bpmn.urn.properties")
-                       urnProps.load(fr)
-                       fr.close()
-                       
-                       aaiUriPfx = urnProps.get("aai.endpoint")
-               }
-                 \r
-           @Before\r
-               public void init()\r
-               {\r
-                       MockitoAnnotations.initMocks(this)\r
-               }
-               
-               
-               // ***** preProcessRequest *****\r
-                               \r
-               @Test\r
-//             @Ignore  \r
-               public void preProcessRequest() {\r
-                       ExecutionEntity mex = setupMock()
-                       initPreProcess(mex)
+       @BeforeClass
+       public static void setUpBeforeClass() {
+               super.setUpBeforeClass()
+       }
+         \r
+    @Before\r
+       public void init()\r
+       {\r
+               MockitoAnnotations.initMocks(this)\r
+       }
+       
+       public DoCreateAllottedResourceBRGTest() {
+               super("DoCreateAllottedResourceBRG")
+       }
+       
+       
+       // ***** preProcessRequest *****\r
                        \r
-                       DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()\r
-                       DoCreateAllottedResourceBRG.preProcessRequest(mex)\r
+       @Test\r
+//     @Ignore  \r
+       public void preProcessRequest() {\r
+               ExecutionEntity mex = setupMock()
+               initPreProcess(mex)
+               \r
+               DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()\r
+               DoCreateAllottedResourceBRG.preProcessRequest(mex)\r
 \r
-                       verify(mex).getVariable("isDebugLogEnabled")\r
-                       verify(mex).setVariable("prefix", Prefix)\r
-                                       
-                       assertTrue(checkMissingPreProcessRequest("URN_mso_workflow_sdncadapter_callback"))
-                       assertTrue(checkMissingPreProcessRequest("serviceInstanceId"))
-                       assertTrue(checkMissingPreProcessRequest("parentServiceInstanceId"))
-                       assertTrue(checkMissingPreProcessRequest("allottedResourceModelInfo"))
-                       assertTrue(checkMissingPreProcessRequest("vni"))
-                       assertTrue(checkMissingPreProcessRequest("vgmuxBearerIP"))
-                       assertTrue(checkMissingPreProcessRequest("brgWanMacAddress"))
-                       assertTrue(checkMissingPreProcessRequest("allottedResourceRole"))
-                       assertTrue(checkMissingPreProcessRequest("allottedResourceType"))\r
-               }
-               
-               
-               // ***** getAaiAR *****
-               
-               @Test
-//             @Ignore
-               public void getAaiAR() {
-                       def arData = FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRG/getAR.xml")
-                       def arBrg = FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRG/getArBrg.xml")
-                       
-                       wireMockRule
-                               .stubFor(get(urlMatching("/aai/v[0-9]+/mylink"))
-                                               .willReturn(aResponse()
-                                                       .withStatus(200)
-                                                       .withHeader("Content-Type", "text/xml")
-                                                       .withBodyFile("VCPE/DoCreateAllottedResourceBRG/getArBrg.xml")))
-                       
-                       ExecutionEntity mex = setupMock()
-                       
-                       when(mex.getVariable("isDebugLogEnabled")).thenReturn("true")
-                       when(mex.getVariable("allottedResourceType")).thenReturn("BRGt")
-                       when(mex.getVariable("allottedResourceRole")).thenReturn("BRGr")
-                       when(mex.getVariable("CSI_service")).thenReturn(arData)
-                       when(mex.getVariable("URN_aai_endpoint")).thenReturn(aaiUriPfx)
-                       when(mex.getVariable("aaiAROrchStatus")).thenReturn("Active")
-                       
-                       DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-                       DoCreateAllottedResourceBRG.getAaiAR(mex)
-                       
-                       verify(mex).setVariable("foundActiveAR", true)
-               }
-               
-               @Test
-//             @Ignore
-               public void getAaiAR_Duplicate() {
-                       def arData = FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRG/getAR.xml")
-                       def arBrg = FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRG/getArBrg.xml")
-                       
-                       wireMockRule
-                               .stubFor(get(urlMatching("/aai/v[0-9]+/mylink"))
-                                               .willReturn(aResponse()
-                                                       .withStatus(200)
-                                                       .withHeader("Content-Type", "text/xml")
-                                                       .withBodyFile("VCPE/DoCreateAllottedResourceBRG/getArBrg.xml")))
-                       
-                       ExecutionEntity mex = setupMock()
-                       
-                       when(mex.getVariable("isDebugLogEnabled")).thenReturn("true")
-                       when(mex.getVariable("allottedResourceType")).thenReturn("BRGt")
-                       when(mex.getVariable("allottedResourceRole")).thenReturn("BRGr")
-                       when(mex.getVariable("CSI_service")).thenReturn(arData)
-                       when(mex.getVariable("URN_aai_endpoint")).thenReturn(aaiUriPfx)
-                       when(mex.getVariable("aaiAROrchStatus")).thenReturn("Active")
-                       
-                       // fail if duplicate
-                       when(mex.getVariable("failExists")).thenReturn("true")
-                       
-                       DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-                       
-                       assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceBRG.getAaiAR(mex) }))
-               }
-               
-               @Test
-//             @Ignore
-               public void getAaiAR_NotActive() {
-                       def arData = FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRG/getAR.xml")
-                       def arBrg = FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRG/getArBrg.xml")
-                       
-                       wireMockRule
-                               .stubFor(get(urlMatching("/aai/v[0-9]+/mylink"))
-                                               .willReturn(aResponse()
-                                                       .withStatus(200)
-                                                       .withHeader("Content-Type", "text/xml")
-                                                       .withBodyFile("VCPE/DoCreateAllottedResourceBRG/getArBrg.xml")))
-                       
-                       ExecutionEntity mex = setupMock()
-                       
-                       when(mex.getVariable("isDebugLogEnabled")).thenReturn("true")
-                       when(mex.getVariable("allottedResourceType")).thenReturn("BRGt")
-                       when(mex.getVariable("allottedResourceRole")).thenReturn("BRGr")
-                       when(mex.getVariable("CSI_service")).thenReturn(arData)
-                       when(mex.getVariable("URN_aai_endpoint")).thenReturn(aaiUriPfx)
-                       
-                       // not active
-                       when(mex.getVariable("aaiAROrchStatus")).thenReturn("not-active")
-                       
-                       DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-                       
-                       assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceBRG.getAaiAR(mex) }))
-               }
-               
-               @Test
-//             @Ignore
-               public void getAaiAR_NoStatus() {
-                       def arData = FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRG/getAR.xml")
-                       def arBrg = FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRG/getArBrg.xml")
-                       
-                       wireMockRule
-                               .stubFor(get(urlMatching("/aai/v[0-9]+/mylink"))
-                                               .willReturn(aResponse()
-                                                       .withStatus(200)
-                                                       .withHeader("Content-Type", "text/xml")
-                                                       .withBodyFile("VCPE/DoCreateAllottedResourceBRG/getArBrg.xml")))
-                       
-                       ExecutionEntity mex = setupMock()
-                       
-                       when(mex.getVariable("isDebugLogEnabled")).thenReturn("true")
-                       when(mex.getVariable("allottedResourceType")).thenReturn("BRGt")
-                       when(mex.getVariable("allottedResourceRole")).thenReturn("BRGr")
-                       when(mex.getVariable("CSI_service")).thenReturn(arData)
-                       when(mex.getVariable("URN_aai_endpoint")).thenReturn(aaiUriPfx)
-                       
-                       when(mex.getVariable("aaiAROrchStatus")).thenReturn(null)
-                       
-                       DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-                       DoCreateAllottedResourceBRG.getAaiAR(mex)
-                       
-                       verify(mex, never()).setVariable("foundActiveAR", true)
-               }
+               verify(mex).getVariable(DBGFLAG)\r
+               verify(mex).setVariable("prefix", Prefix)\r
+                               
+               assertTrue(checkMissingPreProcessRequest("URN_mso_workflow_sdncadapter_callback"))
+               assertTrue(checkMissingPreProcessRequest("serviceInstanceId"))
+               assertTrue(checkMissingPreProcessRequest("parentServiceInstanceId"))
+               assertTrue(checkMissingPreProcessRequest("allottedResourceModelInfo"))
+               assertTrue(checkMissingPreProcessRequest("vni"))
+               assertTrue(checkMissingPreProcessRequest("vgmuxBearerIP"))
+               assertTrue(checkMissingPreProcessRequest("brgWanMacAddress"))
+               assertTrue(checkMissingPreProcessRequest("allottedResourceRole"))
+               assertTrue(checkMissingPreProcessRequest("allottedResourceType"))\r
+       }
+       
+       
+       // ***** getAaiAR *****
+       
+       @Test
+//     @Ignore
+       public void getAaiAR() {
+               MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRG/getArBrg.xml")
                
+               ExecutionEntity mex = setupMock()
+               initGetAaiAR(mex)
+                               
+               DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+               DoCreateAllottedResourceBRG.getAaiAR(mex)
                
-               // ***** createAaiAR *****
+               verify(mex).setVariable("foundActiveAR", true)
+       }
+       
+       @Test
+//     @Ignore
+       public void getAaiAR_Duplicate() {
+               MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRG/getArBrg.xml")
                
-               @Test
-//             @Ignore
-               public void createAaiAR() {
-                       ExecutionEntity mex = setupMock()
-                       initCreateAaiAr(mex)
-                       
-                       wireMockRule
-                               .stubFor(put(urlMatching("/aai/v[0-9]+/mypsi/allotted-resources/allotted-resource/myid"))
-                                               .willReturn(aResponse()
-                                                       .withStatus(200)))
-                       
-                       DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-                       DoCreateAllottedResourceBRG.createAaiAR(mex)
-                       
-                       ArgumentCaptor<String> keycap = ArgumentCaptor.forClass(String.class)
-                       ArgumentCaptor<Object> valcap = ArgumentCaptor.forClass(Object.class)
-                       
-                       verify(mex, times(3)).setVariable(keycap.capture(), valcap.capture())
-                       
-                       assertFalse(keycap.getAllValues().isEmpty())
-                       assertEquals("rollbackData", keycap.getAllValues().get(keycap.getAllValues().size()-1))
-                       
-                       def data = valcap.getAllValues().get(valcap.getAllValues().size()-1)
-                       assertNotNull(data)
-                       assertTrue(data instanceof RollbackData)
-                       
-                       assertEquals("45", data.get(Prefix, "disableRollback"))
-                       assertEquals("true", data.get(Prefix, "rollbackAAI"))
-                       assertEquals("myid", data.get(Prefix, "allottedResourceId"))
-                       assertEquals("sii", data.get(Prefix, "serviceInstanceId"))
-                       assertEquals("psii", data.get(Prefix, "parentServiceInstanceId"))
-                       assertEquals(aaiUriPfx+"/aai/v9/mypsi/allotted-resources/allotted-resource/myid", data.get(Prefix, "aaiARPath"))
-               }
-               
-               @Test
-//             @Ignore
-               public void createAaiAR_NoArid_NoModelUuids() {
-                       ExecutionEntity mex = setupMock()
-                       initCreateAaiAr(mex)
-                               
-                       // no allottedResourceId - will be generated
-                       
-                       when(mex.getVariable("allottedResourceId")).thenReturn(null)
-                       
-                       wireMockRule
-                               .stubFor(put(urlMatching("/aai/v[0-9]+/mypsi/allotted-resources/allotted-resource/.*"))
-                                               .willReturn(aResponse()
-                                                       .withStatus(200)))
-                       
-                       DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-                       DoCreateAllottedResourceBRG.createAaiAR(mex)
-                       
-                       ArgumentCaptor<String> keycap = ArgumentCaptor.forClass(String.class)
-                       ArgumentCaptor<Object> valcap = ArgumentCaptor.forClass(Object.class)
-                       
-                       verify(mex, times(4)).setVariable(keycap.capture(), valcap.capture())
-                       
-                       assertFalse(keycap.getAllValues().isEmpty())
-                       assertEquals("allottedResourceId", keycap.getAllValues().get(0))
-                       assertEquals("rollbackData", keycap.getAllValues().get(keycap.getAllValues().size()-1))
-                       
-                       def arid = valcap.getAllValues().get(0)
-                       assertNotNull(arid)
-                       assertFalse(arid.isEmpty())
-                       
-                       def data = valcap.getAllValues().get(valcap.getAllValues().size()-1)
-                       assertNotNull(data)
-                       assertTrue(data instanceof RollbackData)
-                       
-                       assertEquals(arid, data.get(Prefix, "allottedResourceId"))
-               }
-               
-               @Test
-//             @Ignore
-               public void createAaiAR_MissingPsiLink() {
-                       ExecutionEntity mex = setupMock()
-                       initCreateAaiAr(mex)
-                       
-                       when(mex.getVariable("PSI_resourceLink")).thenReturn(null)
-                       
-                       wireMockRule
-                               .stubFor(put(urlMatching("/aai/v[0-9]+/mypsi/allotted-resources/allotted-resource/myid"))
-                                               .willReturn(aResponse()
-                                                       .withStatus(200)))
-                       
-                       DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-                       
-                       assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.createAaiAR(mex) }))
-               }
-               
-               @Test
-//             @Ignore
-               public void createAaiAR_HttpFailed() {
-                       ExecutionEntity mex = setupMock()
-                       initCreateAaiAr(mex)
-                       
-                       // return 500 status
-                       wireMockRule
-                               .stubFor(put(urlMatching("/aai/v[0-9]+/mypsi/allotted-resources/allotted-resource/myid"))
-                                               .willReturn(aResponse()
-                                                       .withStatus(500)))
-                       
-                       DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-                       
-                       assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.createAaiAR(mex) }))
-               }
-               
-               @Test
-//             @Ignore
-               public void createAaiAR_BpmnError() {
-                       ExecutionEntity mex = setupMock()
-                       initCreateAaiAr(mex)
-                       
-                       when(mex.getVariable("URN_aai_endpoint")).thenThrow(new BpmnError("expected exception"))
-                       
-                       wireMockRule
-                               .stubFor(put(urlMatching("/aai/v[0-9]+/mypsi/allotted-resources/allotted-resource/myid"))
-                                               .willReturn(aResponse()
-                                                       .withStatus(200)))
-                       
-                       DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-                       
-                       assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.createAaiAR(mex) }))
-               }
-               
-               @Test
-//             @Ignore
-               public void createAaiAR_Ex() {
-                       ExecutionEntity mex = setupMock()
-                       initCreateAaiAr(mex)
-                       
-                       when(mex.getVariable("URN_aai_endpoint")).thenThrow(new RuntimeException("expected exception"))
-                       
-                       wireMockRule
-                               .stubFor(put(urlMatching("/aai/v[0-9]+/mypsi/allotted-resources/allotted-resource/myid"))
-                                               .willReturn(aResponse()
-                                                       .withStatus(200)))
-                       
-                       DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-                       
-                       assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.createAaiAR(mex) }))
-               }
+               ExecutionEntity mex = setupMock()
+               initGetAaiAR(mex)
                
+               // fail if duplicate
+               when(mex.getVariable("failExists")).thenReturn("true")
                
-               // ***** buildSDNCRequest *****
+               DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
                
-               @Test
-//             @Ignore
-               public void buildSDNCRequest() {
-                       ExecutionEntity mex = setupMock()
-                       initBuildSDNCRequest(mex)
-                       
-                       DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-                       
-                       String result = DoCreateAllottedResourceBRG.buildSDNCRequest(mex, "myact", "myreq")
-                       
-                       assertTrue(result.indexOf("<sdncadapter:RequestId>myreq</") >= 0)
-                       assertTrue(result.indexOf("<sdncadapter:SvcAction>myact</") >= 0)
-                       assertTrue(result.indexOf("<allotted-resource-id>ari</") >= 0)
-                       assertTrue(result.indexOf("<sdncadapter:SvcInstanceId>sii</") >= 0)
-                       assertTrue(result.indexOf("<service-instance-id>psii</") >= 0)
-                       assertTrue(result.indexOf("<parent-service-instance-id>psii</") >= 0)
-                       assertTrue(result.indexOf("<sdncadapter:CallbackUrl>scu</") >= 0)
-                       assertTrue(result.indexOf("<request-id>mri</") >= 0)
-                       assertTrue(result.indexOf("<brg-wan-mac-address>bwma</") >= 0)
-                       assertTrue(result.indexOf("<vni>myvni</") >= 0)
-                       assertTrue(result.indexOf("<vgmux-bearer-ip>vbi</") >= 0)
-                       assertTrue(result.indexOf("<model-invariant-uuid>miu</") >= 0)
-                       assertTrue(result.indexOf("<model-uuid>mu</") >= 0)
-                       assertTrue(result.indexOf("<model-customization-uuid>mcu</") >= 0)
-                       assertTrue(result.indexOf("<model-version>mv</") >= 0)
-                       assertTrue(result.indexOf("<model-name>mn</") >= 0)
-               }
-               
-               @Test
-//             @Ignore
-               public void buildSDNCRequest_EmptyModelInfo() {
-                       ExecutionEntity mex = setupMock()
-                       initBuildSDNCRequest(mex)
-                       
-                       when(mex.getVariable("allottedResourceModelInfo")).thenReturn("{}")
-                       
-                       DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-                       
-                       String result = DoCreateAllottedResourceBRG.buildSDNCRequest(mex, "myact", "myreq")
-                       
-                       assertTrue(result.indexOf("<sdncadapter:RequestId>myreq</") >= 0)
-                       assertTrue(result.indexOf("<sdncadapter:SvcAction>myact</") >= 0)
-                       assertTrue(result.indexOf("<allotted-resource-id>ari</") >= 0)
-                       assertTrue(result.indexOf("<sdncadapter:SvcInstanceId>sii</") >= 0)
-                       assertTrue(result.indexOf("<service-instance-id>psii</") >= 0)
-                       assertTrue(result.indexOf("<parent-service-instance-id>psii</") >= 0)
-                       assertTrue(result.indexOf("<sdncadapter:CallbackUrl>scu</") >= 0)
-                       assertTrue(result.indexOf("<request-id>mri</") >= 0)
-                       assertTrue(result.indexOf("<brg-wan-mac-address>bwma</") >= 0)
-                       assertTrue(result.indexOf("<vni>myvni</") >= 0)
-                       assertTrue(result.indexOf("<vgmux-bearer-ip>vbi</") >= 0)
-                       assertTrue(result.indexOf("<model-invariant-uuid/>") >= 0)
-                       assertTrue(result.indexOf("<model-uuid/>") >= 0)
-                       assertTrue(result.indexOf("<model-customization-uuid/>") >= 0)
-                       assertTrue(result.indexOf("<model-version/>") >= 0)
-                       assertTrue(result.indexOf("<model-name/>") >= 0)
-               }
-               
-               @Test
-//             @Ignore
-               public void buildSDNCRequest_Ex() {
-                       ExecutionEntity mex = setupMock()
-                       initBuildSDNCRequest(mex)
-                       
-                       when(mex.getVariable("allottedResourceId")).thenThrow(new RuntimeException("expected exception"))
-                       
-                       DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-                       
-                       assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.buildSDNCRequest(mex, "myact", "myreq") }))
-               }
+               assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceBRG.getAaiAR(mex) }))
+       }
+       
+       @Test
+//     @Ignore
+       public void getAaiAR_NotActive() {
+               MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRG/getArBrg.xml")
                
+               ExecutionEntity mex = setupMock()
+               initGetAaiAR(mex)
                
-               // ***** preProcessSDNCAssign *****
+               // not active
+               when(mex.getVariable("aaiAROrchStatus")).thenReturn("not-active")
                
-               @Test
-//             @Ignore
-               public void preProcessSDNCAssign() {
-                       ExecutionEntity mex = setupMock()
-                       def data = initPreProcessSDNC(mex)
-                                               
-                       DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-                       DoCreateAllottedResourceBRG.preProcessSDNCAssign(mex)
-                       
-                       ArgumentCaptor<String> keycap = ArgumentCaptor.forClass(String.class)
-                       ArgumentCaptor<Object> valcap = ArgumentCaptor.forClass(Object.class)
-                       
-                       verify(mex, times(2)).setVariable(keycap.capture(), valcap.capture())
-                       
-                       assertFalse(keycap.getAllValues().isEmpty())
-                       assertEquals("sdncAssignRequest", keycap.getAllValues().get(0))
-                       assertEquals("rollbackData", keycap.getAllValues().get(keycap.getAllValues().size()-1))
-                       
-                       def req = valcap.getAllValues().get(0)
-                       assertNotNull(req)
-                       
-                       assertEquals(data, valcap.getAllValues().get(valcap.getAllValues().size()-1))
-                       
-                       def rbreq = data.get(Prefix, "sdncAssignRollbackReq")
-                       
-                       assertTrue(req.indexOf("<sdncadapter:SvcAction>assign</") >= 0)
-                       assertTrue(req.indexOf("<request-action>CreateBRGInstance</") >= 0)
-                       assertTrue(req.indexOf("<sdncadapter:RequestId>") >= 0)
-                       
-                       assertTrue(rbreq.indexOf("<sdncadapter:SvcAction>unassign</") >= 0)
-                       assertTrue(rbreq.indexOf("<request-action>DeleteBRGInstance</") >= 0)
-                       assertTrue(rbreq.indexOf("<sdncadapter:RequestId>") >= 0)
-               }
-               
-               @Test
-//             @Ignore
-               public void preProcessSDNCAssign_BpmnError() {
-                       ExecutionEntity mex = setupMock()
-                       initPreProcessSDNC(mex)
-                       
-                       when(mex.getVariable("rollbackData")).thenThrow(new BpmnError("expected exception"))
-                                               
-                       DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-                       
-                       assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.preProcessSDNCAssign(mex) }))
-               }
-               
-               @Test
-//             @Ignore
-               public void preProcessSDNCAssign_Ex() {
-                       ExecutionEntity mex = setupMock()
-                       initPreProcessSDNC(mex)
-                       
-                       when(mex.getVariable("rollbackData")).thenThrow(new RuntimeException("expected exception"))
-                                               
-                       DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-                       
-                       assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.preProcessSDNCAssign(mex) }))
-               }
+               DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
                
+               assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceBRG.getAaiAR(mex) }))
+       }
+       
+       @Test
+//     @Ignore
+       public void getAaiAR_NoStatus() {
+               MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRG/getArBrg.xml")
                
-               // ***** preProcessSDNCCreate *****
+               ExecutionEntity mex = setupMock()
+               initGetAaiAR(mex)
                
-               @Test
-//             @Ignore
-               public void preProcessSDNCCreate() {
-                       ExecutionEntity mex = setupMock()
-                       def data = initPreProcessSDNC(mex)
-                                               
-                       DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-                       DoCreateAllottedResourceBRG.preProcessSDNCCreate(mex)
-                       
-                       ArgumentCaptor<String> keycap = ArgumentCaptor.forClass(String.class)
-                       ArgumentCaptor<Object> valcap = ArgumentCaptor.forClass(Object.class)
-                       
-                       verify(mex, times(2)).setVariable(keycap.capture(), valcap.capture())
-                       
-                       assertFalse(keycap.getAllValues().isEmpty())
-                       assertEquals("sdncCreateRequest", keycap.getAllValues().get(0))
-                       assertEquals("rollbackData", keycap.getAllValues().get(keycap.getAllValues().size()-1))
-                       
-                       def req = valcap.getAllValues().get(0)
-                       assertNotNull(req)
-                       
-                       assertEquals(data, valcap.getAllValues().get(valcap.getAllValues().size()-1))
-                       
-                       def rbreq = data.get(Prefix, "sdncCreateRollbackReq")
-                       
-                       assertTrue(req.indexOf("<sdncadapter:SvcAction>create</") >= 0)
-                       assertTrue(req.indexOf("<request-action>CreateBRGInstance</") >= 0)
-                       assertTrue(req.indexOf("<sdncadapter:RequestId>") >= 0)
-                       
-                       assertTrue(rbreq.indexOf("<sdncadapter:SvcAction>delete</") >= 0)
-                       assertTrue(rbreq.indexOf("<request-action>DeleteBRGInstance</") >= 0)
-                       assertTrue(rbreq.indexOf("<sdncadapter:RequestId>") >= 0)
-                       
-               }
+               when(mex.getVariable("aaiAROrchStatus")).thenReturn(null)
                
-               @Test
-//             @Ignore
-               public void preProcessSDNCCreate_BpmnError() {
-                       ExecutionEntity mex = setupMock()
-                       initPreProcessSDNC(mex)
-                       
-                       when(mex.getVariable("rollbackData")).thenThrow(new BpmnError("expected exception"))
-                                               
-                       DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-                       
-                       assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.preProcessSDNCCreate(mex) }))
-               }
-               
-               @Test
-//             @Ignore
-               public void preProcessSDNCCreate_Ex() {
-                       ExecutionEntity mex = setupMock()
-                       initPreProcessSDNC(mex)
-                       
-                       when(mex.getVariable("rollbackData")).thenThrow(new RuntimeException("expected exception"))
-                                               
-                       DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+               DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+               DoCreateAllottedResourceBRG.getAaiAR(mex)
+               
+               verify(mex, never()).setVariable("foundActiveAR", true)
+       }
+       
+       
+       // ***** createAaiAR *****
+       
+       @Test
+//     @Ignore
+       public void createAaiAR() {
+               ExecutionEntity mex = setupMock()
+               def map = setupMap(mex)
+               initCreateAaiAr(mex)
+               
+               MockPutAllottedResource(CUST, SVC, INST, ARID)
+               
+               DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+               DoCreateAllottedResourceBRG.createAaiAR(mex)
+               
+               def data = map.get("rollbackData")
+               assertNotNull(data)
+               assertTrue(data instanceof RollbackData)
+               
+               assertEquals("45", data.get(Prefix, "disableRollback"))
+               assertEquals("true", data.get(Prefix, "rollbackAAI"))
+               assertEquals(ARID, data.get(Prefix, "allottedResourceId"))
+               assertEquals("sii", data.get(Prefix, "serviceInstanceId"))
+               assertEquals("psii", data.get(Prefix, "parentServiceInstanceId"))
+               assertEquals(mex.getVariable("PSI_resourceLink")+"/allotted-resources/allotted-resource/"+ARID, data.get(Prefix, "aaiARPath"))
+       }
+       
+       @Test
+//     @Ignore
+       public void createAaiAR_NoArid_NoModelUuids() {
+               ExecutionEntity mex = setupMock()
+               def map = setupMap(mex)
+               initCreateAaiAr(mex)
                        
-                       assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.preProcessSDNCCreate(mex) }))
-               }
+               // no allottedResourceId - will be generated
                
+               when(mex.getVariable("allottedResourceId")).thenReturn(null)
                
-               // ***** preProcessSDNCActivate *****
+               wireMockRule
+                       .stubFor(put(urlMatching("/aai/.*/allotted-resource/.*"))
+                                       .willReturn(aResponse()
+                                               .withStatus(200)))
                
-               @Test
-//             @Ignore
-               public void preProcessSDNCActivate() {
-                       ExecutionEntity mex = setupMock()
-                       def data = initPreProcessSDNC(mex)
-                                               
-                       DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-                       DoCreateAllottedResourceBRG.preProcessSDNCActivate(mex)
-                       
-                       ArgumentCaptor<String> keycap = ArgumentCaptor.forClass(String.class)
-                       ArgumentCaptor<Object> valcap = ArgumentCaptor.forClass(Object.class)
-                       
-                       verify(mex, times(2)).setVariable(keycap.capture(), valcap.capture())
-                       
-                       assertFalse(keycap.getAllValues().isEmpty())
-                       assertEquals("sdncActivateRequest", keycap.getAllValues().get(0))
-                       assertEquals("rollbackData", keycap.getAllValues().get(keycap.getAllValues().size()-1))
-                       
-                       def req = valcap.getAllValues().get(0)
-                       assertNotNull(req)
-                       
-                       assertEquals(data, valcap.getAllValues().get(valcap.getAllValues().size()-1))
-                       
-                       def rbreq = data.get(Prefix, "sdncActivateRollbackReq")
-                       
-                       assertTrue(req.indexOf("<sdncadapter:SvcAction>activate</") >= 0)
-                       assertTrue(req.indexOf("<request-action>CreateBRGInstance</") >= 0)
-                       assertTrue(req.indexOf("<sdncadapter:RequestId>") >= 0)
-                       
-                       assertTrue(rbreq.indexOf("<sdncadapter:SvcAction>deactivate</") >= 0)
-                       assertTrue(rbreq.indexOf("<request-action>DeleteBRGInstance</") >= 0)
-                       assertTrue(rbreq.indexOf("<sdncadapter:RequestId>") >= 0)
-                       
-               }
+               DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+               DoCreateAllottedResourceBRG.createAaiAR(mex)
                
-               @Test
-//             @Ignore
-               public void preProcessSDNCActivate_BpmnError() {
-                       ExecutionEntity mex = setupMock()
-                       initPreProcessSDNC(mex)
-                       
-                       when(mex.getVariable("rollbackData")).thenThrow(new BpmnError("expected exception"))
-                                               
-                       DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-                       
-                       assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.preProcessSDNCActivate(mex) }))
-               }
-               
-               @Test
-//             @Ignore
-               public void preProcessSDNCActivate_Ex() {
-                       ExecutionEntity mex = setupMock()
-                       initPreProcessSDNC(mex)
-                       
-                       when(mex.getVariable("rollbackData")).thenThrow(new RuntimeException("expected exception"))
-                                               
-                       DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-                       
-                       assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.preProcessSDNCActivate(mex) }))
-               }
+               def arid = map.get("allottedResourceId")
+               assertNotNull(arid)
+               assertFalse(arid.isEmpty())
                
+               def data = map.get("rollbackData")
+               assertNotNull(data)
+               assertTrue(data instanceof RollbackData)
                
-               // ***** validateSDNCResp *****
+               assertEquals(arid, data.get(Prefix, "allottedResourceId"))
+       }
+       
+       @Test
+//     @Ignore
+       public void createAaiAR_MissingPsiLink() {
+               ExecutionEntity mex = setupMock()
+               initCreateAaiAr(mex)
                
-               @Test
-//             @Ignore
-               public void validateSDNCResp() {
-                       ExecutionEntity mex = setupMock()
-                       def data = initValidateSDNCResp(mex)
-                       def resp = initValidateSDNCResp_Resp()
-                       
-                       when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(true)
-                       
-                       DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-                       
-                       DoCreateAllottedResourceBRG.validateSDNCResp(mex, resp, "create")
-                       
-                       verify(mex).getVariable("WorkflowException")
-                       verify(mex).getVariable("SDNCA_SuccessIndicator")
-                       verify(mex).getVariable("rollbackData")
-                       
-                       ArgumentCaptor<String> keycap = ArgumentCaptor.forClass(String.class)
-                       ArgumentCaptor<Object> valcap = ArgumentCaptor.forClass(Object.class)
-                       
-                       verify(mex, times(4)).setVariable(keycap.capture(), valcap.capture())
-                       
-                       assertFalse(keycap.getAllValues().isEmpty())
-                       assertEquals("rollbackData", keycap.getAllValues().get(keycap.getAllValues().size()-1))
-                       
-                       assertEquals(data, valcap.getAllValues().get(valcap.getAllValues().size()-1))
-                       
-                       assertEquals("true", data.get(Prefix, "rollback" +  "SDNCcreate"))
-                       
-               }
-               
-               @Test
-//             @Ignore
-               public void validateSDNCResp_Get() {
-                       ExecutionEntity mex = setupMock()
-                       def data = initValidateSDNCResp(mex)
-                       def resp = initValidateSDNCResp_Resp()
-                       
-                       when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(true)
-                       
-                       DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-                       
-                       DoCreateAllottedResourceBRG.validateSDNCResp(mex, resp, "get")
-                       
-                       verify(mex).getVariable("WorkflowException")
-                       verify(mex).getVariable("SDNCA_SuccessIndicator")
-                       
-                       verify(mex, never()).getVariable("rollbackData")
-               }
-               
-               @Test
-//             @Ignore
-               public void validateSDNCResp_Unsuccessful() {
-                       ExecutionEntity mex = setupMock()
-                       initValidateSDNCResp(mex)
-                       def resp = initValidateSDNCResp_Resp()
-                       
-                       // unsuccessful
-                       when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(false)
-                       
-                       DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-                       
-                       assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.validateSDNCResp(mex, resp, "create") }))
-               }
-               
-               @Test
-//             @Ignore
-               public void validateSDNCResp_BpmnError() {
-                       ExecutionEntity mex = setupMock()
-                       initValidateSDNCResp(mex)
-                       def resp = initValidateSDNCResp_Resp()
-                       
-                       when(mex.getVariable("WorkflowException")).thenThrow(new BpmnError("expected exception"))
-                       
-                       DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-                       
-                       assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.validateSDNCResp(mex, resp, "create") }))
-               }
-               
-               @Test
-//             @Ignore
-               public void validateSDNCResp_Ex() {
-                       ExecutionEntity mex = setupMock()
-                       initValidateSDNCResp(mex)
-                       def resp = initValidateSDNCResp_Resp()
-                       
-                       when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception"))
-                       
-                       DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-                       
-                       assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.validateSDNCResp(mex, resp, "create") }))
-               }
+               when(mex.getVariable("PSI_resourceLink")).thenReturn(null)
                
+               MockPutAllottedResource(CUST, SVC, INST, ARID)
                
-               // ***** preProcessSDNCGet *****
+               DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
                
-               @Test
-//             @Ignore
-               public void preProcessSDNCGet_FoundAR() {
-                       ExecutionEntity mex = setupMock()
-                       initPreProcessSDNCGet(mex)
-                                               
-                       DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-                       DoCreateAllottedResourceBRG.preProcessSDNCGet(mex)
-                       
-                       ArgumentCaptor<String> keycap = ArgumentCaptor.forClass(String.class)
-                       ArgumentCaptor<Object> valcap = ArgumentCaptor.forClass(Object.class)
-                       
-                       verify(mex, times(1)).setVariable(keycap.capture(), valcap.capture())
-                       
-                       assertFalse(keycap.getAllValues().isEmpty())
-                       assertEquals("sdncGetRequest", keycap.getAllValues().get(keycap.getAllValues().size()-1))
-                       
-                       String req = valcap.getAllValues().get(valcap.getAllValues().size()-1)
-                       
-                       assertTrue(req.indexOf("<sdncadapter:RequestId>") >= 0)
-                       assertTrue(req.indexOf("<sdncadapter:SvcInstanceId>sii</") >= 0)
-                       assertTrue(req.indexOf("<sdncadapter:SvcOperation>arlink</") >= 0)
-                       assertTrue(req.indexOf("<sdncadapter:CallbackUrl>myurl</") >= 0)
-                       
-               }
+               assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.createAaiAR(mex) }))
+       }
+       
+       @Test
+//     @Ignore
+       public void createAaiAR_HttpFailed() {
+               ExecutionEntity mex = setupMock()
+               initCreateAaiAr(mex)
                
-               @Test
-//             @Ignore
-               public void preProcessSDNCGet_NotFoundAR() {
-                       ExecutionEntity mex = setupMock()
-                       initPreProcessSDNCGet(mex)
-                       
-                       when(mex.getVariable("foundActiveAR")).thenReturn(false)
-                                               
-                       DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-                       DoCreateAllottedResourceBRG.preProcessSDNCGet(mex)
-                       
-                       ArgumentCaptor<String> keycap = ArgumentCaptor.forClass(String.class)
-                       ArgumentCaptor<Object> valcap = ArgumentCaptor.forClass(Object.class)
-                       
-                       verify(mex, times(1)).setVariable(keycap.capture(), valcap.capture())
-                       
-                       assertFalse(keycap.getAllValues().isEmpty())
-                       assertEquals("sdncGetRequest", keycap.getAllValues().get(keycap.getAllValues().size()-1))
-                       
-                       String req = valcap.getAllValues().get(valcap.getAllValues().size()-1)
-                       
-                       assertTrue(req.indexOf("<sdncadapter:RequestId>") >= 0)
-                       assertTrue(req.indexOf("<sdncadapter:SvcInstanceId>sii</") >= 0)
-                       assertTrue(req.indexOf("<sdncadapter:SvcOperation>assignlink</") >= 0)
-                       assertTrue(req.indexOf("<sdncadapter:CallbackUrl>myurl</") >= 0)
-                       
-               }
+               MockPutAllottedResource_500(CUST, SVC, INST, ARID)
                
-               @Test
-//             @Ignore
-               public void preProcessSDNCGet_Ex() {
-                       ExecutionEntity mex = setupMock()
-                       initPreProcessSDNCGet(mex)
-                       
-                       when(mex.getVariable("foundActiveAR")).thenThrow(new RuntimeException("expected exception"))
-                       
-                       DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-                       
-                       assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.preProcessSDNCGet(mex) }))
-               }
+               DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
                
+               assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.createAaiAR(mex) }))
+       }
+       
+       @Test
+//     @Ignore
+       public void createAaiAR_BpmnError() {
+               ExecutionEntity mex = setupMock()
+               initCreateAaiAr(mex)
                
-               // ***** updateAaiAROrchStatus *****
+               when(mex.getVariable("URN_aai_endpoint")).thenThrow(new BpmnError("expected exception"))
                
-               @Test
-//             @Ignore
-               public void updateAaiAROrchStatus() {
-                       ExecutionEntity mex = setupMock()
-                       initUpdateAaiAROrchStatus(mex)
-                                               
-                       DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-                       DoCreateAllottedResourceBRG.updateAaiAROrchStatus(mex, "success")
-               }
+               MockPutAllottedResource(CUST, SVC, INST, ARID)
                
+               DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
                
-               // ***** generateOutputs *****
+               assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.createAaiAR(mex) }))
+       }
+       
+       @Test
+//     @Ignore
+       public void createAaiAR_Ex() {
+               ExecutionEntity mex = setupMock()
+               initCreateAaiAr(mex)
                
-               @Test
-//             @Ignore
-               public void generateOutputs() {
-                       ExecutionEntity mex = setupMock()
-                       def brgtop = FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRG/SDNCTopologyQueryCallback.xml")
-                       
-                       when(mex.getVariable("isDebugLogEnabled")).thenReturn("true")
-                       when(mex.getVariable("enhancedCallbackRequestData")).thenReturn(brgtop)
-                       
-                       DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-                       DoCreateAllottedResourceBRG.generateOutputs(mex)
-                       
-                       verify(mex).setVariable("allotedResourceName", "namefromrequest")
-                       
-               }
+               when(mex.getVariable("URN_aai_endpoint")).thenThrow(new RuntimeException("expected exception"))
                
-               @Test
-//             @Ignore
-               public void generateOutputs_BadXml() {
-                       ExecutionEntity mex = setupMock()
-                       
-                       when(mex.getVariable("isDebugLogEnabled")).thenReturn("true")
-                       when(mex.getVariable("enhancedCallbackRequestData")).thenReturn("invalid xml")
-                       
-                       DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-                       DoCreateAllottedResourceBRG.generateOutputs(mex)
-                       
-                       verify(mex, never()).setVariable(anyString(), anyString())
-                       
-               }
+               MockPutAllottedResource(CUST, SVC, INST, ARID)
                
-               @Test
-//             @Ignore
-               public void generateOutputs_BpmnError() {
-                       ExecutionEntity mex = setupMock()
-                       
-                       when(mex.getVariable("isDebugLogEnabled")).thenReturn("true")
-                       when(mex.getVariable("enhancedCallbackRequestData")).thenThrow(new BpmnError("expected exception"))
-                       
-                       DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-                       
-                       DoCreateAllottedResourceBRG.generateOutputs(mex)
-                       verify(mex, never()).setVariable(anyString(), anyString())
-                       
-               }
+               DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
                
-               @Test
-//             @Ignore
-               public void generateOutputs_Ex() {
-                       ExecutionEntity mex = setupMock()
-                       
-                       when(mex.getVariable("isDebugLogEnabled")).thenReturn("true")
-                       when(mex.getVariable("enhancedCallbackRequestData")).thenThrow(new RuntimeException("expected exception"))
-                       
-                       DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-                       
-                       DoCreateAllottedResourceBRG.generateOutputs(mex)
-                       verify(mex, never()).setVariable(anyString(), anyString())
-                       
-               }
+               assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.createAaiAR(mex) }))
+       }
+       
+       
+       // ***** buildSDNCRequest *****
+       
+       @Test
+//     @Ignore
+       public void buildSDNCRequest() {
+               ExecutionEntity mex = setupMock()
+               initBuildSDNCRequest(mex)
+               
+               DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+               
+               String result = DoCreateAllottedResourceBRG.buildSDNCRequest(mex, "myact", "myreq")
+               
+               assertTrue(result.indexOf("<sdncadapter:RequestId>myreq</") >= 0)
+               assertTrue(result.indexOf("<sdncadapter:SvcAction>myact</") >= 0)
+               assertTrue(result.indexOf("<allotted-resource-id>ari</") >= 0)
+               assertTrue(result.indexOf("<sdncadapter:SvcInstanceId>sii</") >= 0)
+               assertTrue(result.indexOf("<service-instance-id>psii</") >= 0)
+               assertTrue(result.indexOf("<parent-service-instance-id>psii</") >= 0)
+               assertTrue(result.indexOf("<sdncadapter:CallbackUrl>scu</") >= 0)
+               assertTrue(result.indexOf("<request-id>mri</") >= 0)
+               assertTrue(result.indexOf("<brg-wan-mac-address>bwma</") >= 0)
+               assertTrue(result.indexOf("<vni>myvni</") >= 0)
+               assertTrue(result.indexOf("<vgmux-bearer-ip>vbi</") >= 0)
+               assertTrue(result.indexOf("<model-invariant-uuid>miu</") >= 0)
+               assertTrue(result.indexOf("<model-uuid>mu</") >= 0)
+               assertTrue(result.indexOf("<model-customization-uuid>mcu</") >= 0)
+               assertTrue(result.indexOf("<model-version>mv</") >= 0)
+               assertTrue(result.indexOf("<model-name>mn</") >= 0)
+       }
+       
+       @Test
+//     @Ignore
+       public void buildSDNCRequest_EmptyModelInfo() {
+               ExecutionEntity mex = setupMock()
+               initBuildSDNCRequest(mex)
+               
+               when(mex.getVariable("allottedResourceModelInfo")).thenReturn("{}")
+               
+               DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+               
+               String result = DoCreateAllottedResourceBRG.buildSDNCRequest(mex, "myact", "myreq")
+               
+               assertTrue(result.indexOf("<sdncadapter:RequestId>myreq</") >= 0)
+               assertTrue(result.indexOf("<sdncadapter:SvcAction>myact</") >= 0)
+               assertTrue(result.indexOf("<allotted-resource-id>ari</") >= 0)
+               assertTrue(result.indexOf("<sdncadapter:SvcInstanceId>sii</") >= 0)
+               assertTrue(result.indexOf("<service-instance-id>psii</") >= 0)
+               assertTrue(result.indexOf("<parent-service-instance-id>psii</") >= 0)
+               assertTrue(result.indexOf("<sdncadapter:CallbackUrl>scu</") >= 0)
+               assertTrue(result.indexOf("<request-id>mri</") >= 0)
+               assertTrue(result.indexOf("<brg-wan-mac-address>bwma</") >= 0)
+               assertTrue(result.indexOf("<vni>myvni</") >= 0)
+               assertTrue(result.indexOf("<vgmux-bearer-ip>vbi</") >= 0)
+               assertTrue(result.indexOf("<model-invariant-uuid/>") >= 0)
+               assertTrue(result.indexOf("<model-uuid/>") >= 0)
+               assertTrue(result.indexOf("<model-customization-uuid/>") >= 0)
+               assertTrue(result.indexOf("<model-version/>") >= 0)
+               assertTrue(result.indexOf("<model-name/>") >= 0)
+       }
+       
+       @Test
+//     @Ignore
+       public void buildSDNCRequest_Ex() {
+               ExecutionEntity mex = setupMock()
+               initBuildSDNCRequest(mex)
                
+               when(mex.getVariable("allottedResourceId")).thenThrow(new RuntimeException("expected exception"))
                
-               // ***** preProcessRollback *****
+               DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
                
-               @Test
-//             @Ignore
-               public void preProcessRollback() {
-                       ExecutionEntity mex = setupMock()
-                       WorkflowException wfe = mock(WorkflowException.class)
-                       
-                       when(mex.getVariable("isDebugLogEnabled")).thenReturn("true")
-                       when(mex.getVariable("WorkflowException")).thenReturn(wfe)
-                       
-                       DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-                       DoCreateAllottedResourceBRG.preProcessRollback(mex)
-                       
-                       verify(mex).setVariable("prevWorkflowException", wfe)
-                       
-               }
+               assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.buildSDNCRequest(mex, "myact", "myreq") }))
+       }
+       
+       
+       // ***** preProcessSDNCAssign *****
+       
+       @Test
+//     @Ignore
+       public void preProcessSDNCAssign() {
+               ExecutionEntity mex = setupMock()
+               def map = setupMap(mex)
+               def data = initPreProcessSDNC(mex)
+                                       
+               DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+               DoCreateAllottedResourceBRG.preProcessSDNCAssign(mex)
+               
+               def req = map.get("sdncAssignRequest")
+               assertNotNull(req)
+               
+               assertEquals(data, map.get("rollbackData"))
+               
+               def rbreq = data.get(Prefix, "sdncAssignRollbackReq")
+               
+               assertTrue(req.indexOf("<sdncadapter:SvcAction>assign</") >= 0)
+               assertTrue(req.indexOf("<request-action>CreateBRGInstance</") >= 0)
+               assertTrue(req.indexOf("<sdncadapter:RequestId>") >= 0)
+               
+               assertTrue(rbreq.indexOf("<sdncadapter:SvcAction>unassign</") >= 0)
+               assertTrue(rbreq.indexOf("<request-action>DeleteBRGInstance</") >= 0)
+               assertTrue(rbreq.indexOf("<sdncadapter:RequestId>") >= 0)
+       }
+       
+       @Test
+//     @Ignore
+       public void preProcessSDNCAssign_BpmnError() {
+               ExecutionEntity mex = setupMock()
+               initPreProcessSDNC(mex)
+               
+               when(mex.getVariable("rollbackData")).thenThrow(new BpmnError("expected exception"))
+                                       
+               DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+               
+               assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.preProcessSDNCAssign(mex) }))
+       }
+       
+       @Test
+//     @Ignore
+       public void preProcessSDNCAssign_Ex() {
+               ExecutionEntity mex = setupMock()
+               initPreProcessSDNC(mex)
+               
+               when(mex.getVariable("rollbackData")).thenThrow(new RuntimeException("expected exception"))
+                                       
+               DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+               
+               assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.preProcessSDNCAssign(mex) }))
+       }
+       
+       
+       // ***** preProcessSDNCCreate *****
+       
+       @Test
+//     @Ignore
+       public void preProcessSDNCCreate() {
+               ExecutionEntity mex = setupMock()
+               def map = setupMap(mex)
+               def data = initPreProcessSDNC(mex)
+                                       
+               DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+               DoCreateAllottedResourceBRG.preProcessSDNCCreate(mex)
+               
+               def req = map.get("sdncCreateRequest")
+               assertNotNull(req)
+               
+               assertEquals(data, map.get("rollbackData"))
+               
+               def rbreq = data.get(Prefix, "sdncCreateRollbackReq")
+               
+               assertTrue(req.indexOf("<sdncadapter:SvcAction>create</") >= 0)
+               assertTrue(req.indexOf("<request-action>CreateBRGInstance</") >= 0)
+               assertTrue(req.indexOf("<sdncadapter:RequestId>") >= 0)
+               
+               assertTrue(rbreq.indexOf("<sdncadapter:SvcAction>delete</") >= 0)
+               assertTrue(rbreq.indexOf("<request-action>DeleteBRGInstance</") >= 0)
+               assertTrue(rbreq.indexOf("<sdncadapter:RequestId>") >= 0)
+               
+       }
+       
+       @Test
+//     @Ignore
+       public void preProcessSDNCCreate_BpmnError() {
+               ExecutionEntity mex = setupMock()
+               initPreProcessSDNC(mex)
+               
+               when(mex.getVariable("rollbackData")).thenThrow(new BpmnError("expected exception"))
+                                       
+               DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+               
+               assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.preProcessSDNCCreate(mex) }))
+       }
+       
+       @Test
+//     @Ignore
+       public void preProcessSDNCCreate_Ex() {
+               ExecutionEntity mex = setupMock()
+               initPreProcessSDNC(mex)
+               
+               when(mex.getVariable("rollbackData")).thenThrow(new RuntimeException("expected exception"))
+                                       
+               DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+               
+               assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.preProcessSDNCCreate(mex) }))
+       }
+       
+       
+       // ***** preProcessSDNCActivate *****
+       
+       @Test
+//     @Ignore
+       public void preProcessSDNCActivate() {
+               ExecutionEntity mex = setupMock()
+               def map = setupMap(mex)
+               def data = initPreProcessSDNC(mex)
+                                       
+               DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+               DoCreateAllottedResourceBRG.preProcessSDNCActivate(mex)
+               
+               def req = map.get("sdncActivateRequest")
+               assertNotNull(req)
+               
+               assertEquals(data, map.get("rollbackData"))
+               
+               def rbreq = data.get(Prefix, "sdncActivateRollbackReq")
+               
+               assertTrue(req.indexOf("<sdncadapter:SvcAction>activate</") >= 0)
+               assertTrue(req.indexOf("<request-action>CreateBRGInstance</") >= 0)
+               assertTrue(req.indexOf("<sdncadapter:RequestId>") >= 0)
+               
+               assertTrue(rbreq.indexOf("<sdncadapter:SvcAction>deactivate</") >= 0)
+               assertTrue(rbreq.indexOf("<request-action>DeleteBRGInstance</") >= 0)
+               assertTrue(rbreq.indexOf("<sdncadapter:RequestId>") >= 0)
+               
+       }
+       
+       @Test
+//     @Ignore
+       public void preProcessSDNCActivate_BpmnError() {
+               ExecutionEntity mex = setupMock()
+               initPreProcessSDNC(mex)
+               
+               when(mex.getVariable("rollbackData")).thenThrow(new BpmnError("expected exception"))
+                                       
+               DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+               
+               assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.preProcessSDNCActivate(mex) }))
+       }
+       
+       @Test
+//     @Ignore
+       public void preProcessSDNCActivate_Ex() {
+               ExecutionEntity mex = setupMock()
+               initPreProcessSDNC(mex)
+               
+               when(mex.getVariable("rollbackData")).thenThrow(new RuntimeException("expected exception"))
+                                       
+               DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+               
+               assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.preProcessSDNCActivate(mex) }))
+       }
+       
+       
+       // ***** validateSDNCResp *****
+       
+       @Test
+//     @Ignore
+       public void validateSDNCResp() {
+               ExecutionEntity mex = setupMock()
+               def map = setupMap(mex)
+               def data = initValidateSDNCResp(mex)
+               def resp = initValidateSDNCResp_Resp()
+               
+               when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(true)
+               
+               DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+               
+               DoCreateAllottedResourceBRG.validateSDNCResp(mex, resp, "create")
+               
+               verify(mex).getVariable("WorkflowException")
+               verify(mex).getVariable("SDNCA_SuccessIndicator")
+               verify(mex).getVariable("rollbackData")
+               
+               assertEquals(data, map.get("rollbackData"))
+               
+               assertEquals("true", data.get(Prefix, "rollback" +  "SDNCcreate"))
+               
+       }
+       
+       @Test
+//     @Ignore
+       public void validateSDNCResp_Get() {
+               ExecutionEntity mex = setupMock()
+               def data = initValidateSDNCResp(mex)
+               def resp = initValidateSDNCResp_Resp()
+               
+               when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(true)
+               
+               DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+               
+               DoCreateAllottedResourceBRG.validateSDNCResp(mex, resp, "get")
+               
+               verify(mex).getVariable("WorkflowException")
+               verify(mex).getVariable("SDNCA_SuccessIndicator")
+               
+               verify(mex, never()).getVariable("rollbackData")
+       }
+       
+       @Test
+//     @Ignore
+       public void validateSDNCResp_Unsuccessful() {
+               ExecutionEntity mex = setupMock()
+               initValidateSDNCResp(mex)
+               def resp = initValidateSDNCResp_Resp()
+               
+               // unsuccessful
+               when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(false)
+               
+               DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+               
+               assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.validateSDNCResp(mex, resp, "create") }))
+       }
+       
+       @Test
+//     @Ignore
+       public void validateSDNCResp_BpmnError() {
+               ExecutionEntity mex = setupMock()
+               initValidateSDNCResp(mex)
+               def resp = initValidateSDNCResp_Resp()
+               
+               when(mex.getVariable("WorkflowException")).thenThrow(new BpmnError("expected exception"))
+               
+               DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+               
+               assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.validateSDNCResp(mex, resp, "create") }))
+       }
+       
+       @Test
+//     @Ignore
+       public void validateSDNCResp_Ex() {
+               ExecutionEntity mex = setupMock()
+               initValidateSDNCResp(mex)
+               def resp = initValidateSDNCResp_Resp()
+               
+               when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception"))
+               
+               DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+               
+               assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.validateSDNCResp(mex, resp, "create") }))
+       }
+       
+       
+       // ***** preProcessSDNCGet *****
+       
+       @Test
+//     @Ignore
+       public void preProcessSDNCGet_FoundAR() {
+               ExecutionEntity mex = setupMock()
+               def map = setupMap(mex)
+               initPreProcessSDNCGet(mex)
+                                       
+               DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+               DoCreateAllottedResourceBRG.preProcessSDNCGet(mex)
+               
+               String req = map.get("sdncGetRequest")
+               
+               assertTrue(req.indexOf("<sdncadapter:RequestId>") >= 0)
+               assertTrue(req.indexOf("<sdncadapter:SvcInstanceId>sii</") >= 0)
+               assertTrue(req.indexOf("<sdncadapter:SvcOperation>arlink</") >= 0)
+               assertTrue(req.indexOf("<sdncadapter:CallbackUrl>myurl</") >= 0)
+               
+       }
+       
+       @Test
+//     @Ignore
+       public void preProcessSDNCGet_NotFoundAR() {
+               ExecutionEntity mex = setupMock()
+               def map = setupMap(mex)
+               initPreProcessSDNCGet(mex)
+               
+               when(mex.getVariable("foundActiveAR")).thenReturn(false)
+                                       
+               DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+               DoCreateAllottedResourceBRG.preProcessSDNCGet(mex)
+               
+               String req = map.get("sdncGetRequest")
+               
+               assertTrue(req.indexOf("<sdncadapter:RequestId>") >= 0)
+               assertTrue(req.indexOf("<sdncadapter:SvcInstanceId>sii</") >= 0)
+               assertTrue(req.indexOf("<sdncadapter:SvcOperation>assignlink</") >= 0)
+               assertTrue(req.indexOf("<sdncadapter:CallbackUrl>myurl</") >= 0)
+               
+       }
+       
+       @Test
+//     @Ignore
+       public void preProcessSDNCGet_Ex() {
+               ExecutionEntity mex = setupMock()
+               initPreProcessSDNCGet(mex)
+               
+               when(mex.getVariable("foundActiveAR")).thenThrow(new RuntimeException("expected exception"))
+               
+               DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+               
+               assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.preProcessSDNCGet(mex) }))
+       }
+       
+       
+       // ***** updateAaiAROrchStatus *****
+       
+       @Test
+//     @Ignore
+       public void updateAaiAROrchStatus() {
+               MockPatchAllottedResource(CUST, SVC, INST, ARID)
+               
+               ExecutionEntity mex = setupMock()
+               initUpdateAaiAROrchStatus(mex)
+                                       
+               DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+               DoCreateAllottedResourceBRG.updateAaiAROrchStatus(mex, "success")
+       }
+       
+       
+       // ***** generateOutputs *****
+       
+       @Test
+//     @Ignore
+       public void generateOutputs() {
+               ExecutionEntity mex = setupMock()
+               def brgtop = FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRG/SDNCTopologyQueryCallback.xml")
+               
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("enhancedCallbackRequestData")).thenReturn(brgtop)
+               
+               DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+               DoCreateAllottedResourceBRG.generateOutputs(mex)
+               
+               verify(mex).setVariable("allotedResourceName", "namefromrequest")
+               
+       }
+       
+       @Test
+//     @Ignore
+       public void generateOutputs_BadXml() {
+               ExecutionEntity mex = setupMock()
+               
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("enhancedCallbackRequestData")).thenReturn("invalid xml")
+               
+               DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+               DoCreateAllottedResourceBRG.generateOutputs(mex)
+               
+               verify(mex, never()).setVariable(anyString(), anyString())
+               
+       }
+       
+       @Test
+//     @Ignore
+       public void generateOutputs_BpmnError() {
+               ExecutionEntity mex = setupMock()
+               
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("enhancedCallbackRequestData")).thenThrow(new BpmnError("expected exception"))
+               
+               DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+               
+               DoCreateAllottedResourceBRG.generateOutputs(mex)
+               verify(mex, never()).setVariable(anyString(), anyString())
+               
+       }
+       
+       @Test
+//     @Ignore
+       public void generateOutputs_Ex() {
+               ExecutionEntity mex = setupMock()
+               
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("enhancedCallbackRequestData")).thenThrow(new RuntimeException("expected exception"))
+               
+               DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+               
+               DoCreateAllottedResourceBRG.generateOutputs(mex)
+               verify(mex, never()).setVariable(anyString(), anyString())
+               
+       }
+       
+       
+       // ***** preProcessRollback *****
+       
+       @Test
+//     @Ignore
+       public void preProcessRollback() {
+               ExecutionEntity mex = setupMock()
+               WorkflowException wfe = mock(WorkflowException.class)
+               
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("WorkflowException")).thenReturn(wfe)
+               
+               DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+               DoCreateAllottedResourceBRG.preProcessRollback(mex)
+               
+               verify(mex).setVariable("prevWorkflowException", wfe)
+               
+       }
+       
+       @Test
+//     @Ignore
+       public void preProcessRollback_NotWFE() {
+               ExecutionEntity mex = setupMock()
+               
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("WorkflowException")).thenReturn("I'm not a WFE")
+               
+               DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+               DoCreateAllottedResourceBRG.preProcessRollback(mex)
                
-               @Test
-//             @Ignore
-               public void preProcessRollback_NotWFE() {
-                       ExecutionEntity mex = setupMock()
-                       
-                       when(mex.getVariable("isDebugLogEnabled")).thenReturn("true")
-                       when(mex.getVariable("WorkflowException")).thenReturn("I'm not a WFE")
-                       
-                       DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-                       DoCreateAllottedResourceBRG.preProcessRollback(mex)
-                       
 //                     verify(mex, never()).setVariable("prevWorkflowException", any())
-                       
-               }
                
-               @Test
-//             @Ignore
-               public void preProcessRollback_BpmnError() {
-                       ExecutionEntity mex = setupMock()
-                       
-                       when(mex.getVariable("isDebugLogEnabled")).thenReturn("true")
-                       when(mex.getVariable("WorkflowException")).thenThrow(new BpmnError("expected exception"))
-                       
-                       DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-                       
-                       DoCreateAllottedResourceBRG.preProcessRollback(mex)
-                       
-               }
+       }
+       
+       @Test
+//     @Ignore
+       public void preProcessRollback_BpmnError() {
+               ExecutionEntity mex = setupMock()
                
-               @Test
-//             @Ignore
-               public void preProcessRollback_Ex() {
-                       ExecutionEntity mex = setupMock()
-                       
-                       when(mex.getVariable("isDebugLogEnabled")).thenReturn("true")
-                       when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception"))
-                       
-                       DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-                       
-                       DoCreateAllottedResourceBRG.preProcessRollback(mex)
-                       
-               }
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("WorkflowException")).thenThrow(new BpmnError("expected exception"))
                
+               DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
                
-               // ***** postProcessRollback *****
+               DoCreateAllottedResourceBRG.preProcessRollback(mex)
                
-               @Test
-//             @Ignore
-               public void postProcessRollback() {
-                       ExecutionEntity mex = setupMock()
-                       WorkflowException wfe = mock(WorkflowException.class)
-                       
-                       when(mex.getVariable("isDebugLogEnabled")).thenReturn("true")
-                       when(mex.getVariable("prevWorkflowException")).thenReturn(wfe)
-                       
-                       DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-                       DoCreateAllottedResourceBRG.postProcessRollback(mex)
-                       
-                       verify(mex).setVariable("WorkflowException", wfe)
-                       verify(mex).setVariable("rollbackData", null)
-                       
-               }
+       }
+       
+       @Test
+//     @Ignore
+       public void preProcessRollback_Ex() {
+               ExecutionEntity mex = setupMock()
+               
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception"))
+               
+               DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+               
+               DoCreateAllottedResourceBRG.preProcessRollback(mex)
+               
+       }
+       
+       
+       // ***** postProcessRollback *****
+       
+       @Test
+//     @Ignore
+       public void postProcessRollback() {
+               ExecutionEntity mex = setupMock()
+               WorkflowException wfe = mock(WorkflowException.class)
+               
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("prevWorkflowException")).thenReturn(wfe)
+               
+               DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+               DoCreateAllottedResourceBRG.postProcessRollback(mex)
+               
+               verify(mex).setVariable("WorkflowException", wfe)
+               verify(mex).setVariable("rollbackData", null)
+               
+       }
+       
+       @Test
+//     @Ignore
+       public void postProcessRollback_NotWFE() {
+               ExecutionEntity mex = setupMock()
+               
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("prevWorkflowException")).thenReturn("I'm not a WFE")
+               
+               DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+               DoCreateAllottedResourceBRG.postProcessRollback(mex)
                
-               @Test
-//             @Ignore
-               public void postProcessRollback_NotWFE() {
-                       ExecutionEntity mex = setupMock()
-                       
-                       when(mex.getVariable("isDebugLogEnabled")).thenReturn("true")
-                       when(mex.getVariable("prevWorkflowException")).thenReturn("I'm not a WFE")
-                       
-                       DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-                       DoCreateAllottedResourceBRG.postProcessRollback(mex)
-                       
 //                     verify(mex, never()).setVariable("WorkflowException", any())
-                       verify(mex).setVariable("rollbackData", null)
-                       
-               }
+               verify(mex).setVariable("rollbackData", null)
                
-               @Test
-//             @Ignore
-               public void postProcessRollback_BpmnError() {
-                       ExecutionEntity mex = setupMock()
-                       
-                       when(mex.getVariable("isDebugLogEnabled")).thenReturn("true")
-                       when(mex.getVariable("prevWorkflowException")).thenThrow(new BpmnError("expected exception"))
-                       
-                       DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-                       
-                       assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.postProcessRollback(mex) }))
-                       verify(mex, never()).setVariable("rollbackData", null)
-                       
-               }
+       }
+       
+       @Test
+//     @Ignore
+       public void postProcessRollback_BpmnError() {
+               ExecutionEntity mex = setupMock()
                
-               @Test
-//             @Ignore
-               public void postProcessRollback_Ex() {
-                       ExecutionEntity mex = setupMock()
-                       
-                       when(mex.getVariable("isDebugLogEnabled")).thenReturn("true")
-                       when(mex.getVariable("prevWorkflowException")).thenThrow(new RuntimeException("expected exception"))
-                       
-                       DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-                       
-                       DoCreateAllottedResourceBRG.postProcessRollback(mex)
-                       verify(mex, never()).setVariable("rollbackData", null)
-                       
-               }
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("prevWorkflowException")).thenThrow(new BpmnError("expected exception"))
                
-               private boolean checkMissingPreProcessRequest(String fieldnm) {
-                       ExecutionEntity mex = setupMock()
-                       initPreProcess(mex)
-                                                                       
-                       DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
-                       
-                       when(mex.getVariable(fieldnm)).thenReturn("")
-                       
-                       return doBpmnError( { _ -> DoCreateAllottedResourceBRG.preProcessRequest(mex) })
-               }
+               DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
                
-               private boolean doBpmnError(def func) {
-                       
-                       try {
-                               func()
-                               return false;
-                               
-                       } catch(BpmnError e) {
-                               return true;
-                       }
-               }
-               
-               private void initPreProcess(ExecutionEntity mex) {
-                       when(mex.getVariable("isDebugLogEnabled")).thenReturn("true")
-                       when(mex.getVariable("URN_mso_workflow_sdncadapter_callback")).thenReturn("sdncurn")
-                       when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
-                       when(mex.getVariable("parentServiceInstanceId")).thenReturn("psii")
-                       when(mex.getVariable("allottedResourceModelInfo")).thenReturn("armi")
-                       when(mex.getVariable("vni")).thenReturn("myvni")
-                       when(mex.getVariable("vgmuxBearerIP")).thenReturn("vbi")
-                       when(mex.getVariable("brgWanMacAddress")).thenReturn("bwma")
-                       when(mex.getVariable("allottedResourceRole")).thenReturn("arr")
-                       when(mex.getVariable("allottedResourceType")).thenReturn("art")
-               }
-               
-               private initCreateAaiAr(ExecutionEntity mex) {                          
-                       when(mex.getVariable("disableRollback")).thenReturn(45)
-                       when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
-                       when(mex.getVariable("parentServiceInstanceId")).thenReturn("psii")
-                       when(mex.getVariable("isDebugLogEnabled")).thenReturn("true")
-                       when(mex.getVariable("allottedResourceId")).thenReturn("myid")
-                       when(mex.getVariable("URN_aai_endpoint")).thenReturn(aaiUriPfx)
-                       when(mex.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn(urnProps.get("mso.workflow.global.default.aai.namespace"))
-                       when(mex.getVariable("PSI_resourceLink")).thenReturn(aaiUriPfx+"/aai/v9/mypsi")
-                       when(mex.getVariable("allottedResourceType")).thenReturn("BRGt")
-                       when(mex.getVariable("allottedResourceRole")).thenReturn("BRGr")
-                       when(mex.getVariable("CSI_resourceLink")).thenReturn(aaiUriPfx+"/aai/v9/mycsi")
-                       when(mex.getVariable("allottedResourceModelInfo")).thenReturn("""
-                                       {
-                                               "modelInvariantUuid":"modelinvuuid",
-                                               "modelUuid":"modeluuid",
-                                               "modelCustomizationUuid":"modelcustuuid"
-                                       }
-                               """)
-               }
-               
-               private initBuildSDNCRequest(ExecutionEntity mex) {
-                       when(mex.getVariable("isDebugLogEnabled")).thenReturn("true")
-                       when(mex.getVariable("allottedResourceId")).thenReturn("ari")
-                       when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
-                       when(mex.getVariable("parentServiceInstanceId")).thenReturn("psii")
-                       when(mex.getVariable("sdncCallbackUrl")).thenReturn("scu")
-                       when(mex.getVariable("msoRequestId")).thenReturn("mri")
-                       when(mex.getVariable("brgWanMacAddress")).thenReturn("bwma")
-                       when(mex.getVariable("vni")).thenReturn("myvni")
-                       when(mex.getVariable("vgmuxBearerIP")).thenReturn("vbi")
-                       when(mex.getVariable("allottedResourceModelInfo")).thenReturn("""
-                                       {
-                                               "modelInvariantUuid":"miu",
-                                               "modelUuid":"mu",
-                                               "modelCustomizationUuid":"mcu",
-                                               "modelVersion":"mv",
-                                               "modelName":"mn"
-                                       }
-                               """)
-               }
-               
-               private RollbackData initPreProcessSDNC(ExecutionEntity mex) {
-                       def data = new RollbackData()
-                       
-                       when(mex.getVariable("isDebugLogEnabled")).thenReturn("true")
-                       when(mex.getVariable("rollbackData")).thenReturn(data)
-                       
-                       return data
-               }
-               
-               private initPreProcessSDNCGet(ExecutionEntity mex) {
-                       when(mex.getVariable("isDebugLogEnabled")).thenReturn("true")
-                       when(mex.getVariable("sdncCallbackUrl")).thenReturn("myurl")
-                       when(mex.getVariable("foundActiveAR")).thenReturn(true)
-                       when(mex.getVariable("aaiARGetResponse")).thenReturn("<selflink>arlink</selflink>")
-                       when(mex.getVariable("sdncAssignResponse")).thenReturn("<response-data>&lt;object-path&gt;assignlink&lt;/object-path&gt;</response-data>")
-                       when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
-                       when(mex.getVariable("junitSleepMs")).thenReturn("5")
-                       when(mex.getVariable("sdncCallbackUrl")).thenReturn("myurl")
-               }
-               
-               private RollbackData initValidateSDNCResp(ExecutionEntity mex) {
-                       def data = new RollbackData()
-                       
-                       when(mex.getVariable("isDebugLogEnabled")).thenReturn("true")
-                       when(mex.getVariable("prefix")).thenReturn(Prefix)
-                       when(mex.getVariable("SDNCA_SuccessIndicator")).thenReturn(true)
-                       when(mex.getVariable("rollbackData")).thenReturn(data)
-                       
-                       return data
-               }
+               assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceBRG.postProcessRollback(mex) }))
+               verify(mex, never()).setVariable("rollbackData", null)
+               
+       }
+       
+       @Test
+//     @Ignore
+       public void postProcessRollback_Ex() {
+               ExecutionEntity mex = setupMock()
                
-               private String initValidateSDNCResp_Resp() {
-                       return "<response-data>&lt;response-code&gt;200&lt;/response-code&gt;</response-data>"
-               }
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("prevWorkflowException")).thenThrow(new RuntimeException("expected exception"))
                
-               private initUpdateAaiAROrchStatus(ExecutionEntity mex) {
-                       when(mex.getVariable("isDebugLogEnabled")).thenReturn("true")
-                       when(mex.getVariable("aaiARPath")).thenReturn(aaiUriPfx+"/aai/v9/myurl")
-                       
-                       wireMockRule
-                               .stubFor(patch(urlMatching("/aai/v[0-9]+/myurl"))
-                                                       .willReturn(aResponse()
-                                                               .withStatus(200)))
-               }\r
-               \r
-               private ExecutionEntity setupMock() {\r
-                       \r
-                       ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class)\r
-                       when(mockProcessDefinition.getKey()).thenReturn("DoCreateAllottedResourceBRG")\r
-                       RepositoryService mockRepositoryService = mock(RepositoryService.class)\r
-                       when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition)\r
-                       when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("DoCreateAllottedResourceBRG")\r
-                       when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100")\r
-                       ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class)\r
-                       when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService)\r
-                       \r
-                       ExecutionEntity mex = mock(ExecutionEntity.class)\r
-                       \r
-                       when(mex.getId()).thenReturn("100")\r
-                       when(mex.getProcessDefinitionId()).thenReturn("DoCreateAllottedResourceBRG")\r
-                       when(mex.getProcessInstanceId()).thenReturn("DoCreateAllottedResourceBRG")\r
-                       when(mex.getProcessEngineServices()).thenReturn(mockProcessEngineServices)\r
-                       when(mex.getProcessEngineServices().getRepositoryService().getProcessDefinition(mex.getProcessDefinitionId())).thenReturn(mockProcessDefinition)\r
-                       \r
-                       return mex\r
-               }\r
+               DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+               
+               DoCreateAllottedResourceBRG.postProcessRollback(mex)
+               verify(mex, never()).setVariable("rollbackData", null)
+               
+       }
+       
+       private boolean checkMissingPreProcessRequest(String fieldnm) {
+               ExecutionEntity mex = setupMock()
+               initPreProcess(mex)
+                                                               
+               DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+               
+               when(mex.getVariable(fieldnm)).thenReturn("")
+               
+               return doBpmnError( { _ -> DoCreateAllottedResourceBRG.preProcessRequest(mex) })
+       }
+       
+       private void initPreProcess(ExecutionEntity mex) {
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("URN_mso_workflow_sdncadapter_callback")).thenReturn("sdncurn")
+               when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
+               when(mex.getVariable("parentServiceInstanceId")).thenReturn("psii")
+               when(mex.getVariable("allottedResourceModelInfo")).thenReturn("armi")
+               when(mex.getVariable("vni")).thenReturn("myvni")
+               when(mex.getVariable("vgmuxBearerIP")).thenReturn("vbi")
+               when(mex.getVariable("brgWanMacAddress")).thenReturn("bwma")
+               when(mex.getVariable("allottedResourceRole")).thenReturn("arr")
+               when(mex.getVariable("allottedResourceType")).thenReturn("art")
+       }
+       
+       private void initGetAaiAR(ExecutionEntity mex) {
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("allottedResourceType")).thenReturn("BRGt")
+               when(mex.getVariable("allottedResourceRole")).thenReturn("BRGr")
+               when(mex.getVariable("CSI_service")).thenReturn(FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRG/getAR.xml"))
+               when(mex.getVariable("URN_aai_endpoint")).thenReturn(aaiUriPfx)
+               when(mex.getVariable("aaiAROrchStatus")).thenReturn("Active")
+       }
+       
+       private initCreateAaiAr(ExecutionEntity mex) {                          
+               when(mex.getVariable("disableRollback")).thenReturn(45)
+               when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
+               when(mex.getVariable("parentServiceInstanceId")).thenReturn("psii")
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("allottedResourceId")).thenReturn(ARID)
+               when(mex.getVariable("URN_aai_endpoint")).thenReturn(aaiUriPfx)
+               when(mex.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn(urnProps.get("mso.workflow.global.default.aai.namespace"))
+               when(mex.getVariable("PSI_resourceLink")).thenReturn(aaiUriPfx + "/aai/v9/business/customers/customer/"+CUST+"/service-subscriptions/service-subscription/"+SVC+"/service-instances/service-instance/"+INST)
+               when(mex.getVariable("allottedResourceType")).thenReturn("BRGt")
+               when(mex.getVariable("allottedResourceRole")).thenReturn("BRGr")
+               when(mex.getVariable("CSI_resourceLink")).thenReturn(aaiUriPfx+"/aai/v9/mycsi")
+               when(mex.getVariable("allottedResourceModelInfo")).thenReturn("""
+                               {
+                                       "modelInvariantUuid":"modelinvuuid",
+                                       "modelUuid":"modeluuid",
+                                       "modelCustomizationUuid":"modelcustuuid"
+                               }
+                       """)
+       }
+       
+       private initBuildSDNCRequest(ExecutionEntity mex) {
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("allottedResourceId")).thenReturn("ari")
+               when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
+               when(mex.getVariable("parentServiceInstanceId")).thenReturn("psii")
+               when(mex.getVariable("sdncCallbackUrl")).thenReturn("scu")
+               when(mex.getVariable("msoRequestId")).thenReturn("mri")
+               when(mex.getVariable("brgWanMacAddress")).thenReturn("bwma")
+               when(mex.getVariable("vni")).thenReturn("myvni")
+               when(mex.getVariable("vgmuxBearerIP")).thenReturn("vbi")
+               when(mex.getVariable("allottedResourceModelInfo")).thenReturn("""
+                               {
+                                       "modelInvariantUuid":"miu",
+                                       "modelUuid":"mu",
+                                       "modelCustomizationUuid":"mcu",
+                                       "modelVersion":"mv",
+                                       "modelName":"mn"
+                               }
+                       """)
+       }
+       
+       private RollbackData initPreProcessSDNC(ExecutionEntity mex) {
+               def data = new RollbackData()
+               
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("rollbackData")).thenReturn(data)
+               
+               return data
+       }
+       
+       private initPreProcessSDNCGet(ExecutionEntity mex) {
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("sdncCallbackUrl")).thenReturn("myurl")
+               when(mex.getVariable("foundActiveAR")).thenReturn(true)
+               when(mex.getVariable("aaiARGetResponse")).thenReturn("<selflink>arlink</selflink>")
+               when(mex.getVariable("sdncAssignResponse")).thenReturn("<response-data>&lt;object-path&gt;assignlink&lt;/object-path&gt;</response-data>")
+               when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
+               when(mex.getVariable("junitSleepMs")).thenReturn("5")
+               when(mex.getVariable("sdncCallbackUrl")).thenReturn("myurl")
+       }
+       
+       private RollbackData initValidateSDNCResp(ExecutionEntity mex) {
+               def data = new RollbackData()
+               
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("prefix")).thenReturn(Prefix)
+               when(mex.getVariable("SDNCA_SuccessIndicator")).thenReturn(true)
+               when(mex.getVariable("rollbackData")).thenReturn(data)
+               
+               return data
+       }
+       
+       private String initValidateSDNCResp_Resp() {
+               return "<response-data>&lt;response-code&gt;200&lt;/response-code&gt;</response-data>"
+       }
+       
+       private initUpdateAaiAROrchStatus(ExecutionEntity mex) {
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               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)
+       }\r
                \r
 }
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollbackTest.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollbackTest.groovy
new file mode 100644 (file)
index 0000000..e5635de
--- /dev/null
@@ -0,0 +1,653 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.mso.bpmn.vcpe.scripts
+
+
+import org.camunda.bpm.engine.ProcessEngineServices
+import org.camunda.bpm.engine.RepositoryService
+import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
+import org.camunda.bpm.engine.repository.ProcessDefinition
+import org.camunda.bpm.engine.runtime.Execution
+import org.junit.Before
+import org.junit.BeforeClass
+import org.junit.Rule
+import org.junit.Test
+import org.junit.Ignore
+import org.mockito.MockitoAnnotations
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.openecomp.mso.bpmn.core.WorkflowException
+import org.openecomp.mso.bpmn.mock.FileUtil
+
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse
+import static com.github.tomakehurst.wiremock.client.WireMock.get
+import static com.github.tomakehurst.wiremock.client.WireMock.stubFor
+import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.*
+import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteAllottedResource
+import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetAllottedResource
+import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchAllottedResource
+
+import org.openecomp.mso.bpmn.core.RollbackData
+
+import com.github.tomakehurst.wiremock.junit.WireMockRule
+
+class DoCreateAllottedResourceTXCRollbackTest extends GroovyTestBase {
+       
+       @Rule
+       public WireMockRule wireMockRule = new WireMockRule(PORT)
+
+       String Prefix = "DCARTXCRB_"
+       String RbType = "DCARTXC_"
+
+       @BeforeClass
+       public static void setUpBeforeClass() {
+               super.setUpBeforeClass()
+       }
+         
+    @Before
+       public void init()
+       {
+               MockitoAnnotations.initMocks(this)
+       }
+       
+       public DoCreateAllottedResourceTXCRollbackTest() {
+               super("DoCreateAllottedResourceTXCRollback")
+       }
+       
+       
+       // ***** preProcessRequest *****
+                       
+       @Test
+//     @Ignore  
+       public void preProcessRequest() {
+               ExecutionEntity mex = setupMock()
+               initPreProcess(mex)
+               
+               DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
+               DoCreateAllottedResourceTXCRollback.preProcessRequest(mex)
+
+               verify(mex).getVariable(DBGFLAG)
+               verify(mex).setVariable("prefix", Prefix)
+               verify(mex).setVariable("serviceInstanceId", "sii")
+               verify(mex).setVariable("parentServiceInstanceId", "psii")
+               verify(mex).setVariable("allottedResourceId", "myid")
+               verify(mex).setVariable("rollbackAAI", true)
+               verify(mex).setVariable("aaiARPath", "mypath")
+               verify(mex).setVariable("rollbackSDNC", true)
+               verify(mex).setVariable("deactivateSdnc", "myactivate")
+               verify(mex).setVariable("deleteSdnc", "mycreate")
+               verify(mex).setVariable("unassignSdnc", "true")
+               verify(mex).setVariable("sdncDeactivateRequest", "activatereq")
+               verify(mex).setVariable("sdncDeleteRequest", "createreq")
+               verify(mex).setVariable("sdncUnassignRequest", "assignreq")
+               
+               verify(mex, never()).setVariable("skipRollback", true)
+       }
+                       
+       @Test
+//     @Ignore  
+       public void preProcessRequest_RollbackDisabled() {
+               ExecutionEntity mex = setupMock()
+               initPreProcess(mex)
+               
+               when(mex.getVariable("disableRollback")).thenReturn("true")
+               
+               DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
+               DoCreateAllottedResourceTXCRollback.preProcessRequest(mex)
+
+               verify(mex).getVariable(DBGFLAG)
+               verify(mex).setVariable("prefix", Prefix)
+               verify(mex).setVariable("serviceInstanceId", "sii")
+               verify(mex).setVariable("parentServiceInstanceId", "psii")
+               verify(mex).setVariable("allottedResourceId", "myid")
+               verify(mex).setVariable("rollbackAAI", true)
+               verify(mex).setVariable("aaiARPath", "mypath")
+               verify(mex).setVariable("rollbackSDNC", true)
+               verify(mex).setVariable("deactivateSdnc", "myactivate")
+               verify(mex).setVariable("deleteSdnc", "mycreate")
+               verify(mex).setVariable("unassignSdnc", "true")
+               verify(mex).setVariable("sdncDeactivateRequest", "activatereq")
+               verify(mex).setVariable("sdncDeleteRequest", "createreq")
+               verify(mex).setVariable("sdncUnassignRequest", "assignreq")
+               
+               verify(mex).setVariable("skipRollback", true)
+       }
+                       
+       @Test
+//     @Ignore  
+       public void preProcessRequest_NoAAI() {
+               ExecutionEntity mex = setupMock()
+               def data = initPreProcess(mex)
+               
+               when(mex.getVariable("rollbackAAI")).thenReturn(false)
+               data.put(RbType, "rollbackAAI", "false")
+               
+               DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
+               DoCreateAllottedResourceTXCRollback.preProcessRequest(mex)
+
+               verify(mex).getVariable(DBGFLAG)
+               verify(mex).setVariable("prefix", Prefix)
+               verify(mex).setVariable("serviceInstanceId", "sii")
+               verify(mex).setVariable("parentServiceInstanceId", "psii")
+               verify(mex).setVariable("allottedResourceId", "myid")
+               verify(mex, never()).setVariable("rollbackAAI", true)
+               verify(mex, never()).setVariable("aaiARPath", "mypath")
+               verify(mex).setVariable("rollbackSDNC", true)
+               verify(mex).setVariable("deactivateSdnc", "myactivate")
+               verify(mex).setVariable("deleteSdnc", "mycreate")
+               verify(mex).setVariable("unassignSdnc", "true")
+               verify(mex).setVariable("sdncDeactivateRequest", "activatereq")
+               verify(mex).setVariable("sdncDeleteRequest", "createreq")
+               verify(mex).setVariable("sdncUnassignRequest", "assignreq")
+               
+               verify(mex, never()).setVariable("skipRollback", true)
+       }
+                       
+       @Test
+//     @Ignore  
+       public void preProcessRequest_NoAssign() {
+               ExecutionEntity mex = setupMock()
+               def data = initPreProcess(mex)
+               
+               when(mex.getVariable("rollbackSDNC")).thenReturn(false)
+               data.put(RbType, "rollbackSDNCassign", "false")
+               
+               DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
+               DoCreateAllottedResourceTXCRollback.preProcessRequest(mex)
+
+               verify(mex).getVariable(DBGFLAG)
+               verify(mex).setVariable("prefix", Prefix)
+               verify(mex).setVariable("serviceInstanceId", "sii")
+               verify(mex).setVariable("parentServiceInstanceId", "psii")
+               verify(mex).setVariable("allottedResourceId", "myid")
+               verify(mex).setVariable("rollbackAAI", true)
+               verify(mex).setVariable("aaiARPath", "mypath")
+               verify(mex, never()).setVariable("rollbackSDNC", true)
+               verify(mex, never()).setVariable("deactivateSdnc", "myactivate")
+               verify(mex, never()).setVariable("deleteSdnc", "mycreate")
+               verify(mex, never()).setVariable("unassignSdnc", "true")
+               verify(mex, never()).setVariable("sdncDeactivateRequest", "activatereq")
+               verify(mex, never()).setVariable("sdncDeleteRequest", "createreq")
+               verify(mex, never()).setVariable("sdncUnassignRequest", "assignreq")
+               
+               verify(mex, never()).setVariable("skipRollback", true)
+       }
+                       
+       @Test
+//     @Ignore  
+       public void preProcessRequest_NoAAI_NoAssign() {
+               ExecutionEntity mex = setupMock()
+               initPreProcess(mex)
+               
+               when(mex.getVariable("rollbackAAI")).thenReturn(false)
+               when(mex.getVariable("rollbackSDNC")).thenReturn(false)
+               
+               DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
+               DoCreateAllottedResourceTXCRollback.preProcessRequest(mex)
+
+               verify(mex).setVariable("skipRollback", true)
+       }
+                       
+       @Test
+//     @Ignore  
+       public void preProcessRequest_NoRbStructure() {
+               ExecutionEntity mex = setupMock()
+               initPreProcess(mex)
+               
+               when(mex.getVariable("rollbackData")).thenReturn(new RollbackData())
+               
+               DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
+               DoCreateAllottedResourceTXCRollback.preProcessRequest(mex)
+
+               verify(mex).setVariable("skipRollback", true)
+       }
+                       
+       @Test
+//     @Ignore  
+       public void preProcessRequest_NullRb() {
+               ExecutionEntity mex = setupMock()
+               initPreProcess(mex)
+               
+               when(mex.getVariable("rollbackData")).thenReturn(null)
+               
+               DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
+               DoCreateAllottedResourceTXCRollback.preProcessRequest(mex)
+
+               verify(mex).setVariable("skipRollback", true)
+       }
+                       
+       @Test
+//     @Ignore  
+       public void preProcessRequest_BpmnError() {
+               ExecutionEntity mex = setupMock()
+               initPreProcess(mex)
+               
+               when(mex.getVariable("rollbackData")).thenThrow(new BpmnError("expected exception"))
+               
+               DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
+               
+               assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceTXCRollback.preProcessRequest(mex) }))
+       }
+                       
+       @Test
+//     @Ignore  
+       public void preProcessRequest_Ex() {
+               ExecutionEntity mex = setupMock()
+               initPreProcess(mex)
+               
+               when(mex.getVariable("rollbackData")).thenThrow(new RuntimeException("expected exception"))
+               
+               DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
+               
+               assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceTXCRollback.preProcessRequest(mex) }))
+       }
+                       
+       @Test
+//     @Ignore  
+       public void updateAaiAROrchStatus() {
+               ExecutionEntity mex = setupMock()
+               initUpdateAaiAROrchStatus(mex)
+               
+               MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml")
+               MockPatchAllottedResource(CUST, SVC, INST, ARID)
+               
+               DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
+               DoCreateAllottedResourceTXCRollback.updateAaiAROrchStatus(mex, "success")
+       }
+                       
+       @Test
+//     @Ignore  
+       public void updateAaiAROrchStatus_EmptyResponse() {
+               ExecutionEntity mex = setupMock()
+               initUpdateAaiAROrchStatus(mex)
+               
+               wireMockRule
+                       .stubFor(get(urlMatching("/aai/v[0-9]+/.*"))
+                                       .willReturn(aResponse()
+                                               .withStatus(200)))
+               
+               DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
+               
+               assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceTXCRollback.updateAaiAROrchStatus(mex, "success") }))
+       }
+                       
+       @Test
+//     @Ignore  
+       public void updateAaiAROrchStatus_NoArPath() {
+               ExecutionEntity mex = setupMock()
+               initUpdateAaiAROrchStatus(mex)
+               
+               MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml")
+               MockPatchAllottedResource(CUST, SVC, INST, ARID)
+                       
+               when(mex.getVariable("aaiARPath")).thenReturn(null)
+               
+               DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
+               
+               assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceTXCRollback.updateAaiAROrchStatus(mex, "success") }))
+       }
+       
+       
+       // ***** validateSDNCResp *****
+       
+       @Test
+//     @Ignore
+       public void validateSDNCResp() {
+               ExecutionEntity mex = setupMock()
+               initValidateSDNCResp(mex)
+               def resp = initValidateSDNCResp_Resp()
+               
+               when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(true)
+               
+               DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
+               
+               DoCreateAllottedResourceTXCRollback.validateSDNCResp(mex, resp, "create")
+               
+               verify(mex).getVariable("WorkflowException")
+               verify(mex).getVariable("SDNCA_SuccessIndicator")
+       }
+       
+       @Test
+//     @Ignore
+       public void validateSDNCResp_Unsuccessful() {
+               ExecutionEntity mex = setupMock()
+               initValidateSDNCResp(mex)
+               def resp = initValidateSDNCResp_Resp()
+               
+               when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(false)
+               
+               DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
+               
+               assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceTXCRollback.validateSDNCResp(mex, resp, "create") }))
+       }
+       
+       @Test
+//     @Ignore
+       public void validateSDNCResp_BpmnError404() {
+               ExecutionEntity mex = setupMock()
+               initValidateSDNCResp(mex)
+               def resp = initValidateSDNCResp_Resp()
+               when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(true)
+               
+               when(mex.getVariable("WorkflowException")).thenThrow(new BpmnError("404", "expected exception"))
+               
+               DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
+               
+               DoCreateAllottedResourceTXCRollback.validateSDNCResp(mex, resp, "create")
+       }
+       
+       @Test
+//     @Ignore
+       public void validateSDNCResp_BpmnError() {
+               ExecutionEntity mex = setupMock()
+               initValidateSDNCResp(mex)
+               def resp = initValidateSDNCResp_Resp()
+               when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(true)
+               
+               when(mex.getVariable("WorkflowException")).thenThrow(new BpmnError("expected exception"))
+               
+               DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
+               
+               assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceTXCRollback.validateSDNCResp(mex, resp, "create") }))
+       }
+       
+       @Test
+//     @Ignore
+       public void validateSDNCResp_Ex() {
+               ExecutionEntity mex = setupMock()
+               initValidateSDNCResp(mex)
+               def resp = initValidateSDNCResp_Resp()
+               when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(true)
+               
+               when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception"))
+               
+               DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
+               
+               assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceTXCRollback.validateSDNCResp(mex, resp, "create") }))
+       }
+                       
+       @Test
+//     @Ignore  
+       public void deleteAaiAR() {
+               ExecutionEntity mex = setupMock()
+               initDeleteAaiAR(mex)
+               
+               MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml")
+               MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS)
+               
+               DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
+               DoCreateAllottedResourceTXCRollback.deleteAaiAR(mex)
+       }
+                       
+       @Test
+//     @Ignore  
+       public void deleteAaiAR_NoArPath() {
+               ExecutionEntity mex = setupMock()
+               initDeleteAaiAR(mex)
+               
+               MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml")
+               MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS)
+                       
+               when(mex.getVariable("aaiARPath")).thenReturn("")
+               
+               DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
+               
+               assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceTXCRollback.deleteAaiAR(mex) }))
+       }
+                       
+       @Test
+//     @Ignore  
+       public void deleteAaiAR_BpmnError() {
+               ExecutionEntity mex = setupMock()
+               initDeleteAaiAR(mex)
+               
+               MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml")
+               MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS)
+                       
+               when(mex.getVariable("aaiARPath")).thenThrow(new BpmnError("expected exception"))
+               
+               DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
+               
+               assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceTXCRollback.deleteAaiAR(mex) }))
+       }
+                       
+       @Test
+//     @Ignore  
+       public void deleteAaiAR_Ex() {
+               ExecutionEntity mex = setupMock()
+               initDeleteAaiAR(mex)
+               
+               MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml")
+               MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS)
+                       
+               when(mex.getVariable("aaiARPath")).thenThrow(new RuntimeException("expected exception"))
+               
+               DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
+               
+               assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceTXCRollback.deleteAaiAR(mex) }))
+       }
+                       
+       @Test
+//     @Ignore  
+       public void postProcessRequest() {
+               ExecutionEntity mex = setupMock()
+               initPostProcessRequest(mex)
+               
+               DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
+               DoCreateAllottedResourceTXCRollback.postProcessRequest(mex)
+
+               verify(mex).getVariable(DBGFLAG)
+               verify(mex).setVariable("rollbackData", null)
+               verify(mex).setVariable("rolledBack", true)
+       }
+                       
+       @Test
+//     @Ignore  
+       public void postProcessRequest_RolledBack() {
+               ExecutionEntity mex = setupMock()
+               initPostProcessRequest(mex)
+               
+               when(mex.getVariable("skipRollback")).thenReturn(true)
+               
+               DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
+               DoCreateAllottedResourceTXCRollback.postProcessRequest(mex)
+
+               verify(mex).getVariable(DBGFLAG)
+               verify(mex).setVariable("rollbackData", null)
+               verify(mex, never()).setVariable("rolledBack", true)
+       }
+                       
+       @Test
+//     @Ignore  
+       public void postProcessRequest_BpmnError() {
+               ExecutionEntity mex = setupMock()
+               initPostProcessRequest(mex)
+               
+               when(mex.getVariable("skipRollback")).thenThrow(new BpmnError("expected exception"))
+               
+               DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
+               DoCreateAllottedResourceTXCRollback.postProcessRequest(mex)
+
+               verify(mex).getVariable(DBGFLAG)
+               verify(mex).setVariable("rollbackData", null)
+               verify(mex, never()).setVariable("rolledBack", true)
+       }
+                       
+       @Test
+//     @Ignore  
+       public void postProcessRequest_Ex() {
+               ExecutionEntity mex = setupMock()
+               initPostProcessRequest(mex)
+               
+               when(mex.getVariable("skipRollback")).thenThrow(new RuntimeException("expected exception"))
+               
+               DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
+               DoCreateAllottedResourceTXCRollback.postProcessRequest(mex)
+
+               verify(mex).getVariable(DBGFLAG)
+               verify(mex).setVariable("rollbackData", null)
+               verify(mex, never()).setVariable("rolledBack", true)
+       }
+                       
+       @Test
+//     @Ignore  
+       public void processRollbackException() {
+               ExecutionEntity mex = setupMock()
+               initProcessRollbackException(mex)
+               
+               DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
+               DoCreateAllottedResourceTXCRollback.processRollbackException(mex)
+
+               verify(mex).getVariable(DBGFLAG)
+               verify(mex).setVariable("rollbackData", null)
+               verify(mex).setVariable("rolledBack", false)
+               verify(mex).setVariable("rollbackError", "Caught exception in AllottedResource Create Rollback")
+               verify(mex).setVariable("WorkflowException", null)
+       }
+                       
+       @Test
+//     @Ignore  
+       public void processRollbackException_BpmnError() {
+               ExecutionEntity mex = setupMock()
+               initProcessRollbackException(mex)
+               
+               doThrow(new BpmnError("expected exception")).when(mex).setVariable("rollbackData", null)
+               
+               DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
+               DoCreateAllottedResourceTXCRollback.processRollbackException(mex)
+       }
+                       
+       @Test
+//     @Ignore  
+       public void processRollbackException_Ex() {
+               ExecutionEntity mex = setupMock()
+               initProcessRollbackException(mex)
+               
+               doThrow(new RuntimeException("expected exception")).when(mex).setVariable("rollbackData", null)
+               
+               DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
+               DoCreateAllottedResourceTXCRollback.processRollbackException(mex)
+       }
+                       
+       @Test
+//     @Ignore  
+       public void processRollbackJavaException() {
+               ExecutionEntity mex = setupMock()
+               initProcessRollbackException(mex)
+               
+               DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
+               DoCreateAllottedResourceTXCRollback.processRollbackJavaException(mex)
+
+               verify(mex).getVariable(DBGFLAG)
+               verify(mex).setVariable("rollbackData", null)
+               verify(mex).setVariable("rolledBack", false)
+               verify(mex).setVariable("rollbackError", "Caught Java exception in AllottedResource Create Rollback")
+               verify(mex, never()).setVariable("WorkflowException", null)
+       }
+                       
+       @Test
+//     @Ignore  
+       public void processRollbackJavaException_BpmnError() {
+               ExecutionEntity mex = setupMock()
+               initProcessRollbackException(mex)
+               
+               doThrow(new BpmnError("expected exception")).when(mex).setVariable("rollbackData", null)
+               
+               DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
+               DoCreateAllottedResourceTXCRollback.processRollbackJavaException(mex)
+       }
+                       
+       @Test
+//     @Ignore  
+       public void processRollbackJavaException_Ex() {
+               ExecutionEntity mex = setupMock()
+               initProcessRollbackException(mex)
+               
+               doThrow(new RuntimeException("expected exception")).when(mex).setVariable("rollbackData", null)
+               
+               DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback()
+               DoCreateAllottedResourceTXCRollback.processRollbackJavaException(mex)
+       }
+       
+       private RollbackData initPreProcess(ExecutionEntity mex) {
+               def data = new RollbackData()
+               
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("rollbackData")).thenReturn(data)
+               when(mex.getVariable("rollbackAAI")).thenReturn(true)
+               when(mex.getVariable("rollbackSDNC")).thenReturn(true)
+               when(mex.getVariable("disableRollback")).thenReturn("false")
+               
+               data.put("SERVICEINSTANCE", "allottedResourceId", "myid")
+               
+               data.put(RbType, "serviceInstanceId", "sii")
+               data.put(RbType, "parentServiceInstanceId", "psii")
+               
+               data.put(RbType, "rollbackAAI", "true")
+               data.put(RbType, "aaiARPath", "mypath")
+               
+               data.put(RbType, "rollbackSDNCassign", "true")
+               data.put(RbType, "rollbackSDNCactivate", "myactivate")
+               data.put(RbType, "rollbackSDNCcreate", "mycreate")
+               data.put(RbType, "sdncActivateRollbackReq", "activatereq")
+               data.put(RbType, "sdncCreateRollbackReq", "createreq")
+               data.put(RbType, "sdncAssignRollbackReq", "assignreq")
+               
+               return data
+       }
+       
+       private initUpdateAaiAROrchStatus(ExecutionEntity mex) {
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               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)
+               when(mex.getVariable("URN_aai_endpoint")).thenReturn(aaiUriPfx)
+       }
+       
+       private initValidateSDNCResp(ExecutionEntity mex) {
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("prefix")).thenReturn(Prefix)
+               when(mex.getVariable("SDNCA_SuccessIndicator")).thenReturn(true)
+       }
+       
+       private String initValidateSDNCResp_Resp() {
+               return "<response-data>&lt;response-code&gt;200&lt;/response-code&gt;</response-data>"
+       }
+       
+       private initDeleteAaiAR(ExecutionEntity mex) {
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("aaiARResourceVersion")).thenReturn(VERS)
+               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)
+               when(mex.getVariable("URN_aai_endpoint")).thenReturn(aaiUriPfx)
+       }
+       
+       private initPostProcessRequest(ExecutionEntity mex) {
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("skipRollback")).thenReturn(false)
+       }
+       
+       private initProcessRollbackException(ExecutionEntity mex) {
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+       }
+       
+       private initProcessRollbackJavaException(ExecutionEntity mex) {
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+       }
+               
+}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCTest.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCTest.groovy
new file mode 100644 (file)
index 0000000..2b6d4ba
--- /dev/null
@@ -0,0 +1,950 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.mso.bpmn.vcpe.scripts
+\r
+\r
+import org.camunda.bpm.engine.ProcessEngineServices\r
+import org.camunda.bpm.engine.RepositoryService\r
+import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity\r
+import org.camunda.bpm.engine.repository.ProcessDefinition\r
+import org.camunda.bpm.engine.runtime.Execution\r
+import org.junit.Before
+import org.junit.BeforeClass\r
+import org.junit.Rule\r
+import org.junit.Test
+import org.junit.Ignore\r
+import org.mockito.MockitoAnnotations
+import org.camunda.bpm.engine.delegate.BpmnError\r
+import org.openecomp.mso.bpmn.core.WorkflowException
+import org.openecomp.mso.bpmn.mock.FileUtil
+
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse
+import static com.github.tomakehurst.wiremock.client.WireMock.put
+import static com.github.tomakehurst.wiremock.client.WireMock.stubFor
+import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching
+import static org.junit.Assert.*;\r
+import static org.mockito.Mockito.*
+import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetAllottedResource
+import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchAllottedResource
+import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutAllottedResource
+import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutAllottedResource_500
+
+import java.util.Map
+
+import org.openecomp.mso.bpmn.core.RollbackData
+import org.openecomp.mso.bpmn.vcpe.scripts.MapSetter
+
+import com.github.tomakehurst.wiremock.junit.WireMockRule\r
+\r
+class DoCreateAllottedResourceTXCTest extends GroovyTestBase {\r
+       \r
+       @Rule\r
+       public WireMockRule wireMockRule = new WireMockRule(PORT)
+\r
+       String Prefix = "DCARTXC_"\r
+
+       @BeforeClass
+       public static void setUpBeforeClass() {
+               def fr = new FileReader("src/test/resources/mso.bpmn.urn.properties")
+               urnProps.load(fr)
+               fr.close()
+               
+               aaiUriPfx = urnProps.get("aai.endpoint")
+       }
+         \r
+    @Before\r
+       public void init()\r
+       {\r
+               MockitoAnnotations.initMocks(this)\r
+       }
+       
+       public DoCreateAllottedResourceTXCTest() {
+               super("DoCreateAllottedResourceTXC")
+       }
+       
+       
+       // ***** preProcessRequest *****\r
+                       \r
+       @Test\r
+//             @Ignore  \r
+       public void preProcessRequest() {\r
+               ExecutionEntity mex = setupMock()
+               initPreProcess(mex)
+               \r
+               DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()\r
+               DoCreateAllottedResourceTXC.preProcessRequest(mex)\r
+\r
+               verify(mex).getVariable(DBGFLAG)\r
+               verify(mex).setVariable("prefix", Prefix)\r
+                               
+               assertTrue(checkMissingPreProcessRequest("URN_mso_workflow_sdncadapter_callback"))
+               assertTrue(checkMissingPreProcessRequest("serviceInstanceId"))
+               assertTrue(checkMissingPreProcessRequest("parentServiceInstanceId"))
+               assertTrue(checkMissingPreProcessRequest("allottedResourceModelInfo"))
+               assertTrue(checkMissingPreProcessRequest("brgWanMacAddress"))
+               assertTrue(checkMissingPreProcessRequest("allottedResourceRole"))
+               assertTrue(checkMissingPreProcessRequest("allottedResourceType"))\r
+       }
+       
+       
+       // ***** getAaiAR *****
+       
+       @Test
+//             @Ignore
+       public void getAaiAR() {
+               MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXC/getArTxc.xml")
+               
+               ExecutionEntity mex = setupMock()
+               initGetAaiAR(mex)
+               
+               DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+               DoCreateAllottedResourceTXC.getAaiAR(mex)
+               
+               verify(mex).setVariable("foundActiveAR", true)
+       }
+       
+       @Test
+//             @Ignore
+       public void getAaiAR_Duplicate() {
+               MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXC/getArTxc.xml")
+               
+               ExecutionEntity mex = setupMock()
+               initGetAaiAR(mex)
+               
+               // fail if duplicate
+               when(mex.getVariable("failExists")).thenReturn("true")
+               
+               DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+               
+               assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceTXC.getAaiAR(mex) }))
+       }
+       
+       @Test
+//             @Ignore
+       public void getAaiAR_NotActive() {
+               MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXC/getArTxc.xml")
+               
+               ExecutionEntity mex = setupMock()
+               initGetAaiAR(mex)
+               
+               // not active
+               when(mex.getVariable("aaiAROrchStatus")).thenReturn("not-active")
+               
+               DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+               
+               assertTrue(doBpmnError( { _ -> DoCreateAllottedResourceTXC.getAaiAR(mex) }))
+       }
+       
+       @Test
+//             @Ignore
+       public void getAaiAR_NoStatus() {
+               MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXC/getArTxc.xml")
+               
+               ExecutionEntity mex = setupMock()
+               initGetAaiAR(mex)
+               
+               when(mex.getVariable("aaiAROrchStatus")).thenReturn(null)
+               
+               DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+               DoCreateAllottedResourceTXC.getAaiAR(mex)
+               
+               verify(mex, never()).setVariable("foundActiveAR", true)
+       }
+       
+       
+       // ***** createAaiAR *****
+       
+       @Test
+//             @Ignore
+       public void createAaiAR() {
+               ExecutionEntity mex = setupMock()
+               def map = setupMap(mex)
+               initCreateAaiAr(mex)
+               
+               MockPutAllottedResource(CUST, SVC, INST, ARID)
+               
+               DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+               DoCreateAllottedResourceTXC.createAaiAR(mex)
+               
+               def data = map.get("rollbackData")
+               assertNotNull(data)
+               assertTrue(data instanceof RollbackData)
+               
+               assertEquals("45", data.get(Prefix, "disableRollback"))
+               assertEquals("true", data.get(Prefix, "rollbackAAI"))
+               assertEquals(ARID, data.get(Prefix, "allottedResourceId"))
+               assertEquals("sii", data.get(Prefix, "serviceInstanceId"))
+               assertEquals("psii", data.get(Prefix, "parentServiceInstanceId"))
+               assertEquals(mex.getVariable("PSI_resourceLink")+"/allotted-resources/allotted-resource/"+ARID, data.get(Prefix, "aaiARPath"))
+       }
+       
+       @Test
+//             @Ignore
+       public void createAaiAR_NoArid_NoModelUuids() {
+               ExecutionEntity mex = setupMock()
+               def map = setupMap(mex)
+               initCreateAaiAr(mex)
+                       
+               // no allottedResourceId - will be generated
+               
+               when(mex.getVariable("allottedResourceId")).thenReturn(null)
+               
+               wireMockRule
+                       .stubFor(put(urlMatching("/aai/.*/allotted-resource/.*"))
+                                       .willReturn(aResponse()
+                                               .withStatus(200)))
+               
+               DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+               DoCreateAllottedResourceTXC.createAaiAR(mex)
+               
+               def arid = map.get("allottedResourceId")
+               assertNotNull(arid)
+               assertFalse(arid.isEmpty())
+               
+               def data = map.get("rollbackData")
+               assertNotNull(data)
+               assertTrue(data instanceof RollbackData)
+               
+               assertEquals(arid, data.get(Prefix, "allottedResourceId"))
+       }
+       
+       @Test
+//             @Ignore
+       public void createAaiAR_MissingPsiLink() {
+               ExecutionEntity mex = setupMock()
+               initCreateAaiAr(mex)
+               
+               when(mex.getVariable("PSI_resourceLink")).thenReturn(null)
+               
+               MockPutAllottedResource(CUST, SVC, INST, ARID)
+               
+               DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+               
+               assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.createAaiAR(mex) }))
+       }
+       
+       @Test
+//             @Ignore
+       public void createAaiAR_HttpFailed() {
+               ExecutionEntity mex = setupMock()
+               initCreateAaiAr(mex)
+               
+               MockPutAllottedResource_500(CUST, SVC, INST, ARID)
+               
+               DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+               
+               assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.createAaiAR(mex) }))
+       }
+       
+       @Test
+//             @Ignore
+       public void createAaiAR_BpmnError() {
+               ExecutionEntity mex = setupMock()
+               initCreateAaiAr(mex)
+               
+               when(mex.getVariable("URN_aai_endpoint")).thenThrow(new BpmnError("expected exception"))
+               
+               MockPutAllottedResource(CUST, SVC, INST, ARID)
+               
+               DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+               
+               assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.createAaiAR(mex) }))
+       }
+       
+       @Test
+//             @Ignore
+       public void createAaiAR_Ex() {
+               ExecutionEntity mex = setupMock()
+               initCreateAaiAr(mex)
+               
+               when(mex.getVariable("URN_aai_endpoint")).thenThrow(new RuntimeException("expected exception"))
+               
+               MockPutAllottedResource(CUST, SVC, INST, ARID)
+               
+               DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+               
+               assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.createAaiAR(mex) }))
+       }
+       
+       
+       // ***** buildSDNCRequest *****
+       
+       @Test
+//             @Ignore
+       public void buildSDNCRequest() {
+               ExecutionEntity mex = setupMock()
+               initBuildSDNCRequest(mex)
+               
+               DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+               
+               String result = DoCreateAllottedResourceTXC.buildSDNCRequest(mex, "myact", "myreq")
+               
+               assertTrue(result.indexOf("<sdncadapter:RequestId>myreq</") >= 0)
+               assertTrue(result.indexOf("<sdncadapter:SvcAction>myact</") >= 0)
+               assertTrue(result.indexOf("<allotted-resource-id>ari</") >= 0)
+               assertTrue(result.indexOf("<sdncadapter:SvcInstanceId>sii</") >= 0)
+               assertTrue(result.indexOf("<service-instance-id>psii</") >= 0)
+               assertTrue(result.indexOf("<parent-service-instance-id>psii</") >= 0)
+               assertTrue(result.indexOf("<sdncadapter:CallbackUrl>scu</") >= 0)
+               assertTrue(result.indexOf("<request-id>mri</") >= 0)
+               assertTrue(result.indexOf("<model-invariant-uuid/>") >= 0)
+               assertTrue(result.indexOf("<model-uuid/>") >= 0)
+               assertTrue(result.indexOf("<model-customization-uuid/>") >= 0)
+               assertTrue(result.indexOf("<model-version/>") >= 0)
+               assertTrue(result.indexOf("<model-name/>") >= 0)
+       }
+       
+       @Test
+//             @Ignore
+       public void buildSDNCRequest_Ex() {
+               ExecutionEntity mex = setupMock()
+               initBuildSDNCRequest(mex)
+               
+               when(mex.getVariable("allottedResourceId")).thenThrow(new RuntimeException("expected exception"))
+               
+               DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+               
+               assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.buildSDNCRequest(mex, "myact", "myreq") }))
+       }
+       
+       
+       // ***** preProcessSDNCAssign *****
+       
+       @Test
+//             @Ignore
+       public void preProcessSDNCAssign() {
+               ExecutionEntity mex = setupMock()
+               def map = setupMap(mex)
+               def data = initPreProcessSDNC(mex)
+                                       
+               DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+               DoCreateAllottedResourceTXC.preProcessSDNCAssign(mex)
+               
+               def req = map.get("sdncAssignRequest")
+               assertNotNull(req)
+               
+               assertEquals(data, map.get("rollbackData"))
+               
+               def rbreq = data.get(Prefix, "sdncAssignRollbackReq")
+               
+               assertTrue(req.indexOf("<sdncadapter:SvcAction>assign</") >= 0)
+               assertTrue(req.indexOf("<request-action>CreateTunnelXConnInstance</") >= 0)
+               assertTrue(req.indexOf("<sdncadapter:RequestId>") >= 0)
+               
+               assertTrue(rbreq.indexOf("<sdncadapter:SvcAction>unassign</") >= 0)
+               assertTrue(rbreq.indexOf("<request-action>DeleteTunnelXConnInstance</") >= 0)
+               assertTrue(rbreq.indexOf("<sdncadapter:RequestId>") >= 0)
+       }
+       
+       @Test
+//             @Ignore
+       public void preProcessSDNCAssign_BpmnError() {
+               ExecutionEntity mex = setupMock()
+               initPreProcessSDNC(mex)
+               
+               when(mex.getVariable("rollbackData")).thenThrow(new BpmnError("expected exception"))
+                                       
+               DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+               
+               assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.preProcessSDNCAssign(mex) }))
+       }
+       
+       @Test
+//             @Ignore
+       public void preProcessSDNCAssign_Ex() {
+               ExecutionEntity mex = setupMock()
+               initPreProcessSDNC(mex)
+               
+               when(mex.getVariable("rollbackData")).thenThrow(new RuntimeException("expected exception"))
+                                       
+               DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+               
+               assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.preProcessSDNCAssign(mex) }))
+       }
+       
+       
+       // ***** preProcessSDNCCreate *****
+       
+       @Test
+//             @Ignore
+       public void preProcessSDNCCreate() {
+               ExecutionEntity mex = setupMock()
+               def map = setupMap(mex)
+               def data = initPreProcessSDNC(mex)
+                                       
+               DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+               DoCreateAllottedResourceTXC.preProcessSDNCCreate(mex)
+               
+               def req = map.get("sdncCreateRequest")
+               assertNotNull(req)
+               
+               assertEquals(data, map.get("rollbackData"))
+               
+               def rbreq = data.get(Prefix, "sdncCreateRollbackReq")
+               
+               assertTrue(req.indexOf("<sdncadapter:SvcAction>create</") >= 0)
+               assertTrue(req.indexOf("<request-action>CreateTunnelXConnInstance</") >= 0)
+               assertTrue(req.indexOf("<sdncadapter:RequestId>") >= 0)
+               
+               assertTrue(rbreq.indexOf("<sdncadapter:SvcAction>delete</") >= 0)
+               assertTrue(rbreq.indexOf("<request-action>DeleteTunnelXConnInstance</") >= 0)
+               assertTrue(rbreq.indexOf("<sdncadapter:RequestId>") >= 0)
+               
+       }
+       
+       @Test
+//             @Ignore
+       public void preProcessSDNCCreate_BpmnError() {
+               ExecutionEntity mex = setupMock()
+               initPreProcessSDNC(mex)
+               
+               when(mex.getVariable("rollbackData")).thenThrow(new BpmnError("expected exception"))
+                                       
+               DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+               
+               assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.preProcessSDNCCreate(mex) }))
+       }
+       
+       @Test
+//             @Ignore
+       public void preProcessSDNCCreate_Ex() {
+               ExecutionEntity mex = setupMock()
+               initPreProcessSDNC(mex)
+               
+               when(mex.getVariable("rollbackData")).thenThrow(new RuntimeException("expected exception"))
+                                       
+               DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+               
+               assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.preProcessSDNCCreate(mex) }))
+       }
+       
+       
+       // ***** preProcessSDNCActivate *****
+       
+       @Test
+//             @Ignore
+       public void preProcessSDNCActivate() {
+               ExecutionEntity mex = setupMock()
+               def map = setupMap(mex)
+               def data = initPreProcessSDNC(mex)
+                                       
+               DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+               DoCreateAllottedResourceTXC.preProcessSDNCActivate(mex)
+               
+               def req = map.get("sdncActivateRequest")
+               assertNotNull(req)
+               
+               assertEquals(data, map.get("rollbackData"))
+               
+               def rbreq = data.get(Prefix, "sdncActivateRollbackReq")
+               
+               assertTrue(req.indexOf("<sdncadapter:SvcAction>activate</") >= 0)
+               assertTrue(req.indexOf("<request-action>CreateTunnelXConnInstance</") >= 0)
+               assertTrue(req.indexOf("<sdncadapter:RequestId>") >= 0)
+               
+               assertTrue(rbreq.indexOf("<sdncadapter:SvcAction>deactivate</") >= 0)
+               assertTrue(rbreq.indexOf("<request-action>DeleteTunnelXConnInstance</") >= 0)
+               assertTrue(rbreq.indexOf("<sdncadapter:RequestId>") >= 0)
+               
+       }
+       
+       @Test
+//             @Ignore
+       public void preProcessSDNCActivate_BpmnError() {
+               ExecutionEntity mex = setupMock()
+               initPreProcessSDNC(mex)
+               
+               when(mex.getVariable("rollbackData")).thenThrow(new BpmnError("expected exception"))
+                                       
+               DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+               
+               assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.preProcessSDNCActivate(mex) }))
+       }
+       
+       @Test
+//             @Ignore
+       public void preProcessSDNCActivate_Ex() {
+               ExecutionEntity mex = setupMock()
+               initPreProcessSDNC(mex)
+               
+               when(mex.getVariable("rollbackData")).thenThrow(new RuntimeException("expected exception"))
+                                       
+               DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+               
+               assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.preProcessSDNCActivate(mex) }))
+       }
+       
+       
+       // ***** validateSDNCResp *****
+       
+       @Test
+//             @Ignore
+       public void validateSDNCResp() {
+               ExecutionEntity mex = setupMock()
+               def map = setupMap(mex)
+               def data = initValidateSDNCResp(mex)
+               def resp = initValidateSDNCResp_Resp()
+               
+               when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(true)
+               
+               DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+               
+               DoCreateAllottedResourceTXC.validateSDNCResp(mex, resp, "create")
+               
+               verify(mex).getVariable("WorkflowException")
+               verify(mex).getVariable("SDNCA_SuccessIndicator")
+               verify(mex).getVariable("rollbackData")
+               
+               assertEquals(data, map.get("rollbackData"))
+               
+               assertEquals("true", data.get(Prefix, "rollback" +  "SDNCcreate"))
+               
+       }
+       
+       @Test
+//             @Ignore
+       public void validateSDNCResp_Get() {
+               ExecutionEntity mex = setupMock()
+               def data = initValidateSDNCResp(mex)
+               def resp = initValidateSDNCResp_Resp()
+               
+               when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(true)
+               
+               DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+               
+               DoCreateAllottedResourceTXC.validateSDNCResp(mex, resp, "get")
+               
+               verify(mex).getVariable("WorkflowException")
+               verify(mex).getVariable("SDNCA_SuccessIndicator")
+               
+               verify(mex, never()).getVariable("rollbackData")
+       }
+       
+       @Test
+//             @Ignore
+       public void validateSDNCResp_Unsuccessful() {
+               ExecutionEntity mex = setupMock()
+               initValidateSDNCResp(mex)
+               def resp = initValidateSDNCResp_Resp()
+               
+               // unsuccessful
+               when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(false)
+               
+               DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+               
+               assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.validateSDNCResp(mex, resp, "create") }))
+       }
+       
+       @Test
+//             @Ignore
+       public void validateSDNCResp_BpmnError() {
+               ExecutionEntity mex = setupMock()
+               initValidateSDNCResp(mex)
+               def resp = initValidateSDNCResp_Resp()
+               
+               when(mex.getVariable("WorkflowException")).thenThrow(new BpmnError("expected exception"))
+               
+               DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+               
+               assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.validateSDNCResp(mex, resp, "create") }))
+       }
+       
+       @Test
+//             @Ignore
+       public void validateSDNCResp_Ex() {
+               ExecutionEntity mex = setupMock()
+               initValidateSDNCResp(mex)
+               def resp = initValidateSDNCResp_Resp()
+               
+               when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception"))
+               
+               DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+               
+               assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.validateSDNCResp(mex, resp, "create") }))
+       }
+       
+       
+       // ***** preProcessSDNCGet *****
+       
+       @Test
+//             @Ignore
+       public void preProcessSDNCGet_FoundAR() {
+               ExecutionEntity mex = setupMock()
+               def map = setupMap(mex)
+               initPreProcessSDNCGet(mex)
+                                       
+               DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+               DoCreateAllottedResourceTXC.preProcessSDNCGet(mex)
+               
+               String req = map.get("sdncGetRequest")
+               
+               assertTrue(req.indexOf("<sdncadapter:RequestId>") >= 0)
+               assertTrue(req.indexOf("<sdncadapter:SvcInstanceId>sii</") >= 0)
+               assertTrue(req.indexOf("<sdncadapter:SvcOperation>arlink</") >= 0)
+               assertTrue(req.indexOf("<sdncadapter:CallbackUrl>myurl</") >= 0)
+               
+       }
+       
+       @Test
+//             @Ignore
+       public void preProcessSDNCGet_NotFoundAR() {
+               ExecutionEntity mex = setupMock()
+               def map = setupMap(mex)
+               initPreProcessSDNCGet(mex)
+               
+               when(mex.getVariable("foundActiveAR")).thenReturn(false)
+                                       
+               DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+               DoCreateAllottedResourceTXC.preProcessSDNCGet(mex)
+               
+               String req = map.get("sdncGetRequest")
+               
+               assertTrue(req.indexOf("<sdncadapter:RequestId>") >= 0)
+               assertTrue(req.indexOf("<sdncadapter:SvcInstanceId>sii</") >= 0)
+               assertTrue(req.indexOf("<sdncadapter:SvcOperation>assignlink</") >= 0)
+               assertTrue(req.indexOf("<sdncadapter:CallbackUrl>myurl</") >= 0)
+               
+       }
+       
+       @Test
+//             @Ignore
+       public void preProcessSDNCGet_Ex() {
+               ExecutionEntity mex = setupMock()
+               initPreProcessSDNCGet(mex)
+               
+               when(mex.getVariable("foundActiveAR")).thenThrow(new RuntimeException("expected exception"))
+               
+               DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+               
+               assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.preProcessSDNCGet(mex) }))
+       }
+       
+       
+       // ***** updateAaiAROrchStatus *****
+       
+       @Test
+//             @Ignore
+       public void updateAaiAROrchStatus() {
+               MockPatchAllottedResource(CUST, SVC, INST, ARID)
+               
+               ExecutionEntity mex = setupMock()
+               initUpdateAaiAROrchStatus(mex)
+                                       
+               DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+               DoCreateAllottedResourceTXC.updateAaiAROrchStatus(mex, "success")
+       }
+       
+       
+       // ***** generateOutputs *****
+       
+       @Test
+//             @Ignore
+       public void generateOutputs() {
+               ExecutionEntity mex = setupMock()
+               def txctop = FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceTXC/SDNCTopologyQueryCallback.xml")
+               
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("enhancedCallbackRequestData")).thenReturn(txctop)
+               
+               DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+               DoCreateAllottedResourceTXC.generateOutputs(mex)
+               
+               verify(mex).setVariable("allotedResourceName", "namefromrequest")
+               verify(mex).setVariable("vni", "my-vni")
+               verify(mex).setVariable("vgmuxBearerIP", "my-bearer-ip")
+               verify(mex).setVariable("vgmuxLanIP", "my-lan-ip")
+               
+       }
+       
+       @Test
+//             @Ignore
+       public void generateOutputs_BadXml() {
+               ExecutionEntity mex = setupMock()
+               
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("enhancedCallbackRequestData")).thenReturn("invalid xml")
+               
+               DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+               DoCreateAllottedResourceTXC.generateOutputs(mex)
+               
+               verify(mex, never()).setVariable(anyString(), anyString())
+               
+       }
+       
+       @Test
+//             @Ignore
+       public void generateOutputs_BpmnError() {
+               ExecutionEntity mex = setupMock()
+               
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("enhancedCallbackRequestData")).thenThrow(new BpmnError("expected exception"))
+               
+               DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+               
+               DoCreateAllottedResourceTXC.generateOutputs(mex)
+               verify(mex, never()).setVariable(anyString(), anyString())
+               
+       }
+       
+       @Test
+//             @Ignore
+       public void generateOutputs_Ex() {
+               ExecutionEntity mex = setupMock()
+               
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("enhancedCallbackRequestData")).thenThrow(new RuntimeException("expected exception"))
+               
+               DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+               
+               DoCreateAllottedResourceTXC.generateOutputs(mex)
+               verify(mex, never()).setVariable(anyString(), anyString())
+               
+       }
+       
+       
+       // ***** preProcessRollback *****
+       
+       @Test
+//             @Ignore
+       public void preProcessRollback() {
+               ExecutionEntity mex = setupMock()
+               WorkflowException wfe = mock(WorkflowException.class)
+               
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("WorkflowException")).thenReturn(wfe)
+               
+               DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+               DoCreateAllottedResourceTXC.preProcessRollback(mex)
+               
+               verify(mex).setVariable("prevWorkflowException", wfe)
+               
+       }
+       
+       @Test
+//             @Ignore
+       public void preProcessRollback_NotWFE() {
+               ExecutionEntity mex = setupMock()
+               
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("WorkflowException")).thenReturn("I'm not a WFE")
+               
+               DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+               DoCreateAllottedResourceTXC.preProcessRollback(mex)
+               
+//                     verify(mex, never()).setVariable("prevWorkflowException", any())
+               
+       }
+       
+       @Test
+//             @Ignore
+       public void preProcessRollback_BpmnError() {
+               ExecutionEntity mex = setupMock()
+               
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("WorkflowException")).thenThrow(new BpmnError("expected exception"))
+               
+               DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+               
+               DoCreateAllottedResourceTXC.preProcessRollback(mex)
+               
+       }
+       
+       @Test
+//             @Ignore
+       public void preProcessRollback_Ex() {
+               ExecutionEntity mex = setupMock()
+               
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception"))
+               
+               DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+               
+               DoCreateAllottedResourceTXC.preProcessRollback(mex)
+               
+       }
+       
+       
+       // ***** postProcessRollback *****
+       
+       @Test
+//             @Ignore
+       public void postProcessRollback() {
+               ExecutionEntity mex = setupMock()
+               WorkflowException wfe = mock(WorkflowException.class)
+               
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("prevWorkflowException")).thenReturn(wfe)
+               
+               DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+               DoCreateAllottedResourceTXC.postProcessRollback(mex)
+               
+               verify(mex).setVariable("WorkflowException", wfe)
+               verify(mex).setVariable("rollbackData", null)
+               
+       }
+       
+       @Test
+//             @Ignore
+       public void postProcessRollback_NotWFE() {
+               ExecutionEntity mex = setupMock()
+               
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("prevWorkflowException")).thenReturn("I'm not a WFE")
+               
+               DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+               DoCreateAllottedResourceTXC.postProcessRollback(mex)
+               
+//                     verify(mex, never()).setVariable("WorkflowException", any())
+               verify(mex).setVariable("rollbackData", null)
+               
+       }
+       
+       @Test
+//             @Ignore
+       public void postProcessRollback_BpmnError() {
+               ExecutionEntity mex = setupMock()
+               
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("prevWorkflowException")).thenThrow(new BpmnError("expected exception"))
+               
+               DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+               
+               assertTrue(doBpmnError({ _ -> DoCreateAllottedResourceTXC.postProcessRollback(mex) }))
+               verify(mex, never()).setVariable("rollbackData", null)
+               
+       }
+       
+       @Test
+//             @Ignore
+       public void postProcessRollback_Ex() {
+               ExecutionEntity mex = setupMock()
+               
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("prevWorkflowException")).thenThrow(new RuntimeException("expected exception"))
+               
+               DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+               
+               DoCreateAllottedResourceTXC.postProcessRollback(mex)
+               verify(mex, never()).setVariable("rollbackData", null)
+               
+       }
+       
+       private boolean checkMissingPreProcessRequest(String fieldnm) {
+               ExecutionEntity mex = setupMock()
+               initPreProcess(mex)
+                                                               
+               DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+               
+               when(mex.getVariable(fieldnm)).thenReturn("")
+               
+               return doBpmnError( { _ -> DoCreateAllottedResourceTXC.preProcessRequest(mex) })
+       }
+       
+       private void initPreProcess(ExecutionEntity mex) {
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("URN_mso_workflow_sdncadapter_callback")).thenReturn("sdncurn")
+               when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
+               when(mex.getVariable("parentServiceInstanceId")).thenReturn("psii")
+               when(mex.getVariable("allottedResourceModelInfo")).thenReturn("armi")
+               when(mex.getVariable("brgWanMacAddress")).thenReturn("bwma")
+               when(mex.getVariable("allottedResourceRole")).thenReturn("arr")
+               when(mex.getVariable("allottedResourceType")).thenReturn("art")
+       }
+       
+       private void initGetAaiAR(ExecutionEntity mex) {
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("allottedResourceType")).thenReturn("TXCt")
+               when(mex.getVariable("allottedResourceRole")).thenReturn("TXCr")
+               when(mex.getVariable("CSI_service")).thenReturn(FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceTXC/getAR.xml"))
+               when(mex.getVariable("URN_aai_endpoint")).thenReturn(aaiUriPfx)
+               when(mex.getVariable("aaiAROrchStatus")).thenReturn("Active")
+       }
+       
+       private initCreateAaiAr(ExecutionEntity mex) {                          
+               when(mex.getVariable("disableRollback")).thenReturn(45)
+               when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
+               when(mex.getVariable("parentServiceInstanceId")).thenReturn("psii")
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("allottedResourceId")).thenReturn(ARID)
+               when(mex.getVariable("URN_aai_endpoint")).thenReturn(aaiUriPfx)
+               when(mex.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn(urnProps.get("mso.workflow.global.default.aai.namespace"))
+               when(mex.getVariable("PSI_resourceLink")).thenReturn(aaiUriPfx + "/aai/v9/business/customers/customer/"+CUST+"/service-subscriptions/service-subscription/"+SVC+"/service-instances/service-instance/"+INST)
+               when(mex.getVariable("allottedResourceType")).thenReturn("TXCt")
+               when(mex.getVariable("allottedResourceRole")).thenReturn("TXCr")
+               when(mex.getVariable("CSI_resourceLink")).thenReturn(aaiUriPfx+"/aai/v9/mycsi")
+               when(mex.getVariable("allottedResourceModelInfo")).thenReturn("""
+                               {
+                                       "modelInvariantUuid":"modelinvuuid",
+                                       "modelUuid":"modeluuid",
+                                       "modelCustomizationUuid":"modelcustuuid"
+                               }
+                       """)
+       }
+       
+       private initBuildSDNCRequest(ExecutionEntity mex) {
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("allottedResourceId")).thenReturn("ari")
+               when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
+               when(mex.getVariable("parentServiceInstanceId")).thenReturn("psii")
+               when(mex.getVariable("sdncCallbackUrl")).thenReturn("scu")
+               when(mex.getVariable("msoRequestId")).thenReturn("mri")
+       }
+       
+       private RollbackData initPreProcessSDNC(ExecutionEntity mex) {
+               def data = new RollbackData()
+               
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("rollbackData")).thenReturn(data)
+               
+               return data
+       }
+       
+       private initPreProcessSDNCGet(ExecutionEntity mex) {
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("sdncCallbackUrl")).thenReturn("myurl")
+               when(mex.getVariable("foundActiveAR")).thenReturn(true)
+               when(mex.getVariable("aaiARGetResponse")).thenReturn("<selflink>arlink</selflink>")
+               when(mex.getVariable("sdncAssignResponse")).thenReturn("<response-data>&lt;object-path&gt;assignlink&lt;/object-path&gt;</response-data>")
+               when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
+               when(mex.getVariable("junitSleepMs")).thenReturn("5")
+               when(mex.getVariable("sdncCallbackUrl")).thenReturn("myurl")
+       }
+       
+       private RollbackData initValidateSDNCResp(ExecutionEntity mex) {
+               def data = new RollbackData()
+               
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("prefix")).thenReturn(Prefix)
+               when(mex.getVariable("SDNCA_SuccessIndicator")).thenReturn(true)
+               when(mex.getVariable("rollbackData")).thenReturn(data)
+               
+               return data
+       }
+       
+       private String initValidateSDNCResp_Resp() {
+               return "<response-data>&lt;response-code&gt;200&lt;/response-code&gt;</response-data>"
+       }
+       
+       private initUpdateAaiAROrchStatus(ExecutionEntity mex) {
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               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)
+       }\r
+               \r
+}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRGTest.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRGTest.groovy
new file mode 100644 (file)
index 0000000..f91a39c
--- /dev/null
@@ -0,0 +1,600 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.mso.bpmn.vcpe.scripts
+\r
+\r
+import org.camunda.bpm.engine.ProcessEngineServices\r
+import org.camunda.bpm.engine.RepositoryService\r
+import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity\r
+import org.camunda.bpm.engine.repository.ProcessDefinition\r
+import org.camunda.bpm.engine.runtime.Execution\r
+import org.junit.Before
+import org.junit.BeforeClass\r
+import org.junit.Rule\r
+import org.junit.Test
+import org.junit.Ignore\r
+import org.mockito.MockitoAnnotations
+import org.camunda.bpm.engine.delegate.BpmnError\r
+import org.openecomp.mso.bpmn.core.WorkflowException
+import org.openecomp.mso.bpmn.mock.FileUtil
+
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse
+import static com.github.tomakehurst.wiremock.client.WireMock.delete
+import static com.github.tomakehurst.wiremock.client.WireMock.get
+import static com.github.tomakehurst.wiremock.client.WireMock.patch
+import static com.github.tomakehurst.wiremock.client.WireMock.put
+import static com.github.tomakehurst.wiremock.client.WireMock.stubFor
+import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching
+import static org.junit.Assert.*;\r
+import static org.mockito.Mockito.*
+import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteAllottedResource
+import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetAllottedResource
+import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchAllottedResource
+import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockQueryAllottedResourceById
+
+import java.util.Map
+
+import org.openecomp.mso.bpmn.core.RollbackData
+import org.openecomp.mso.bpmn.vcpe.scripts.MapSetter
+
+import com.github.tomakehurst.wiremock.junit.WireMockRule\r
+\r
+class DoDeleteAllottedResourceBRGTest extends GroovyTestBase {\r
+       \r
+       @Rule\r
+       public WireMockRule wireMockRule = new WireMockRule(PORT)
+\r
+       String Prefix = "DDARBRG_"\r
+
+       @BeforeClass
+       public static void setUpBeforeClass() {
+               super.setUpBeforeClass()
+       }
+         \r
+    @Before\r
+       public void init()\r
+       {\r
+               MockitoAnnotations.initMocks(this)\r
+       }
+       
+       public DoDeleteAllottedResourceBRGTest() {
+               super("DoDeleteAllottedResourceBRG")
+       }
+       
+       
+       // ***** preProcessRequest *****\r
+                       \r
+       @Test\r
+//     @Ignore  \r
+       public void preProcessRequest() {\r
+               ExecutionEntity mex = setupMock()
+               initPreProcess(mex)
+               \r
+               DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()\r
+               DoDeleteAllottedResourceBRG.preProcessRequest(mex)\r
+\r
+               verify(mex).getVariable(DBGFLAG)\r
+               verify(mex).setVariable("prefix", Prefix)
+               verify(mex).setVariable("sdncCallbackUrl", "sdncurn")\r
+                               
+               assertTrue(checkMissingPreProcessRequest("URN_mso_workflow_sdncadapter_callback"))
+               assertTrue(checkMissingPreProcessRequest("serviceInstanceId"))
+               assertTrue(checkMissingPreProcessRequest("allottedResourceId"))\r
+       }
+                       
+       @Test
+//     @Ignore  
+       public void preProcessRequest_BpmnError() {
+               ExecutionEntity mex = setupMock()
+               initPreProcess(mex)
+               
+               when(mex.getVariable("serviceInstanceId")).thenThrow(new BpmnError("expected exception"))
+               
+               DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
+               
+               assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceBRG.preProcessRequest(mex) }))
+       }
+                       
+       @Test
+//     @Ignore  
+       public void preProcessRequest_Ex() {
+               ExecutionEntity mex = setupMock()
+               initPreProcess(mex)
+               
+               when(mex.getVariable("serviceInstanceId")).thenThrow(new RuntimeException("expected exception"))
+               
+               DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
+               
+               assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceBRG.preProcessRequest(mex) }))
+       }
+       
+       
+       // ***** getAaiAR *****
+       
+       @Test
+//     @Ignore
+       public void getAaiAR() {
+               MockQueryAllottedResourceById(ARID, "GenericFlows/getARUrlById.xml")
+               MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml")
+               
+               ExecutionEntity mex = setupMock()
+               initGetAaiAR(mex)
+               
+               DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
+               DoDeleteAllottedResourceBRG.getAaiAR(mex)
+               
+               verify(mex).setVariable("parentServiceInstanceId", INST)
+       }
+       
+       @Test
+//     @Ignore
+       public void getAaiAR_EmptyResponse() {
+               
+               // note: empty result-link
+               wireMockRule
+                       .stubFor(get(urlMatching("/aai/.*/search/.*"))
+                                       .willReturn(aResponse()
+                                               .withStatus(200)
+                                               .withHeader("Content-Type", "text/xml")
+                                               .withBody("<result-data></result-data>")))
+                       
+               MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml")
+               
+               ExecutionEntity mex = setupMock()
+               initGetAaiAR(mex)
+               
+               DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
+               
+               assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceBRG.getAaiAR(mex) }))
+       }
+       
+       
+       // ***** updateAaiAROrchStatus *****
+       
+       @Test
+//     @Ignore
+       public void updateAaiAROrchStatus() {
+               ExecutionEntity mex = setupMock()
+               initUpdateAaiAROrchStatus(mex)
+               
+               MockPatchAllottedResource(CUST, SVC, INST, ARID)
+                                       
+               DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
+               DoDeleteAllottedResourceBRG.updateAaiAROrchStatus(mex, "success")
+       }
+       
+       
+       // ***** buildSDNCRequest *****
+       
+       @Test
+//     @Ignore
+       public void buildSDNCRequest() {
+               ExecutionEntity mex = setupMock()
+               initBuildSDNCRequest(mex)
+               
+               DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
+               
+               String result = DoDeleteAllottedResourceBRG.buildSDNCRequest(mex, "myact", "myreq")
+               
+               assertTrue(result.indexOf("<sdncadapter:RequestId>myreq</") >= 0)
+               assertTrue(result.indexOf("<sdncadapter:SvcAction>myact</") >= 0)
+               assertTrue(result.indexOf("<allotted-resource-id>ari</") >= 0)
+               assertTrue(result.indexOf("<sdncadapter:SvcInstanceId>sii</") >= 0)
+               assertTrue(result.indexOf("<service-instance-id>psii</") >= 0)
+               assertTrue(result.indexOf("<parent-service-instance-id>psii</") >= 0)
+               assertTrue(result.indexOf("<sdncadapter:CallbackUrl>scu</") >= 0)
+               assertTrue(result.indexOf("<request-id>mri</") >= 0)
+               assertTrue(result.indexOf("<model-invariant-uuid/>") >= 0)
+               assertTrue(result.indexOf("<model-uuid/>") >= 0)
+               assertTrue(result.indexOf("<model-customization-uuid/>") >= 0)
+               assertTrue(result.indexOf("<model-version/>") >= 0)
+               assertTrue(result.indexOf("<model-name/>") >= 0)
+       }
+       
+       @Test
+//     @Ignore
+       public void buildSDNCRequest_Ex() {
+               ExecutionEntity mex = setupMock()
+               initBuildSDNCRequest(mex)
+               
+               when(mex.getVariable("allottedResourceId")).thenThrow(new RuntimeException("expected exception"))
+               
+               DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
+               
+               assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceBRG.buildSDNCRequest(mex, "myact", "myreq") }))
+       }
+       
+       
+       // ***** preProcessSDNCUnassign *****
+       
+       @Test
+//     @Ignore
+       public void preProcessSDNCUnassign() {
+               ExecutionEntity mex = setupMock()
+               def map = setupMap(mex)
+               initPreProcessSDNC(mex)
+                                       
+               DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
+               DoDeleteAllottedResourceBRG.preProcessSDNCUnassign(mex)
+               
+               def req = map.get("sdncUnassignRequest")
+               
+               assertTrue(req.indexOf("<sdncadapter:SvcAction>unassign</") >= 0)
+               assertTrue(req.indexOf("<request-action>DeleteBRGInstance</") >= 0)
+               assertTrue(req.indexOf("<sdncadapter:RequestId>") >= 0)
+       }
+       
+       @Test
+//     @Ignore
+       public void preProcessSDNCUnassign_BpmnError() {
+               ExecutionEntity mex = setupMock()
+               initPreProcessSDNC(mex)
+               
+               when(mex.getVariable("allottedResourceId")).thenThrow(new BpmnError("expected exception"))
+                                       
+               DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
+               
+               assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceBRG.preProcessSDNCUnassign(mex) }))
+       }
+       
+       @Test
+//     @Ignore
+       public void preProcessSDNCUnassign_Ex() {
+               ExecutionEntity mex = setupMock()
+               initPreProcessSDNC(mex)
+               
+               when(mex.getVariable("allottedResourceId")).thenThrow(new RuntimeException("expected exception"))
+                                       
+               DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
+               
+               assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceBRG.preProcessSDNCUnassign(mex) }))
+       }
+       
+       
+       // ***** preProcessSDNCDelete *****
+       
+       @Test
+//     @Ignore
+       public void preProcessSDNCDelete() {
+               ExecutionEntity mex = setupMock()
+               def map = setupMap(mex)
+               initPreProcessSDNC(mex)
+                                       
+               DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
+               DoDeleteAllottedResourceBRG.preProcessSDNCDelete(mex)
+               
+               def req = map.get("sdncDeleteRequest")
+               
+               assertTrue(req.indexOf("<sdncadapter:SvcAction>delete</") >= 0)
+               assertTrue(req.indexOf("<request-action>DeleteBRGInstance</") >= 0)
+               assertTrue(req.indexOf("<sdncadapter:RequestId>") >= 0)
+       }
+       
+       @Test
+//     @Ignore
+       public void preProcessSDNCDelete_BpmnError() {
+               ExecutionEntity mex = setupMock()
+               initPreProcessSDNC(mex)
+               
+               when(mex.getVariable("allottedResourceId")).thenThrow(new BpmnError("expected exception"))
+                                       
+               DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
+               
+               assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceBRG.preProcessSDNCDelete(mex) }))
+       }
+       
+       @Test
+//     @Ignore
+       public void preProcessSDNCDelete_Ex() {
+               ExecutionEntity mex = setupMock()
+               initPreProcessSDNC(mex)
+               
+               when(mex.getVariable("allottedResourceId")).thenThrow(new RuntimeException("expected exception"))
+                                       
+               DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
+               
+               assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceBRG.preProcessSDNCDelete(mex) }))
+       }
+       
+       
+       // ***** preProcessSDNCDeactivate *****
+       
+       @Test
+//     @Ignore
+       public void preProcessSDNCDeactivate() {
+               ExecutionEntity mex = setupMock()
+               def map = setupMap(mex)
+               initPreProcessSDNC(mex)
+                                       
+               DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
+               DoDeleteAllottedResourceBRG.preProcessSDNCDeactivate(mex)
+               
+               def req = map.get("sdncDeactivateRequest")
+               
+               assertTrue(req.indexOf("<sdncadapter:SvcAction>deactivate</") >= 0)
+               assertTrue(req.indexOf("<request-action>DeleteBRGInstance</") >= 0)
+               assertTrue(req.indexOf("<sdncadapter:RequestId>") >= 0)
+       }
+       
+       @Test
+//     @Ignore
+       public void preProcessSDNCDeactivate_BpmnError() {
+               ExecutionEntity mex = setupMock()
+               initPreProcessSDNC(mex)
+               
+               when(mex.getVariable("allottedResourceId")).thenThrow(new BpmnError("expected exception"))
+                                       
+               DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
+               
+               assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceBRG.preProcessSDNCDeactivate(mex) }))
+       }
+       
+       @Test
+//     @Ignore
+       public void preProcessSDNCDeactivate_Ex() {
+               ExecutionEntity mex = setupMock()
+               initPreProcessSDNC(mex)
+               
+               when(mex.getVariable("allottedResourceId")).thenThrow(new RuntimeException("expected exception"))
+                                       
+               DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
+               
+               assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceBRG.preProcessSDNCDeactivate(mex) }))
+       }
+       
+       
+       // ***** validateSDNCResp *****
+       
+       @Test
+//     @Ignore
+       public void validateSDNCResp() {
+               ExecutionEntity mex = setupMock()
+               def data = initValidateSDNCResp(mex)
+               def resp = initValidateSDNCResp_Resp(200)
+               
+               when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(true)
+               
+               DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
+               
+               DoDeleteAllottedResourceBRG.validateSDNCResp(mex, resp, "create")
+               
+               verify(mex).getVariable("WorkflowException")
+               verify(mex).getVariable("SDNCA_SuccessIndicator")               
+               verify(mex).getVariable(Prefix+"sdncResponseSuccess")
+               
+               verify(mex, never()).getVariable(Prefix + "sdncRequestDataResponseCode")
+               verify(mex, never()).setVariable("wasDeleted", false)
+       }
+       
+       @Test
+//     @Ignore
+       public void validateSDNCResp_Fail404_Deactivate_FailNotFound() {
+               ExecutionEntity mex = setupMock()
+               def data = initValidateSDNCResp(mex)
+               
+               def resp = initValidateSDNCResp_Resp(404)
+               when(mex.getVariable(Prefix+"sdncRequestDataResponseCode")).thenReturn("404")
+               when(mex.getVariable("failNotFound")).thenReturn("true")
+               
+               DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
+               
+               assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceBRG.validateSDNCResp(mex, resp, "deactivate")}))
+       }
+       
+       @Test
+//     @Ignore
+       public void validateSDNCResp_Fail404_Deactivate() {
+               ExecutionEntity mex = setupMock()
+               def data = initValidateSDNCResp(mex)
+               
+               def resp = initValidateSDNCResp_Resp(404)
+               when(mex.getVariable(Prefix+"sdncRequestDataResponseCode")).thenReturn("404")
+               
+               DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
+               
+               DoDeleteAllottedResourceBRG.validateSDNCResp(mex, resp, "deactivate")
+               
+               verify(mex).setVariable("ARNotFoundInSDNC", true)
+               verify(mex).setVariable("wasDeleted", false)
+       }
+       
+       @Test
+//     @Ignore
+       public void validateSDNCResp_Fail404() {
+               ExecutionEntity mex = setupMock()
+               def data = initValidateSDNCResp(mex)
+               
+               def resp = initValidateSDNCResp_Resp(404)
+               when(mex.getVariable(Prefix+"sdncRequestDataResponseCode")).thenReturn("404")
+               
+               DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
+               
+               assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceBRG.validateSDNCResp(mex, resp, "create")}))
+       }
+       
+       @Test
+//     @Ignore
+       public void validateSDNCResp_Deactivate() {
+               ExecutionEntity mex = setupMock()
+               def data = initValidateSDNCResp(mex)
+               def resp = initValidateSDNCResp_Resp(200)
+               
+               DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
+               
+               assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceBRG.validateSDNCResp(mex, resp, "deactivate")}))
+       }
+       
+       @Test
+//     @Ignore
+       public void validateSDNCResp_BpmnError() {
+               ExecutionEntity mex = setupMock()
+               initValidateSDNCResp(mex)
+               def resp = initValidateSDNCResp_Resp(200)
+               
+               when(mex.getVariable("WorkflowException")).thenThrow(new BpmnError("expected exception"))
+               
+               DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
+               
+               assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceBRG.validateSDNCResp(mex, resp, "create") }))
+       }
+       
+       @Test
+//     @Ignore
+       public void validateSDNCResp_Ex() {
+               ExecutionEntity mex = setupMock()
+               initValidateSDNCResp(mex)
+               def resp = initValidateSDNCResp_Resp(200)
+               
+               when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception"))
+               
+               DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
+               
+               assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceBRG.validateSDNCResp(mex, resp, "create") }))
+       }
+                       
+       @Test
+//     @Ignore  
+       public void deleteAaiAR() {
+               ExecutionEntity mex = setupMock()
+               initDeleteAaiAR(mex)
+               
+               MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml")
+               MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS)
+               
+               DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
+               DoDeleteAllottedResourceBRG.deleteAaiAR(mex)
+       }
+                       
+       @Test
+//     @Ignore  
+       public void deleteAaiAR_NoArPath() {
+               ExecutionEntity mex = setupMock()
+               initDeleteAaiAR(mex)
+               
+               MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml")
+               MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS)
+                       
+               when(mex.getVariable("aaiARPath")).thenReturn("")
+               
+               DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
+               
+               assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceBRG.deleteAaiAR(mex) }))
+       }
+                       
+       @Test
+//     @Ignore  
+       public void deleteAaiAR_BpmnError() {
+               ExecutionEntity mex = setupMock()
+               initDeleteAaiAR(mex)
+               
+               MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml")
+               MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS)
+                       
+               when(mex.getVariable("aaiARPath")).thenThrow(new BpmnError("expected exception"))
+               
+               DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
+               
+               assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceBRG.deleteAaiAR(mex) }))
+       }
+                       
+       @Test
+//     @Ignore  
+       public void deleteAaiAR_Ex() {
+               ExecutionEntity mex = setupMock()
+               initDeleteAaiAR(mex)
+               
+               MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml")
+               MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS)
+                       
+               when(mex.getVariable("aaiARPath")).thenThrow(new RuntimeException("expected exception"))
+               
+               DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
+               
+               assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceBRG.deleteAaiAR(mex) }))
+       }
+       
+       private boolean checkMissingPreProcessRequest(String fieldnm) {
+               ExecutionEntity mex = setupMock()
+               initPreProcess(mex)
+                                                               
+               DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
+               
+               when(mex.getVariable(fieldnm)).thenReturn("")
+               
+               return doBpmnError( { _ -> DoDeleteAllottedResourceBRG.preProcessRequest(mex) })
+       }
+       
+       private void initPreProcess(ExecutionEntity mex) {
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("URN_mso_workflow_sdncadapter_callback")).thenReturn("sdncurn")
+               when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
+               when(mex.getVariable("allottedResourceId")).thenReturn("ari")
+       }
+       
+       private void initGetAaiAR(ExecutionEntity mex) {
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("allottedResourceType")).thenReturn("BRG")
+               when(mex.getVariable("allottedResourceRole")).thenReturn("BRG")
+               when(mex.getVariable("allottedResourceId")).thenReturn(ARID)
+               when(mex.getVariable("CSI_service")).thenReturn(FileUtil.readResourceFile("__files/VCPE/DoDeleteAllottedResourceBRG/getAR.xml"))
+               when(mex.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn(urnProps.get("mso.workflow.global.default.aai.namespace"))
+               when(mex.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn(urnProps.get("mso.workflow.global.default.aai.version"))
+               when(mex.getVariable("URN_mso_workflow_default_aai_v8_nodes_query_uri")).thenReturn(urnProps.get("mso.workflow.default.aai.v8.nodes-query.uri"))
+               when(mex.getVariable("URN_aai_endpoint")).thenReturn(aaiUriPfx)
+               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)
+               when(mex.getVariable("aaiAROrchStatus")).thenReturn("Active")
+       }
+       
+       private initUpdateAaiAROrchStatus(ExecutionEntity mex) {
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               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)
+       }
+       
+       private initBuildSDNCRequest(ExecutionEntity mex) {
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("allottedResourceId")).thenReturn("ari")
+               when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
+               when(mex.getVariable("parentServiceInstanceId")).thenReturn("psii")
+               when(mex.getVariable("sdncCallbackUrl")).thenReturn("scu")
+               when(mex.getVariable("msoRequestId")).thenReturn("mri")
+       }
+       
+       private initPreProcessSDNC(ExecutionEntity mex) {
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+       }
+       
+       private initValidateSDNCResp(ExecutionEntity mex) {
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("prefix")).thenReturn(Prefix)
+               when(mex.getVariable("SDNCA_SuccessIndicator")).thenReturn(true)
+       }
+       
+       private String initValidateSDNCResp_Resp(int code) {
+               return "<response-data>&lt;response-code&gt;${code}&lt;/response-code&gt;</response-data>"
+       }
+       
+       private initDeleteAaiAR(ExecutionEntity mex) {
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               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)
+               when(mex.getVariable("aaiARResourceVersion")).thenReturn("myvers")
+               when(mex.getVariable("URN_aai_endpoint")).thenReturn(aaiUriPfx)
+       }\r
+               \r
+}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXCTest.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXCTest.groovy
new file mode 100644 (file)
index 0000000..97f714d
--- /dev/null
@@ -0,0 +1,600 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.mso.bpmn.vcpe.scripts
+
+
+import org.camunda.bpm.engine.ProcessEngineServices
+import org.camunda.bpm.engine.RepositoryService
+import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
+import org.camunda.bpm.engine.repository.ProcessDefinition
+import org.camunda.bpm.engine.runtime.Execution
+import org.junit.Before
+import org.junit.BeforeClass
+import org.junit.Rule
+import org.junit.Test
+import org.junit.Ignore
+import org.mockito.MockitoAnnotations
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.openecomp.mso.bpmn.core.WorkflowException
+import org.openecomp.mso.bpmn.mock.FileUtil
+
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse
+import static com.github.tomakehurst.wiremock.client.WireMock.delete
+import static com.github.tomakehurst.wiremock.client.WireMock.get
+import static com.github.tomakehurst.wiremock.client.WireMock.patch
+import static com.github.tomakehurst.wiremock.client.WireMock.put
+import static com.github.tomakehurst.wiremock.client.WireMock.stubFor
+import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.*
+import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteAllottedResource
+import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetAllottedResource
+import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchAllottedResource
+import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockQueryAllottedResourceById
+
+import java.util.Map
+
+import org.openecomp.mso.bpmn.core.RollbackData
+import org.openecomp.mso.bpmn.vcpe.scripts.MapSetter
+
+import com.github.tomakehurst.wiremock.junit.WireMockRule
+
+class DoDeleteAllottedResourceTXCTest extends GroovyTestBase {
+       
+       @Rule
+       public WireMockRule wireMockRule = new WireMockRule(PORT)
+
+       String Prefix = "DDARTXC_"
+
+       @BeforeClass
+       public static void setUpBeforeClass() {
+               super.setUpBeforeClass()
+       }
+         
+    @Before
+       public void init()
+       {
+               MockitoAnnotations.initMocks(this)
+       }
+       
+       public DoDeleteAllottedResourceTXCTest() {
+               super("DoDeleteAllottedResourceTXC")
+       }
+       
+       
+       // ***** preProcessRequest *****
+                       
+       @Test
+//     @Ignore  
+       public void preProcessRequest() {
+               ExecutionEntity mex = setupMock()
+               initPreProcess(mex)
+               
+               DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
+               DoDeleteAllottedResourceTXC.preProcessRequest(mex)
+
+               verify(mex).getVariable(DBGFLAG)
+               verify(mex).setVariable("prefix", Prefix)
+               verify(mex).setVariable("sdncCallbackUrl", "sdncurn")
+                               
+               assertTrue(checkMissingPreProcessRequest("URN_mso_workflow_sdncadapter_callback"))
+               assertTrue(checkMissingPreProcessRequest("serviceInstanceId"))
+               assertTrue(checkMissingPreProcessRequest("allottedResourceId"))
+       }
+                       
+       @Test
+//     @Ignore  
+       public void preProcessRequest_BpmnError() {
+               ExecutionEntity mex = setupMock()
+               initPreProcess(mex)
+               
+               when(mex.getVariable("serviceInstanceId")).thenThrow(new BpmnError("expected exception"))
+               
+               DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
+               
+               assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceTXC.preProcessRequest(mex) }))
+       }
+                       
+       @Test
+//     @Ignore  
+       public void preProcessRequest_Ex() {
+               ExecutionEntity mex = setupMock()
+               initPreProcess(mex)
+               
+               when(mex.getVariable("serviceInstanceId")).thenThrow(new RuntimeException("expected exception"))
+               
+               DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
+               
+               assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceTXC.preProcessRequest(mex) }))
+       }
+       
+       
+       // ***** getAaiAR *****
+       
+       @Test
+//     @Ignore
+       public void getAaiAR() {
+               MockQueryAllottedResourceById(ARID, "GenericFlows/getARUrlById.xml")
+               MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml")
+               
+               ExecutionEntity mex = setupMock()
+               initGetAaiAR(mex)
+               
+               DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
+               DoDeleteAllottedResourceTXC.getAaiAR(mex)
+               
+               verify(mex).setVariable("parentServiceInstanceId", INST)
+       }
+       
+       @Test
+//     @Ignore
+       public void getAaiAR_EmptyResponse() {
+               
+               // note: empty result-link
+               wireMockRule
+                       .stubFor(get(urlMatching("/aai/.*/search/.*"))
+                                       .willReturn(aResponse()
+                                               .withStatus(200)
+                                               .withHeader("Content-Type", "text/xml")
+                                               .withBody("<result-data></result-data>")))
+                       
+               MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml")
+               
+               ExecutionEntity mex = setupMock()
+               initGetAaiAR(mex)
+               
+               DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
+               
+               assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceTXC.getAaiAR(mex) }))
+       }
+       
+       
+       // ***** updateAaiAROrchStatus *****
+       
+       @Test
+//     @Ignore
+       public void updateAaiAROrchStatus() {
+               ExecutionEntity mex = setupMock()
+               initUpdateAaiAROrchStatus(mex)
+               
+               MockPatchAllottedResource(CUST, SVC, INST, ARID)
+                                       
+               DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
+               DoDeleteAllottedResourceTXC.updateAaiAROrchStatus(mex, "success")
+       }
+       
+       
+       // ***** buildSDNCRequest *****
+       
+       @Test
+//     @Ignore
+       public void buildSDNCRequest() {
+               ExecutionEntity mex = setupMock()
+               initBuildSDNCRequest(mex)
+               
+               DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
+               
+               String result = DoDeleteAllottedResourceTXC.buildSDNCRequest(mex, "myact", "myreq")
+               
+               assertTrue(result.indexOf("<sdncadapter:RequestId>myreq</") >= 0)
+               assertTrue(result.indexOf("<sdncadapter:SvcAction>myact</") >= 0)
+               assertTrue(result.indexOf("<allotted-resource-id>ari</") >= 0)
+               assertTrue(result.indexOf("<sdncadapter:SvcInstanceId>sii</") >= 0)
+               assertTrue(result.indexOf("<service-instance-id>psii</") >= 0)
+               assertTrue(result.indexOf("<parent-service-instance-id>psii</") >= 0)
+               assertTrue(result.indexOf("<sdncadapter:CallbackUrl>scu</") >= 0)
+               assertTrue(result.indexOf("<request-id>mri</") >= 0)
+               assertTrue(result.indexOf("<model-invariant-uuid/>") >= 0)
+               assertTrue(result.indexOf("<model-uuid/>") >= 0)
+               assertTrue(result.indexOf("<model-customization-uuid/>") >= 0)
+               assertTrue(result.indexOf("<model-version/>") >= 0)
+               assertTrue(result.indexOf("<model-name/>") >= 0)
+       }
+       
+       @Test
+//     @Ignore
+       public void buildSDNCRequest_Ex() {
+               ExecutionEntity mex = setupMock()
+               initBuildSDNCRequest(mex)
+               
+               when(mex.getVariable("allottedResourceId")).thenThrow(new RuntimeException("expected exception"))
+               
+               DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
+               
+               assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceTXC.buildSDNCRequest(mex, "myact", "myreq") }))
+       }
+       
+       
+       // ***** preProcessSDNCUnassign *****
+       
+       @Test
+//     @Ignore
+       public void preProcessSDNCUnassign() {
+               ExecutionEntity mex = setupMock()
+               def map = setupMap(mex)
+               initPreProcessSDNC(mex)
+                                       
+               DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
+               DoDeleteAllottedResourceTXC.preProcessSDNCUnassign(mex)
+               
+               def req = map.get("sdncUnassignRequest")
+               
+               assertTrue(req.indexOf("<sdncadapter:SvcAction>unassign</") >= 0)
+               assertTrue(req.indexOf("<request-action>DeleteTunnelXConnInstance</") >= 0)
+               assertTrue(req.indexOf("<sdncadapter:RequestId>") >= 0)
+       }
+       
+       @Test
+//     @Ignore
+       public void preProcessSDNCUnassign_BpmnError() {
+               ExecutionEntity mex = setupMock()
+               initPreProcessSDNC(mex)
+               
+               when(mex.getVariable("allottedResourceId")).thenThrow(new BpmnError("expected exception"))
+                                       
+               DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
+               
+               assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceTXC.preProcessSDNCUnassign(mex) }))
+       }
+       
+       @Test
+//     @Ignore
+       public void preProcessSDNCUnassign_Ex() {
+               ExecutionEntity mex = setupMock()
+               initPreProcessSDNC(mex)
+               
+               when(mex.getVariable("allottedResourceId")).thenThrow(new RuntimeException("expected exception"))
+                                       
+               DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
+               
+               assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceTXC.preProcessSDNCUnassign(mex) }))
+       }
+       
+       
+       // ***** preProcessSDNCDelete *****
+       
+       @Test
+//     @Ignore
+       public void preProcessSDNCDelete() {
+               ExecutionEntity mex = setupMock()
+               def map = setupMap(mex)
+               initPreProcessSDNC(mex)
+                                       
+               DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
+               DoDeleteAllottedResourceTXC.preProcessSDNCDelete(mex)
+               
+               def req = map.get("sdncDeleteRequest")
+               
+               assertTrue(req.indexOf("<sdncadapter:SvcAction>delete</") >= 0)
+               assertTrue(req.indexOf("<request-action>DeleteTunnelXConnInstance</") >= 0)
+               assertTrue(req.indexOf("<sdncadapter:RequestId>") >= 0)
+       }
+       
+       @Test
+//     @Ignore
+       public void preProcessSDNCDelete_BpmnError() {
+               ExecutionEntity mex = setupMock()
+               initPreProcessSDNC(mex)
+               
+               when(mex.getVariable("allottedResourceId")).thenThrow(new BpmnError("expected exception"))
+                                       
+               DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
+               
+               assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceTXC.preProcessSDNCDelete(mex) }))
+       }
+       
+       @Test
+//     @Ignore
+       public void preProcessSDNCDelete_Ex() {
+               ExecutionEntity mex = setupMock()
+               initPreProcessSDNC(mex)
+               
+               when(mex.getVariable("allottedResourceId")).thenThrow(new RuntimeException("expected exception"))
+                                       
+               DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
+               
+               assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceTXC.preProcessSDNCDelete(mex) }))
+       }
+       
+       
+       // ***** preProcessSDNCDeactivate *****
+       
+       @Test
+//     @Ignore
+       public void preProcessSDNCDeactivate() {
+               ExecutionEntity mex = setupMock()
+               def map = setupMap(mex)
+               initPreProcessSDNC(mex)
+                                       
+               DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
+               DoDeleteAllottedResourceTXC.preProcessSDNCDeactivate(mex)
+               
+               def req = map.get("sdncDeactivateRequest")
+               
+               assertTrue(req.indexOf("<sdncadapter:SvcAction>deactivate</") >= 0)
+               assertTrue(req.indexOf("<request-action>DeleteTunnelXConnInstance</") >= 0)
+               assertTrue(req.indexOf("<sdncadapter:RequestId>") >= 0)
+       }
+       
+       @Test
+//     @Ignore
+       public void preProcessSDNCDeactivate_BpmnError() {
+               ExecutionEntity mex = setupMock()
+               initPreProcessSDNC(mex)
+               
+               when(mex.getVariable("allottedResourceId")).thenThrow(new BpmnError("expected exception"))
+                                       
+               DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
+               
+               assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceTXC.preProcessSDNCDeactivate(mex) }))
+       }
+       
+       @Test
+//     @Ignore
+       public void preProcessSDNCDeactivate_Ex() {
+               ExecutionEntity mex = setupMock()
+               initPreProcessSDNC(mex)
+               
+               when(mex.getVariable("allottedResourceId")).thenThrow(new RuntimeException("expected exception"))
+                                       
+               DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
+               
+               assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceTXC.preProcessSDNCDeactivate(mex) }))
+       }
+       
+       
+       // ***** validateSDNCResp *****
+       
+       @Test
+//     @Ignore
+       public void validateSDNCResp() {
+               ExecutionEntity mex = setupMock()
+               def data = initValidateSDNCResp(mex)
+               def resp = initValidateSDNCResp_Resp(200)
+               
+               when(mex.getVariable(Prefix+"sdncResponseSuccess")).thenReturn(true)
+               
+               DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
+               
+               DoDeleteAllottedResourceTXC.validateSDNCResp(mex, resp, "create")
+               
+               verify(mex).getVariable("WorkflowException")
+               verify(mex).getVariable("SDNCA_SuccessIndicator")               
+               verify(mex).getVariable(Prefix+"sdncResponseSuccess")
+               
+               verify(mex, never()).getVariable(Prefix + "sdncRequestDataResponseCode")
+               verify(mex, never()).setVariable("wasDeleted", false)
+       }
+       
+       @Test
+//     @Ignore
+       public void validateSDNCResp_Fail404_Deactivate_FailNotFound() {
+               ExecutionEntity mex = setupMock()
+               def data = initValidateSDNCResp(mex)
+               
+               def resp = initValidateSDNCResp_Resp(404)
+               when(mex.getVariable(Prefix+"sdncRequestDataResponseCode")).thenReturn("404")
+               when(mex.getVariable("failNotFound")).thenReturn("true")
+               
+               DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
+               
+               assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceTXC.validateSDNCResp(mex, resp, "deactivate")}))
+       }
+       
+       @Test
+//     @Ignore
+       public void validateSDNCResp_Fail404_Deactivate() {
+               ExecutionEntity mex = setupMock()
+               def data = initValidateSDNCResp(mex)
+               
+               def resp = initValidateSDNCResp_Resp(404)
+               when(mex.getVariable(Prefix+"sdncRequestDataResponseCode")).thenReturn("404")
+               
+               DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
+               
+               DoDeleteAllottedResourceTXC.validateSDNCResp(mex, resp, "deactivate")
+               
+               verify(mex).setVariable("ARNotFoundInSDNC", true)
+               verify(mex).setVariable("wasDeleted", false)
+       }
+       
+       @Test
+//     @Ignore
+       public void validateSDNCResp_Fail404() {
+               ExecutionEntity mex = setupMock()
+               def data = initValidateSDNCResp(mex)
+               
+               def resp = initValidateSDNCResp_Resp(404)
+               when(mex.getVariable(Prefix+"sdncRequestDataResponseCode")).thenReturn("404")
+               
+               DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
+               
+               assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceTXC.validateSDNCResp(mex, resp, "create")}))
+       }
+       
+       @Test
+//     @Ignore
+       public void validateSDNCResp_Deactivate() {
+               ExecutionEntity mex = setupMock()
+               def data = initValidateSDNCResp(mex)
+               def resp = initValidateSDNCResp_Resp(200)
+               
+               DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
+               
+               assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceTXC.validateSDNCResp(mex, resp, "deactivate")}))
+       }
+       
+       @Test
+//     @Ignore
+       public void validateSDNCResp_BpmnError() {
+               ExecutionEntity mex = setupMock()
+               initValidateSDNCResp(mex)
+               def resp = initValidateSDNCResp_Resp(200)
+               
+               when(mex.getVariable("WorkflowException")).thenThrow(new BpmnError("expected exception"))
+               
+               DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
+               
+               assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceTXC.validateSDNCResp(mex, resp, "create") }))
+       }
+       
+       @Test
+//     @Ignore
+       public void validateSDNCResp_Ex() {
+               ExecutionEntity mex = setupMock()
+               initValidateSDNCResp(mex)
+               def resp = initValidateSDNCResp_Resp(200)
+               
+               when(mex.getVariable("WorkflowException")).thenThrow(new RuntimeException("expected exception"))
+               
+               DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
+               
+               assertTrue(doBpmnError({ _ -> DoDeleteAllottedResourceTXC.validateSDNCResp(mex, resp, "create") }))
+       }
+                       
+       @Test
+//     @Ignore  
+       public void deleteAaiAR() {
+               ExecutionEntity mex = setupMock()
+               initDeleteAaiAR(mex)
+               
+               MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml")
+               MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS)
+               
+               DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
+               DoDeleteAllottedResourceTXC.deleteAaiAR(mex)
+       }
+                       
+       @Test
+//     @Ignore  
+       public void deleteAaiAR_NoArPath() {
+               ExecutionEntity mex = setupMock()
+               initDeleteAaiAR(mex)
+               
+               MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml")
+               MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS)
+                       
+               when(mex.getVariable("aaiARPath")).thenReturn("")
+               
+               DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
+               
+               assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceTXC.deleteAaiAR(mex) }))
+       }
+                       
+       @Test
+//     @Ignore  
+       public void deleteAaiAR_BpmnError() {
+               ExecutionEntity mex = setupMock()
+               initDeleteAaiAR(mex)
+               
+               MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml")
+               MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS)
+                       
+               when(mex.getVariable("aaiARPath")).thenThrow(new BpmnError("expected exception"))
+               
+               DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
+               
+               assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceTXC.deleteAaiAR(mex) }))
+       }
+                       
+       @Test
+//     @Ignore  
+       public void deleteAaiAR_Ex() {
+               ExecutionEntity mex = setupMock()
+               initDeleteAaiAR(mex)
+               
+               MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml")
+               MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS)
+                       
+               when(mex.getVariable("aaiARPath")).thenThrow(new RuntimeException("expected exception"))
+               
+               DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
+               
+               assertTrue(doBpmnError( { _ -> DoDeleteAllottedResourceTXC.deleteAaiAR(mex) }))
+       }
+       
+       private boolean checkMissingPreProcessRequest(String fieldnm) {
+               ExecutionEntity mex = setupMock()
+               initPreProcess(mex)
+                                                               
+               DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC()
+               
+               when(mex.getVariable(fieldnm)).thenReturn("")
+               
+               return doBpmnError( { _ -> DoDeleteAllottedResourceTXC.preProcessRequest(mex) })
+       }
+       
+       private void initPreProcess(ExecutionEntity mex) {
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("URN_mso_workflow_sdncadapter_callback")).thenReturn("sdncurn")
+               when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
+               when(mex.getVariable("allottedResourceId")).thenReturn("ari")
+       }
+       
+       private void initGetAaiAR(ExecutionEntity mex) {
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("allottedResourceType")).thenReturn("TXC")
+               when(mex.getVariable("allottedResourceRole")).thenReturn("TXC")
+               when(mex.getVariable("allottedResourceId")).thenReturn(ARID)
+               when(mex.getVariable("CSI_service")).thenReturn(FileUtil.readResourceFile("__files/VCPE/DoDeleteAllottedResourceTXC/getAR.xml"))
+               when(mex.getVariable("URN_mso_workflow_global_default_aai_namespace")).thenReturn(urnProps.get("mso.workflow.global.default.aai.namespace"))
+               when(mex.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn(urnProps.get("mso.workflow.global.default.aai.version"))
+               when(mex.getVariable("URN_mso_workflow_default_aai_v8_nodes_query_uri")).thenReturn(urnProps.get("mso.workflow.default.aai.v8.nodes-query.uri"))
+               when(mex.getVariable("URN_aai_endpoint")).thenReturn(aaiUriPfx)
+               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)
+               when(mex.getVariable("aaiAROrchStatus")).thenReturn("Active")
+       }
+       
+       private initUpdateAaiAROrchStatus(ExecutionEntity mex) {
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               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)
+       }
+       
+       private initBuildSDNCRequest(ExecutionEntity mex) {
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("allottedResourceId")).thenReturn("ari")
+               when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
+               when(mex.getVariable("parentServiceInstanceId")).thenReturn("psii")
+               when(mex.getVariable("sdncCallbackUrl")).thenReturn("scu")
+               when(mex.getVariable("msoRequestId")).thenReturn("mri")
+       }
+       
+       private initPreProcessSDNC(ExecutionEntity mex) {
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+       }
+       
+       private initValidateSDNCResp(ExecutionEntity mex) {
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               when(mex.getVariable("prefix")).thenReturn(Prefix)
+               when(mex.getVariable("SDNCA_SuccessIndicator")).thenReturn(true)
+       }
+       
+       private String initValidateSDNCResp_Resp(int code) {
+               return "<response-data>&lt;response-code&gt;${code}&lt;/response-code&gt;</response-data>"
+       }
+       
+       private initDeleteAaiAR(ExecutionEntity mex) {
+               when(mex.getVariable(DBGFLAG)).thenReturn("true")
+               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)
+               when(mex.getVariable("aaiARResourceVersion")).thenReturn("myvers")
+               when(mex.getVariable("URN_aai_endpoint")).thenReturn(aaiUriPfx)
+       }
+               
+}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/GroovyTestBase.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/GroovyTestBase.groovy
new file mode 100644 (file)
index 0000000..121583e
--- /dev/null
@@ -0,0 +1,124 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.mso.bpmn.vcpe.scripts
+\r
+\r
+import org.camunda.bpm.engine.ProcessEngineServices\r
+import org.camunda.bpm.engine.RepositoryService\r
+import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity\r
+import org.camunda.bpm.engine.repository.ProcessDefinition\r
+import org.camunda.bpm.engine.runtime.Execution\r
+import org.junit.Before
+import org.junit.BeforeClass\r
+import org.junit.Rule\r
+import org.junit.Test
+import org.junit.Ignore\r
+import org.mockito.MockitoAnnotations
+import org.camunda.bpm.engine.delegate.BpmnError\r
+import org.openecomp.mso.bpmn.core.WorkflowException
+import org.openecomp.mso.bpmn.mock.FileUtil
+
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse
+import static com.github.tomakehurst.wiremock.client.WireMock.get
+import static com.github.tomakehurst.wiremock.client.WireMock.patch
+import static com.github.tomakehurst.wiremock.client.WireMock.put
+import static com.github.tomakehurst.wiremock.client.WireMock.stubFor
+import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching
+import static org.junit.Assert.*;\r
+import static org.mockito.Mockito.*
+import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetAllottedResource
+import org.openecomp.mso.bpmn.core.RollbackData
+import org.openecomp.mso.bpmn.vcpe.scripts.MapSetter
+
+import com.github.tomakehurst.wiremock.junit.WireMockRule\r
+\r
+class GroovyTestBase {
+       
+       static final int PORT = 28090
+       static final String LOCAL_URI = "http://localhost:" + PORT
+       
+       static final String CUST = "SDN-ETHERNET-INTERNET"
+       static final String SVC = "123456789"
+       static final String INST = "MIS%252F1604%252F0026%252FSW_INTERNET"
+       static final String ARID = "arId-1"
+       static final String VERS = "myvers"
+       
+       static final String DBGFLAG = "isDebugLogEnabled"\r
+       
+       static Properties urnProps = new Properties()
+       static String aaiUriPfx
+       
+       String processName\r
+
+       public static void setUpBeforeClass() {
+               def fr = new FileReader("src/test/resources/mso.bpmn.urn.properties")
+               urnProps.load(fr)
+               fr.close()
+               
+               aaiUriPfx = urnProps.get("aai.endpoint")
+       }
+       
+       public GroovyTestBase(String processName) {
+               this.processName = processName
+       }
+       
+       public boolean doBpmnError(def func) {
+               
+               try {
+                       func()
+                       return false;
+                       
+               } catch(BpmnError e) {
+                       return true;
+               }
+       }\r
+       \r
+       public ExecutionEntity setupMock() {\r
+               \r
+               ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class)\r
+               when(mockProcessDefinition.getKey()).thenReturn(processName)\r
+               RepositoryService mockRepositoryService = mock(RepositoryService.class)\r
+               when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition)\r
+               when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn(processName)\r
+               when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100")\r
+               ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class)\r
+               when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService)\r
+               \r
+               ExecutionEntity mex = mock(ExecutionEntity.class)\r
+               \r
+               when(mex.getId()).thenReturn("100")\r
+               when(mex.getProcessDefinitionId()).thenReturn(processName)\r
+               when(mex.getProcessInstanceId()).thenReturn(processName)\r
+               when(mex.getProcessEngineServices()).thenReturn(mockProcessEngineServices)\r
+               when(mex.getProcessEngineServices().getRepositoryService().getProcessDefinition(mex.getProcessDefinitionId())).thenReturn(mockProcessDefinition)
+               
+               when(mex.getVariable("isAsyncProcess")).thenReturn("true")
+               when(mex.getVariable(processName+"WorkflowResponseSent")).thenReturn("false")\r
+               \r
+               return mex\r
+       }
+       
+       public Map<String,Object> setupMap(ExecutionEntity mex) {
+               MapSetter mapset = new MapSetter();
+               doAnswer(mapset).when(mex).setVariable(any(), any())
+               return mapset.getMap();
+       }\r
+               \r
+}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/MapGetter.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/MapGetter.groovy
new file mode 100644 (file)
index 0000000..062cc06
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.mso.bpmn.vcpe.scripts;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.mockito.invocation.InvocationOnMock;
+import org.mockito.stubbing.Answer;
+
+class MapGetter implements Answer<Object> {
+       final Map<String,Object> map;
+       
+       public MapGetter() {
+               map = new HashMap<>();
+       }
+       
+       public MapGetter(Map<String,Object> map) {
+               this.map = map;
+       }
+
+       public Map<String, Object> getMap() {
+               return map;
+       }
+
+       @Override
+       public Object answer(InvocationOnMock invocation) throws Throwable {
+               return map.get(invocation.getArgumentAt(0, String.class));
+       }
+
+}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/MapSetter.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/MapSetter.groovy
new file mode 100644 (file)
index 0000000..e339532
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.mso.bpmn.vcpe.scripts;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.mockito.invocation.InvocationOnMock;
+import org.mockito.stubbing.Answer;
+
+class MapSetter implements Answer<Void> {
+       final Map<String,Object> map;
+       
+       public MapSetter() {
+               map = new HashMap<>();
+       }
+       
+       public MapSetter(Map<String,Object> map) {
+               this.map = map;
+       }
+
+       public Map<String, Object> getMap() {
+               return map;
+       }
+
+       @Override
+       public Void answer(InvocationOnMock invocation) throws Throwable {
+               map.put(invocation.getArgumentAt(0, String.class), invocation.getArgumentAt(1, Object.class));
+               return null;
+       }
+
+}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/AbstractTestBase.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/AbstractTestBase.java
new file mode 100644 (file)
index 0000000..e7b80f1
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.mso.bpmn.vcpe;
+
+import org.openecomp.mso.bpmn.common.WorkflowTest;
+
+public class AbstractTestBase extends WorkflowTest {
+       
+       
+       public static final String CUST = "SDN-ETHERNET-INTERNET";
+       public static final String SVC = "123456789";
+       public static final String INST = "MIS%252F1604%252F0026%252FSW_INTERNET";
+       public static final String PARENT_INST = "MIS%252F1604%252F0027%252FSW_INTERNET";
+       public static final String ARID = "arId-1";
+       public static final String ARVERS = "1490627351232";
+
+       public static final String DEC_INST = "MIS%2F1604%2F0026%2FSW_INTERNET";
+       public static final String DEC_PARENT_INST = "MIS%2F1604%2F0027%2FSW_INTERNET";
+
+       public static final String VAR_SUCCESS_IND = "SuccessIndicator";
+       public static final String VAR_WFEX = "SavedWorkflowException1";
+       public static final String VAR_RESP_CODE = "CMSO_ResponseCode";
+       public static final String VAR_COMP_REQ = "CompleteMsoProcessRequest";
+}
index a94dc85..8f94187 100644 (file)
@@ -1,4 +1,4 @@
-/*-
+/*
  * ============LICENSE_START=======================================================
  * ONAP - SO
  * ================================================================================
@@ -7,9 +7,9 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- *
+ * 
  *      http://www.apache.org/licenses/LICENSE-2.0
- *
+ * 
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
-
 package org.openecomp.mso.bpmn.vcpe;
 
-import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
-import static com.github.tomakehurst.wiremock.client.WireMock.post;
-import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteAllottedResource;
+import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetAllottedResource;
 import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetCustomer;
 import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetServiceInstance;
 import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById;
 import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchAllottedResource;
 import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutAllottedResource;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutGenericVnf;
+import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutServiceInstance;
 import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.MockGetServiceResourcesCatalogData;
 import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB;
 import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter;
-//             TODO: uncomment when Homing BB is merged
-// import static org.openecomp.mso.bpmn.mock.StubResponseSNIRO.mockSNIRO;
 
 import java.io.IOException;
 import java.util.HashMap;
@@ -42,569 +40,335 @@ import java.util.Map;
 import java.util.UUID;
 
 import org.camunda.bpm.engine.test.Deployment;
-import org.junit.Ignore;
 import org.junit.Test;
-import org.openecomp.mso.bpmn.common.WorkflowTest;
-import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse;
+import org.openecomp.mso.bpmn.common.BPMNUtil;
 import org.openecomp.mso.bpmn.mock.FileUtil;
 
-public class CreateVcpeResCustServiceTest extends WorkflowTest {
+public class CreateVcpeResCustServiceTest extends AbstractTestBase {
 
+       private static final String PROCNAME = "CreateVcpeResCustService";
+       private static final String Prefix = "CVRCS_";
+       
        private final CallbackSet callbacks = new CallbackSet();
        private final String request;
        
        public CreateVcpeResCustServiceTest() throws IOException {
-               callbacks.put("assign", FileUtil.readResourceFile("__files/VCPE/VfModularity/SDNCTopologyAssignCallback.xml"));
-               callbacks.put("query", FileUtil.readResourceFile("__files/VCPE/SDNCTopologyQueryCallbackNetworkInstance.xml"));
-               callbacks.put("activate", FileUtil.readResourceFile("__files/VCPE/VfModularity/SDNCTopologyActivateCallback.xml"));
-               callbacks.put("vnfCreate", FileUtil.readResourceFile("__files/VCPE/VfModularity/VNFAdapterRestCreateCallback.xml"));
-               callbacks.put("create", FileUtil.readResourceFile("__files/VCPE/VfModularity/SDNCTopologyCreateCallback.xml"));
-               callbacks.put("queryTXC", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceTXC/SDNCTopologyQueryCallback.xml"));
-               callbacks.put("queryBRG", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRG/SDNCTopologyQueryCallback.xml"));
-               
-               callbacks.put("sniro", JSON, "SNIROResponse", FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallback2AR1Vnf"));
-               callbacks.put("sniro2", JSON, "SNIROResponse", FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallback2AR1Vnf2Net"));
-               callbacks.put("sniroNoSol", JSON, "SNIROResponse", FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallbackNoSolutionFound"));
-               callbacks.put("sniroPolicyEx", JSON, "SNIROResponse", FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallbackPolicyException"));
-               callbacks.put("sniroServiceEx", JSON, "SNIROResponse", FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallbackServiceException"));
-               
-               request = FileUtil.readResourceFile("__files/VCPE/request.json");
+               callbacks.put("assign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyAssignCallback.xml"));
+               callbacks.put("create", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyCreateCallback.xml"));
+               callbacks.put("activate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyActivateCallback.xml"));
+               callbacks.put("queryTXC", FileUtil.readResourceFile("__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryTXCCallback.xml"));
+               callbacks.put("queryBRG", FileUtil.readResourceFile("__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryBRGCallback.xml"));
+               callbacks.put("deactivate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml"));
+               callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml"));
+               callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml"));
+               
+               request = FileUtil.readResourceFile("__files/VCPE/CreateVcpeResCustService/requestNoSIName.json");
        }
+       
+       @Test
+       @Deployment(resources = {
+                       "process/CreateVcpeResCustService.bpmn",
+                       "subprocess/SDNCAdapterV1.bpmn",
+                       "subprocess/FalloutHandler.bpmn",
+                       "subprocess/GenericGetService.bpmn",
+                       "subprocess/GenericPutService.bpmn",
+                       "subprocess/BuildingBlock/DecomposeService.bpmn",
+            "subprocess/DoCreateServiceInstance.bpmn",
+                       "subprocess/DoCreateAllottedResourceTXC.bpmn",
+                       "subprocess/DoCreateAllottedResourceBRG.bpmn",
+            "subprocess/CompleteMsoProcess.bpmn",
+
+            // stubs
+                       "VCPE/stubprocess/Homing.bpmn",
+            "VCPE/stubprocess/DoCreateVnfAndModules.bpmn"})
+       
+       public void testCreateVcpeResCustService_Success() throws Exception {
+
+               MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "2", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json");
+               MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json");
+               MockGetCustomer(CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml");
+               
+               // TODO: the SI should NOT have to be URL-encoded yet again!
+               MockPutServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml");
+               MockGetServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml");
+               
+               MockNodeQueryServiceInstanceById(INST, "GenericFlows/getSIUrlById.xml");
+               MockNodeQueryServiceInstanceById(PARENT_INST, "GenericFlows/getParentSIUrlById.xml");           
+               MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+               MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+               MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
+               MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
+
+               mockSDNCAdapter(200);
+               mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+               
+               Map<String, Object> variables = setupVariables();
 
+               String businessKey = UUID.randomUUID().toString();
+               invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables);
+               
+               // for SI
+               injectSDNCCallbacks(callbacks, "assign");
+               
+               // for TXC
+               injectSDNCCallbacks(callbacks, "assign");
+               injectSDNCCallbacks(callbacks, "create");
+               injectSDNCCallbacks(callbacks, "activate");
+               injectSDNCCallbacks(callbacks, "queryTXC");
+               
+               // for BRG
+               injectSDNCCallbacks(callbacks, "assign");
+               injectSDNCCallbacks(callbacks, "create");
+               injectSDNCCallbacks(callbacks, "activate");
+               injectSDNCCallbacks(callbacks, "queryBRG");
+               
+               waitForProcessEnd(businessKey, 10000);
 
-//     /**
-//      * End-to-End flow - Unit test for CreateVcpeResCustService.bpmn
-//      *  - String input & String response
-//      */
-//
-//     @Test
-//     @Ignore
-//     @Deployment(resources = {"process/CreateVcpeResCustService.bpmn",
-//                                      "subprocess/DoCreateServiceInstance.bpmn",
-//                                      "subprocess/DoCreateServiceInstanceRollback.bpmn",
-//                                      "subprocess/DoCreateNetworkInstance.bpmn",
-//                                      "subprocess/DoCreateNetworkInstanceRollback.bpmn",
-//                                      "subprocess/DoCreateVnfAndModules.bpmn",
-//                                      "subprocess/DoCreateAllottedResourceTXC.bpmn",
-//                                      "subprocess/DoCreateAllottedResourceTXCRollback.bpmn",
-//                                      "subprocess/DoCreateAllottedResourceBRG.bpmn",
-//                                      "subprocess/DoCreateAllottedResourceBRGRollback.bpmn",
-//                                      "subprocess/BuildingBlock/DecomposeService.bpmn",
-//                                      "subprocess/BuildingBlock/Homing.bpmn",
-//                                      "subprocess/GenericGetService.bpmn",
-//                                      "subprocess/GenericPutService.bpmn",
-//                                      "subprocess/SDNCAdapterV1.bpmn",
-//                                      "subprocess/DoCreateVnf.bpmn",
-//                                      "subprocess/GenericGetVnf.bpmn",
-//                                      "subprocess/GenericPutVnf.bpmn",
-//                                      "subprocess/FalloutHandler.bpmn",
-//                                      "subprocess/GenericDeleteService.bpmn",
-//                                      "subprocess/ReceiveWorkflowMessage.bpmn",
-//                              "subprocess/CompleteMsoProcess.bpmn"})
-//
-//     public void invokeCreateServiceInstanceInfra_Success() throws Exception {
-//
-//             logStart();
-//
-//             // setup simulators
-//             //MockGetCustomer_VCPE();
-//             MockGetCustomer("MCBH-1610", "VCPE/getCustomer.xml");
-//             //MockGetNetworkCatalogData_VCPE();
-//             MockGetNetworkCatalogData("uuid-miu-svc-011-abcdef", "2", "VCPE/getCatalogNetworkData.json");
-//             //MockGetVnfCatalogData_VCPE();
-//             MockGetVnfCatalogData("uuid-miu-svc-011-abcdef", "2", "VCPE/getCatalogVnfData.json");
-//             //MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "VCPE/getCatalogServiceResourcesData.json");
-//             MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "VCPE/getCatalogServiceResourcesDataNoNetworkVnf.json");
-//             MockGetServiceInstanceById_VCPE();
-//             MockPutServiceInstance_VCPE();
-//
-//             //SDNC Adapter Mocks
-//             mockSDNCAdapterRest();
-//             mockSDNCAdapter();
-//
-//             //from CreateNetworkInstanceTest
-//             sdncAdapterNetworkTopologySimulator_CreateNetworkV2();
-//             MockNetworkAdapterResponse_CreateSuccessV2();
-//             MockAAIResponse_queryName_CreateNetwork_404V2();         // 'network-name' not in AAI , Ok to Create.
-//             MockAAIResponse_cloudRegion25_Success();
-//             MockAAIResponse_queryId_CreateNetwork_SuccessV2();
-//             MockAAIResponse_queryVpnBinding_CreateNetwork_SuccessV2();
-//             MockAAIResponse_queryVpnBinding2_CreateNetwork_SuccessV2();
-//             MockAAIResponse_queryNetworkPolicy_CreateNetwork_SuccessV2();
-//             MockAAIResponse_queryNetworkTableRef_CreateNetwork_SuccessV2();
-//             MockAAIResponse_updateContrail_CreateNetwork_SuccessV2();
-//             MockDBUpdate_Success();
-//             MocksAAIResponse_queryNetworkInstance_CreateNetwork_Success();
-//
-//             //network AAI Mocks
-//             MockGetNetworkById("680b7453-0ec4-4d96-b355-280d981d418f", "VCPE/getNetwork.xml");
-//             MockGetNetworkById("444a701a-6419-45b2-aa52-b45a1b719cf6", "VCPE/getNetwork.xml");
-//             MockGetNetworkById("cf82a73f-de7f-4f84-8dfc-16a487c63a36", "VCPE/getNetwork.xml");
-//             MockPutNetwork("680b7453-0ec4-4d96-b355-280d981d418f");
-//             MockPutNetwork("cf82a73f-de7f-4f84-8dfc-16a487c63a36");
-//
-//             MockPutGenericVnf("9c61db87-345c-49ae-ac80-472211df5deb");
-//             
-//             mockSNIRO();
-//
-//             String businessKey = UUID.randomUUID().toString();
-////           String createVfModuleRequest =
-////                   FileUtil.readResourceFile("__files/VCPE/CreateVfModule_VID_request.json");
-//
-//             Map<String, Object> variables = setupVariablesObjectMap();
-//
-//             TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVcpeResCustService",
-//                     "v1", businessKey, getRequest(), variables);
-//
-//             WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
-//
-//             String responseBody = response.getResponse();
-//             System.out.println("Workflow (Synch) Response:\n" + responseBody);
-//
-//             injectSDNCCallbacks(callbacks, "assign, query");
-//             injectSDNCCallbacks(callbacks, "activate");
-//
-//             // TODO add appropriate assertions
-//
-//             waitForProcessEnd(businessKey, 10000);
-//             checkVariable(businessKey, "CreateVcpeResCustServiceSuccessIndicator", true);
-//
-//             logEnd();
-//     }
+               String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+               System.out.println("workflowException:\n" + workflowException);
+
+               String completionReq = BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix+VAR_COMP_REQ);
+               System.out.println("completionReq:\n" + completionReq);
+               
+               assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, PROCNAME+VAR_SUCCESS_IND));
+               assertEquals("200", BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_RESP_CODE));
+               assertEquals(null, workflowException);
+               assertTrue(completionReq.indexOf("request-id>testRequestId<") >= 0);
+               assertTrue(completionReq.indexOf("action>CREATE<") >= 0);
+               assertTrue(completionReq.indexOf("source>VID<") >= 0);
+
+               assertEquals("1", BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix+"VnfsCreatedCount"));
+       }
        
+       @Test
+       @Deployment(resources = {
+                       "process/CreateVcpeResCustService.bpmn",
+                       "subprocess/SDNCAdapterV1.bpmn",
+                       "subprocess/FalloutHandler.bpmn",
+                       "subprocess/GenericGetService.bpmn",
+                       "subprocess/GenericPutService.bpmn",
+                       "subprocess/BuildingBlock/DecomposeService.bpmn",
+            "subprocess/DoCreateServiceInstance.bpmn",
+                       "subprocess/DoCreateAllottedResourceTXC.bpmn",
+                       "subprocess/DoCreateAllottedResourceBRG.bpmn",
+            "subprocess/CompleteMsoProcess.bpmn",
+
+            // stubs
+                       "VCPE/stubprocess/Homing.bpmn",
+            "VCPE/stubprocess/DoCreateVnfAndModules.bpmn"})
        
-       /**
-        * TEST Decompose + Homing - Unit test for CreateVcpeResCustService.bpmn
-        *  - String input & String response
-        */
+       public void testCreateVcpeResCustService_NoParts() throws Exception {
 
-       @Test
-//  TODO: run this test when Homing BB is merged
-       @Ignore
-       @Deployment(resources = {"process/CreateVcpeResCustService.bpmn",
-                                        "subprocess/DoCreateServiceInstance.bpmn",
-                                        "subprocess/DoCreateServiceInstanceRollback.bpmn",
-                                        "subprocess/DoCreateNetworkInstance.bpmn",
-                                        "subprocess/DoCreateNetworkInstanceRollback.bpmn",
-                                        "subprocess/BuildingBlock/DecomposeService.bpmn",
-                                        "subprocess/BuildingBlock/Homing.bpmn",
-                                        "subprocess/GenericGetService.bpmn",
-                                        "subprocess/GenericPutService.bpmn",
-                                        "subprocess/SDNCAdapterV1.bpmn",
-                                        "subprocess/DoCreateVnf.bpmn",
-                                        "subprocess/GenericGetVnf.bpmn",
-                                        "subprocess/GenericPutVnf.bpmn",
-                                        "subprocess/FalloutHandler.bpmn",
-                                        "subprocess/GenericDeleteService.bpmn",
-                                        "subprocess/DoCreateAllottedResourceBRG.bpmn",
-                                        "subprocess/DoCreateAllottedResourceBRGRollback.bpmn",
-                                        "subprocess/DoCreateAllottedResourceTXC.bpmn",
-                                        "subprocess/DoCreateAllottedResourceTXCRollback.bpmn",
-                                "subprocess/CompleteMsoProcess.bpmn"})
-
-       public void invokeDecompositionHomingCreateServiceInstanceNetwork() throws Exception {
-
-               logStart();
-
-               // setup simulators
-               MockGetCustomer("MCBH-1610", "VCPE/getCustomer.xml");
-
-               MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "2", "VCPE/getCatalogVcpe.json");
-               
-//             MockPutServiceInstance_VCPE();
-               
-//             MockGetNetworkByIdWithDepth("680b7453-0ec4-4d96-b355-280d981d418f", "VCPE/CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_Success.xml", "1");
-//             MockGetNetworkByIdWithDepth("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "VCPE/CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_Success.xml", "1");
-
-               MockPutGenericVnf("39ae1b77-4edd-4e94-846a-d087a35a2260");
-               
-               // stuff to satisfy TXC & BRG subflows
-               MockNodeQueryServiceInstanceById("MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getSIUrlById.xml");
-               MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml");
-               MockNodeQueryServiceInstanceById("MIS%252F1604%252F0027%252FSW_INTERNET", "GenericFlows/getParentSIUrlById.xml");
-               MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0027%252FSW_INTERNET", "GenericFlows/getParentServiceInstance.xml");
-               MockPutAllottedResource("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0027%252FSW_INTERNET", "arId-1");
-               MockPatchAllottedResource("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0027%252FSW_INTERNET", "arId-1");
+               MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "2", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesNoData.json");
+               MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesNoData.json");
+               MockGetCustomer(CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml");
                
-               mockSDNCAdapter(200);
+               // TODO: the SI should NOT have to be URL-encoded yet again!
+               MockPutServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml");
+               MockGetServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml");
+               
+               MockNodeQueryServiceInstanceById(INST, "GenericFlows/getSIUrlById.xml");                
+               MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+               MockNodeQueryServiceInstanceById(PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+               MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+               
+               // TODO: should these really be PARENT_INST, or should they be INST?
+               MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
+               MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
 
+               mockSDNCAdapter(200);
                mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+               
+               Map<String, Object> variables = setupVariables();
 
-//             TODO: uncomment when Homing BB is merged
-//             mockSNIRO();
+               String businessKey = UUID.randomUUID().toString();
+               invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables);
+               
+               // for SI
+               injectSDNCCallbacks(callbacks, "assign");
+               
+               waitForProcessEnd(businessKey, 10000);
 
-               //Below works for Homing/Sniro
+               String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+               System.out.println("workflowException:\n" + workflowException);
+
+               String completionReq = BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix+VAR_COMP_REQ);
+               System.out.println("completionReq:\n" + completionReq);
                
-               Map<String, Object> variables = setupVariablesObjectMap();
+               assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, PROCNAME+VAR_SUCCESS_IND));
+               assertEquals("200", BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_RESP_CODE));
+               assertEquals(null, workflowException);
+               assertTrue(completionReq.indexOf("request-id>testRequestId<") >= 0);
+               assertTrue(completionReq.indexOf("action>CREATE<") >= 0);
+               assertTrue(completionReq.indexOf("source>VID<") >= 0);
 
-               String businessKey = UUID.randomUUID().toString();
-               TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVcpeResCustService",
-                       "v1", businessKey, request, variables);
-                               
-               WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
+               assertEquals("0", BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix+"VnfsCreatedCount"));
+       }
+       
+       @Test
+       @Deployment(resources = {
+                       "process/CreateVcpeResCustService.bpmn",
+                       "subprocess/SDNCAdapterV1.bpmn",
+                       "subprocess/FalloutHandler.bpmn",
+                       "subprocess/GenericGetService.bpmn",
+                       "subprocess/GenericPutService.bpmn",
+                       "subprocess/BuildingBlock/DecomposeService.bpmn",
+            "subprocess/DoCreateServiceInstance.bpmn",
+                       "subprocess/DoCreateAllottedResourceBRG.bpmn",
+            "subprocess/CompleteMsoProcess.bpmn",
+
+            // this stub will trigger a fault
+                       "VCPE/stubprocess/DoCreateAllottedResourceTXC.bpmn",
+
+            // stubs
+                       "VCPE/stubprocess/Homing.bpmn",
+            "VCPE/stubprocess/DoCreateVnfAndModules.bpmn"})
+       
+       public void testCreateVcpeResCustService_Fault_NoRollback() throws Exception {
+
+               MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "2", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json");
+               MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json");
+               MockGetCustomer(CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml");
+               
+               // TODO: the SI should NOT have to be URL-encoded yet again!
+               MockPutServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml");
+               MockGetServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml");
                
-               String responseBody = response.getResponse();
-               System.out.println("Workflow (Synch) Response:\n" + responseBody);
+               MockNodeQueryServiceInstanceById(INST, "GenericFlows/getSIUrlById.xml");
+               MockNodeQueryServiceInstanceById(PARENT_INST, "GenericFlows/getParentSIUrlById.xml");           
+               MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+               MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+               MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
+               MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
 
-               injectWorkflowMessages(callbacks, "sniro");
-               injectSDNCCallbacks(callbacks, "assign, create, activate, queryTXC");
-               injectSDNCCallbacks(callbacks, "assign, create, activate, queryBRG");
+               mockSDNCAdapter(200);
+               mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+               
+               Map<String, Object> variables = setupVariables();
 
+               String req = FileUtil.readResourceFile("__files/VCPE/CreateVcpeResCustService/requestNoSINameNoRollback.json");
+               
+               String businessKey = UUID.randomUUID().toString();
+               invokeAsyncProcess(PROCNAME, "v1", businessKey, req, variables);
+               
+               // for SI
+               injectSDNCCallbacks(callbacks, "assign");
+               
                waitForProcessEnd(businessKey, 10000);
-               checkVariable(businessKey, "CreateVcpeResCustServiceSuccessIndicator", true);
 
-               logEnd();
+               String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+               System.out.println("workflowException:\n" + workflowException);
+
+               String completionReq = BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix+VAR_COMP_REQ);
+               System.out.println("completionReq:\n" + completionReq);
+               
+               assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, PROCNAME+VAR_SUCCESS_IND));
+               assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_RESP_CODE));
+               assertNotNull(workflowException);
+               
+               BPMNUtil.assertNoProcessInstance(processEngineRule, "DoCreateAllottedResourceBRGRollback");
+               BPMNUtil.assertNoProcessInstance(processEngineRule, "DoCreateVnfAndModulesRollback");
+               BPMNUtil.assertNoProcessInstance(processEngineRule, "DoCreateAllottedResourceTXCRollback");
        }
        
+       @Test
+       @Deployment(resources = {
+                       "process/CreateVcpeResCustService.bpmn",
+                       "subprocess/SDNCAdapterV1.bpmn",
+                       "subprocess/FalloutHandler.bpmn",
+                       "subprocess/GenericGetService.bpmn",
+                       "subprocess/GenericPutService.bpmn",
+                       "subprocess/BuildingBlock/DecomposeService.bpmn",
+            "subprocess/DoCreateServiceInstance.bpmn",
+                       "subprocess/DoCreateAllottedResourceTXC.bpmn",
+                       "subprocess/DoCreateAllottedResourceTXCRollback.bpmn",
+            "subprocess/CompleteMsoProcess.bpmn",
+
+            // this stub will trigger a fault
+                       "VCPE/stubprocess/DoCreateAllottedResourceBRG.bpmn",
+
+            // stubs
+                       "VCPE/stubprocess/DoCreateAllottedResourceBRGRollback.bpmn",
+                       "VCPE/stubprocess/DoCreateVnfAndModulesRollback.bpmn",
+            "VCPE/stubprocess/DoCreateServiceInstanceRollback.bpmn",
+                       "VCPE/stubprocess/Homing.bpmn",
+            "VCPE/stubprocess/DoCreateVnfAndModules.bpmn"})
        
-       /**
-        * TEST Decompose + Homing - Unit test for CreateVcpeResCustService.bpmn
-        *  - String input & String response
-        */
-
-//     @Test
-//     @Deployment(resources = {"process/CreateVcpeResCustService.bpmn",
-//                                      "subprocess/DoCreateServiceInstance.bpmn",
-//                                      "subprocess/DoCreateServiceInstanceRollback.bpmn",
-//                                      "subprocess/DoCreateNetworkInstance.bpmn",
-//                                      "subprocess/DoCreateNetworkInstanceRollback.bpmn",
-//                                      "subprocess/BuildingBlock/DecomposeService.bpmn",
-//                                      "subprocess/BuildingBlock/Homing.bpmn",
-//                                      "subprocess/DoCreateAllottedResourceTXC.bpmn",
-//                                      "subprocess/DoCreateAllottedResourceTXCRollback.bpmn",
-//                                      "subprocess/DoCreateAllottedResourceBRG.bpmn",
-//                                      "subprocess/DoCreateAllottedResourceBRGRollback.bpmn",
-//                                      "subprocess/GenericGetService.bpmn",
-//                                      "subprocess/GenericPutService.bpmn",
-//                                      "subprocess/SDNCAdapterV1.bpmn",
-//                                      "subprocess/DoCreateVnf.bpmn",
-//                                      "subprocess/GenericGetVnf.bpmn",
-//                                      "subprocess/GenericPutVnf.bpmn",
-//                                      "subprocess/FalloutHandler.bpmn",
-//                                      "subprocess/GenericDeleteService.bpmn",
-//                                      "subprocess/ReceiveWorkflowMessage.bpmn",
-//                              "subprocess/CompleteMsoProcess.bpmn"})
-//
-//     public void invokeDecompositionHomingCreateServiceInstanceARs() throws Exception {
-//
-//             logStart();
-//
-//             // setup simulators
-//             MockGetCustomer("MCBH-1610", "VCPE/getCustomer.xml");
-//
-//             MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "VCPE/getCatalogServiceResourcesDataServiceAllotted.json");
-//             
-//             MockPutServiceInstance_VCPE();
-//             //network AAI Mocks
-//             MockGetNetworkById("cf82a73f-de7f-4f84-8dfc-16a487c63a36", "VCPE/getNetwork.xml");
-//             MockPutNetwork("cf82a73f-de7f-4f84-8dfc-16a487c63a36");
-//             
-//             MockNodeQueryServiceInstanceById("c763d462-dfe4-4577-9706-fa3a9db640be", "VCPE/getSIUrlById.xml");
-//             
-//             mockSDNCAdapter();
-//
-//             MockNodeQueryServiceInstanceById("MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getSIUrlById.xml");
-//             MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET");
-//             MockPutAllottedResource("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "arId-1");
-//             MockPutAllottedResource("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET_in-use", "arId-1");
-//             MockPatchAllottedResource("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET_in-use", "arId-1");
-//             
-//             
-//             MockDBUpdateVfModule();
-//             
-//             mockSNIRO();
-//
-//             String businessKey = UUID.randomUUID().toString();
-//
-//             //Below works for Homing/Sniro
-//             
-//             Map<String, Object> variables = setupVariablesObjectMap();
-//             TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVcpeResCustService", "v1", businessKey, getRequest(), variables);
-//             WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
-//             String responseBody = response.getResponse();
-//             System.out.println("Workflow (Synch) Response:\n" + responseBody);
-//             
-//             //Below is from CreateVcpeResCustService
-////           Map<String, String> variables = setupVariables();
-////           WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "CreateVcpeResCustService", variables);
-////           waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
-////           String workflowResp = BPMNUtil.getVariable(processEngineRule, "CreateVcpeResCustService", "WorkflowResponse");
-//
-//             injectWorkflowMessages(callbacks, "sniro");
-//             // TODO add appropriate assertions
-//             injectSDNCCallbacks(callbacks, "assign, query, create, activate, queryTXC, assign, create, activate, queryBRG");
-//             waitForProcessEnd(businessKey, 10000);
-//
-////           checkVariable(businessKey, "CreateVcpeResCustServiceSuccessIndicator", true);
-//
-//             logEnd();
-//     }
-//
-//     
-//     /**
-//      * TEST Decompose + Homing - Unit test for CreateVcpeResCustService.bpmn
-//      *  - String input & String response
-//      */
-//
-//     @Test
-//     //@Ignore
-//     @Deployment(resources = {"process/CreateVcpeResCustService.bpmn",
-//                                      "subprocess/DoCreateServiceInstance.bpmn",
-//                                      "subprocess/DoCreateServiceInstanceRollback.bpmn",
-//                                      "subprocess/DoCreateNetworkInstance.bpmn",
-//                                      "subprocess/DoCreateNetworkInstanceRollback.bpmn",
-//                                      "subprocess/BuildingBlock/DecomposeService.bpmn",
-//                                      "subprocess/BuildingBlock/Homing.bpmn",
-//                                      "subprocess/DoCreateVnfAndModules.bpmn",
-//                                      "subprocess/DoCreateVnfAndModulesRollback.bpmn",
-//                                      "subprocess/DoCreateAllottedResourceTXC.bpmn",
-//                                      "subprocess/DoCreateAllottedResourceTXCRollback.bpmn",
-//                                      "subprocess/DoCreateAllottedResourceBRG.bpmn",
-//                                      "subprocess/DoCreateAllottedResourceBRGRollback.bpmn",
-//                                      "subprocess/GenericGetService.bpmn",
-//                                      "subprocess/GenericPutService.bpmn",
-//                                      "subprocess/SDNCAdapterV1.bpmn",
-//                                      "subprocess/DoCreateVnf.bpmn",
-//                                      "subprocess/GenericGetVnf.bpmn",
-//                                      "subprocess/GenericPutVnf.bpmn",
-//                                      "subprocess/FalloutHandler.bpmn",
-//                                      "subprocess/GenericDeleteService.bpmn",
-//                                      "subprocess/ReceiveWorkflowMessage.bpmn",
-//                              "subprocess/CompleteMsoProcess.bpmn"})
-//
-//     public void invokeDecompositionHomingCreateServiceVnf() throws Exception {
-//
-//             logStart();
-//
-//             // setup simulators
-//             MockGetCustomer("MCBH-1610", "VCPE/getCustomer.xml");
-//
-//             MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "VCPE/getCatalogServiceResourcesServiceVnf.json");
-//             
-//             MockPutServiceInstance_VCPE();
-//             //network AAI Mocks
-//             MockGetNetworkById("cf82a73f-de7f-4f84-8dfc-16a487c63a36", "VCPE/getNetwork.xml");
-//             MockPutNetwork("cf82a73f-de7f-4f84-8dfc-16a487c63a36");
-//             
-//             MockNodeQueryServiceInstanceById("c763d462-dfe4-4577-9706-fa3a9db640be", "VCPE/getSIUrlById.xml");
-//             
-//             
-//             MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlByIdVcpe.xml");
-//             MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET");
-//             MockGetGenericVnfById_404("testVnfId");
-//             MockPutGenericVnf(".*");
-//             MockAAIVfModule();
-//             MockPatchGenericVnf("skask");
-//             MockPatchVfModuleId("skask", ".*");
-//             MockSDNCAdapterVfModule();              
-//             MockVNFAdapterRestVfModule();
-//             MockDBUpdateVfModule(); 
-//             
-//             
-//             mockSDNCAdapter();
-//             //mockSDNCAdapterRest();
-//             
-//             //MockSDNCAdapterServiceInstanceModule();
-//             
-//             //mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologyRsrcAssignResponse.xml", "SvcAction>assign");
-//             
-//             MockDBUpdateVfModule();
-//             
-//             mockSNIRO();
-//
-//             String businessKey = UUID.randomUUID().toString();
-//
-//             //Below works for Homing/Sniro
-//             
-//             Map<String, Object> variables = setupVariablesObjectMap();
-//             TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVcpeResCustService", "v1", businessKey, getRequest(), variables);
-//             WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
-//             String responseBody = response.getResponse();
-//             System.out.println("Workflow (Synch) Response:\n" + responseBody);
-//             
-//             //Below is from CreateVcpeResCustService
-////           Map<String, String> variables = setupVariables();
-////           WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "CreateVcpeResCustService", variables);
-////           waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
-////           String workflowResp = BPMNUtil.getVariable(processEngineRule, "CreateVcpeResCustService", "WorkflowResponse");
-//
-//             injectWorkflowMessages(callbacks, "sniro");
-//             // TODO add appropriate assertions
-//             injectSDNCCallbacks(callbacks, "assign, query");
-//             waitForProcessEnd(businessKey, 10000);
-//
-////           checkVariable(businessKey, "CreateVcpeResCustServiceSuccessIndicator", true);
-//
-//             logEnd();
-//     }
-//     
-//     
-//     /**
-//      * TEST Decompose + Homing - Unit test for CreateVcpeResCustService.bpmn
-//      *  - String input & String response
-//      */
-//
-//     @Test
-//     //@Ignore
-//     @Deployment(resources = {"process/CreateVcpeResCustService.bpmn",
-//                                      "subprocess/DoCreateServiceInstance.bpmn",
-//                                      "subprocess/DoCreateServiceInstanceRollback.bpmn",
-//                                      "subprocess/DoCreateNetworkInstance.bpmn",
-//                                      "subprocess/DoCreateNetworkInstanceRollback.bpmn",
-//                                      "subprocess/BuildingBlock/DecomposeService.bpmn",
-//                                      "subprocess/BuildingBlock/Homing.bpmn",
-//                                      "subprocess/DoCreateVnfAndModules.bpmn",
-//                                      "subprocess/DoCreateVnfAndModulesRollback.bpmn",
-//                                      "subprocess/DoCreateAllottedResourceTXC.bpmn",
-//                                      "subprocess/DoCreateAllottedResourceTXCRollback.bpmn",
-//                                      "subprocess/DoCreateAllottedResourceBRG.bpmn",
-//                                      "subprocess/DoCreateAllottedResourceBRGRollback.bpmn",
-//                                      "subprocess/GenericGetService.bpmn",
-//                                      "subprocess/GenericPutService.bpmn",
-//                                      "subprocess/SDNCAdapterV1.bpmn",
-//                                      "subprocess/DoCreateVnf.bpmn",
-//                                      "subprocess/GenericGetVnf.bpmn",
-//                                      "subprocess/GenericPutVnf.bpmn",
-//                                      "subprocess/FalloutHandler.bpmn",
-//                                      "subprocess/GenericDeleteService.bpmn",
-//                                      "subprocess/ReceiveWorkflowMessage.bpmn",
-//                              "subprocess/CompleteMsoProcess.bpmn"})
-//
-//     public void invokeCreateAll() throws Exception {
-//
-//             logStart();
-//
-//             // setup simulators
-//             MockGetCustomer("MCBH-1610", "VCPE/getCustomer.xml");
-//
-//             MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "VCPE/getCatalogServiceResourcesData.json");
-//             
-//             MockPutServiceInstance_VCPE();
-//             //network AAI Mocks
-//             MockGetNetworkById("cf82a73f-de7f-4f84-8dfc-16a487c63a36", "VCPE/getNetwork.xml");
-//             MockPutNetwork("cf82a73f-de7f-4f84-8dfc-16a487c63a36");
-//             
-//             MockNodeQueryServiceInstanceById("c763d462-dfe4-4577-9706-fa3a9db640be", "VCPE/getSIUrlById.xml");
-//             
-//             MockGetNetworkByIdWithDepth("680b7453-0ec4-4d96-b355-280d981d418f", "VCPE/CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_Success.xml", "1");
-//             MockGetNetworkByIdWithDepth("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "VCPE/CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_Success.xml", "1");
-//             MockNetworkAdapterPost("CreateNetworkV2/createNetworkResponse_Success.xml", "VCPE/createNetworkRequest");
-//             MockGetNetworkVpnBindingWithDepth("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017", "all");
-//             MockGetNetworkVpnBindingWithDepth("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6", "all");
-//             MockGetNetworkPolicyWithDepth("CreateNetworkV2/createNetwork_queryNetworkPolicy_AAIResponse_Success.xml", "cee6d136-e378-4678-a024-2cd15f0ee0cg", "all");
-//             MockGetNetworkTableReferenceWithDepth("CreateNetworkV2/createNetwork_queryNetworkTableRef1_AAIResponse_Success.xml", "refFQDN1", "all");
-//             MockGetNetworkTableReferenceWithDepth("CreateNetworkV2/createNetwork_queryNetworkTableRef1_AAIResponse_Success.xml", "refFQDN2", "all");
-//             MockPutNetworkIdWithDepth("CreateNetworkV2/createNetwork_updateContrail_AAIResponse_Success.xml", "680b7453-0ec4-4d96-b355-280d981d418f", "1");
-//             MockPutNetworkIdWithDepth("CreateNetworkV2/createNetwork_updateContrail_AAIResponse_Success.xml", "49c86598-f766-46f8-84f8-8d1c1b10f9b4", "1");
-//             
-//             
-//             MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlByIdVcpe.xml");
-//             MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET");
-//             MockGetGenericVnfById_404("testVnfId");
-//             MockPutGenericVnf(".*");
-//             MockAAIVfModule();
-//             MockPatchGenericVnf("skask");
-//             MockPatchVfModuleId("skask", ".*");
-//             MockSDNCAdapterVfModule();              
-//             MockVNFAdapterRestVfModule();
-//             MockDBUpdateVfModule(); 
-//             
-//             
-//             mockSDNCAdapter();
-//             //mockSDNCAdapterRest();
-//             
-//             //MockSDNCAdapterServiceInstanceModule();
-//             
-//             //mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologyRsrcAssignResponse.xml", "SvcAction>assign");
-//             
-//             MockDBUpdateVfModule();
-//             
-//             mockSNIRO();
-//
-//             String businessKey = UUID.randomUUID().toString();
-//
-//             //Below works for Homing/Sniro
-//             
-//             Map<String, Object> variables = setupVariablesObjectMap();
-//             TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVcpeResCustService", "v1", businessKey, getRequest(), variables);
-//             WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
-//             String responseBody = response.getResponse();
-//             System.out.println("Workflow (Synch) Response:\n" + responseBody);
-//             
-//             //Below is from CreateVcpeResCustService
-////           Map<String, String> variables = setupVariables();
-////           WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "CreateVcpeResCustService", variables);
-////           waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
-////           String workflowResp = BPMNUtil.getVariable(processEngineRule, "CreateVcpeResCustService", "WorkflowResponse");
-//
-//             injectWorkflowMessages(callbacks, "sniro");
-//             // TODO add appropriate assertions
-//             injectSDNCCallbacks(callbacks, "assign, query");
-//             waitForProcessEnd(businessKey, 10000);
-//
-////           checkVariable(businessKey, "CreateVcpeResCustServiceSuccessIndicator", true);
-//
-//             logEnd();
-//     }
+       public void testCreateVcpeResCustService_Fault_Rollback() throws Exception {
+
+               MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "2", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json");
+               MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json");
+               MockGetCustomer(CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml");
+               
+               // TODO: the SI should NOT have to be URL-encoded yet again!
+               MockPutServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml");
+               MockGetServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml");
+               
+               MockNodeQueryServiceInstanceById(INST, "GenericFlows/getSIUrlById.xml");
+               MockNodeQueryServiceInstanceById(PARENT_INST, "GenericFlows/getParentSIUrlById.xml");           
+               MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+               MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+               MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/CreateVcpeResCustService/arGetById.xml");
+               MockGetAllottedResource(CUST, SVC, PARENT_INST, ARID, "VCPE/CreateVcpeResCustService/arGetById.xml");
+               MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
+               MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
+               MockDeleteAllottedResource(CUST, SVC, PARENT_INST, ARID, ARVERS);
+
+               mockSDNCAdapter(200);
+               mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+               
+               Map<String, Object> variables = setupVariables();
+
+               String businessKey = UUID.randomUUID().toString();
+               invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables);
+               
+               // for SI
+               injectSDNCCallbacks(callbacks, "assign");
+               
+               // for TXC
+               injectSDNCCallbacks(callbacks, "assign");
+               injectSDNCCallbacks(callbacks, "create");
+               injectSDNCCallbacks(callbacks, "activate");
+               injectSDNCCallbacks(callbacks, "queryTXC");
+               
+               // BRG is a stub so don't need SDNC callbacks
+               
+               // for TXC rollback
+               injectSDNCCallbacks(callbacks, "deactivate");
+               injectSDNCCallbacks(callbacks, "delete");
+               injectSDNCCallbacks(callbacks, "unassign");
+               
+               waitForProcessEnd(businessKey, 10000);
+
+               String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+               System.out.println("workflowException:\n" + workflowException);
+
+               String completionReq = BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix+VAR_COMP_REQ);
+               System.out.println("completionReq:\n" + completionReq);
+               
+               assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, PROCNAME+VAR_SUCCESS_IND));
+               assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_RESP_CODE));
+               assertEquals(null, completionReq);
+               assertNotNull(workflowException);
+               
+               BPMNUtil.assertAnyProcessInstanceFinished(processEngineRule, "DoCreateAllottedResourceBRGRollback");
+               BPMNUtil.assertAnyProcessInstanceFinished(processEngineRule, "DoCreateVnfAndModulesRollback");
+               BPMNUtil.assertAnyProcessInstanceFinished(processEngineRule, "DoCreateAllottedResourceTXCRollback");
+       }
        
        // *****************
        // Utility Section
        // *****************
 
        // Success Scenario
-       private Map<String, Object> setupVariablesObjectMap() {
+       private Map<String, Object> setupVariables() {
                Map<String, Object> variables = new HashMap<>();
                variables.put("requestId", "testRequestId");
                variables.put("request-id", "testRequestId");
-               variables.put("CREVAS_testServiceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4"); // assigned for testing
-               variables.put("serviceInstanceId", "c763d462-dfe4-4577-9706-fa3a9db640be");// unit test
-               variables.put("sourceNetworkId", "c763d462-dfe4-4577-9706-fa3a9db640be");// unit test
-               variables.put("networkId", "c763d462-dfe4-4577-9706-fa3a9db640be");// unit test
-               variables.put("sourceNetworkRole", "whoknows");// unit test
-               variables.put("allottedResourceId", "arId-1");
+               variables.put("serviceInstanceId", DEC_INST);
+               variables.put("allottedResourceId", ARID);
                variables.put("junitSleepMs", "5");
                return variables;
 
        }
-
-//     private Map<String, String> setupVariables() {
-//             Map<String, String> variables = new HashMap<String, String>();
-//             variables.put("bpmnRequest", getRequest());
-//             variables.put("mso-request-id", "testRequestId");
-//             variables.put("CREVAS_testServiceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4"); // assigned for testing
-//             variables.put("serviceInstanceId", "c763d462-dfe4-4577-9706-fa3a9db640be");// unit test
-//             variables.put("sourceNetworkId", "c763d462-dfe4-4577-9706-fa3a9db640be");// unit test
-//             variables.put("sourceNetworkRole", "whoknows");// unit test
-//             variables.put("allottedResourceId", "arId-1");
-//             variables.put("junitSleepMs", "5");
-//             return variables;
-//
-//     }
-       
-       // start of mocks used locally and by other VF Module unit tests
-       public static void MockSDNCAdapterVfModule() {
-               // simplified the implementation to return "success" for all requests
-               stubFor(post(urlEqualTo("/SDNCAdapter"))
-//                     .withRequestBody(containing("SvcInstanceId><"))
-                       .willReturn(aResponse()
-                               .withStatus(200)
-                               .withHeader("Content-Type", "text/xml")
-                               .withBodyFile("VfModularity/StandardSDNCSynchResponse.xml")));
-//             stubFor(post(urlEqualTo("/SDNCAdapter"))
-//                             .withRequestBody(containing("vnf-type>STMTN"))
-//                             .willReturn(aResponse()
-//                                     .withStatus(200)
-//                                     .withHeader("Content-Type", "text/xml")
-//                                     .withBodyFile("VfModularity/StandardSDNCSynchResponse.xml")));
-//             stubFor(post(urlEqualTo("/SDNCAdapter"))
-//                             .withRequestBody(containing("SvcAction>query"))
-//                             .willReturn(aResponse()
-//                                     .withStatus(200)
-//                                     .withHeader("Content-Type", "text/xml")
-//                                     .withBodyFile("VfModularity/StandardSDNCSynchResponse.xml")));
-       }
-       
-
-       
-       
 }
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DeleteVcpeResCustServiceTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DeleteVcpeResCustServiceTest.java
new file mode 100644 (file)
index 0000000..88b6464
--- /dev/null
@@ -0,0 +1,297 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.mso.bpmn.vcpe;
+
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.get;
+import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteAllottedResource;
+import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetAllottedResource;
+import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetServiceInstance;
+import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById;
+import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchAllottedResource;
+import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockQueryAllottedResourceById;
+import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB;
+import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter;
+
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import org.camunda.bpm.engine.test.Deployment;
+import org.junit.Test;
+import org.openecomp.mso.bpmn.common.BPMNUtil;
+import org.openecomp.mso.bpmn.mock.FileUtil;
+
+import com.github.tomakehurst.wiremock.stubbing.Scenario;
+
+public class DeleteVcpeResCustServiceTest extends AbstractTestBase {
+
+       private static final String PROCNAME = "DeleteVcpeResCustService";
+       private static final String Prefix = "DVRCS_";
+       private static final String AR_BRG_ID = "ar-brgB";
+       private static final String AR_TXC_ID = "ar-txcA";
+       
+       private final CallbackSet callbacks = new CallbackSet();
+       private final String request;
+       
+       public DeleteVcpeResCustServiceTest() throws IOException {
+               callbacks.put("deactivate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml"));
+               callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml"));
+               callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml"));
+               
+               request = FileUtil.readResourceFile("__files/VCPE/DeleteVcpeResCustService/request.json");
+       }
+       
+       @Test
+       @Deployment(resources = {
+                       "process/DeleteVcpeResCustService.bpmn",
+                       "subprocess/GenericGetService.bpmn",
+                       "subprocess/GenericDeleteService.bpmn",
+                       "subprocess/SDNCAdapterV1.bpmn",
+                       "subprocess/FalloutHandler.bpmn",
+            "subprocess/DoDeleteServiceInstance.bpmn",
+                       "subprocess/DoDeleteAllottedResourceBRG.bpmn",
+                       "subprocess/DoDeleteAllottedResourceTXC.bpmn",
+            "subprocess/CompleteMsoProcess.bpmn",
+
+            // stubs
+            "VCPE/stubprocess/DoDeleteVnfAndModules.bpmn"})
+       
+       public void testDeleteVcpeResCustService_Success() throws Exception {
+
+               MockNodeQueryServiceInstanceById(INST, "GenericFlows/getSIUrlById.xml");
+
+               // TODO: use INST instead of DEC_INST
+               /*
+                * Seems to be a bug in GenericDeleteService (or its subflows) as they
+                * fail to URL-encode the SI id before performing the query so we'll
+                * add a stub for that case, too.
+                */
+               MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml");
+               
+               /*
+                * cannot use MockGetServiceInstance(), because we need to return
+                * different responses as we traverse through the flow
+                */ 
+
+               // initially, the SI includes the ARs
+               stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST))
+                               .inScenario("SI retrieval")
+                               .whenScenarioStateIs(Scenario.STARTED)
+                               .willReturn(aResponse()
+                                               .withStatus(200)
+                                               .withHeader("Content-Type", "text/xml")
+                                               .withBodyFile("VCPE/DeleteVcpeResCustService/getSI.xml"))
+                               .willSetStateTo("ARs Deleted"));
+               
+               // once the ARs have been deleted, the SI should be empty
+               stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST))
+                               .inScenario("SI retrieval")
+                               .whenScenarioStateIs("ARs Deleted")
+                               .willReturn(aResponse()
+                                               .withStatus(200)
+                                               .withHeader("Content-Type", "text/xml")
+                                               .withBodyFile("VCPE/DeleteVcpeResCustService/getSIAfterDelArs.xml")));
+
+               // for BRG
+               MockQueryAllottedResourceById(AR_BRG_ID, "VCPE/DeleteVcpeResCustService/getBRGArUrlById.xml");
+               MockGetAllottedResource(CUST, SVC, INST, AR_BRG_ID, "VCPE/DeleteVcpeResCustService/arGetBRGById.xml");
+               MockPatchAllottedResource(CUST, SVC, INST, AR_BRG_ID);
+               MockDeleteAllottedResource(CUST, SVC, INST, AR_BRG_ID, ARVERS);
+
+               // for TXC
+               MockQueryAllottedResourceById(AR_TXC_ID, "VCPE/DeleteVcpeResCustService/getTXCArUrlById.xml");
+               MockGetAllottedResource(CUST, SVC, INST, AR_TXC_ID, "VCPE/DeleteVcpeResCustService/arGetTXCById.xml");
+               MockPatchAllottedResource(CUST, SVC, INST, AR_TXC_ID);
+               MockDeleteAllottedResource(CUST, SVC, INST, AR_TXC_ID, ARVERS);
+               
+               mockSDNCAdapter(200);
+               mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+               
+               Map<String, Object> variables = setupVariables();
+
+               String businessKey = UUID.randomUUID().toString();
+               invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables);
+               
+               // for BRG
+               injectSDNCCallbacks(callbacks, "deactivate");
+               injectSDNCCallbacks(callbacks, "delete");
+               injectSDNCCallbacks(callbacks, "unassign");
+
+               // for TXC
+               injectSDNCCallbacks(callbacks, "deactivate");
+               injectSDNCCallbacks(callbacks, "delete");
+               injectSDNCCallbacks(callbacks, "unassign");
+               
+               // for SI
+               injectSDNCCallbacks(callbacks, "deactivate");
+               injectSDNCCallbacks(callbacks, "delete");
+               
+               waitForProcessEnd(businessKey, 10000);
+
+               String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+               System.out.println("workflowException:\n" + workflowException);
+
+               String completionReq = BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix+VAR_COMP_REQ);
+               System.out.println("completionReq:\n" + completionReq);
+               
+               assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, PROCNAME+VAR_SUCCESS_IND));
+               assertEquals("200", BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_RESP_CODE));
+               assertEquals(null, workflowException);
+               assertTrue(completionReq.indexOf("<request-id>testRequestId<") >= 0);
+               assertTrue(completionReq.indexOf("<action>DELETE<") >= 0);
+               assertTrue(completionReq.indexOf("<source>VID<") >= 0);
+
+               assertEquals("2", BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix+"vnfsDeletedCount"));
+
+               BPMNUtil.assertAnyProcessInstanceFinished(processEngineRule, "DoDeleteVnfAndModules");
+       }
+       
+       @Test
+       @Deployment(resources = {
+                       "process/DeleteVcpeResCustService.bpmn",
+                       "subprocess/GenericGetService.bpmn",
+                       "subprocess/GenericDeleteService.bpmn",
+                       "subprocess/SDNCAdapterV1.bpmn",
+                       "subprocess/FalloutHandler.bpmn",
+            "subprocess/DoDeleteServiceInstance.bpmn",
+                       "subprocess/DoDeleteAllottedResourceBRG.bpmn",
+                       "subprocess/DoDeleteAllottedResourceTXC.bpmn",
+            "subprocess/CompleteMsoProcess.bpmn",
+
+            // stubs
+            "VCPE/stubprocess/DoDeleteVnfAndModules.bpmn"})
+       
+       public void testDeleteVcpeResCustService_NoBRG_NoTXC_NoVNF() throws Exception {
+
+               MockNodeQueryServiceInstanceById(INST, "GenericFlows/getSIUrlById.xml");
+
+               // TODO: use INST instead of DEC_INST
+               /*
+                * Seems to be a bug in GenericDeleteService (or its subflows) as they
+                * fail to URL-encode the SI id before performing the query so we'll
+                * add a stub for that case, too.
+                */
+               MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml");
+               
+               MockGetServiceInstance(CUST, SVC, INST, "VCPE/DeleteVcpeResCustService/getSIAfterDelArs.xml");
+               
+               mockSDNCAdapter(200);
+               mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+               
+               Map<String, Object> variables = setupVariables();
+
+               String businessKey = UUID.randomUUID().toString();
+               invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables);
+               
+               // for SI
+               injectSDNCCallbacks(callbacks, "deactivate");
+               injectSDNCCallbacks(callbacks, "delete");
+               
+               waitForProcessEnd(businessKey, 10000);
+
+               String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+               System.out.println("workflowException:\n" + workflowException);
+
+               String completionReq = BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix+VAR_COMP_REQ);
+               System.out.println("completionReq:\n" + completionReq);
+               
+               assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, PROCNAME+VAR_SUCCESS_IND));
+               assertEquals("200", BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_RESP_CODE));
+               assertEquals(null, workflowException);
+               assertTrue(completionReq.indexOf("<request-id>testRequestId<") >= 0);
+               assertTrue(completionReq.indexOf("<action>DELETE<") >= 0);
+               assertTrue(completionReq.indexOf("<source>VID<") >= 0);
+
+               assertEquals("0", BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix+"vnfsDeletedCount"));
+               
+               BPMNUtil.assertNoProcessInstance(processEngineRule, "DoDeleteVnfAndModules");
+       }
+       
+       @Test
+       @Deployment(resources = {
+                       "process/DeleteVcpeResCustService.bpmn",
+                       "subprocess/GenericGetService.bpmn",
+                       "subprocess/GenericDeleteService.bpmn",
+                       "subprocess/SDNCAdapterV1.bpmn",
+                       "subprocess/FalloutHandler.bpmn",
+            "subprocess/DoDeleteServiceInstance.bpmn",
+                       "subprocess/DoDeleteAllottedResourceBRG.bpmn",
+                       "subprocess/DoDeleteAllottedResourceTXC.bpmn",
+            "subprocess/CompleteMsoProcess.bpmn",
+
+            // stubs
+            "VCPE/stubprocess/DoDeleteVnfAndModules.bpmn"})
+       
+       public void testDeleteVcpeResCustService_Fault() throws Exception {
+
+               MockNodeQueryServiceInstanceById(INST, "GenericFlows/getSIUrlById.xml");
+
+               // TODO: use INST instead of DEC_INST
+               /*
+                * Seems to be a bug in GenericDeleteService (or its subflows) as they
+                * fail to URL-encode the SI id before performing the query so we'll
+                * add a stub for that case, too.
+                */
+               MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml");
+               
+               MockGetServiceInstance(CUST, SVC, INST, "VCPE/DeleteVcpeResCustService/getSIAfterDelArs.xml");
+               
+               // generate failure
+               mockSDNCAdapter(404);
+               
+               mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+               
+               Map<String, Object> variables = setupVariables();
+
+               String businessKey = UUID.randomUUID().toString();
+               invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables);
+               
+               waitForProcessEnd(businessKey, 10000);
+
+               String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+               System.out.println("workflowException:\n" + workflowException);
+
+               String completionReq = BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix+VAR_COMP_REQ);
+               System.out.println("completionReq:\n" + completionReq);
+               
+               assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, PROCNAME+VAR_SUCCESS_IND));
+               assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_RESP_CODE));
+               assertNotNull(workflowException);
+       }
+       
+       private Map<String, Object> setupVariables() throws UnsupportedEncodingException {
+               Map<String, Object> variables = new HashMap<>();
+               variables.put("isDebugLogEnabled", "true");
+               variables.put("requestId", "testRequestId");
+               variables.put("serviceInstanceId", DEC_INST);
+               variables.put("sdncVersion", "1802");
+               variables.put("serviceInstanceName", "some-junk-name");
+               return variables;
+       }
+       
+}
index f5c3775..0407e17 100644 (file)
@@ -1,4 +1,4 @@
-/*-
+/*
  * ============LICENSE_START=======================================================
  * ONAP - SO
  * ================================================================================
@@ -7,9 +7,9 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- *
+ * 
  *      http://www.apache.org/licenses/LICENSE-2.0
- *
+ * 
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
-
-/*
- * Â© 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property.
- */
 package org.openecomp.mso.bpmn.vcpe;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
 import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteAllottedResource;
 import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetAllottedResource;
 import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchAllottedResource;
@@ -36,23 +35,22 @@ import java.util.Map;
 import java.util.UUID;
 
 import org.camunda.bpm.engine.test.Deployment;
-import org.junit.Assert;
 import org.junit.Test;
 import org.openecomp.mso.bpmn.common.BPMNUtil;
-import org.openecomp.mso.bpmn.common.WorkflowTest;
 import org.openecomp.mso.bpmn.core.RollbackData;
 import org.openecomp.mso.bpmn.mock.FileUtil;
 
 
-public class DoCreateAllottedResourceBRGRollbackTest extends WorkflowTest {
+public class DoCreateAllottedResourceBRGRollbackTest extends AbstractTestBase {
 
+       private static final String PROCNAME = "DoCreateAllottedResourceBRGRollback";
        private static final String RbType = "DCARBRG_";
        private final CallbackSet callbacks = new CallbackSet();
        
        public DoCreateAllottedResourceBRGRollbackTest() throws IOException {
-               callbacks.put("deactivate", FileUtil.readResourceFile("__files/VCPE/VfModularity/SDNCTopologyDeactivateCallback.xml"));
-               callbacks.put("delete", FileUtil.readResourceFile("__files/VCPE/VfModularity/SDNCTopologyDeleteCallback.xml"));
-               callbacks.put("unassign", FileUtil.readResourceFile("__files/VCPE/VfModularity/SDNCTopologyUnassignCallback.xml"));
+               callbacks.put("deactivate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml"));
+               callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml"));
+               callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml"));
        }
        
        @Test
@@ -60,11 +58,11 @@ public class DoCreateAllottedResourceBRGRollbackTest extends WorkflowTest {
                        "subprocess/SDNCAdapterV1.bpmn",
                        "subprocess/FalloutHandler.bpmn",
                        "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"})
-       public void testDoCreateAllottedResourceBRGRollback_success() throws Exception {
+       public void testDoCreateAllottedResourceBRGRollback_Success() throws Exception {
                
-               MockGetAllottedResource("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "arId-1", "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
-               MockPatchAllottedResource("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "arId-1");
-               MockDeleteAllottedResource("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "arId-1", "1490627351232");
+               MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
+               MockPatchAllottedResource(CUST, SVC, INST, ARID);
+               MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
                mockSDNCAdapter(200);
                mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
                
@@ -72,7 +70,7 @@ public class DoCreateAllottedResourceBRGRollbackTest extends WorkflowTest {
                Map<String, Object> variables = new HashMap<>();
                setVariablesSuccess(variables, "testRequestId1");
                
-               invokeSubProcess("DoCreateAllottedResourceBRGRollback", businessKey, variables);
+               invokeSubProcess(PROCNAME, businessKey, variables);
                
                injectSDNCCallbacks(callbacks, "deactivate");
                injectSDNCCallbacks(callbacks, "delete");
@@ -80,37 +78,268 @@ public class DoCreateAllottedResourceBRGRollbackTest extends WorkflowTest {
 
                waitForProcessEnd(businessKey, 10000);
                
-               Assert.assertTrue(isProcessEnded(businessKey));
-               String workflowException = BPMNUtil.getVariable(processEngineRule, "DoCreateAllottedResourceBRGRollback", "WorkflowException");
+               assertTrue(isProcessEnded(businessKey));
+               String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
                System.out.println("workflowException:\n" + workflowException);
                assertEquals(null, workflowException);
+               assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack"));
+               assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError"));
        }
+       
+       @Test
+       @Deployment(resources = {
+                       "subprocess/SDNCAdapterV1.bpmn",
+                       "subprocess/FalloutHandler.bpmn",
+                       "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"})
+       public void testDoCreateAllottedResourceBRGRollback_skipRollback() throws Exception {
+               
+               MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
+               MockPatchAllottedResource(CUST, SVC, INST, ARID);
+               MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+               mockSDNCAdapter(200);
+               mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+               
+               String businessKey = UUID.randomUUID().toString();
+               Map<String, Object> variables = new HashMap<>();
+               RollbackData rollbackData = setVariablesSuccess(variables, "testRequestId1");
+
+               rollbackData.put(RbType, "rollbackAAI", "false");
+               rollbackData.put(RbType, "rollbackSDNCassign", "false");
+               
+               invokeSubProcess(PROCNAME, businessKey, variables);
 
-       private void setVariablesSuccess(Map<String, Object> variables, String requestId) {
+               waitForProcessEnd(businessKey, 10000);
+               
+               assertTrue(isProcessEnded(businessKey));
+               String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+               System.out.println("workflowException:\n" + workflowException);
+               assertEquals(null, workflowException);
+               assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack"));
+               assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError"));
+       }
+       
+       @Test
+       @Deployment(resources = {
+                       "subprocess/SDNCAdapterV1.bpmn",
+                       "subprocess/FalloutHandler.bpmn",
+                       "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"})
+       public void testDoCreateAllottedResourceBRGRollback_DoNotRollBack() throws Exception {
+               
+               mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+               
+               String businessKey = UUID.randomUUID().toString();
+               Map<String, Object> variables = new HashMap<>();
+               RollbackData rollbackData = setVariablesSuccess(variables, "testRequestId1");
+
+               // this will cause "rollbackSDNC" to be set to false
+               rollbackData.put(RbType, "rollbackSDNCassign", "false");
+               
+               invokeSubProcess(PROCNAME, businessKey, variables);
+
+               waitForProcessEnd(businessKey, 10000);
+               
+               assertTrue(isProcessEnded(businessKey));
+               String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+               System.out.println("workflowException:\n" + workflowException);
+               assertEquals(null, workflowException);
+               assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack"));
+               assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError"));
+       }
+       
+       @Test
+       @Deployment(resources = {
+                       "subprocess/SDNCAdapterV1.bpmn",
+                       "subprocess/FalloutHandler.bpmn",
+                       "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"})
+       public void testDoCreateAllottedResourceBRGRollback_NoDeactivate() throws Exception {
+               
+               MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
+               MockPatchAllottedResource(CUST, SVC, INST, ARID);
+               MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+               mockSDNCAdapter(200);
+               mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+               
+               String businessKey = UUID.randomUUID().toString();
+               Map<String, Object> variables = new HashMap<>();
+               RollbackData rollbackData = setVariablesSuccess(variables, "testRequestId1");
+
+               rollbackData.put(RbType, "rollbackSDNCactivate", "false");
+               
+               invokeSubProcess(PROCNAME, businessKey, variables);
+
+               injectSDNCCallbacks(callbacks, "delete");
+               injectSDNCCallbacks(callbacks, "unassign");
+
+               waitForProcessEnd(businessKey, 10000);
+               
+               assertTrue(isProcessEnded(businessKey));
+               String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+               System.out.println("workflowException:\n" + workflowException);
+               assertEquals(null, workflowException);
+               assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack"));
+               assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError"));
+       }
+       
+       @Test
+       @Deployment(resources = {
+                       "subprocess/SDNCAdapterV1.bpmn",
+                       "subprocess/FalloutHandler.bpmn",
+                       "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"})
+       public void testDoCreateAllottedResourceBRGRollback_NoDelete() throws Exception {
+               
+               MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
+               MockPatchAllottedResource(CUST, SVC, INST, ARID);
+               MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+               mockSDNCAdapter(200);
+               mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+               
+               String businessKey = UUID.randomUUID().toString();
+               Map<String, Object> variables = new HashMap<>();
+               RollbackData rollbackData = setVariablesSuccess(variables, "testRequestId1");
+
+               rollbackData.put(RbType, "rollbackSDNCcreate", "false");
+               
+               invokeSubProcess(PROCNAME, businessKey, variables);
+
+               injectSDNCCallbacks(callbacks, "deactivate");
+               injectSDNCCallbacks(callbacks, "unassign");
+
+               waitForProcessEnd(businessKey, 10000);
+               
+               assertTrue(isProcessEnded(businessKey));
+               String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+               System.out.println("workflowException:\n" + workflowException);
+               assertEquals(null, workflowException);
+               assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack"));
+               assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError"));
+       }
+       
+       @Test
+       @Deployment(resources = {
+                       "subprocess/SDNCAdapterV1.bpmn",
+                       "subprocess/FalloutHandler.bpmn",
+                       "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"})
+       public void testDoCreateAllottedResourceBRGRollback_NoUnassign() throws Exception {
+               
+               MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
+               MockPatchAllottedResource(CUST, SVC, INST, ARID);
+               MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+               mockSDNCAdapter(200);
+               mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+               
+               String businessKey = UUID.randomUUID().toString();
+               Map<String, Object> variables = new HashMap<>();
+               RollbackData rollbackData = setVariablesSuccess(variables, "testRequestId1");
+
+               rollbackData.put(RbType, "rollbackSDNCassign", "false");
+               
+               /*
+                * Note: if assign == false then the flow/script will set
+                * "skipRollback" to false, which will cause ALL of the SDNC steps
+                * to be skipped, not just the unassign step.
+                */
+               
+               invokeSubProcess(PROCNAME, businessKey, variables);
+
+               waitForProcessEnd(businessKey, 10000);
+               
+               assertTrue(isProcessEnded(businessKey));
+               String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+               System.out.println("workflowException:\n" + workflowException);
+               assertEquals(null, workflowException);
+               assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack"));
+               assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError"));
+       }
+       
+       @Test
+       @Deployment(resources = {
+                       "subprocess/SDNCAdapterV1.bpmn",
+                       "subprocess/FalloutHandler.bpmn",
+                       "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"})
+       public void testDoCreateAllottedResourceBRGRollback_SubProcessError() throws Exception {
+               
+               MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
+               MockPatchAllottedResource(CUST, SVC, INST, ARID);
+               MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+               mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+               mockSDNCAdapter(404);
+               
+               String businessKey = UUID.randomUUID().toString();
+               Map<String, Object> variables = new HashMap<>();
+               setVariablesSuccess(variables, "testRequestId1");
+               
+               invokeSubProcess(PROCNAME, businessKey, variables);
+
+               waitForProcessEnd(businessKey, 10000);
+               
+               assertTrue(isProcessEnded(businessKey));
+               String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+               System.out.println("workflowException:\n" + workflowException);
+               assertEquals(null, workflowException);
+               assertEquals("false", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack"));
+               assertNotNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError"));
+       }
+       
+       @Test
+       @Deployment(resources = {
+                       "subprocess/SDNCAdapterV1.bpmn",
+                       "subprocess/FalloutHandler.bpmn",
+                       "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"})
+       public void testDoCreateAllottedResourceBRGRollback_JavaException() throws Exception {
+               
+               MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
+               MockPatchAllottedResource(CUST, SVC, INST, ARID);
+               MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+               mockSDNCAdapter(200);
+               mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+               
+               String businessKey = UUID.randomUUID().toString();
+               Map<String, Object> variables = new HashMap<>();
+               setVariablesSuccess(variables, "testRequestId1");
+
+               variables.put("rollbackData", "string instead of rollback data");
+               
+               invokeSubProcess(PROCNAME, businessKey, variables);
+
+               waitForProcessEnd(businessKey, 10000);
+               
+               assertTrue(isProcessEnded(businessKey));
+               String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+               System.out.println("workflowException:\n" + workflowException);
+               assertEquals(null, workflowException);
+               assertEquals("false", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack"));
+               assertNotNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError"));
+       }
+
+       private RollbackData setVariablesSuccess(Map<String, Object> variables, String requestId) {
                variables.put("isDebugLogEnabled", "true");
                variables.put("failNotFound", "true");
                variables.put("msoRequestId", requestId);
                variables.put("mso-request-id", "requestId");
-               variables.put("allottedResourceId", "arId-1");
+               variables.put("allottedResourceId", ARID);
+
+               variables.put("serviceInstanceId", DEC_INST);
+               variables.put("parentServiceInstanceId", DEC_PARENT_INST);
                
-               variables.put("serviceInstanceId", "MIS%252F1604%252F0026%252FSW_INTERNET");
-               variables.put("parentServiceInstanceId","MIS%252F1604%252F0026%252FSW_INTERNET");
                RollbackData rollbackData = new RollbackData();
 
-               rollbackData.put(RbType, "serviceInstanceId", "MIS%252F1604%252F0026%252FSW_INTERNET");
-               rollbackData.put(RbType, "serviceSubscriptionType", "123456789");
+               rollbackData.put(RbType, "serviceInstanceId", DEC_INST);
+               rollbackData.put(RbType, "serviceSubscriptionType", SVC);
                rollbackData.put(RbType, "disablerollback", "false");
                rollbackData.put(RbType, "rollbackAAI", "true");
                rollbackData.put(RbType, "rollbackSDNCassign", "true");
                rollbackData.put(RbType, "rollbackSDNCactivate", "true");
                rollbackData.put(RbType, "rollbackSDNCcreate", "true");
-               rollbackData.put(RbType, "aaiARPath", "http://localhost:28090/aai/v9/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1");
+               rollbackData.put(RbType, "aaiARPath", "http://localhost:28090/aai/v9/business/customers/customer/"+CUST+"/service-subscriptions/service-subscription/"+SVC+"/service-instances/service-instance/"+INST+"/allotted-resources/allotted-resource/"+ARID);
                
                rollbackData.put(RbType, "sdncActivateRollbackReq", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncActivateRollbackReq.xml"));
                rollbackData.put(RbType, "sdncCreateRollbackReq", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncCreateRollbackReq.xml")); 
                rollbackData.put(RbType, "sdncAssignRollbackReq", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncAssignRollbackReq.xml"));
                
                variables.put("rollbackData",rollbackData);
+               
+               return rollbackData;
        }
 
 }
index 4f7b32b..5b6f74f 100644 (file)
@@ -1,4 +1,4 @@
-/*-
+/*
  * ============LICENSE_START=======================================================
  * ONAP - SO
  * ================================================================================
@@ -7,9 +7,9 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- *
+ * 
  *      http://www.apache.org/licenses/LICENSE-2.0
- *
+ * 
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
-
-/*
- * Â© 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property.
- */
 package org.openecomp.mso.bpmn.vcpe;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetAllottedResource;
 import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetServiceInstance;
 import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById;
 import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchAllottedResource;
@@ -40,18 +38,18 @@ import org.camunda.bpm.engine.test.Deployment;
 import org.junit.Assert;
 import org.junit.Test;
 import org.openecomp.mso.bpmn.common.BPMNUtil;
-import org.openecomp.mso.bpmn.common.WorkflowTest;
 import org.openecomp.mso.bpmn.mock.FileUtil;
 
 
-public class DoCreateAllottedResourceBRGTest extends WorkflowTest {
+public class DoCreateAllottedResourceBRGTest extends AbstractTestBase {
 
+       private static final String PROCNAME = "DoCreateAllottedResourceBRG";
        private final CallbackSet callbacks = new CallbackSet();
 
        public DoCreateAllottedResourceBRGTest() throws IOException {
-               callbacks.put("assign", FileUtil.readResourceFile("__files/VCPE/VfModularity/SDNCTopologyAssignCallback.xml"));
-               callbacks.put("create", FileUtil.readResourceFile("__files/VCPE/VfModularity/SDNCTopologyCreateCallback.xml"));
-               callbacks.put("activate", FileUtil.readResourceFile("__files/VCPE/VfModularity/SDNCTopologyActivateCallback.xml"));
+               callbacks.put("assign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyAssignCallback.xml"));
+               callbacks.put("create", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyCreateCallback.xml"));
+               callbacks.put("activate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyActivateCallback.xml"));
                callbacks.put("query", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRG/SDNCTopologyQueryCallback.xml"));
        }
        
@@ -62,14 +60,21 @@ public class DoCreateAllottedResourceBRGTest extends WorkflowTest {
                        "subprocess/FalloutHandler.bpmn",
                        "subprocess/DoCreateAllottedResourceBRG.bpmn",
                        "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"})
-       public void testDoCreateAllottedResourceBRG_success() throws Exception{
-
-               MockNodeQueryServiceInstanceById("MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getSIUrlById.xml");
-               MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml");
-               MockNodeQueryServiceInstanceById("MIS%252F1604%252F0027%252FSW_INTERNET", "GenericFlows/getParentSIUrlById.xml");
-               MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0027%252FSW_INTERNET", "GenericFlows/getParentServiceInstance.xml");
-               MockPutAllottedResource("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0027%252FSW_INTERNET", "arId-1");
-               MockPatchAllottedResource("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0027%252FSW_INTERNET", "arId-1");
+       public void testDoCreateAllottedResourceBRG_Success() throws Exception{
+
+               // TODO: use INST instead of DEC_INST
+               /*
+                * should be INST instead of DEC_INST, but AAI utilities appear to
+                * have a bug in that they don't URL-encode the SI id before using
+                * it in the query
+                */
+               MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml");
+               MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+
+               MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+               MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+               MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
+               MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
                mockSDNCAdapter(200);
                mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
 
@@ -77,7 +82,7 @@ public class DoCreateAllottedResourceBRGTest extends WorkflowTest {
                Map<String, Object> variables = new HashMap<>();
                setVariablesSuccess(variables, "testRequestId123");
                
-               invokeSubProcess("DoCreateAllottedResourceBRG", businessKey, variables);
+               invokeSubProcess(PROCNAME, businessKey, variables);
                
                injectSDNCCallbacks(callbacks, "assign");
                injectSDNCCallbacks(callbacks, "create");
@@ -87,14 +92,178 @@ public class DoCreateAllottedResourceBRGTest extends WorkflowTest {
                waitForProcessEnd(businessKey, 10000);
                
                Assert.assertTrue(isProcessEnded(businessKey));
-               String allotedResourceName = BPMNUtil.getVariable(processEngineRule, "DoCreateAllottedResourceBRG", "allotedResourceName");
-               String workflowException = BPMNUtil.getVariable(processEngineRule, "DoCreateAllottedResourceBRG", "WorkflowException");
-               assertEquals("namefromrequest", allotedResourceName);
+               String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
                assertEquals(null, workflowException);
+               
+               assertEquals("namefromrequest", BPMNUtil.getVariable(processEngineRule, PROCNAME, "allotedResourceName"));
+       }
+       
+       @Test
+       @Deployment(resources = {
+                       "subprocess/GenericGetService.bpmn", 
+                       "subprocess/SDNCAdapterV1.bpmn", 
+                       "subprocess/FalloutHandler.bpmn",
+                       "subprocess/DoCreateAllottedResourceBRG.bpmn",
+                       "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"})
+       public void testDoCreateAllottedResourceBRG_NoSI() throws Exception{
+
+               // TODO: use INST instead of DEC_INST
+               /*
+                * should be INST instead of DEC_INST, but AAI utilities appear to
+                * have a bug in that they don't URL-encode the SI id before using
+                * it in the query
+                */
+               MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getNotFound.xml");
+               MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+
+               MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+               MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+               MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
+               MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
+               mockSDNCAdapter(200);
+               mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+               String businessKey = UUID.randomUUID().toString();
+               Map<String, Object> variables = new HashMap<>();
+               setVariablesSuccess(variables, "testRequestId123");
+               
+               invokeSubProcess(PROCNAME, businessKey, variables);
+
+               waitForProcessEnd(businessKey, 10000);
+               
+               Assert.assertTrue(isProcessEnded(businessKey));
+               String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+               assertNotNull(workflowException);
+               
+               assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, "allotedResourceName"));
+       }
+       
+       @Test
+       @Deployment(resources = {
+                       "subprocess/GenericGetService.bpmn", 
+                       "subprocess/SDNCAdapterV1.bpmn", 
+                       "subprocess/FalloutHandler.bpmn",
+                       "subprocess/DoCreateAllottedResourceBRG.bpmn",
+                       "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"})
+       public void testDoCreateAllottedResourceBRG_ActiveAr() throws Exception{
+
+               // TODO: use INST instead of DEC_INST
+               /*
+                * should be INST instead of DEC_INST, but AAI utilities appear to
+                * have a bug in that they don't URL-encode the SI id before using
+                * it in the query
+                */
+               MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml");
+               MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+               
+               MockGetServiceInstance(CUST, SVC, INST, "VCPE/DoCreateAllottedResourceBRG/getSIandAR.xml");
+               MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRG/getArBrg2.xml");
+               MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+               MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
+               MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
+               mockSDNCAdapter(200);
+               mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+               String businessKey = UUID.randomUUID().toString();
+               Map<String, Object> variables = new HashMap<>();
+               setVariablesSuccess(variables, "testRequestId123");
+
+               variables.put("failExists", "false");
+               
+               invokeSubProcess(PROCNAME, businessKey, variables);
+               
+               injectSDNCCallbacks(callbacks, "query");
+
+               waitForProcessEnd(businessKey, 10000);
+               
+               Assert.assertTrue(isProcessEnded(businessKey));
+               String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+               assertEquals(null, workflowException);
+               
+               assertEquals("namefromrequest", BPMNUtil.getVariable(processEngineRule, PROCNAME, "allotedResourceName"));
+       }
+       
+       @Test
+       @Deployment(resources = {
+                       "subprocess/GenericGetService.bpmn", 
+                       "subprocess/SDNCAdapterV1.bpmn", 
+                       "subprocess/FalloutHandler.bpmn",
+                       "subprocess/DoCreateAllottedResourceBRG.bpmn",
+                       "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"})
+       public void testDoCreateAllottedResourceBRG_NoParentSI() throws Exception{
+
+               // TODO: use INST instead of DEC_INST
+               /*
+                * should be INST instead of DEC_INST, but AAI utilities appear to
+                * have a bug in that they don't URL-encode the SI id before using
+                * it in the query
+                */
+               MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml");
+               MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getNotFound.xml");
+
+               MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+               MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+               MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
+               MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
+               mockSDNCAdapter(200);
+               mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+               String businessKey = UUID.randomUUID().toString();
+               Map<String, Object> variables = new HashMap<>();
+               setVariablesSuccess(variables, "testRequestId123");
+               
+               invokeSubProcess(PROCNAME, businessKey, variables);
+
+               waitForProcessEnd(businessKey, 10000);
+               
+               Assert.assertTrue(isProcessEnded(businessKey));
+               String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+               assertNotNull(workflowException);
+               
+               assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, "allotedResourceName"));
+       }
+       
+       @Test
+       @Deployment(resources = {
+                       "subprocess/GenericGetService.bpmn", 
+                       "subprocess/SDNCAdapterV1.bpmn", 
+                       "subprocess/FalloutHandler.bpmn",
+                       "subprocess/DoCreateAllottedResourceBRG.bpmn",
+                       "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"})
+       public void testDoCreateAllottedResourceBRG_SubProcessError() throws Exception{
+
+               // TODO: use INST instead of DEC_INST
+               /*
+                * should be INST instead of DEC_INST, but AAI utilities appear to
+                * have a bug in that they don't URL-encode the SI id before using
+                * it in the query
+                */
+               MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml");
+               MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+               
+               MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+               MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+               MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
+               MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
+               mockSDNCAdapter(404);
+               mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+               String businessKey = UUID.randomUUID().toString();
+               Map<String, Object> variables = new HashMap<>();
+               setVariablesSuccess(variables, "testRequestId123");
+               
+               invokeSubProcess(PROCNAME, businessKey, variables);
+
+               waitForProcessEnd(businessKey, 10000);
+               
+               Assert.assertTrue(isProcessEnded(businessKey));
+               String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+               assertNotNull(workflowException);
+               
+               assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, "allotedResourceName"));
        }
 
        private void setVariablesSuccess(Map<String, Object> variables, String requestId) {
-               // TODO: need all of these?
                variables.put("isDebugLogEnabled", "true");
                variables.put("failExists", "true");
                variables.put("disableRollback", "true");
@@ -104,14 +273,15 @@ public class DoCreateAllottedResourceBRGTest extends WorkflowTest {
                variables.put("sourceNetworkRole", "snRole");
                variables.put("allottedResourceRole", "txc");
                variables.put("allottedResourceType", "BRG");
-               variables.put("allottedResourceId", "arId-1");
+               variables.put("allottedResourceId", ARID);
                variables.put("vni", "BRG");
                variables.put("vgmuxBearerIP", "bearerip");
                variables.put("brgWanMacAddress", "wanmac");
                variables.put("junitSleepMs", "5");
+
+               variables.put("serviceInstanceId", DEC_INST);
+               variables.put("parentServiceInstanceId", DEC_PARENT_INST);
                
-               variables.put("serviceInstanceId", "MIS%252F1604%252F0026%252FSW_INTERNET");
-               variables.put("parentServiceInstanceId","MIS%252F1604%252F0027%252FSW_INTERNET");
                variables.put("serviceChainServiceInstanceId", "scsiId");
                
                String arModelInfo = "{ "+ "\"modelType\": \"allotted-resource\"," +
index a887f72..cdce56e 100644 (file)
@@ -1,4 +1,4 @@
-/*-
+/*
  * ============LICENSE_START=======================================================
  * ONAP - SO
  * ================================================================================
@@ -7,9 +7,9 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- *
+ * 
  *      http://www.apache.org/licenses/LICENSE-2.0
- *
+ * 
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
-
-/*
- * Â© 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property.
- */
 package org.openecomp.mso.bpmn.vcpe;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
 import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteAllottedResource;
 import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetAllottedResource;
 import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchAllottedResource;
@@ -36,23 +35,22 @@ import java.util.Map;
 import java.util.UUID;
 
 import org.camunda.bpm.engine.test.Deployment;
-import org.junit.Assert;
 import org.junit.Test;
 import org.openecomp.mso.bpmn.common.BPMNUtil;
-import org.openecomp.mso.bpmn.common.WorkflowTest;
 import org.openecomp.mso.bpmn.core.RollbackData;
 import org.openecomp.mso.bpmn.mock.FileUtil;
 
 
-public class DoCreateAllottedResourceTXCRollbackTest extends WorkflowTest {
+public class DoCreateAllottedResourceTXCRollbackTest extends AbstractTestBase {
 
+       private static final String PROCNAME = "DoCreateAllottedResourceTXCRollback";
        private static final String RbType = "DCARTXC_";
        private final CallbackSet callbacks = new CallbackSet();
        
        public DoCreateAllottedResourceTXCRollbackTest() throws IOException {
-               callbacks.put("deactivate", FileUtil.readResourceFile("__files/VCPE/VfModularity/SDNCTopologyDeactivateCallback.xml"));
-               callbacks.put("delete", FileUtil.readResourceFile("__files/VCPE/VfModularity/SDNCTopologyDeleteCallback.xml"));
-               callbacks.put("unassign", FileUtil.readResourceFile("__files/VCPE/VfModularity/SDNCTopologyUnassignCallback.xml"));
+               callbacks.put("deactivate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml"));
+               callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml"));
+               callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml"));
        }
        
        @Test
@@ -60,11 +58,11 @@ public class DoCreateAllottedResourceTXCRollbackTest extends WorkflowTest {
                        "subprocess/SDNCAdapterV1.bpmn",
                        "subprocess/FalloutHandler.bpmn",
                        "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"})
-       public void testDoCreateAllottedResourceTXCRollback_success() throws Exception{
+       public void testDoCreateAllottedResourceTXCRollback_Success() throws Exception {
                
-               MockGetAllottedResource("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "arId-1", "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
-               MockPatchAllottedResource("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "arId-1");
-               MockDeleteAllottedResource("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "arId-1", "1490627351232");
+               MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
+               MockPatchAllottedResource(CUST, SVC, INST, ARID);
+               MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
                mockSDNCAdapter(200);
                mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
                
@@ -72,7 +70,7 @@ public class DoCreateAllottedResourceTXCRollbackTest extends WorkflowTest {
                Map<String, Object> variables = new HashMap<>();
                setVariablesSuccess(variables, "testRequestId1");
                
-               invokeSubProcess("DoCreateAllottedResourceTXCRollback", businessKey, variables);
+               invokeSubProcess(PROCNAME, businessKey, variables);
                
                injectSDNCCallbacks(callbacks, "deactivate");
                injectSDNCCallbacks(callbacks, "delete");
@@ -80,37 +78,268 @@ public class DoCreateAllottedResourceTXCRollbackTest extends WorkflowTest {
 
                waitForProcessEnd(businessKey, 10000);
                
-               Assert.assertTrue(isProcessEnded(businessKey));
-               String workflowException = BPMNUtil.getVariable(processEngineRule, "DoCreateAllottedResourceTXCRollback", "WorkflowException");
+               assertTrue(isProcessEnded(businessKey));
+               String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
                System.out.println("workflowException:\n" + workflowException);
                assertEquals(null, workflowException);
+               assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack"));
+               assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError"));
        }
+       
+       @Test
+       @Deployment(resources = {
+                       "subprocess/SDNCAdapterV1.bpmn",
+                       "subprocess/FalloutHandler.bpmn",
+                       "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"})
+       public void testDoCreateAllottedResourceTXCRollback_skipRollback() throws Exception {
+               
+               MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
+               MockPatchAllottedResource(CUST, SVC, INST, ARID);
+               MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+               mockSDNCAdapter(200);
+               mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+               
+               String businessKey = UUID.randomUUID().toString();
+               Map<String, Object> variables = new HashMap<>();
+               RollbackData rollbackData = setVariablesSuccess(variables, "testRequestId1");
+
+               rollbackData.put(RbType, "rollbackAAI", "false");
+               rollbackData.put(RbType, "rollbackSDNCassign", "false");
+               
+               invokeSubProcess(PROCNAME, businessKey, variables);
 
-       private void setVariablesSuccess(Map<String, Object> variables, String requestId) {
+               waitForProcessEnd(businessKey, 10000);
+               
+               assertTrue(isProcessEnded(businessKey));
+               String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+               System.out.println("workflowException:\n" + workflowException);
+               assertEquals(null, workflowException);
+               assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack"));
+               assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError"));
+       }
+       
+       @Test
+       @Deployment(resources = {
+                       "subprocess/SDNCAdapterV1.bpmn",
+                       "subprocess/FalloutHandler.bpmn",
+                       "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"})
+       public void testDoCreateAllottedResourceTXCRollback_DoNotRollBack() throws Exception {
+               
+               mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+               
+               String businessKey = UUID.randomUUID().toString();
+               Map<String, Object> variables = new HashMap<>();
+               RollbackData rollbackData = setVariablesSuccess(variables, "testRequestId1");
+
+               // this will cause "rollbackSDNC" to be set to false
+               rollbackData.put(RbType, "rollbackSDNCassign", "false");
+               
+               invokeSubProcess(PROCNAME, businessKey, variables);
+
+               waitForProcessEnd(businessKey, 10000);
+               
+               assertTrue(isProcessEnded(businessKey));
+               String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+               System.out.println("workflowException:\n" + workflowException);
+               assertEquals(null, workflowException);
+               assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack"));
+               assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError"));
+       }
+       
+       @Test
+       @Deployment(resources = {
+                       "subprocess/SDNCAdapterV1.bpmn",
+                       "subprocess/FalloutHandler.bpmn",
+                       "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"})
+       public void testDoCreateAllottedResourceTXCRollback_NoDeactivate() throws Exception {
+               
+               MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
+               MockPatchAllottedResource(CUST, SVC, INST, ARID);
+               MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+               mockSDNCAdapter(200);
+               mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+               
+               String businessKey = UUID.randomUUID().toString();
+               Map<String, Object> variables = new HashMap<>();
+               RollbackData rollbackData = setVariablesSuccess(variables, "testRequestId1");
+
+               rollbackData.put(RbType, "rollbackSDNCactivate", "false");
+               
+               invokeSubProcess(PROCNAME, businessKey, variables);
+
+               injectSDNCCallbacks(callbacks, "delete");
+               injectSDNCCallbacks(callbacks, "unassign");
+
+               waitForProcessEnd(businessKey, 10000);
+               
+               assertTrue(isProcessEnded(businessKey));
+               String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+               System.out.println("workflowException:\n" + workflowException);
+               assertEquals(null, workflowException);
+               assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack"));
+               assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError"));
+       }
+       
+       @Test
+       @Deployment(resources = {
+                       "subprocess/SDNCAdapterV1.bpmn",
+                       "subprocess/FalloutHandler.bpmn",
+                       "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"})
+       public void testDoCreateAllottedResourceTXCRollback_NoDelete() throws Exception {
+               
+               MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
+               MockPatchAllottedResource(CUST, SVC, INST, ARID);
+               MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+               mockSDNCAdapter(200);
+               mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+               
+               String businessKey = UUID.randomUUID().toString();
+               Map<String, Object> variables = new HashMap<>();
+               RollbackData rollbackData = setVariablesSuccess(variables, "testRequestId1");
+
+               rollbackData.put(RbType, "rollbackSDNCcreate", "false");
+               
+               invokeSubProcess(PROCNAME, businessKey, variables);
+
+               injectSDNCCallbacks(callbacks, "deactivate");
+               injectSDNCCallbacks(callbacks, "unassign");
+
+               waitForProcessEnd(businessKey, 10000);
+               
+               assertTrue(isProcessEnded(businessKey));
+               String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+               System.out.println("workflowException:\n" + workflowException);
+               assertEquals(null, workflowException);
+               assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack"));
+               assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError"));
+       }
+       
+       @Test
+       @Deployment(resources = {
+                       "subprocess/SDNCAdapterV1.bpmn",
+                       "subprocess/FalloutHandler.bpmn",
+                       "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"})
+       public void testDoCreateAllottedResourceTXCRollback_NoUnassign() throws Exception {
+               
+               MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
+               MockPatchAllottedResource(CUST, SVC, INST, ARID);
+               MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+               mockSDNCAdapter(200);
+               mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+               
+               String businessKey = UUID.randomUUID().toString();
+               Map<String, Object> variables = new HashMap<>();
+               RollbackData rollbackData = setVariablesSuccess(variables, "testRequestId1");
+
+               rollbackData.put(RbType, "rollbackSDNCassign", "false");
+               
+               /*
+                * Note: if assign == false then the flow/script will set
+                * "skipRollback" to false, which will cause ALL of the SDNC steps
+                * to be skipped, not just the unassign step.
+                */
+               
+               invokeSubProcess(PROCNAME, businessKey, variables);
+
+               waitForProcessEnd(businessKey, 10000);
+               
+               assertTrue(isProcessEnded(businessKey));
+               String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+               System.out.println("workflowException:\n" + workflowException);
+               assertEquals(null, workflowException);
+               assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack"));
+               assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError"));
+       }
+       
+       @Test
+       @Deployment(resources = {
+                       "subprocess/SDNCAdapterV1.bpmn",
+                       "subprocess/FalloutHandler.bpmn",
+                       "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"})
+       public void testDoCreateAllottedResourceTXCRollback_SubProcessError() throws Exception {
+               
+               MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
+               MockPatchAllottedResource(CUST, SVC, INST, ARID);
+               MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+               mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+               mockSDNCAdapter(404);
+               
+               String businessKey = UUID.randomUUID().toString();
+               Map<String, Object> variables = new HashMap<>();
+               setVariablesSuccess(variables, "testRequestId1");
+               
+               invokeSubProcess(PROCNAME, businessKey, variables);
+
+               waitForProcessEnd(businessKey, 10000);
+               
+               assertTrue(isProcessEnded(businessKey));
+               String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+               System.out.println("workflowException:\n" + workflowException);
+               assertEquals(null, workflowException);
+               assertEquals("false", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack"));
+               assertNotNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError"));
+       }
+       
+       @Test
+       @Deployment(resources = {
+                       "subprocess/SDNCAdapterV1.bpmn",
+                       "subprocess/FalloutHandler.bpmn",
+                       "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"})
+       public void testDoCreateAllottedResourceTXCRollback_JavaException() throws Exception {
+               
+               MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
+               MockPatchAllottedResource(CUST, SVC, INST, ARID);
+               MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+               mockSDNCAdapter(200);
+               mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+               
+               String businessKey = UUID.randomUUID().toString();
+               Map<String, Object> variables = new HashMap<>();
+               setVariablesSuccess(variables, "testRequestId1");
+
+               variables.put("rollbackData", "string instead of rollback data");
+               
+               invokeSubProcess(PROCNAME, businessKey, variables);
+
+               waitForProcessEnd(businessKey, 10000);
+               
+               assertTrue(isProcessEnded(businessKey));
+               String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+               System.out.println("workflowException:\n" + workflowException);
+               assertEquals(null, workflowException);
+               assertEquals("false", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack"));
+               assertNotNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError"));
+       }
+
+       private RollbackData setVariablesSuccess(Map<String, Object> variables, String requestId) {
                variables.put("isDebugLogEnabled", "true");
                variables.put("failNotFound", "true");
                variables.put("msoRequestId", requestId);
                variables.put("mso-request-id", "requestId");
-               variables.put("allottedResourceId", "arId-1");
+               variables.put("allottedResourceId", ARID);
+
+               variables.put("serviceInstanceId", DEC_INST);
+               variables.put("parentServiceInstanceId", DEC_PARENT_INST);
                
-               variables.put("serviceInstanceId", "MIS%252F1604%252F0026%252FSW_INTERNET");
-               variables.put("parentServiceInstanceId","MIS%252F1604%252F0026%252FSW_INTERNET");
                RollbackData rollbackData = new RollbackData();
 
-               rollbackData.put(RbType, "serviceInstanceId", "MIS%252F1604%252F0026%252FSW_INTERNET");
-               rollbackData.put(RbType, "serviceSubscriptionType", "123456789");
+               rollbackData.put(RbType, "serviceInstanceId", DEC_INST);
+               rollbackData.put(RbType, "serviceSubscriptionType", SVC);
                rollbackData.put(RbType, "disablerollback", "false");
                rollbackData.put(RbType, "rollbackAAI", "true");
                rollbackData.put(RbType, "rollbackSDNCassign", "true");
                rollbackData.put(RbType, "rollbackSDNCactivate", "true");
                rollbackData.put(RbType, "rollbackSDNCcreate", "true");
-               rollbackData.put(RbType, "aaiARPath", "http://localhost:28090/aai/v9/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1");
+               rollbackData.put(RbType, "aaiARPath", "http://localhost:28090/aai/v9/business/customers/customer/"+CUST+"/service-subscriptions/service-subscription/"+SVC+"/service-instances/service-instance/"+INST+"/allotted-resources/allotted-resource/"+ARID);
                
                rollbackData.put(RbType, "sdncActivateRollbackReq", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncActivateRollbackReq.xml"));
                rollbackData.put(RbType, "sdncCreateRollbackReq", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncCreateRollbackReq.xml")); 
                rollbackData.put(RbType, "sdncAssignRollbackReq", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncAssignRollbackReq.xml"));
                
                variables.put("rollbackData",rollbackData);
+               
+               return rollbackData;
        }
 
 }
index 42704bf..4323cca 100644 (file)
@@ -1,4 +1,4 @@
-/*-
+/*
  * ============LICENSE_START=======================================================
  * ONAP - SO
  * ================================================================================
@@ -7,9 +7,9 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- *
+ * 
  *      http://www.apache.org/licenses/LICENSE-2.0
- *
+ * 
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
-
-/*
- * Â© 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property.
- */
 package org.openecomp.mso.bpmn.vcpe;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetAllottedResource;
 import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetServiceInstance;
 import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById;
 import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchAllottedResource;
@@ -40,18 +38,18 @@ import org.camunda.bpm.engine.test.Deployment;
 import org.junit.Assert;
 import org.junit.Test;
 import org.openecomp.mso.bpmn.common.BPMNUtil;
-import org.openecomp.mso.bpmn.common.WorkflowTest;
 import org.openecomp.mso.bpmn.mock.FileUtil;
 
 
-public class DoCreateAllottedResourceTXCTest extends WorkflowTest {
+public class DoCreateAllottedResourceTXCTest extends AbstractTestBase {
 
+       private static final String PROCNAME = "DoCreateAllottedResourceTXC";
        private final CallbackSet callbacks = new CallbackSet();
 
        public DoCreateAllottedResourceTXCTest() throws IOException {
-               callbacks.put("assign", FileUtil.readResourceFile("__files/VCPE/VfModularity/SDNCTopologyAssignCallback.xml"));
-               callbacks.put("create", FileUtil.readResourceFile("__files/VCPE/VfModularity/SDNCTopologyCreateCallback.xml"));
-               callbacks.put("activate", FileUtil.readResourceFile("__files/VCPE/VfModularity/SDNCTopologyActivateCallback.xml"));
+               callbacks.put("assign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyAssignCallback.xml"));
+               callbacks.put("create", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyCreateCallback.xml"));
+               callbacks.put("activate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyActivateCallback.xml"));
                callbacks.put("query", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceTXC/SDNCTopologyQueryCallback.xml"));
        }
        
@@ -62,22 +60,29 @@ public class DoCreateAllottedResourceTXCTest extends WorkflowTest {
                        "subprocess/FalloutHandler.bpmn",
                        "subprocess/DoCreateAllottedResourceTXC.bpmn",
                        "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"})
-       public void testDoCreateAllottedResourceTXC_success() throws Exception{
-
-               MockNodeQueryServiceInstanceById("MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getSIUrlById.xml");
-               MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml");
-               MockNodeQueryServiceInstanceById("MIS%252F1604%252F0027%252FSW_INTERNET", "GenericFlows/getParentSIUrlById.xml");
-               MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0027%252FSW_INTERNET", "GenericFlows/getParentServiceInstance.xml");
-               MockPutAllottedResource("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0027%252FSW_INTERNET", "arId-1");
-               MockPatchAllottedResource("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0027%252FSW_INTERNET", "arId-1");
+       public void testDoCreateAllottedResourceTXC_Success() throws Exception{
+
+               // TODO: use INST instead of DEC_INST
+               /*
+                * should be INST instead of DEC_INST, but AAI utilities appear to
+                * have a bug in that they don't URL-encode the SI id before using
+                * it in the query
+                */
+               MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml");
+               MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+               
+               MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+               MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+               MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
+               MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
                mockSDNCAdapter(200);
                mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
 
                String businessKey = UUID.randomUUID().toString();
-               Map<String, Object> variables = new HashMap<String, Object>();
+               Map<String, Object> variables = new HashMap<>();
                setVariablesSuccess(variables, "testRequestId123");
                
-               invokeSubProcess("DoCreateAllottedResourceTXC", businessKey, variables);
+               invokeSubProcess(PROCNAME, businessKey, variables);
                
                injectSDNCCallbacks(callbacks, "assign");
                injectSDNCCallbacks(callbacks, "create");
@@ -87,13 +92,186 @@ public class DoCreateAllottedResourceTXCTest extends WorkflowTest {
                waitForProcessEnd(businessKey, 10000);
                
                Assert.assertTrue(isProcessEnded(businessKey));
-               String workflowException = BPMNUtil.getVariable(processEngineRule, "DoCreateAllottedResourceTXC", "WorkflowException");
-               System.out.println("workflowException:\n" + workflowException);
+               String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+               assertEquals(null, workflowException);
+
+               assertEquals("namefromrequest", BPMNUtil.getVariable(processEngineRule, PROCNAME, "allotedResourceName"));
+               assertEquals("my-vni", BPMNUtil.getVariable(processEngineRule, PROCNAME, "vni"));
+               assertEquals("my-bearer-ip", BPMNUtil.getVariable(processEngineRule, PROCNAME, "vgmuxBearerIP"));
+               assertEquals("my-lan-ip", BPMNUtil.getVariable(processEngineRule, PROCNAME, "vgmuxLanIP"));
+       }
+       
+       @Test
+       @Deployment(resources = {
+                       "subprocess/GenericGetService.bpmn", 
+                       "subprocess/SDNCAdapterV1.bpmn", 
+                       "subprocess/FalloutHandler.bpmn",
+                       "subprocess/DoCreateAllottedResourceTXC.bpmn",
+                       "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"})
+       public void testDoCreateAllottedResourceTXC_NoSI() throws Exception{
+
+               // TODO: use INST instead of DEC_INST
+               /*
+                * should be INST instead of DEC_INST, but AAI utilities appear to
+                * have a bug in that they don't URL-encode the SI id before using
+                * it in the query
+                */
+               MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getNotFound.xml");
+               MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+               
+               MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+               MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+               MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
+               MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
+               mockSDNCAdapter(200);
+               mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+               String businessKey = UUID.randomUUID().toString();
+               Map<String, Object> variables = new HashMap<>();
+               setVariablesSuccess(variables, "testRequestId123");
+               
+               invokeSubProcess(PROCNAME, businessKey, variables);
+
+               waitForProcessEnd(businessKey, 10000);
+               
+               Assert.assertTrue(isProcessEnded(businessKey));
+               String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+               assertNotNull(workflowException);
+               
+               assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, "allotedResourceName"));
+       }
+       
+       @Test
+       @Deployment(resources = {
+                       "subprocess/GenericGetService.bpmn", 
+                       "subprocess/SDNCAdapterV1.bpmn", 
+                       "subprocess/FalloutHandler.bpmn",
+                       "subprocess/DoCreateAllottedResourceTXC.bpmn",
+                       "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"})
+       public void testDoCreateAllottedResourceTXC_ActiveAr() throws Exception{
+
+               // TODO: use INST instead of DEC_INST
+               /*
+                * should be INST instead of DEC_INST, but AAI utilities appear to
+                * have a bug in that they don't URL-encode the SI id before using
+                * it in the query
+                */
+               MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml");
+               MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+               
+               MockGetServiceInstance(CUST, SVC, INST, "VCPE/DoCreateAllottedResourceTXC/getSIandAR.xml");
+               MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXC/getArTxc2.xml");
+               MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+               MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
+               MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
+               mockSDNCAdapter(200);
+               mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+               String businessKey = UUID.randomUUID().toString();
+               Map<String, Object> variables = new HashMap<>();
+               setVariablesSuccess(variables, "testRequestId123");
+
+               variables.put("failExists", "false");
+               
+               invokeSubProcess(PROCNAME, businessKey, variables);
+               
+               injectSDNCCallbacks(callbacks, "query");
+
+               waitForProcessEnd(businessKey, 10000);
+               
+               Assert.assertTrue(isProcessEnded(businessKey));
+               String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
                assertEquals(null, workflowException);
-               logEnd();
+
+               assertEquals("namefromrequest", BPMNUtil.getVariable(processEngineRule, PROCNAME, "allotedResourceName"));
+               assertEquals("my-vni", BPMNUtil.getVariable(processEngineRule, PROCNAME, "vni"));
+               assertEquals("my-bearer-ip", BPMNUtil.getVariable(processEngineRule, PROCNAME, "vgmuxBearerIP"));
+               assertEquals("my-lan-ip", BPMNUtil.getVariable(processEngineRule, PROCNAME, "vgmuxLanIP"));
+       }
+       
+       @Test
+       @Deployment(resources = {
+                       "subprocess/GenericGetService.bpmn", 
+                       "subprocess/SDNCAdapterV1.bpmn", 
+                       "subprocess/FalloutHandler.bpmn",
+                       "subprocess/DoCreateAllottedResourceTXC.bpmn",
+                       "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"})
+       public void testDoCreateAllottedResourceTXC_NoParentSI() throws Exception{
+
+               // TODO: use INST instead of DEC_INST
+               /*
+                * should be INST instead of DEC_INST, but AAI utilities appear to
+                * have a bug in that they don't URL-encode the SI id before using
+                * it in the query
+                */
+               MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml");
+               
+               MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getNotFound.xml");
+               
+               MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+               MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+               MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
+               MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
+               mockSDNCAdapter(200);
+               mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+               String businessKey = UUID.randomUUID().toString();
+               Map<String, Object> variables = new HashMap<>();
+               setVariablesSuccess(variables, "testRequestId123");
+               
+               invokeSubProcess(PROCNAME, businessKey, variables);
+
+               waitForProcessEnd(businessKey, 10000);
+               
+               Assert.assertTrue(isProcessEnded(businessKey));
+               String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+               assertNotNull(workflowException);
+               
+               assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, "allotedResourceName"));
+       }
+       
+       @Test
+       @Deployment(resources = {
+                       "subprocess/GenericGetService.bpmn", 
+                       "subprocess/SDNCAdapterV1.bpmn", 
+                       "subprocess/FalloutHandler.bpmn",
+                       "subprocess/DoCreateAllottedResourceTXC.bpmn",
+                       "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"})
+       public void testDoCreateAllottedResourceTXC_SubProcessError() throws Exception{
+
+               // TODO: use INST instead of DEC_INST
+               /*
+                * should be INST instead of DEC_INST, but AAI utilities appear to
+                * have a bug in that they don't URL-encode the SI id before using
+                * it in the query
+                */
+               MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml");
+               MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+               
+               MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+               MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+               MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
+               MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
+               mockSDNCAdapter(404);
+               mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+               String businessKey = UUID.randomUUID().toString();
+               Map<String, Object> variables = new HashMap<>();
+               setVariablesSuccess(variables, "testRequestId123");
+               
+               invokeSubProcess(PROCNAME, businessKey, variables);
+
+               waitForProcessEnd(businessKey, 10000);
+               
+               Assert.assertTrue(isProcessEnded(businessKey));
+               String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+               assertNotNull(workflowException);
+               
+               assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, "allotedResourceName"));
        }
 
        private void setVariablesSuccess(Map<String, Object> variables, String requestId) {
+               // TODO: need all of these?
                variables.put("isDebugLogEnabled", "true");
                variables.put("failExists", "true");
                variables.put("disableRollback", "true");
@@ -101,14 +279,15 @@ public class DoCreateAllottedResourceTXCTest extends WorkflowTest {
                variables.put("mso-request-id", "requestId");
                variables.put("sourceNetworkId", "snId");
                variables.put("sourceNetworkRole", "snRole");
-               variables.put("allottedResourceRole", "txc");
-               variables.put("allottedResourceType", "TunnelXConn");
-               variables.put("allottedResourceId", "arId-1");
+               variables.put("allottedResourceRole", "brg");
+               variables.put("allottedResourceType", "TXC");
+               variables.put("allottedResourceId", ARID);
                variables.put("brgWanMacAddress", "wanmac");
                variables.put("junitSleepMs", "5");
+
+               variables.put("serviceInstanceId", DEC_INST);
+               variables.put("parentServiceInstanceId", DEC_PARENT_INST);
                
-               variables.put("serviceInstanceId", "MIS%252F1604%252F0026%252FSW_INTERNET");
-               variables.put("parentServiceInstanceId","MIS%252F1604%252F0027%252FSW_INTERNET");
                variables.put("serviceChainServiceInstanceId", "scsiId");
                
                String arModelInfo = "{ "+ "\"modelType\": \"allotted-resource\"," +
index 46f5da4..03972da 100644 (file)
@@ -1,4 +1,4 @@
-/*-
+/*
  * ============LICENSE_START=======================================================
  * ONAP - SO
  * ================================================================================
@@ -7,9 +7,9 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- *
+ * 
  *      http://www.apache.org/licenses/LICENSE-2.0
- *
+ * 
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
-
-/*
- * Â© 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property.
- */
 package org.openecomp.mso.bpmn.vcpe;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
 import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteAllottedResource;
 import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetAllottedResource;
 import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchAllottedResource;
@@ -38,20 +35,22 @@ import java.util.UUID;
 
 import org.camunda.bpm.engine.test.Deployment;
 import org.junit.Assert;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.openecomp.mso.bpmn.common.BPMNUtil;
-import org.openecomp.mso.bpmn.common.WorkflowTest;
 import org.openecomp.mso.bpmn.mock.FileUtil;
 
 
-public class DoDeleteAllottedResourceBRGTest extends WorkflowTest {
+public class DoDeleteAllottedResourceBRGTest extends AbstractTestBase {
 
+       private static final String PROCNAME = "DoDeleteAllottedResourceBRG";
        private final CallbackSet callbacks = new CallbackSet();
        
        public DoDeleteAllottedResourceBRGTest() throws IOException {
-               callbacks.put("deactivate", FileUtil.readResourceFile("__files/VCPE/VfModularity/SDNCTopologyDeactivateCallback.xml"));
-               callbacks.put("delete", FileUtil.readResourceFile("__files/VCPE/VfModularity/SDNCTopologyDeleteCallback.xml"));
-               callbacks.put("unassign", FileUtil.readResourceFile("__files/VCPE/VfModularity/SDNCTopologyUnassignCallback.xml"));
+               callbacks.put("deactivate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml"));
+               callbacks.put("deactivateNF", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallbackNotFound.xml"));
+               callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml"));
+               callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml"));
        }
        
        @Test
@@ -59,12 +58,12 @@ public class DoDeleteAllottedResourceBRGTest extends WorkflowTest {
                        "subprocess/SDNCAdapterV1.bpmn",
                        "subprocess/FalloutHandler.bpmn",
                        "subprocess/DoDeleteAllottedResourceBRG.bpmn"})
-       public void testDoDeleteAllottedResourceBRG_success() throws Exception {
+       public void testDoDeleteAllottedResourceBRG_Success() throws Exception {
                
-               MockQueryAllottedResourceById("arId-1", "GenericFlows/getARUrlById.xml");
-               MockGetAllottedResource("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "arId-1", "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml");
-               MockPatchAllottedResource("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "arId-1");
-               MockDeleteAllottedResource("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "arId-1", "1490627351232");
+               MockQueryAllottedResourceById(ARID, "GenericFlows/getARUrlById.xml");
+               MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml");
+               MockPatchAllottedResource(CUST, SVC, INST, ARID);
+               MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
                mockSDNCAdapter(200);
                mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
                
@@ -72,7 +71,7 @@ public class DoDeleteAllottedResourceBRGTest extends WorkflowTest {
                Map<String, Object> variables = new HashMap<>();
                setVariablesSuccess(variables, "testRequestId1");
                
-               invokeSubProcess("DoDeleteAllottedResourceBRG", businessKey, variables);
+               invokeSubProcess(PROCNAME, businessKey, variables);
                
                injectSDNCCallbacks(callbacks, "deactivate");
                injectSDNCCallbacks(callbacks, "delete");
@@ -81,20 +80,83 @@ public class DoDeleteAllottedResourceBRGTest extends WorkflowTest {
                waitForProcessEnd(businessKey, 10000);
                
                Assert.assertTrue(isProcessEnded(businessKey));
-               String workflowException = BPMNUtil.getVariable(processEngineRule, "DoDeleteAllottedResourceBRG", "WorkflowException");
+               String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
                System.out.println("workflowException:\n" + workflowException);
                assertEquals(null, workflowException);
        }
+       
+       @Test
+       @Deployment(resources = {
+                       "subprocess/SDNCAdapterV1.bpmn",
+                       "subprocess/FalloutHandler.bpmn",
+                       "subprocess/DoDeleteAllottedResourceBRG.bpmn"})
+       public void testDoDeleteAllottedResourceBRG_ARNotInSDNC() throws Exception {
+               
+               MockQueryAllottedResourceById(ARID, "GenericFlows/getARUrlById.xml");
+               MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml");
+               MockPatchAllottedResource(CUST, SVC, INST, ARID);
+               MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+               mockSDNCAdapter(200);
+               mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+               
+               String businessKey = UUID.randomUUID().toString();
+               Map<String, Object> variables = new HashMap<>();
+               setVariablesSuccess(variables, "testRequestId1");
+
+               variables.put("failNotFound", "false");
+               
+               invokeSubProcess(PROCNAME, businessKey, variables);
+               
+               injectSDNCCallbacks(callbacks, "deactivateNF");
+
+               waitForProcessEnd(businessKey, 10000);
+               
+               Assert.assertTrue(isProcessEnded(businessKey));
+               String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+               System.out.println("workflowException:\n" + workflowException);
+               assertEquals(null, workflowException);
+       }
+       
+       // TODO - exception is not caught
+       @Test
+       @Ignore
+       @Deployment(resources = {
+                       "subprocess/SDNCAdapterV1.bpmn",
+                       "subprocess/FalloutHandler.bpmn",
+                       "subprocess/DoDeleteAllottedResourceBRG.bpmn"})
+       public void testDoDeleteAllottedResourceBRG_SubProcessError() throws Exception {
+               
+               MockQueryAllottedResourceById(ARID, "GenericFlows/getARUrlById.xml");
+               MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml");
+               MockPatchAllottedResource(CUST, SVC, INST, ARID);
+               MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+               mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+               mockSDNCAdapter(500);
+               
+               String businessKey = UUID.randomUUID().toString();
+               Map<String, Object> variables = new HashMap<>();
+               setVariablesSuccess(variables, "testRequestId1");
+               
+               invokeSubProcess(PROCNAME, businessKey, variables);
+
+               waitForProcessEnd(businessKey, 10000);
+               
+               Assert.assertTrue(isProcessEnded(businessKey));
+               String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+               System.out.println("workflowException:\n" + workflowException);
+               assertNotNull(workflowException);
+       }
 
        private void setVariablesSuccess(Map<String, Object> variables, String requestId) {
                variables.put("isDebugLogEnabled", "true");
                variables.put("failNotFound", "true");
                variables.put("msoRequestId", requestId);
                variables.put("mso-request-id", "requestId");
-               variables.put("allottedResourceId", "arId-1");
+               variables.put("allottedResourceId", ARID);
                
-               variables.put("serviceInstanceId", "MIS%252F1604%252F0026%252FSW_INTERNET");
-               variables.put("parentServiceInstanceId","MIS%252F1604%252F0026%252FSW_INTERNET");
+               variables.put("serviceInstanceId", DEC_INST);
+               variables.put("parentServiceInstanceId", DEC_PARENT_INST);
        }
 
 }
index 48e1349..2b0364c 100644 (file)
@@ -1,4 +1,4 @@
-/*-
+/*
  * ============LICENSE_START=======================================================
  * ONAP - SO
  * ================================================================================
@@ -7,9 +7,9 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- *
+ * 
  *      http://www.apache.org/licenses/LICENSE-2.0
- *
+ * 
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
-
-/*
- * Â© 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property.
- */
 package org.openecomp.mso.bpmn.vcpe;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
 import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteAllottedResource;
 import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetAllottedResource;
 import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchAllottedResource;
@@ -38,20 +35,22 @@ import java.util.UUID;
 
 import org.camunda.bpm.engine.test.Deployment;
 import org.junit.Assert;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.openecomp.mso.bpmn.common.BPMNUtil;
-import org.openecomp.mso.bpmn.common.WorkflowTest;
 import org.openecomp.mso.bpmn.mock.FileUtil;
 
 
-public class DoDeleteAllottedResourceTXCTest extends WorkflowTest {
+public class DoDeleteAllottedResourceTXCTest extends AbstractTestBase {
 
+       private static final String PROCNAME = "DoDeleteAllottedResourceTXC";
        private final CallbackSet callbacks = new CallbackSet();
        
        public DoDeleteAllottedResourceTXCTest() throws IOException {
-               callbacks.put("deactivate", FileUtil.readResourceFile("__files/VCPE/VfModularity/SDNCTopologyDeactivateCallback.xml"));
-               callbacks.put("delete", FileUtil.readResourceFile("__files/VCPE/VfModularity/SDNCTopologyDeleteCallback.xml"));
-               callbacks.put("unassign", FileUtil.readResourceFile("__files/VCPE/VfModularity/SDNCTopologyUnassignCallback.xml"));
+               callbacks.put("deactivate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml"));
+               callbacks.put("deactivateNF", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallbackNotFound.xml"));
+               callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml"));
+               callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml"));
        }
        
        @Test
@@ -59,12 +58,12 @@ public class DoDeleteAllottedResourceTXCTest extends WorkflowTest {
                        "subprocess/SDNCAdapterV1.bpmn",
                        "subprocess/FalloutHandler.bpmn",
                        "subprocess/DoDeleteAllottedResourceTXC.bpmn"})
-       public void testDoDeleteAllottedResourceTXC_success() throws Exception {
+       public void testDoDeleteAllottedResourceTXC_Success() throws Exception {
                
-               MockQueryAllottedResourceById("arId-1", "GenericFlows/getARUrlById.xml");
-               MockGetAllottedResource("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "arId-1", "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml");
-               MockPatchAllottedResource("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "arId-1");
-               MockDeleteAllottedResource("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "arId-1", "1490627351232");
+               MockQueryAllottedResourceById(ARID, "GenericFlows/getARUrlById.xml");
+               MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml");
+               MockPatchAllottedResource(CUST, SVC, INST, ARID);
+               MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
                mockSDNCAdapter(200);
                mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
                
@@ -72,7 +71,7 @@ public class DoDeleteAllottedResourceTXCTest extends WorkflowTest {
                Map<String, Object> variables = new HashMap<>();
                setVariablesSuccess(variables, "testRequestId1");
                
-               invokeSubProcess("DoDeleteAllottedResourceTXC", businessKey, variables);
+               invokeSubProcess(PROCNAME, businessKey, variables);
                
                injectSDNCCallbacks(callbacks, "deactivate");
                injectSDNCCallbacks(callbacks, "delete");
@@ -81,20 +80,83 @@ public class DoDeleteAllottedResourceTXCTest extends WorkflowTest {
                waitForProcessEnd(businessKey, 10000);
                
                Assert.assertTrue(isProcessEnded(businessKey));
-               String workflowException = BPMNUtil.getVariable(processEngineRule, "DoDeleteAllottedResourceTXC", "WorkflowException");
+               String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
                System.out.println("workflowException:\n" + workflowException);
                assertEquals(null, workflowException);
        }
+       
+       @Test
+       @Deployment(resources = {
+                       "subprocess/SDNCAdapterV1.bpmn",
+                       "subprocess/FalloutHandler.bpmn",
+                       "subprocess/DoDeleteAllottedResourceTXC.bpmn"})
+       public void testDoDeleteAllottedResourceTXC_ARNotInSDNC() throws Exception {
+               
+               MockQueryAllottedResourceById(ARID, "GenericFlows/getARUrlById.xml");
+               MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml");
+               MockPatchAllottedResource(CUST, SVC, INST, ARID);
+               MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+               mockSDNCAdapter(200);
+               mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+               
+               String businessKey = UUID.randomUUID().toString();
+               Map<String, Object> variables = new HashMap<>();
+               setVariablesSuccess(variables, "testRequestId1");
+
+               variables.put("failNotFound", "false");
+               
+               invokeSubProcess(PROCNAME, businessKey, variables);
+               
+               injectSDNCCallbacks(callbacks, "deactivateNF");
+
+               waitForProcessEnd(businessKey, 10000);
+               
+               Assert.assertTrue(isProcessEnded(businessKey));
+               String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+               System.out.println("workflowException:\n" + workflowException);
+               assertEquals(null, workflowException);
+       }
+       
+       // TODO - exception is not caught
+       @Test
+       @Ignore
+       @Deployment(resources = {
+                       "subprocess/SDNCAdapterV1.bpmn",
+                       "subprocess/FalloutHandler.bpmn",
+                       "subprocess/DoDeleteAllottedResourceTXC.bpmn"})
+       public void testDoDeleteAllottedResourceTXC_SubProcessError() throws Exception {
+               
+               MockQueryAllottedResourceById(ARID, "GenericFlows/getARUrlById.xml");
+               MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml");
+               MockPatchAllottedResource(CUST, SVC, INST, ARID);
+               MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+               mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+               mockSDNCAdapter(500);
+               
+               String businessKey = UUID.randomUUID().toString();
+               Map<String, Object> variables = new HashMap<>();
+               setVariablesSuccess(variables, "testRequestId1");
+               
+               invokeSubProcess(PROCNAME, businessKey, variables);
+
+               waitForProcessEnd(businessKey, 10000);
+               
+               Assert.assertTrue(isProcessEnded(businessKey));
+               String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+               System.out.println("workflowException:\n" + workflowException);
+               assertNotNull(workflowException);
+       }
 
        private void setVariablesSuccess(Map<String, Object> variables, String requestId) {
                variables.put("isDebugLogEnabled", "true");
                variables.put("failNotFound", "true");
                variables.put("msoRequestId", requestId);
                variables.put("mso-request-id", "requestId");
-               variables.put("allottedResourceId", "arId-1");
+               variables.put("allottedResourceId", ARID);
                
-               variables.put("serviceInstanceId", "MIS%252F1604%252F0026%252FSW_INTERNET");
-               variables.put("parentServiceInstanceId","MIS%252F1604%252F0026%252FSW_INTERNET");
+               variables.put("serviceInstanceId", DEC_INST);
+               variables.put("parentServiceInstanceId", DEC_PARENT_INST);
        }
 
 }
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/DoCreateAllottedResourceBRG.bpmn b/bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/DoCreateAllottedResourceBRG.bpmn
new file mode 100644 (file)
index 0000000..b33aad7
--- /dev/null
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_DkzPAHB4EeaJwpcpVN5gXw" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.9.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
+  <bpmn2:process id="DoCreateAllottedResourceBRG" name="DoCreateAllottedResourceBRG" isExecutable="true">
+    <bpmn2:startEvent id="StartEvent_1">
+      <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing>
+    </bpmn2:startEvent>
+    <bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="StartEvent_1" targetRef="initialization" />
+    <bpmn2:scriptTask id="initialization" name="set rollbackData">
+      <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming>
+      <bpmn2:outgoing>SequenceFlow_1v2f9n5</bpmn2:outgoing>
+      <bpmn2:script><![CDATA[#{execution.setVariable("rollbackData", true)}]]></bpmn2:script>
+    </bpmn2:scriptTask>
+    <bpmn2:endEvent id="EndEvent_1">
+      <bpmn2:incoming>SequenceFlow_1v2f9n5</bpmn2:incoming>
+      <bpmn2:errorEventDefinition id="ErrorEventDefinition_1" errorRef="Error_2" />
+    </bpmn2:endEvent>
+    <bpmn2:sequenceFlow id="SequenceFlow_1v2f9n5" sourceRef="initialization" targetRef="EndEvent_1" />
+  </bpmn2:process>
+  <bpmn2:error id="Error_1" name="Java Lang Exception" errorCode="java.lang.Exception" />
+  <bpmn2:error id="Error_2" name="MSO Workflow Exception" errorCode="MSOWorkflowException" />
+  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoCreateAllottedResourceBRG">
+      <bpmndi:BPMNShape id="_BPMNShape_StartEvent_68" bpmnElement="StartEvent_1">
+        <dc:Bounds x="-91" y="222" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="-73" y="263" width="0" height="0" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_285" bpmnElement="initialization">
+        <dc:Bounds x="35" y="200" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_StartEvent_68" targetElement="_BPMNShape_ScriptTask_285">
+        <di:waypoint xsi:type="dc:Point" x="-55" y="240" />
+        <di:waypoint xsi:type="dc:Point" x="35" y="241" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="-55" y="225.5" width="90" height="0" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="_BPMNShape_EndEvent_225" bpmnElement="EndEvent_1">
+        <dc:Bounds x="235" y="222" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="208" y="263" width="90" height="0" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_1v2f9n5_di" bpmnElement="SequenceFlow_1v2f9n5">
+        <di:waypoint xsi:type="dc:Point" x="135" y="240" />
+        <di:waypoint xsi:type="dc:Point" x="235" y="240" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="140" y="219" width="90" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+    </bpmndi:BPMNPlane>
+  </bpmndi:BPMNDiagram>
+</bpmn2:definitions>
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/DoCreateAllottedResourceBRGRollback.bpmn b/bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/DoCreateAllottedResourceBRGRollback.bpmn
new file mode 100644 (file)
index 0000000..807efae
--- /dev/null
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_DkzPAHB4EeaJwpcpVN5gXw" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.9.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
+  <bpmn2:process id="DoCreateAllottedResourceBRGRollback" name="DoCreateAllottedResourceBRGRollback" isExecutable="true">
+    <bpmn2:startEvent id="StartEvent_1">
+      <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing>
+    </bpmn2:startEvent>
+    <bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="StartEvent_1" targetRef="ScriptTask_03yvb82" />
+    <bpmn2:endEvent id="EndEvent_1sn21jr">
+      <bpmn2:incoming>SequenceFlow_1epm19d</bpmn2:incoming>
+    </bpmn2:endEvent>
+    <bpmn2:scriptTask id="ScriptTask_03yvb82" name="set Success">
+      <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming>
+      <bpmn2:outgoing>SequenceFlow_1epm19d</bpmn2:outgoing>
+      <bpmn2:script><![CDATA[#{execution.setVariable("rolledBack", true)}]]></bpmn2:script>
+    </bpmn2:scriptTask>
+    <bpmn2:sequenceFlow id="SequenceFlow_1epm19d" sourceRef="ScriptTask_03yvb82" targetRef="EndEvent_1sn21jr" />
+  </bpmn2:process>
+  <bpmn2:error id="Error_1" name="Java Lang Exception" errorCode="java.lang.Exception" />
+  <bpmn2:error id="Error_2" name="MSO Workflow Exception" errorCode="MSOWorkflowException" />
+  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoCreateAllottedResourceBRGRollback">
+      <bpmndi:BPMNShape id="_BPMNShape_StartEvent_68" bpmnElement="StartEvent_1">
+        <dc:Bounds x="66" y="392" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="84" y="433" width="0" height="0" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_StartEvent_68" targetElement="ScriptTask_03yvb82_di">
+        <di:waypoint xsi:type="dc:Point" x="101" y="412" />
+        <di:waypoint xsi:type="dc:Point" x="207" y="410" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="109" y="396" width="90" height="0" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="EndEvent_1sn21jr_di" bpmnElement="EndEvent_1sn21jr">
+        <dc:Bounds x="413" y="392" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="386" y="432" width="90" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_03yvb82_di" bpmnElement="ScriptTask_03yvb82">
+        <dc:Bounds x="207" y="370" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_1epm19d_di" bpmnElement="SequenceFlow_1epm19d">
+        <di:waypoint xsi:type="dc:Point" x="307" y="410" />
+        <di:waypoint xsi:type="dc:Point" x="377" y="410" />
+        <di:waypoint xsi:type="dc:Point" x="377" y="410" />
+        <di:waypoint xsi:type="dc:Point" x="413" y="410" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="392" y="404" width="0" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+    </bpmndi:BPMNPlane>
+  </bpmndi:BPMNDiagram>
+</bpmn2:definitions>
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/DoCreateAllottedResourceTXC.bpmn b/bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/DoCreateAllottedResourceTXC.bpmn
new file mode 100644 (file)
index 0000000..b2f280d
--- /dev/null
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_DkzPAHB4EeaJwpcpVN5gXw" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.9.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
+  <bpmn2:process id="DoCreateAllottedResourceTXC" name="DoCreateAllottedResourceTXC" isExecutable="true">
+    <bpmn2:startEvent id="StartEvent_1">
+      <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing>
+    </bpmn2:startEvent>
+    <bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="StartEvent_1" targetRef="EndEvent_1" />
+    <bpmn2:endEvent id="EndEvent_1">
+      <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming>
+      <bpmn2:errorEventDefinition id="ErrorEventDefinition_1" errorRef="Error_2" />
+    </bpmn2:endEvent>
+  </bpmn2:process>
+  <bpmn2:error id="Error_1" name="Java Lang Exception" errorCode="java.lang.Exception" />
+  <bpmn2:error id="Error_2" name="MSO Workflow Exception" errorCode="MSOWorkflowException" />
+  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoCreateAllottedResourceTXC">
+      <bpmndi:BPMNShape id="_BPMNShape_StartEvent_68" bpmnElement="StartEvent_1">
+        <dc:Bounds x="-91" y="222" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="-73" y="263" width="0" height="0" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_StartEvent_68" targetElement="_BPMNShape_EndEvent_225">
+        <di:waypoint xsi:type="dc:Point" x="-55" y="240" />
+        <di:waypoint xsi:type="dc:Point" x="139" y="240" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="-3" y="225" width="90" height="0" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="_BPMNShape_EndEvent_225" bpmnElement="EndEvent_1">
+        <dc:Bounds x="139" y="222" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="112" y="263" width="90" height="0" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+    </bpmndi:BPMNPlane>
+  </bpmndi:BPMNDiagram>
+</bpmn2:definitions>
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/DoCreateServiceInstanceRollback.bpmn b/bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/DoCreateServiceInstanceRollback.bpmn
new file mode 100644 (file)
index 0000000..532ca86
--- /dev/null
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.9.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
+  <bpmn2:process id="DoCreateServiceInstanceRollback" name="DoCreateServiceInstanceRollback" isExecutable="true">
+    <bpmn2:startEvent id="createSIRollback_startEvent" name="Start Flow">
+      <bpmn2:outgoing>SequenceFlow_1ipu8um</bpmn2:outgoing>
+    </bpmn2:startEvent>
+    <bpmn2:endEvent id="EndEvent_3">
+      <bpmn2:incoming>SequenceFlow_1l4c4k0</bpmn2:incoming>
+    </bpmn2:endEvent>
+    <bpmn2:scriptTask id="ScriptTask_05ltxyj" name="set Success">
+      <bpmn2:incoming>SequenceFlow_1ipu8um</bpmn2:incoming>
+      <bpmn2:outgoing>SequenceFlow_1l4c4k0</bpmn2:outgoing>
+      <bpmn2:script><![CDATA[#{execution.setVariable("rolledBack", true)}]]></bpmn2:script>
+    </bpmn2:scriptTask>
+    <bpmn2:sequenceFlow id="SequenceFlow_1ipu8um" sourceRef="createSIRollback_startEvent" targetRef="ScriptTask_05ltxyj" />
+    <bpmn2:sequenceFlow id="SequenceFlow_1l4c4k0" sourceRef="ScriptTask_05ltxyj" targetRef="EndEvent_3" />
+  </bpmn2:process>
+  <bpmn2:error id="Error_2" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
+  <bpmn2:error id="Error_1" name="java.lang.Exception" errorCode="java.lang.Exception" />
+  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoCreateServiceInstanceRollback">
+      <bpmndi:BPMNShape id="_BPMNShape_StartEvent_47" bpmnElement="createSIRollback_startEvent">
+        <dc:Bounds x="151" y="79" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="146" y="120" width="48" height="14" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="_BPMNShape_EndEvent_177" bpmnElement="EndEvent_3">
+        <dc:Bounds x="484" y="79" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="457" y="120" width="90" height="0" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ScriptTask_05ltxyj_di" bpmnElement="ScriptTask_05ltxyj">
+        <dc:Bounds x="287" y="57" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_1ipu8um_di" bpmnElement="SequenceFlow_1ipu8um">
+        <di:waypoint xsi:type="dc:Point" x="187" y="97" />
+        <di:waypoint xsi:type="dc:Point" x="287" y="97" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="237" y="76" width="0" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1l4c4k0_di" bpmnElement="SequenceFlow_1l4c4k0">
+        <di:waypoint xsi:type="dc:Point" x="387" y="97" />
+        <di:waypoint xsi:type="dc:Point" x="484" y="97" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="435.5" y="76" width="0" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+    </bpmndi:BPMNPlane>
+  </bpmndi:BPMNDiagram>
+</bpmn2:definitions>
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/DoCreateVnfAndModules.bpmn b/bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/DoCreateVnfAndModules.bpmn
new file mode 100644 (file)
index 0000000..5e4400e
--- /dev/null
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.9.0">
+  <bpmn:process id="DoCreateVnfAndModules" name="DoCreateVnfAndModules" isExecutable="true">
+    <bpmn:startEvent id="StartEvent_1">
+      <bpmn:outgoing>SequenceFlow_11sp3s9</bpmn:outgoing>
+    </bpmn:startEvent>
+    <bpmn:sequenceFlow id="SequenceFlow_11sp3s9" sourceRef="StartEvent_1" targetRef="ScriptTask_0y5wsgy" />
+    <bpmn:scriptTask id="ScriptTask_0y5wsgy" name="set rollbackData">
+      <bpmn:incoming>SequenceFlow_11sp3s9</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0q1lfmf</bpmn:outgoing>
+      <bpmn:script><![CDATA[#{execution.setVariable("rollbackData", true)}]]></bpmn:script>
+    </bpmn:scriptTask>
+    <bpmn:sequenceFlow id="SequenceFlow_0q1lfmf" sourceRef="ScriptTask_0y5wsgy" targetRef="EndEvent_0vgtf5f" />
+    <bpmn:endEvent id="EndEvent_0vgtf5f">
+      <bpmn:incoming>SequenceFlow_0q1lfmf</bpmn:incoming>
+    </bpmn:endEvent>
+  </bpmn:process>
+  <bpmn:error id="Error_1" name="Java Lang Exception" errorCode="java.lang.Exception" />
+  <bpmn:error id="Error_2" name="MSO Workflow Exception" errorCode="MSOWorkflowException" />
+  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoCreateVnfAndModules">
+      <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
+        <dc:Bounds x="152" y="147" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="170" y="183" width="0" height="0" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_11sp3s9_di" bpmnElement="SequenceFlow_11sp3s9">
+        <di:waypoint xsi:type="dc:Point" x="188" y="165" />
+        <di:waypoint xsi:type="dc:Point" x="268" y="165" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="183" y="144" width="90" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="ScriptTask_0y5wsgy_di" bpmnElement="ScriptTask_0y5wsgy">
+        <dc:Bounds x="268" y="125" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_0q1lfmf_di" bpmnElement="SequenceFlow_0q1lfmf">
+        <di:waypoint xsi:type="dc:Point" x="368" y="165" />
+        <di:waypoint xsi:type="dc:Point" x="447" y="165" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="362.5" y="144" width="90" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="EndEvent_0vgtf5f_di" bpmnElement="EndEvent_0vgtf5f">
+        <dc:Bounds x="447" y="147" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="420" y="187" width="90" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+    </bpmndi:BPMNPlane>
+  </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/DoCreateVnfAndModulesRollback.bpmn b/bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/DoCreateVnfAndModulesRollback.bpmn
new file mode 100644 (file)
index 0000000..2867a67
--- /dev/null
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_Wblj8GyfEeWUWLTvug7ZOg" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.9.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
+  <bpmn2:process id="DoCreateVnfAndModulesRollback" name="DoCreateVnfAndModulesRollback" isExecutable="true">
+    <bpmn2:startEvent id="StartEvent_1gai4qr">
+      <bpmn2:outgoing>SequenceFlow_1537b7m</bpmn2:outgoing>
+    </bpmn2:startEvent>
+    <bpmn2:endEvent id="EndEvent_1seag7u">
+      <bpmn2:incoming>SequenceFlow_1mz2mgf</bpmn2:incoming>
+    </bpmn2:endEvent>
+    <bpmn2:sequenceFlow id="SequenceFlow_1537b7m" sourceRef="StartEvent_1gai4qr" targetRef="ScriptTask_0fpaoo0" />
+    <bpmn2:scriptTask id="ScriptTask_0fpaoo0" name="set Success">
+      <bpmn2:incoming>SequenceFlow_1537b7m</bpmn2:incoming>
+      <bpmn2:outgoing>SequenceFlow_1mz2mgf</bpmn2:outgoing>
+      <bpmn2:script><![CDATA[#{execution.setVariable("rolledBack", true)}]]></bpmn2:script>
+    </bpmn2:scriptTask>
+    <bpmn2:sequenceFlow id="SequenceFlow_1mz2mgf" sourceRef="ScriptTask_0fpaoo0" targetRef="EndEvent_1seag7u" />
+  </bpmn2:process>
+  <bpmn2:error id="Error_1" name="MSO Workflow Exception" errorCode="MSOWorkflowException" />
+  <bpmn2:message id="Message_1" name="DoCreateVfModuleRollbackRequest" />
+  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoCreateVnfAndModulesRollback">
+      <bpmndi:BPMNShape id="StartEvent_1gai4qr_di" bpmnElement="StartEvent_1gai4qr">
+        <dc:Bounds x="-91" y="655" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="-73" y="691" width="0" height="0" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="EndEvent_1seag7u_di" bpmnElement="EndEvent_1seag7u">
+        <dc:Bounds x="248" y="655" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="660" y="676" width="90" height="0" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_1537b7m_di" bpmnElement="SequenceFlow_1537b7m">
+        <di:waypoint xsi:type="dc:Point" x="-55" y="673" />
+        <di:waypoint xsi:type="dc:Point" x="55" y="673" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="-45" y="658" width="90" height="0" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="ScriptTask_0fpaoo0_di" bpmnElement="ScriptTask_0fpaoo0">
+        <dc:Bounds x="55" y="633" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_1mz2mgf_di" bpmnElement="SequenceFlow_1mz2mgf">
+        <di:waypoint xsi:type="dc:Point" x="155" y="673" />
+        <di:waypoint xsi:type="dc:Point" x="248" y="673" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="201.5" y="652" width="0" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+    </bpmndi:BPMNPlane>
+  </bpmndi:BPMNDiagram>
+</bpmn2:definitions>
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/DoDeleteVnfAndModules.bpmn b/bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/DoDeleteVnfAndModules.bpmn
new file mode 100644 (file)
index 0000000..517df36
--- /dev/null
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_9MhrcHqVEea26OhQB97uCQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.9.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
+  <bpmn2:process id="DoDeleteVnfAndModules" name="DoDeleteVnfAndModules" isExecutable="true">
+    <bpmn2:startEvent id="StartEvent_1">
+      <bpmn2:outgoing>SequenceFlow_0qi7pl3</bpmn2:outgoing>
+    </bpmn2:startEvent>
+    <bpmn2:sequenceFlow id="SequenceFlow_0qi7pl3" sourceRef="StartEvent_1" targetRef="EndEvent_11dfyam" />
+    <bpmn2:endEvent id="EndEvent_11dfyam">
+      <bpmn2:incoming>SequenceFlow_0qi7pl3</bpmn2:incoming>
+    </bpmn2:endEvent>
+  </bpmn2:process>
+  <bpmn2:error id="Error_1" name="MSO Workflow Exception" errorCode="MSOWorkflowException" />
+  <bpmn2:error id="Error_2" name="Java Lang Exception" errorCode="java.lang.Exception" />
+  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoDeleteVnfAndModules">
+      <bpmndi:BPMNShape id="_BPMNShape_StartEvent_79" bpmnElement="StartEvent_1">
+        <dc:Bounds x="238" y="209" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="256" y="250" width="0" height="0" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_0qi7pl3_di" bpmnElement="SequenceFlow_0qi7pl3">
+        <di:waypoint xsi:type="dc:Point" x="274" y="227" />
+        <di:waypoint xsi:type="dc:Point" x="387" y="227" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="285.5" y="206" width="90" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="EndEvent_11dfyam_di" bpmnElement="EndEvent_11dfyam">
+        <dc:Bounds x="387" y="209" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="360" y="249" width="90" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+    </bpmndi:BPMNPlane>
+  </bpmndi:BPMNDiagram>
+</bpmn2:definitions>
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/Homing.bpmn b/bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/Homing.bpmn
new file mode 100644 (file)
index 0000000..ad4c3c8
--- /dev/null
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_vwRmIBsREeeIQtzUKIjH4g" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.9.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
+  <bpmn2:process id="Homing" name="Homing" isExecutable="true">
+    <bpmn2:startEvent id="StartEvent_1">
+      <bpmn2:outgoing>SequenceFlow_0tyavm9</bpmn2:outgoing>
+    </bpmn2:startEvent>
+    <bpmn2:endEvent id="EndEvent_0n56tas">
+      <bpmn2:incoming>SequenceFlow_0tyavm9</bpmn2:incoming>
+      <bpmn2:terminateEventDefinition />
+    </bpmn2:endEvent>
+    <bpmn2:sequenceFlow id="SequenceFlow_0tyavm9" sourceRef="StartEvent_1" targetRef="EndEvent_0n56tas" />
+  </bpmn2:process>
+  <bpmn2:error id="Error_10hit0u" name="MSO Workflow Exception" errorCode="MSOWorkflowException" />
+  <bpmn2:error id="Error_1lwpypa" name="Java Lang Exception" errorCode="java.lang.Exception" />
+  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Homing">
+      <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
+        <dc:Bounds x="147" y="275" width="36" height="36" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="EndEvent_0ougemc_di" bpmnElement="EndEvent_0n56tas">
+        <dc:Bounds x="263" y="275" width="36" height="36" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="236" y="311" width="90" height="0" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_0tyavm9_di" bpmnElement="SequenceFlow_0tyavm9">
+        <di:waypoint xsi:type="dc:Point" x="183" y="293" />
+        <di:waypoint xsi:type="dc:Point" x="263" y="293" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="223" y="272" width="0" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+    </bpmndi:BPMNPlane>
+  </bpmndi:BPMNDiagram>
+</bpmn2:definitions>
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getNotFound.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getNotFound.xml
new file mode 100644 (file)
index 0000000..f66c9c4
--- /dev/null
@@ -0,0 +1,2 @@
+<search-results xmlns="http://org.openecomp.aai.inventory">
+</search-results>
\ No newline at end of file
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateServiceInstance/createServiceInstance_AAIResponse_success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateServiceInstance/createServiceInstance_AAIResponse_success.xml
deleted file mode 100644 (file)
index 5f810ba..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<rest:RESTResponse xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd"\r
-                   statusCode="200">\r
-   <rest:headers>\r
-      <rest:header name="Date" value="Thu,10 Mar 2016 00:01:18 GMT"/>\r
-      <rest:header name="Content-Length" value="0"/>\r
-      <rest:header name="Expires" value="Thu,01 Jan 1970 00:00:00 UTC"/>\r
-      <rest:header name="X-AAI-TXID" value="mtcnjv9aaas03-20160310-00:01:18:551-132672"/>\r
-      <rest:header name="Server" value="Apache-Coyote/1.1"/>\r
-      <rest:header name="Cache-Control" value="private"/>\r
-   </rest:headers>\r
-</rest:RESTResponse>
\ No newline at end of file
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryBRGCallback.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryBRGCallback.xml
new file mode 100644 (file)
index 0000000..410ba05
--- /dev/null
@@ -0,0 +1,37 @@
+<output xmlns="org:openecomp:sdnctl:vnf">\r
+<brg-topology  xmlns="org:openecomp:sdnctl:vnf">\r
+    <ecomp-model-information>\r
+        <model-invariant-uuid>36e20198-c67a-464b-96d0-aaa99eb2639e</model-invariant-uuid>\r
+        <model-uuid>5b9b15d0-5dd7-47dc-95b9-0440c340a3ba</model-uuid>\r
+        <model-version>1.0</model-version>\r
+        <model-name>BRGmodelname</model-name>\r
+        <model-customization-uuid>013bd784-9bca-4919-ae2f-ae57af27bad9</model-customization-uuid>\r
+    </ecomp-model-information>\r
+    <allotted-resource-identifiers>\r
+        <parent-service-instance-id>parent-service-instance-id</parent-service-instance-id>\r
+        <consuming-service-intance-id>consuming-service-instance-id</consuming-service-intance-id>\r
+        <allotted-resource-name>namefromrequest</allotted-resource-name>\r
+        <allotted-resource-type>brg</allotted-resource-type>\r
+        <allotted-resource-id>allottedresourceidfromrequest</allotted-resource-id>\r
+    </allotted-resource-identifiers>\r
+    <brg-assignments>\r
+        <fq-name>fq-name</fq-name>\r
+        <dest-network>\r
+            <network-id>d1</network-id>\r
+            <network-role>drole</network-role>\r
+        </dest-network>\r
+        <vlan-tag>vlan-tag</vlan-tag>\r
+        <source-network>\r
+            <network-id>s2</network-id>\r
+            <network-role>srole</network-role>\r
+        </source-network>\r
+        <txc-id>txc-id</txc-id>\r
+        <txc-applied-service>\r
+            <service-instance-id>1</service-instance-id>\r
+            <vnf-id>123</vnf-id>\r
+            <txc-fqdn>a.b.c.d</txc-fqdn>\r
+        </txc-applied-service>\r
+    </brg-assignments>\r
+</brg-topology>\r
+\r
+</output>\r
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryTXCCallback.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryTXCCallback.xml
new file mode 100644 (file)
index 0000000..ac85be4
--- /dev/null
@@ -0,0 +1,24 @@
+<output xmlns="org:openecomp:sdnctl:vnf">\r
+<tunnelxconn-topology  xmlns="org:openecomp:sdnctl:vnf">\r
+    <ecomp-model-information>\r
+        <model-invariant-uuid>36e20198-c67a-464b-96d0-aaa99eb2639e</model-invariant-uuid>\r
+        <model-uuid>5b9b15d0-5dd7-47dc-95b9-0440c340a3ba</model-uuid>\r
+        <model-version>1.0</model-version>\r
+        <model-name>TXCmodelname</model-name>\r
+        <model-customization-uuid>013bd784-9bca-4919-ae2f-ae57af27bad9</model-customization-uuid>\r
+    </ecomp-model-information>\r
+    <allotted-resource-identifiers>\r
+        <parent-service-instance-id>parent-service-instance-id</parent-service-instance-id>\r
+        <consuming-service-intance-id>consuming-service-instance-id</consuming-service-intance-id>\r
+        <allotted-resource-name>namefromrequest</allotted-resource-name>\r
+        <allotted-resource-type>tunnelxconn</allotted-resource-type>\r
+        <allotted-resource-id>allottedresourceidfromrequest</allotted-resource-id>\r
+    </allotted-resource-identifiers>\r
+    <tunnelxconn-assignments>\r
+       <vni>my-vni</vni>\r
+       <vgmux_bearer_ip>my-bearer-ip</vgmux_bearer_ip>\r
+       <vgmux_lan_ip>my-lan-ip</vgmux_lan_ip>\r
+    </tunnelxconn-assignments>\r
+</tunnelxconn-topology>\r
+\r
+</output>\r
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/arGetById.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/arGetById.xml
new file mode 100644 (file)
index 0000000..bb7f4c2
--- /dev/null
@@ -0,0 +1,31 @@
+<allotted-resource xmlns="http://org.openecomp.aai.inventory/v9">
+   <id>ar-1</id>
+   <orchestration-status>Active</orchestration-status>
+   <role>TunnelXConn</role>
+   <type>TunnelXConn</type>
+   <description>TunnelXConn</description>
+   <selflink/>
+   <resource-version>1490627351232</resource-version>
+   <relationship-list>
+      <relationship>
+         <related-to>service-instance</related-to>
+         <related-link>http://localhost:28090/aai/v9/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1</related-link>
+         <relationship-data>
+            <relationship-key>customer.global-customer-id</relationship-key>
+            <relationship-value>SDN-ETHERNET-INTERNET</relationship-value>
+         </relationship-data> 
+         <relationship-data>
+            <relationship-key>service-subscription.service-type</relationship-key>
+            <relationship-value>123456789</relationship-value>
+         </relationship-data>
+         <relationship-data>
+            <relationship-key>service-instance.service-instance-id</relationship-key>
+            <relationship-value>88819355-9a71-4ddc-9e22-373f0644b40b</relationship-value>
+         </relationship-data>
+         <related-to-property>
+            <property-key>service-instance.service-instance-name</property-key>
+            <property-value>vcpe-1702-m010904-name4</property-value>
+         </related-to-property>
+      </relationship>
+   </relationship-list>
+</allotted-resource>
                                "modelInstanceName"      : "Pri_IP_MUX_Demux 1"
                        },
                        "toscaNodeType"              : null,
-                       "allottedResourceType"              : "ContrailRoute",
-                       "allottedResourceRole"              : null,
+                       "allottedResourceType"              : "TunnelXConn",
+                       "allottedResourceRole"              : "TunnelXConn",
                        "providingServiceModelInvariantUuid"              : null,
                        "nfFunction"              : null,
                        "nfType"              : null,
                        "nfRole"              : null,
-                       "nfNamingCode"              : null
+                       "nfNamingCode"              : null,
+               "homingSolution": {
+                 "inventoryType": "service",
+                 "serviceInstanceId": "MIS%252F1604%252F0027%252FSW_INTERNET",
+                 "vnfHostname": "MDTNJ01",
+                 "cloudOwner": "aic",
+                 "cloudRegionId": "dfwtx",
+                 "aicClli": "KDTNJ01",
+                 "aicVersion": "3.0",
+                 "entitlementPoolList": [
+                   "f1d563e8-e714-4393-8f99-cc480144a05e",
+                   "j1d563e8-e714-4393-8f99-cc480144a05e"
+                 ],
+                 "licenseKeyGroupList": [
+                   "s1d563e8-e714-4393-8f99-cc480144a05e",
+                   "b1d563e8-e714-4393-8f99-cc480144a05e"
+                 ]
+               }
                },
                                {
                        "modelInfo"       : {
                                "modelInstanceName"      : "Pri_Service_Admin 5"
                        },
                        "toscaNodeType"              : null,
-                       "allottedResourceType"              : "SecurityZone",
-                       "allottedResourceRole"              : null,
+                       "allottedResourceType"              : "BRG",
+                       "allottedResourceRole"              : "BRG",
                        "providingServiceModelInvariantUuid"              : null,
                        "nfFunction"              : null,
                        "nfType"              : null,
                        "nfRole"              : null,
-                       "nfNamingCode"              : null
+                       "nfNamingCode"              : null,
+               "homingSolution": {
+                 "inventoryType": "service",
+                 "serviceInstanceId": "MIS%252F1604%252F0027%252FSW_INTERNET",
+                 "vnfHostname": "MDTNJ01",
+                 "cloudOwner": "aic",
+                 "cloudRegionId": "dfwtx",
+                 "aicClli": "KDTNJ01",
+                 "aicVersion": "3.0",
+                 "entitlementPoolList": [
+                   "f1d563e8-e714-4393-8f99-cc480144a05e",
+                   "j1d563e8-e714-4393-8f99-cc480144a05e"
+                 ],
+                 "licenseKeyGroupList": [
+                   "s1d563e8-e714-4393-8f99-cc480144a05e",
+                   "b1d563e8-e714-4393-8f99-cc480144a05e"
+                 ]
+               }
                }
                ]
        }}
\ No newline at end of file
@@ -1,13 +1,11 @@
-{
-  "serviceResources": {
+{ "serviceResources"    : {
        "modelInfo"       : {
                "modelName"          : "MSO Test Network",
                "modelUuid"          : "aed5a5b7-20d3-44f7-90a3-ddbd16f14d1e",
                "modelInvariantUuid" : "52b49b5d-3086-4ffd-b5e6-1b1e5e7e062f",
                "modelVersion"       : null
        },
-    "serviceVnfs": [],
-    "serviceNetworks": [],
-    "serviceAllottedResources": []
-  }
-}
\ No newline at end of file
+       "serviceVnfs": [],
+       "serviceNetworks": [],
+       "serviceAllottedResources": []
+       }}
\ No newline at end of file
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/getCustomer.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/getCustomer.xml
new file mode 100644 (file)
index 0000000..b9d88d1
--- /dev/null
@@ -0,0 +1,7 @@
+<customer xmlns="http://org.openecomp.aai.inventory/v8">
+    <global-customer-id>SDN-ETHERNET-INTERNET</global-customer-id>
+    <subscriber-name>SDN-ETHERNET-INTERNET</subscriber-name>
+    <resource-version>1490627351232</resource-version>
+    <service-subscriptions/>
+    <relationship-list/>
+</customer>
@@ -11,7 +11,7 @@
                                },
                        "subscriberInfo":
                                {
-                                       "globalSubscriberId":"MCBH-1610",
+                                       "globalSubscriberId":"SDN-ETHERNET-INTERNET",
                                        "subscriberName":"Kaneohe"
                                },
                        "requestInfo":
@@ -28,7 +28,7 @@
                                },
                        "requestParameters":
                                {
-                                       "subscriptionServiceType":"vcpesvc",
+                                       "subscriptionServiceType":"123456789",
                                        "aLaCarte":"false",
                                        "userParams":
                                                {
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/requestNoSIName.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/requestNoSIName.json
new file mode 100644 (file)
index 0000000..dc9ac49
--- /dev/null
@@ -0,0 +1,39 @@
+{
+       "requestDetails":
+               {
+                       "modelInfo":
+                               {
+                                       "modelType":"service",
+                                       "modelInvariantUuid":"uuid-miu-svc-011-abcdef",
+                                       "modelVersionId":"ASDC_TOSCA_UUID",
+                                       "modelName":"SIModelName1",
+                                       "modelVersion":"2"
+                               },
+                       "subscriberInfo":
+                               {
+                                       "globalSubscriberId":"SDN-ETHERNET-INTERNET",
+                                       "subscriberName":"Kaneohe"
+                               },
+                       "requestInfo":
+                               {
+                                       "source":"VID",
+                                       "suppressRollback":"false",
+                                       "productFamilyId":"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"
+                               },
+                       "cloudConfiguration":
+                               {
+                                       "lcpCloudRegionId":"mdt1",
+                                       "tenantId":"8b1df54faa3b49078e3416e21370a3ba"
+                               },
+                       "requestParameters":
+                               {
+                                       "subscriptionServiceType":"123456789",
+                                       "aLaCarte":"false",
+                                       "userParams":
+                                               {
+                                                       "BRG_WAN_MAC_Address" : "brgmac"
+                                               }
+                               }
+                               
+               }
+}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/requestNoSINameNoRollback.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/requestNoSINameNoRollback.json
new file mode 100644 (file)
index 0000000..d5b0713
--- /dev/null
@@ -0,0 +1,39 @@
+{
+       "requestDetails":
+               {
+                       "modelInfo":
+                               {
+                                       "modelType":"service",
+                                       "modelInvariantUuid":"uuid-miu-svc-011-abcdef",
+                                       "modelVersionId":"ASDC_TOSCA_UUID",
+                                       "modelName":"SIModelName1",
+                                       "modelVersion":"2"
+                               },
+                       "subscriberInfo":
+                               {
+                                       "globalSubscriberId":"SDN-ETHERNET-INTERNET",
+                                       "subscriberName":"Kaneohe"
+                               },
+                       "requestInfo":
+                               {
+                                       "source":"VID",
+                                       "suppressRollback":"true",
+                                       "productFamilyId":"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"
+                               },
+                       "cloudConfiguration":
+                               {
+                                       "lcpCloudRegionId":"mdt1",
+                                       "tenantId":"8b1df54faa3b49078e3416e21370a3ba"
+                               },
+                       "requestParameters":
+                               {
+                                       "subscriptionServiceType":"123456789",
+                                       "aLaCarte":"false",
+                                       "userParams":
+                                               {
+                                                       "BRG_WAN_MAC_Address" : "brgmac"
+                                               }
+                               }
+                               
+               }
+}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/arGetBRGById.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/arGetBRGById.xml
new file mode 100644 (file)
index 0000000..3cb3146
--- /dev/null
@@ -0,0 +1,31 @@
+<allotted-resource xmlns="http://org.openecomp.aai.inventory/v9">
+   <id>ar-brgB</id>
+   <orchestration-status>Active</orchestration-status>
+   <role>BRG</role>
+   <type>BRG</type>
+   <description>BRG</description>
+   <selflink/>
+   <resource-version>1490627351232</resource-version>
+   <relationship-list>
+      <relationship>
+         <related-to>service-instance</related-to>
+         <related-link>http://localhost:28090/aai/v9/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1</related-link>
+         <relationship-data>
+            <relationship-key>customer.global-customer-id</relationship-key>
+            <relationship-value>SDN-ETHERNET-INTERNET</relationship-value>
+         </relationship-data> 
+         <relationship-data>
+            <relationship-key>service-subscription.service-type</relationship-key>
+            <relationship-value>123456789</relationship-value>
+         </relationship-data>
+         <relationship-data>
+            <relationship-key>service-instance.service-instance-id</relationship-key>
+            <relationship-value>88819355-9a71-4ddc-9e22-373f0644b40b</relationship-value>
+         </relationship-data>
+         <related-to-property>
+            <property-key>service-instance.service-instance-name</property-key>
+            <property-value>vcpe-1702-m010904-name4</property-value>
+         </related-to-property>
+      </relationship>
+   </relationship-list>
+</allotted-resource>
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/arGetTXCById.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/arGetTXCById.xml
new file mode 100644 (file)
index 0000000..65cee9f
--- /dev/null
@@ -0,0 +1,31 @@
+<allotted-resource xmlns="http://org.openecomp.aai.inventory/v9">
+   <id>ar-txcA</id>
+   <orchestration-status>Active</orchestration-status>
+   <role>TunnelXConn</role>
+   <type>TunnelXConn</type>
+   <description>TunnelXConn</description>
+   <selflink/>
+   <resource-version>1490627351232</resource-version>
+   <relationship-list>
+      <relationship>
+         <related-to>service-instance</related-to>
+         <related-link>http://localhost:28090/aai/v9/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1</related-link>
+         <relationship-data>
+            <relationship-key>customer.global-customer-id</relationship-key>
+            <relationship-value>SDN-ETHERNET-INTERNET</relationship-value>
+         </relationship-data> 
+         <relationship-data>
+            <relationship-key>service-subscription.service-type</relationship-key>
+            <relationship-value>123456789</relationship-value>
+         </relationship-data>
+         <relationship-data>
+            <relationship-key>service-instance.service-instance-id</relationship-key>
+            <relationship-value>88819355-9a71-4ddc-9e22-373f0644b40b</relationship-value>
+         </relationship-data>
+         <related-to-property>
+            <property-key>service-instance.service-instance-name</property-key>
+            <property-value>vcpe-1702-m010904-name4</property-value>
+         </related-to-property>
+      </relationship>
+   </relationship-list>
+</allotted-resource>
@@ -1,6 +1,6 @@
 <search-results xmlns="http://org.openecomp.aai.inventory">
      <result-data>
         <resource-type>allotted-resource</resource-type>
-        <resource-link>https://aai-ext1.test.com:8443/aai/v7/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1</resource-link>
+        <resource-link>https://aai-ext1.test.com:8443/aai/v7/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/ar-brgB</resource-link>
      </result-data>
 </search-results>
\ No newline at end of file
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getSI.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getSI.xml
new file mode 100644 (file)
index 0000000..4f95ed2
--- /dev/null
@@ -0,0 +1,43 @@
+<service-instance>
+       
+   <service-instance-id>MIS/1604/0026/SW_INTERNET</service-instance-id>
+   <resource-version>123456789</resource-version>
+   
+       <allotted-resources>
+               <allotted-resource>
+                       <type>TunnelXConn</type>
+                       <id>ar-txcA</id>
+               </allotted-resource>
+               <allotted-resource>
+                       <type>BRG</type>
+                       <id>ar-brgB</id>
+               </allotted-resource>
+               <allotted-resource>
+                       <type>other</type>
+                       <id>ar-otherC</id>
+               </allotted-resource>
+       </allotted-resources>
+       
+       <relationship-list>
+      <relationship>
+         <related-to>generic-vnf</related-to>
+         <related-link>https://aai-ext1.test.com:8443/aai/v7/generic-vnf/vnfX</related-link>
+      </relationship>
+      <relationship>
+         <related-to>l3-network</related-to>
+         <related-link>https://aai-ext1.test.com:8443/aai/v7/l3-network/netA</related-link>
+      </relationship>
+      <relationship>
+         <related-to>generic-vnf</related-to>
+         <related-link>https://aai-ext1.test.com:8443/aai/v7/generic-vnf/vnfY</related-link>
+      </relationship>
+      <relationship>
+         <related-to>l3-network</related-to>
+         <related-link>https://aai-ext1.test.com:8443/aai/v7/l3-network/netB</related-link>
+      </relationship>
+      <relationship>
+         <related-to>l3-network</related-to>
+         <related-link>https://aai-ext1.test.com:8443/aai/v7/l3-network/netC</related-link>
+      </relationship>
+   </relationship-list>
+</service-instance>
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getSIAfterDelArs.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getSIAfterDelArs.xml
new file mode 100644 (file)
index 0000000..feb535c
--- /dev/null
@@ -0,0 +1,8 @@
+<service-instance>
+       <service-instance-id>MIS/1604/0026/SW_INTERNET</service-instance-id>
+       <service-type>SDN-MOBILITY</service-type>
+       <resource-version>123456789</resource-version>
+       
+       <relationship-list>
+       </relationship-list>
+</service-instance>
@@ -1,6 +1,6 @@
 <search-results xmlns="http://org.openecomp.aai.inventory">
      <result-data>
-        <resource-type>service-instance</resource-type>
-        <resource-link>https://aai-ext1.test.com:8443/aai/v7/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0027%252FSW_INTERNET</resource-link>
+        <resource-type>allotted-resource</resource-type>
+        <resource-link>https://aai-ext1.test.com:8443/aai/v7/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/ar-txcA</resource-link>
      </result-data>
 </search-results>
\ No newline at end of file
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/request.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/request.json
new file mode 100644 (file)
index 0000000..dc4669e
--- /dev/null
@@ -0,0 +1,40 @@
+{
+       "requestDetails":
+               {
+                       "modelInfo":
+                               {
+                                       "modelType":"service",
+                                       "modelInvariantUuid":"uuid-miu-svc-011-abcdef",
+                                       "modelVersionId":"ASDC_TOSCA_UUID",
+                                       "modelName":"SIModelName1",
+                                       "modelVersion":"2"
+                               },
+                       "subscriberInfo":
+                               {
+                                       "globalSubscriberId":"SDN-ETHERNET-INTERNET",
+                                       "subscriberName":"Kaneohe"
+                               },
+                       "requestInfo":
+                               {
+                                       "instanceName":"VCPE1",
+                                       "source":"VID",
+                                       "suppressRollback":"false",
+                                       "productFamilyId":"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"
+                               },
+                       "cloudConfiguration":
+                               {
+                                       "lcpCloudRegionId":"mdt1",
+                                       "tenantId":"8b1df54faa3b49078e3416e21370a3ba"
+                               },
+                       "requestParameters":
+                               {
+                                       "subscriptionServiceType":"123456789",
+                                       "aLaCarte":"false",
+                                       "userParams":
+                                               {
+                                                       "BRG_WAN_MAC_Address" : "brgmac"
+                                               }
+                               }
+                               
+               }
+}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/serviceToDelete.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/serviceToDelete.xml
new file mode 100644 (file)
index 0000000..6071c51
--- /dev/null
@@ -0,0 +1,38 @@
+<service xmlns="http://org.openecomp.aai.inventory/v9">
+       <allotted-resources>
+               <allotted-resource>
+                       <type>TunnelXConn</type>
+                       <id>txcA</id>
+               </allotted-resource>
+               <allotted-resource>
+                       <type>BRG</type>
+                       <id>brgB</id>
+               </allotted-resource>
+               <allotted-resource>
+                       <type>other</type>
+                       <id>otherC</id>
+               </allotted-resource>
+       </allotted-resources>
+       <relationship-list>
+      <relationship>
+         <related-to>generic-vnf</related-to>
+         <related-link>https://aai-ext1.test.com:8443/aai/v7/generic-vnf/vnfX</related-link>
+      </relationship>
+      <relationship>
+         <related-to>l3-network</related-to>
+         <related-link>https://aai-ext1.test.com:8443/aai/v7/l3-network/netA</related-link>
+      </relationship>
+      <relationship>
+         <related-to>generic-vnf</related-to>
+         <related-link>https://aai-ext1.test.com:8443/aai/v7/generic-vnf/vnfY</related-link>
+      </relationship>
+      <relationship>
+         <related-to>l3-network</related-to>
+         <related-link>https://aai-ext1.test.com:8443/aai/v7/l3-network/netB</related-link>
+      </relationship>
+      <relationship>
+         <related-to>l3-network</related-to>
+         <related-link>https://aai-ext1.test.com:8443/aai/v7/l3-network/netC</related-link>
+      </relationship>
+   </relationship-list>
+</service>
index b6da551..e352ff8 100644 (file)
@@ -2,7 +2,7 @@
    <relationship-list>
       <relationship>
          <related-to>allotted-resource</related-to>
-         <related-link>http://localhost:28090/aai/v9/mylink</related-link>
+         <related-link>https://aai-ext1.test.com:8443/aai/v7/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1</related-link>
       </relationship>
    </relationship-list>
 </allotted-resource>
index 361d440..8c3976b 100644 (file)
          <related-link>http://localhost:28090/aai/v9/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1</related-link>
          <relationship-data>
             <relationship-key>customer.global-customer-id</relationship-key>
-            <relationship-value>MCBH-1610</relationship-value>
+            <relationship-value>SDN-ETHERNET-INTERNET</relationship-value>
          </relationship-data> 
          <relationship-data>
             <relationship-key>service-subscription.service-type</relationship-key>
-            <relationship-value>vcpesvc</relationship-value>
+            <relationship-value>123456789</relationship-value>
          </relationship-data>
          <relationship-data>
             <relationship-key>service-instance.service-instance-id</relationship-key>
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getArBrg2.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getArBrg2.xml
new file mode 100644 (file)
index 0000000..650d608
--- /dev/null
@@ -0,0 +1,31 @@
+<allotted-resource xmlns="http://org.openecomp.aai.inventory/v9">
+   <id>ar-1</id>
+   <orchestration-status>Active</orchestration-status>
+   <role>txc</role>
+   <type>BRG</type>
+   <description>BRG</description>
+   <selflink/>
+   <resource-version>1490627351232</resource-version>
+   <relationship-list>
+      <relationship>
+         <related-to>service-instance</related-to>
+         <related-link>http://localhost:28090/aai/v9/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1</related-link>
+         <relationship-data>
+            <relationship-key>customer.global-customer-id</relationship-key>
+            <relationship-value>SDN-ETHERNET-INTERNET</relationship-value>
+         </relationship-data> 
+         <relationship-data>
+            <relationship-key>service-subscription.service-type</relationship-key>
+            <relationship-value>123456789</relationship-value>
+         </relationship-data>
+         <relationship-data>
+            <relationship-key>service-instance.service-instance-id</relationship-key>
+            <relationship-value>88819355-9a71-4ddc-9e22-373f0644b40b</relationship-value>
+         </relationship-data>
+         <related-to-property>
+            <property-key>service-instance.service-instance-name</property-key>
+            <property-value>vcpe-1702-m010904-name4</property-value>
+         </related-to-property>
+      </relationship>
+   </relationship-list>
+</allotted-resource>
@@ -1,7 +1,15 @@
 <service-instance>
-   <service-instance-id>MIS/1604/0027/SW_INTERNET</service-instance-id>
-   <resource-version>123456789</resource-version>
-   <relationship-list>
+    <service-instance-id>MIS/1604/0026/SW_INTERNET</service-instance-id>
+    <resource-version>123456789</resource-version>
+    
+    <orchestration-status>Active</orchestration-status>
+    
+    <relationship-list>
+      <relationship>
+         <related-to>allotted-resource</related-to>
+         <related-link>https://aai-ext1.test.com:8443/aai/v7/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1</related-link>
+      </relationship>
+      
       <relationship>
          <related-to>cvlan-tag</related-to>
          <related-link>https://aai-ext1.test.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/port-groups/port-group/slcp1447vbc.ipag/cvlan-tags/cvlan-tag/2003/</related-link>
       </relationship>
       <relationship>
          <related-to>vce</related-to>
-               <related-link>https://aai-ext1.test.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/</related-link>
+               <related-link>https://aai-ext1.test.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/</related-link>
          <relationship-data>
             <relationship-key>vce.vnf-id</relationship-key>
             <relationship-value>832bace2-3fb0-49e0-a6a4-07c47223c535</relationship-value>
          </relationship-data>
       </relationship>
-   </relationship-list>
+    </relationship-list>
 </service-instance>
index 6a35247..8ed9916 100644 (file)
          <related-link>http://localhost:28090/aai/v9/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1</related-link>
          <relationship-data>
             <relationship-key>customer.global-customer-id</relationship-key>
-            <relationship-value>MCBH-1610</relationship-value>
+            <relationship-value>SDN-ETHERNET-INTERNET</relationship-value>
          </relationship-data> 
          <relationship-data>
             <relationship-key>service-subscription.service-type</relationship-key>
-            <relationship-value>vcpesvc</relationship-value>
+            <relationship-value>123456789</relationship-value>
          </relationship-data>
          <relationship-data>
             <relationship-key>service-instance.service-instance-id</relationship-key>
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getAR.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getAR.xml
new file mode 100644 (file)
index 0000000..e352ff8
--- /dev/null
@@ -0,0 +1,8 @@
+<allotted-resource xmlns="http://org.openecomp.aai.inventory/v9">
+   <relationship-list>
+      <relationship>
+         <related-to>allotted-resource</related-to>
+         <related-link>https://aai-ext1.test.com:8443/aai/v7/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1</related-link>
+      </relationship>
+   </relationship-list>
+</allotted-resource>
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getArTxc.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getArTxc.xml
new file mode 100644 (file)
index 0000000..dfb7d46
--- /dev/null
@@ -0,0 +1,31 @@
+<allotted-resource xmlns="http://org.openecomp.aai.inventory/v9">
+   <id>ar-1</id>
+   <orchestration-status>Active</orchestration-status>
+   <role>TXCr</role>
+   <type>TXCt</type>
+   <description>TXC</description>
+   <selflink/>
+   <resource-version>1490627351232</resource-version>
+   <relationship-list>
+      <relationship>
+         <related-to>service-instance</related-to>
+         <related-link>http://localhost:28090/aai/v9/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1</related-link>
+         <relationship-data>
+            <relationship-key>customer.global-customer-id</relationship-key>
+            <relationship-value>SDN-ETHERNET-INTERNET</relationship-value>
+         </relationship-data> 
+         <relationship-data>
+            <relationship-key>service-subscription.service-type</relationship-key>
+            <relationship-value>123456789</relationship-value>
+         </relationship-data>
+         <relationship-data>
+            <relationship-key>service-instance.service-instance-id</relationship-key>
+            <relationship-value>88819355-9a71-4ddc-9e22-373f0644b40b</relationship-value>
+         </relationship-data>
+         <related-to-property>
+            <property-key>service-instance.service-instance-name</property-key>
+            <property-value>vcpe-1702-m010904-name4</property-value>
+         </related-to-property>
+      </relationship>
+   </relationship-list>
+</allotted-resource>
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getArTxc2.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getArTxc2.xml
new file mode 100644 (file)
index 0000000..59c5030
--- /dev/null
@@ -0,0 +1,31 @@
+<allotted-resource xmlns="http://org.openecomp.aai.inventory/v9">
+   <id>ar-1</id>
+   <orchestration-status>Active</orchestration-status>
+   <role>brg</role>
+   <type>TXC</type>
+   <description>TXC</description>
+   <selflink/>
+   <resource-version>1490627351232</resource-version>
+   <relationship-list>
+      <relationship>
+         <related-to>service-instance</related-to>
+         <related-link>http://localhost:28090/aai/v9/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1</related-link>
+         <relationship-data>
+            <relationship-key>customer.global-customer-id</relationship-key>
+            <relationship-value>SDN-ETHERNET-INTERNET</relationship-value>
+         </relationship-data> 
+         <relationship-data>
+            <relationship-key>service-subscription.service-type</relationship-key>
+            <relationship-value>123456789</relationship-value>
+         </relationship-data>
+         <relationship-data>
+            <relationship-key>service-instance.service-instance-id</relationship-key>
+            <relationship-value>88819355-9a71-4ddc-9e22-373f0644b40b</relationship-value>
+         </relationship-data>
+         <related-to-property>
+            <property-key>service-instance.service-instance-name</property-key>
+            <property-value>vcpe-1702-m010904-name4</property-value>
+         </related-to-property>
+      </relationship>
+   </relationship-list>
+</allotted-resource>
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getSIandAR.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getSIandAR.xml
new file mode 100644 (file)
index 0000000..14c7410
--- /dev/null
@@ -0,0 +1,38 @@
+<service-instance>
+    <service-instance-id>MIS/1604/0026/SW_INTERNET</service-instance-id>
+    <resource-version>123456789</resource-version>
+    
+    <orchestration-status>Active</orchestration-status>
+    
+    <relationship-list>
+      <relationship>
+         <related-to>allotted-resource</related-to>
+         <related-link>https://aai-ext1.test.com:8443/aai/v7/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1</related-link>
+      </relationship>
+      
+      <relationship>
+         <related-to>cvlan-tag</related-to>
+         <related-link>https://aai-ext1.test.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/port-groups/port-group/slcp1447vbc.ipag/cvlan-tags/cvlan-tag/2003/</related-link>
+         <relationship-data>
+            <relationship-key>cvlan-tag.cvlan-tag</relationship-key>
+            <relationship-value>2003</relationship-value>
+         </relationship-data>
+         <relationship-data>
+            <relationship-key>port-group.interface-id</relationship-key>
+            <relationship-value>slcp1447vbc.ipag</relationship-value>
+         </relationship-data>
+         <relationship-data>
+            <relationship-key>vce.vnf-id</relationship-key>
+            <relationship-value>832bace2-3fb0-49e0-a6a4-07c47223c535</relationship-value>
+         </relationship-data>
+      </relationship>
+      <relationship>
+         <related-to>vce</related-to>
+               <related-link>https://aai-ext1.test.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/</related-link>
+         <relationship-data>
+            <relationship-key>vce.vnf-id</relationship-key>
+            <relationship-value>832bace2-3fb0-49e0-a6a4-07c47223c535</relationship-value>
+         </relationship-data>
+      </relationship>
+    </relationship-list>
+</service-instance>
index 713ef56..bb7f4c2 100644 (file)
          <related-link>http://localhost:28090/aai/v9/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1</related-link>
          <relationship-data>
             <relationship-key>customer.global-customer-id</relationship-key>
-            <relationship-value>MCBH-1610</relationship-value>
+            <relationship-value>SDN-ETHERNET-INTERNET</relationship-value>
          </relationship-data> 
          <relationship-data>
             <relationship-key>service-subscription.service-type</relationship-key>
-            <relationship-value>vcpesvc</relationship-value>
+            <relationship-value>123456789</relationship-value>
          </relationship-data>
          <relationship-data>
             <relationship-key>service-instance.service-instance-id</relationship-key>
index 6a35247..8ed9916 100644 (file)
          <related-link>http://localhost:28090/aai/v9/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1</related-link>
          <relationship-data>
             <relationship-key>customer.global-customer-id</relationship-key>
-            <relationship-value>MCBH-1610</relationship-value>
+            <relationship-value>SDN-ETHERNET-INTERNET</relationship-value>
          </relationship-data> 
          <relationship-data>
             <relationship-key>service-subscription.service-type</relationship-key>
-            <relationship-value>vcpesvc</relationship-value>
+            <relationship-value>123456789</relationship-value>
          </relationship-data>
          <relationship-data>
             <relationship-key>service-instance.service-instance-id</relationship-key>
index 713ef56..bb7f4c2 100644 (file)
          <related-link>http://localhost:28090/aai/v9/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET/allotted-resources/allotted-resource/arId-1</related-link>
          <relationship-data>
             <relationship-key>customer.global-customer-id</relationship-key>
-            <relationship-value>MCBH-1610</relationship-value>
+            <relationship-value>SDN-ETHERNET-INTERNET</relationship-value>
          </relationship-data> 
          <relationship-data>
             <relationship-key>service-subscription.service-type</relationship-key>
-            <relationship-value>vcpesvc</relationship-value>
+            <relationship-value>123456789</relationship-value>
          </relationship-data>
          <relationship-data>
             <relationship-key>service-instance.service-instance-id</relationship-key>
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/VNFAdapterRestCreateCallback.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/VNFAdapterRestCreateCallback.xml
deleted file mode 100644 (file)
index 49ecd0b..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-<createVfModuleResponse>
-    <vnfId>skask</vnfId>
-    <vfModuleId>supercool</vfModuleId>
-    <vfModuleStackId>slowburn</vfModuleStackId>
-    <vfModuleCreated>true</vfModuleCreated>
-    <vfModuleOutputs>
-        <entry>
-            <key>key1</key>
-            <value>value1</value>
-        </entry>
-        <entry>
-            <key>key2</key>
-            <value>value2</value>
-        </entry>
-        <entry>
-<key>server1_private_ip</key>
-<value>192.168.28.3</value>
-</entry>
-<entry>
-<key>contrail-service-instance-fqdn</key>
-<value>default-domain:MSOTest:MsoNW-RA</value>
-</entry>
-<entry>
-<key>policyKey1_contrail_network_policy_fqdn</key>
-<value>MSOTest:DefaultPolicyFQDN1</value>
-</entry>
-<entry>
-<key>policyKey2_contrail_network_policy_fqdn</key>
-<value>MSOTest:DefaultPolicyFQDN2</value>
-</entry>
-<entry>
-<key>oam_management_v6_address</key>
-<value>2000:abc:bce:1111</value>
-</entry>
-<entry>
-<key>oam_management_v4_address</key>
-<value>127.0.0.1</value>
-</entry>
-    </vfModuleOutputs>
-    <rollback> <!-- JC's doc has "vfModuleRollback" -->
-        <vnfId>skask</vnfId>
-        <vfModuleId>supercool</vfModuleId>
-        <vfModuleStackId>slowburn</vfModuleStackId>
-        <vfModuleCreated>true</vfModuleCreated>
-        <tenantId>tenantId</tenantId>
-        <cloudSiteId>cloudSiteId</cloudSiteId>
-        <msoRequest>
-            <requestId>requestId</requestId>
-            <serviceInstanceId>serviceInstanceId</serviceInstanceId>
-        </msoRequest>
-        <messageId>{{MESSAGE-ID}}</messageId> <!-- JC's doc does not have this -->
-    </rollback>
-    <messageId>{{MESSAGE-ID}}</messageId>
-</createVfModuleResponse>
-
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/createServiceInstance_genericQueryByInstance_AAIResponse_200.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/createServiceInstance_genericQueryByInstance_AAIResponse_200.xml
deleted file mode 100644 (file)
index 2f38a4f..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-<search-results xmlns="http://org.openecomp.aai.inventory">
-      <service-instances> 
-          <service-instance>
-         <service-instance-id>f70e927b-6087-4974-9ef8-c5e4d5847ca4</service-instance-id>
-         <persona-model-id>gg0e927b-6087-5574-9ef8-c5e4d5847db5</persona-model-id>
-         <persona-model-version>V1.0</persona-model-version>
-         <service-instance-name>vMOG-AKRON-1234</service-instance-name>
-         <resource-version>1462561835</resource-version>
-         <relationship-list/> 
-         <metadata/> 
-               </service-instance>
-      </service-instances>             
-      </search-results>
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogNetworkData.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogNetworkData.json
deleted file mode 100644 (file)
index cab2637..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-{
-  "serviceNetworks": [
-    {
-      "version": null,
-      "modelCustomizationUuid": "93a5f915-403f-487d-89e4-7107359635b0",
-      "modelName": "VIPR_TENANT_OAM_NET",
-      "modelInstanceName": "VIPR_TENANT_OAM_NET 1",
-      "modelUuid": "6524c8ad-dc17-44c0-ad24-08c4d2df52e6",
-      "modelVersion": "1.0",
-      "modelInvariantUuid": "b2667e06-1ec1-4a2a-a916-991b5510b603",
-      "networkResourceId": 100,
-      "created": 1484943975000,
-      "networkResource": {
-        "version": "1",
-        "id": 100,
-        "networkType": "VIPR_TENANT_OAM_NET",
-        "orchestrationMode": "HEAT",
-        "description": "manual record pointing to existing CONTRAIL30_BASIC template",
-        "templateId": 1,
-        "neutronNetworkType": "BASIC",
-        "aicVersionMin": "3.0",
-        "aicVersionMax": null,
-        "created": 1484936027000
-      },
-      "networkType": "VIPR_TENANT_OAM_NET"
-    }
-  ]
-}
\ No newline at end of file
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogServiceResourcesDataNoNetwork.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogServiceResourcesDataNoNetwork.json
deleted file mode 100644 (file)
index 2003acf..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-{ "serviceResources"    : {
-       "modelName"          : "CMW_Service",
-       "modelUuid"          : "Cmw_123",
-       "modelInvariantUuid" : "cmw-123-456-789",
-       "modelVersion"       : null,
-       "serviceVnfs": [
-               { "vnf"                    : {
-                       "modelName"              : "MANUAL RECORD",
-                       "modelUuid"              : null,
-                       "modelInvariantUuid"     : "miu-vnf-15190",
-                       "modelVersion"           : "1.0",
-                       "modelCustomizationUuid" : "123456-789012-cmwabd",
-                       "modelInstanceName"      : null,
-                       "vfModules": [
-                               { "vfModule"               : { 
-                                       "modelName"              : "vSAMP12::base::module-0",
-                                       "modelUuid"              : null,
-                                       "modelInvariantUuid"     : "miu-1001",
-                                       "modelVersion"           : "1",
-                                       "modelCustomizationUuid" : "1001",
-                                       "vfModuleType"           : "Test/vSAMP12::vSAMP12::base::module-0",
-                                       "isBase"                 : true,
-                                       "vfModuleLabel"          : "base",
-                                       "initialCount"           : 1
-                               }},
-                               { "vfModule"               : { 
-                                       "modelName"              : "base::module-0",
-                                       "modelUuid"              : null,
-                                       "modelInvariantUuid"     : "miu-1002",
-                                       "modelVersion"           : "1",
-                                       "modelCustomizationUuid" : "1002",
-                                       "vfModuleType"           : "Test/vSAMP12::base::module-0",
-                                       "isBase"                 : true,
-                                       "vfModuleLabel"          : "module-0",
-                                       "initialCount"           : 1
-                               }},
-                               { "vfModule"               : { 
-                                       "modelName"              : "vSAMP12DEV::base::module-0",
-                                       "modelUuid"              : null,
-                                       "modelInvariantUuid"     : "miu-1003",
-                                       "modelVersion"           : "1",
-                                       "modelCustomizationUuid" : "f86e8800-7629-427f-b284-3dbfd04db01f",
-                                       "vfModuleType"           : "Test/vSAMP12::vSAMP12DEV::base::module-0",
-                                       "isBase"                 : true,
-                                       "vfModuleLabel"          : "base",
-                                       "initialCount"           : 0
-                               }}
-                       ]
-               }}
-       ],
-       "serviceNetworks": [],
-       "serviceAllottedResources": [
-               { "allottedResource"       : {
-                       "modelName"              : "Bruce Wayne",
-                       "modelUuid"              : "123-123",
-                       "modelInvariantUuid"     : "not yet implemented",
-                       "modelVersion"           : "1.0",
-                       "modelCustomizationUuid" : "ar-mod-custid-456-456",
-                       "modelInstanceName"      : "Clark Kent"
-               }}
-       ]
-       }}
\ No newline at end of file
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogServiceResourcesDataNoNetworkVnf.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogServiceResourcesDataNoNetworkVnf.json
deleted file mode 100644 (file)
index 4364eaf..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-{
-  "serviceResources": {
-    "modelName": "CMW_Service",
-    "modelUuid": "Cmw_123",
-    "modelInvariantUuid": "cmw-123-456-789",
-    "modelVersion": null,
-    "serviceVnfs": [],
-    "serviceNetworks": [],
-    "serviceAllottedResources": [
-      {
-        "allottedResource": {
-          "modelName": "Bruce Wayne",
-          "modelUuid": "123-123",
-          "modelInvariantUuid": "not yet implemented",
-          "modelVersion": "1.0",
-          "modelCustomizationUuid": "ar-mod-custid-456-456",
-          "modelInstanceName": "Clark Kent",
-          "toscaModelType": "undefined",
-          "allottedResourceType": "ContrailRoute",
-          "allottedResourceRole": "ALLOTTED_RESROUCE_ROLE",
-          "providingServiceModelInvariantUuid": "PROVIDING_SERVICE_MODEL_INVARIANT_UUID"
-        }
-      }
-    ]
-  }
-}
\ No newline at end of file
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogServiceResourcesDataServiceAllotted.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogServiceResourcesDataServiceAllotted.json
deleted file mode 100644 (file)
index e865210..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-{
-  "serviceResources": {
-    "modelInfo": {
-      "modelName": "SD-WAN",
-      "modelUuid": "ee9807ef-9814-4067-b997-5eee54c9e719",
-      "modelInvariantUuid": "7b0fafc1-83df-4590-9460-b5a8d9f9f277",
-      "modelVersion": null
-    },
-    "serviceVnfs": [],
-    "serviceNetworks": [],
-    "serviceAllottedResources": [
-      {
-        "modelInfo": {
-          "modelName": "IP_MUX_Demux",
-          "modelUuid": "64a1a718-556b-48ce-b3b7-ed3237ccc94f",
-          "modelInvariantUuid": "f110ef53-a0a6-4d72-ab91-fd88a835e8c4",
-          "modelVersion": "2.0",
-          "modelCustomizationUuid": "4bab0880-2f06-4aeb-87cb-3734c8e8bf93",
-          "modelInstanceName": "Pri_IP_MUX_Demux 1"
-        },
-        "toscaNodeType": null,
-        "allottedResourceType": "ContrailRoute",
-        "allottedResourceRole": "ContrailRoute",
-        "providingServiceModelInvariantUuid": null,
-        "nfFunction": null,
-        "nfType": null,
-        "nfRole": null,
-        "nfNamingCode": null,
-        "homingSolution": {
-          "inventoryType": "service",
-          "serviceInstanceId": "c763d462-dfe4-4577-9706-fa3a9db640be",
-          "vnfHostname": "MDTNJ01",
-          "cloudOwner": "aic",
-          "cloudRegionId": "dfwtx",
-          "aicClli": "KDTNJ01",
-          "aicVersion": "3.0",
-          "entitlementPoolList": [
-            "f1d563e8-e714-4393-8f99-cc480144a05e",
-            "j1d563e8-e714-4393-8f99-cc480144a05e"
-          ],
-          "licenseKeyGroupList": [
-            "s1d563e8-e714-4393-8f99-cc480144a05e",
-            "b1d563e8-e714-4393-8f99-cc480144a05e"
-          ]
-        }
-      },
-      {
-        "modelInfo": {
-          "modelName": "Service_Admin",
-          "modelUuid": "73501e03-ee76-4509-a8ce-96d2a9f33ee9",
-          "modelInvariantUuid": "462edf71-1a3c-487b-bf55-497460ab7de3",
-          "modelVersion": "2.0",
-          "modelCustomizationUuid": "a896ffad-c8f9-404e-a527-7a8d0cc99ce6",
-          "modelInstanceName": "Pri_Service_Admin 5"
-        },
-        "toscaNodeType": null,
-        "allottedResourceType": "SecurityZone",
-        "allottedResourceRole": "SecurityZone",
-        "providingServiceModelInvariantUuid": null,
-        "nfFunction": null,
-        "nfType": null,
-        "nfRole": null,
-        "nfNamingCode": null,
-        "homingSolution": {
-          "inventoryType": "service",
-          "serviceInstanceId": "c763d462-dfe4-4577-9706-fa3a9db640be",
-          "vnfHostname": "MDTNJ01",
-          "cloudOwner": "aic",
-          "cloudRegionId": "dfwtx",
-          "aicClli": "KDTNJ01",
-          "aicVersion": "3.0",
-          "entitlementPoolList": [
-            "f1d563e8-e714-4393-8f99-cc480144a05e",
-            "j1d563e8-e714-4393-8f99-cc480144a05e"
-          ],
-          "licenseKeyGroupList": [
-            "s1d563e8-e714-4393-8f99-cc480144a05e",
-            "b1d563e8-e714-4393-8f99-cc480144a05e"
-          ]
-        }
-      }
-    ]
-  }
-}
\ No newline at end of file
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogServiceResourcesServiceNetwork.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogServiceResourcesServiceNetwork.json
deleted file mode 100644 (file)
index 821bd04..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-{ "serviceResources"    : {
-       "modelInfo"       : {
-               "modelName"          : "MSO Test Network",
-               "modelUuid"          : "aed5a5b7-20d3-44f7-90a3-ddbd16f14d1e",
-               "modelInvariantUuid" : "52b49b5d-3086-4ffd-b5e6-1b1e5e7e062f",
-               "modelVersion"       : null
-       },
-       "serviceVnfs": [],
-       "serviceNetworks": [
-               {
-                       "modelInfo"                : {
-                               "modelName"              : "CONTRAIL_BASIC",
-                               "modelUuid"              : "fe5be3a6-dbe0-46d6-bcac-44dc841a7edc",
-                               "modelInvariantUuid"     : "ab07fbd8-185a-45ac-be45-db3eb02e98d5",
-                               "modelVersion"           : null,
-                               "modelCustomizationUuid" : "0cb9b26a-9820-48a7-86e5-16c510e993d9",
-                               "modelInstanceName"      : "CONTRAIL_BASIC 5"
-               },
-                       "toscaNodeType"            : null,
-                       "networkType"              : null,
-                       "networkTechnology"        : null,
-                       "networkRole"              : null,
-                       "networkScope"             : null
-               }
-       ],
-       "serviceAllottedResources": []
-       }}
\ No newline at end of file
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogServiceResourcesServiceVnf.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogServiceResourcesServiceVnf.json
deleted file mode 100644 (file)
index 7893aff..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-{ "serviceResources"    : {
-       "modelInfo"       : {
-               "modelName"          : "MSO Test Network",
-               "modelUuid"          : "aed5a5b7-20d3-44f7-90a3-ddbd16f14d1e",
-               "modelInvariantUuid" : "52b49b5d-3086-4ffd-b5e6-1b1e5e7e062f",
-               "modelVersion"       : null
-       },
-       "serviceVnfs": [
-               { "modelInfo"                    : {
-                       "modelName"              : "vHNF for DHV Test",
-                       "modelUuid"              : "7097d8bb-f6ad-4cf7-866e-6a04c8f1b332",
-                       "modelInvariantUuid"     : "6ea0b528-e303-4686-aa77-aa2fcbdccb96",
-                       "modelVersion"           : "2.0",
-                       "modelCustomizationUuid" : "da86dd87-43c5-458c-b226-5315b7be9ad5",
-                       "modelInstanceName"      : "vHNF for DHV Test 17"
-                       },
-               "toscaNodeType"            : null,
-               "nfFunction"            : null,
-               "nfType"                        : null,
-               "nfRole"                        : null,
-               "nfNamingCode"          : null,
-                       "vfModules": [
-                               {
-                                       "modelInfo"               : { 
-                                               "modelName"              : "VhnfForDhvTest..base_TEST..module-0",
-                                               "modelUuid"              : "ebc3d18c-3e62-4c24-bcd6-961e98701a0a",
-                                               "modelInvariantUuid"     : "f5696ec0-ec71-4916-bf3b-93a654efcba4",
-                                               "modelVersion"           : "1",
-                                               "modelCustomizationUuid" : "1740536a-742e-40f5-b9c8-83918849a787"
-                                       },              "isBase"                 : true,
-                                       "vfModuleLabel"          : "base_TEST",
-                                       "initialCount"           : 1,
-                                       "hasVolumeGroup"           : true
-                               }
-                       ]
-               }
-               ],
-       "serviceNetworks": [],
-       "serviceAllottedResources": []
-       }}
\ No newline at end of file
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogVcpe.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogVcpe.json
deleted file mode 100644 (file)
index b95e45a..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-{ "serviceResources"    : {
-       "modelInfo"       : {
-               "modelName"          : "MSO Test Network",
-               "modelUuid"          : "aed5a5b7-20d3-44f7-90a3-ddbd16f14d1e",
-               "modelInvariantUuid" : "52b49b5d-3086-4ffd-b5e6-1b1e5e7e062f",
-               "modelVersion"       : null
-       },
-       "serviceVnfs": [
-               { "modelInfo"                    : {
-                       "modelName"              : "vHNF for DHV Test",
-                       "modelUuid"              : "7097d8bb-f6ad-4cf7-866e-6a04c8f1b332",
-                       "modelInvariantUuid"     : "6ea0b528-e303-4686-aa77-aa2fcbdccb96",
-                       "modelVersion"           : "2.0",
-                       "modelCustomizationUuid" : "da86dd87-43c5-458c-b226-5315b7be9ad5",
-                       "modelInstanceName"      : "vHNF for DHV Test 17"
-                       },
-               "toscaNodeType"            : null,
-               "nfFunction"            : null,
-               "nfType"                        : null,
-               "nfRole"                        : null,
-               "nfNamingCode"          : null,
-                       "vfModules": [
-                               {
-                                       "modelInfo"               : { 
-                                               "modelName"              : "VhnfForDhvTest..base_TEST..module-0",
-                                               "modelUuid"              : "ebc3d18c-3e62-4c24-bcd6-961e98701a0a",
-                                               "modelInvariantUuid"     : "f5696ec0-ec71-4916-bf3b-93a654efcba4",
-                                               "modelVersion"           : "1",
-                                               "modelCustomizationUuid" : "1740536a-742e-40f5-b9c8-83918849a787"
-                                       },              "isBase"                 : true,
-                                       "vfModuleLabel"          : "base_TEST",
-                                       "initialCount"           : 1,
-                                       "hasVolumeGroup"           : true
-                               }
-                       ]
-               }
-               ],
-       "serviceAllottedResources": [
-                       {
-                       "modelInfo"       : {
-                               "modelName"              : "IP_MUX_Demux",
-                               "modelUuid"              : "64a1a718-556b-48ce-b3b7-ed3237ccc94f",
-                               "modelInvariantUuid"     : "f110ef53-a0a6-4d72-ab91-fd88a835e8c4",
-                               "modelVersion"           : "2.0",
-                               "modelCustomizationUuid" : "4bab0880-2f06-4aeb-87cb-3734c8e8bf93",
-                               "modelInstanceName"      : "Pri_IP_MUX_Demux 1"
-                       },
-                       "toscaNodeType"              : null,
-                       "allottedResourceType"              : "TunnelXConn",
-                       "allottedResourceRole"              : null,
-                       "providingServiceModelInvariantUuid"              : null,
-                       "nfFunction"              : null,
-                       "nfType"              : null,
-                       "nfRole"              : null,
-                       "nfNamingCode"              : null
-               },
-                               {
-                       "modelInfo"       : {
-                               "modelName"              : "Service_Admin",
-                               "modelUuid"              : "73501e03-ee76-4509-a8ce-96d2a9f33ee9",
-                               "modelInvariantUuid"     : "462edf71-1a3c-487b-bf55-497460ab7de3",
-                               "modelVersion"           : "2.0",
-                               "modelCustomizationUuid" : "a896ffad-c8f9-404e-a527-7a8d0cc99ce6",
-                               "modelInstanceName"      : "Pri_Service_Admin 5"
-                       },
-                       "toscaNodeType"              : null,
-                       "allottedResourceType"              : "BRG",
-                       "allottedResourceRole"              : null,
-                       "providingServiceModelInvariantUuid"              : null,
-                       "nfFunction"              : null,
-                       "nfType"              : null,
-                       "nfRole"              : null,
-                       "nfNamingCode"              : null
-               }
-               ]
-       }}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogVnfData.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogVnfData.json
deleted file mode 100644 (file)
index d95b313..0000000
+++ /dev/null
@@ -1 +0,0 @@
-{"serviceVnfs":[]}
\ No newline at end of file
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCustomer.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCustomer.xml
deleted file mode 100644 (file)
index 6e35f24..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-<customer xmlns="http://org.openecomp.aai.inventory/v8">
-    <global-customer-id>MCBH-1610</global-customer-id>
-    <subscriber-name>MCBH-1610</subscriber-name>
-    <resource-version>1465943440</resource-version>
-    <service-subscriptions/>
-    <relationship-list/>
-</customer>
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getNetwork.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getNetwork.xml
deleted file mode 100644 (file)
index 32a01b6..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-<l3-network xmlns="http://org.openecomp.aai.inventory/v8">
-   <network-id>cf82a73f-de7f-4f84-8dfc-16a487c63a36</network-id>
-   <network-name>Dev_NoBinding-2001</network-name>
-   <network-type>CONTRAIL30_BASIC</network-type>
-   <network-role>GN_EVPN_direct</network-role>
-   <network-technology>contrail</network-technology>
-   <neutron-network-id>968a47e3-e238-4158-af87-6be7f508a6c0</neutron-network-id>
-   <is-bound-to-vpn>false</is-bound-to-vpn>
-   <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id>
-   <network-role-instance>0</network-role-instance>
-   <resource-version>1476384388</resource-version>
-   <orchestration-status>active</orchestration-status>
-   <heat-stack-id>Dev_NoBinding-2001/11c429ac-eab3-4566-a9d3-d8ca6fb4e803</heat-stack-id>
-   <contrail-network-fqdn>default-domain:IST_Automation_AAI_updated:Dev_NoBinding-2001</contrail-network-fqdn>
-   <physical-network-name/>
-   <is-provider-network>false</is-provider-network>
-   <is-shared-network>false</is-shared-network>
-   <is-external-network>false</is-external-network>
-   <subnets>
-      <subnet>
-         <subnet-id>5c559cd8-1ef2-45a8-b342-b4c9307d33ff</subnet-id>
-         <subnet-name/>
-         <neutron-subnet-id>48267a65-2209-4e10-ad44-fc30d4fcb508</neutron-subnet-id>
-         <gateway-address>218.210.11.1</gateway-address>
-         <network-start-address>218.210.11.0</network-start-address>
-         <cidr-mask>24</cidr-mask>
-         <ip-version>4</ip-version>
-         <orchestration-status>pending-update</orchestration-status>
-         <dhcp-enabled>true</dhcp-enabled>
-         <dhcp-start>218.210.11.3</dhcp-start>
-         <dhcp-end>218.210.11.64</dhcp-end>
-         <resource-version>1476384386</resource-version>
-      </subnet>
-   </subnets>
-   <relationship-list>
-      <relationship>
-         <related-to>tenant</related-to>
-         <related-link>https://aai-int1.test.openecomp.com:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6/tenants/tenant/fe4400a8e96e4caa85ccdca8a850255b</related-link>
-         <relationship-data>
-            <relationship-key>cloud-region.cloud-owner</relationship-key>
-            <relationship-value>att-aic</relationship-value>
-         </relationship-data>
-         <relationship-data>
-            <relationship-key>cloud-region.cloud-region-id</relationship-key>
-            <relationship-value>mtn6</relationship-value>
-         </relationship-data>
-         <relationship-data>
-            <relationship-key>tenant.tenant-id</relationship-key>
-            <relationship-value>fe4400a8e96e4caa85ccdca8a850255b</relationship-value>
-         </relationship-data>
-         <related-to-property>
-            <property-key>tenant.tenant-name</property-key>
-            <property-value>IST_Automation_AAI_updated</property-value>
-         </related-to-property>
-      </relationship>
-      <relationship>
-         <related-to>cloud-region</related-to>
-         <related-link>https://aai-int1.test.openecomp.com:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6</related-link>
-         <relationship-data>
-            <relationship-key>cloud-region.cloud-owner</relationship-key>
-            <relationship-value>att-aic</relationship-value>
-         </relationship-data>
-         <relationship-data>
-            <relationship-key>cloud-region.cloud-region-id</relationship-key>
-            <relationship-value>mtn6</relationship-value>
-         </relationship-data>
-         <related-to-property>
-            <property-key>cloud-region.owner-defined-type</property-key>
-         </related-to-property>
-      </relationship>
-      <relationship>
-         <related-to>service-instance</related-to>
-         <related-link>https://aai-int1.test.openecomp.com:8443/aai/v8/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/ffdfebef-9cf0-4be4-ab29-0380f0da0341</related-link>
-         <relationship-data>
-            <relationship-key>customer.global-customer-id</relationship-key>
-            <relationship-value>MSO_1610_dev</relationship-value>
-         </relationship-data>
-         <relationship-data>
-            <relationship-key>service-subscription.service-type</relationship-key>
-            <relationship-value>MSO-dev-service-type</relationship-value>
-         </relationship-data>
-         <relationship-data>
-            <relationship-key>service-instance.service-instance-id</relationship-key>
-            <relationship-value>ffdfebef-9cf0-4be4-ab29-0380f0da0341</relationship-value>
-         </relationship-data>
-         <related-to-property>
-            <property-key>service-instance.service-instance-name</property-key>
-            <property-value>dm4251_SERVICE1</property-value>
-         </related-to-property>
-      </relationship>
-   </relationship-list>
-</l3-network>
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/serviceDecompositionATMFW.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/serviceDecompositionATMFW.json
deleted file mode 100644 (file)
index bc54c55..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-{
-"serviceResources" : {
-    "modelInfo" : {
-      "modelName" : "CMW_Service",
-      "modelUuid" : "",
-      "modelInvariantId" : "cmw-123-456-789",
-      "modelVersion" : "",
-      "modelCustomizationUuid" : "",
-      "modelInstanceName" : "",
-      "modelCustomizationName" : "",
-      "modelVersionId" : "Cmw_123",
-      "modelType" : ""
-    },
-    "serviceInstanceData" : {
-      "instanceId" : "ff5256d2-5a33-55df-13ab-12abad84e7ff"
-    },
-    "serviceNetworks" : [ {
-      "modelInfo" : {
-        "modelName" : "CONTRAIL30_BASIC",
-        "modelUuid" : "",
-        "modelInvariantId" : "not yet implemented",
-        "modelVersion" : "1.0",
-        "modelCustomizationUuid" : "z_network_123",
-        "modelInstanceName" : "",
-        "modelCustomizationName" : "",
-        "modelVersionId" : "mod-inst-uuid-123",
-        "modelType" : "network"
-      },
-      "instanceData" : { },
-      "networkType" : "CONTRAIL30_BASIC"
-    } ],
-    "serviceVnfs" : [ {
-      "modelInfo" : {
-        "modelName" : "vSAMP12",
-        "modelUuid" : "",
-        "modelInvariantId" : "ff5256d2-5a33-55df-13ab-12abad84e7ff",
-        "modelVersion" : "1.0",
-        "modelCustomizationUuid" : "ff5256d2-5a33-55df-13ab-12abad84e7ff",
-        "modelInstanceName" : "",
-        "modelCustomizationName" : "",
-        "modelVersionId" : "fe6478e5-ea33-3346-ac12-ab121484a3fe",
-        "modelType" : "vnf"
-      },
-      "instanceData" : { },
-      "vfModules" : [ {
-        "modelInfo" : {
-          "modelName" : "vSAMP12::base::module-0",
-          "modelUuid" : "",
-          "modelInvariantId" : "miu-1001",
-          "modelVersion" : "1",
-          "modelCustomizationUuid" : "1001",
-          "modelInstanceName" : "",
-          "modelCustomizationName" : "",
-          "modelVersionId" : "",
-          "modelType" : "vfModule"
-        },
-        "instanceData" : { },
-        "hasVolumeGroup" : false,
-        "isBase" : true,
-        "initialCount" : 1
-      }, {
-        "modelInfo" : {
-          "modelName" : "base::module-0",
-          "modelUuid" : "",
-          "modelInvariantId" : "miu-1002",
-          "modelVersion" : "1",
-          "modelCustomizationUuid" : "1002",
-          "modelInstanceName" : "",
-          "modelCustomizationName" : "",
-          "modelVersionId" : "",
-          "modelType" : "vfModule"
-        },
-        "instanceData" : { },
-        "hasVolumeGroup" : false,
-        "isBase" : true,
-        "initialCount" : 1
-      }, {
-        "modelInfo" : {
-          "modelName" : "vSAMP12DEV::base::module-0",
-          "modelUuid" : "",
-          "modelInvariantId" : "miu-1003",
-          "modelVersion" : "1",
-          "modelCustomizationUuid" : "f86e8800-7629-427f-b284-3dbfd04db01f",
-          "modelInstanceName" : "",
-          "modelCustomizationName" : "",
-          "modelVersionId" : "",
-          "modelType" : "vfModule"
-        },
-        "instanceData" : { },
-        "hasVolumeGroup" : false,
-        "isBase" : true,
-        "initialCount" : 0
-      } ]
-    } ],
-    "serviceAllottedResources" : [ {
-      "modelInfo" : {
-        "modelName" : "Bruce Wayne",
-        "modelUuid" : "",
-        "modelInvariantId" : "not yet implemented",
-        "modelVersion" : "1.0",
-        "modelCustomizationUuid" : "ar-mod-custid-456-456",
-        "modelInstanceName" : "Clark Kent",
-        "modelCustomizationName" : "",
-        "modelVersionId" : "123-123",
-        "modelType" : "allottedResource"
-      },
-      "instanceData" : { }
-    } ]
-  }
-}
\ No newline at end of file
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyDeactivateCallbackNotFound.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyDeactivateCallbackNotFound.xml
new file mode 100644 (file)
index 0000000..bf2b3c0
--- /dev/null
@@ -0,0 +1,8 @@
+<output xmlns="org:openecomp:sdnctl:vnf">\r
+       <vnf-information>\r
+               <vnf-id>skask</vnf-id>\r
+       </vnf-information>\r
+       <response-code>404</response-code>\r
+       <svc-request-id>{{REQUEST-ID}}</svc-request-id>\r
+       <ack-final-indicator>Y</ack-final-indicator>\r
+</output>\r