summaryrefslogtreecommitdiffstats
path: root/bpmn/MSOInfrastructureBPMN/src/test
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2017-10-11 11:49:51 -0400
committerJim Hahn <jrh3@att.com>2017-10-11 11:49:51 -0400
commit015b92c3d96fb42f80b018fdf8f639f1cf3298c3 (patch)
treef96f2e944d456809702041bc9f9ef653ba061216 /bpmn/MSOInfrastructureBPMN/src/test
parentf86960874497f005079c9e595b5e9e2eb0a815d1 (diff)
Add junit test coverage and fix bugs in VCPE
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>
Diffstat (limited to 'bpmn/MSOInfrastructureBPMN/src/test')
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy1198
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DeleteVcpeResCustServiceTest.groovy709
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollbackTest.groovy653
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGTest.groovy1943
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollbackTest.groovy653
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCTest.groovy950
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRGTest.groovy600
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXCTest.groovy600
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/GroovyTestBase.groovy124
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/MapGetter.groovy48
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/MapSetter.groovy49
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/AbstractTestBase.java41
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/CreateVcpeResCustServiceTest.java832
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DeleteVcpeResCustServiceTest.java297
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceBRGRollbackTest.java283
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceBRGTest.java226
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceTXCRollbackTest.java283
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceTXCTest.java239
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoDeleteAllottedResourceBRGTest.java106
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoDeleteAllottedResourceTXCTest.java106
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/DoCreateAllottedResourceBRG.bpmn54
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/DoCreateAllottedResourceBRGRollback.bpmn55
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/DoCreateAllottedResourceTXC.bpmn38
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/DoCreateServiceInstanceRollback.bpmn53
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/DoCreateVnfAndModules.bpmn53
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/DoCreateVnfAndModulesRollback.bpmn53
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/DoDeleteVnfAndModules.bpmn37
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/Homing.bpmn35
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getNotFound.xml2
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateServiceInstance/createServiceInstance_AAIResponse_success.xml11
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryBRGCallback.xml37
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryTXCCallback.xml24
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/arGetById.xml31
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json (renamed from bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogServiceResourcesData.json)46
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/getCatalogServiceResourcesNoData.json (renamed from bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogServiceResourcesDataServiceInstanceOnly.json)12
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/getCustomer.xml7
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/request.json (renamed from bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/request.json)4
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/requestNoSIName.json39
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/requestNoSINameNoRollback.json39
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/arGetBRGById.xml31
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/arGetTXCById.xml31
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getBRGArUrlById.xml (renamed from bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getARUrlById.xml)2
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getSI.xml43
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getSIAfterDelArs.xml8
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getTXCArUrlById.xml (renamed from bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getParentSIUrlById.xml)4
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/request.json40
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/serviceToDelete.xml38
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getAR.xml2
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getArBrg.xml4
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getArBrg2.xml31
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getSIandAR.xml (renamed from bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getParentServiceInstance.xml)18
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml4
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getAR.xml8
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getArTxc.xml31
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getArTxc2.xml31
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getSIandAR.xml38
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml4
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoDeleteAllottedResourceBRG/arGetById.xml4
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoDeleteAllottedResourceTXC/arGetById.xml4
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/VNFAdapterRestCreateCallback.xml55
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/createServiceInstance_genericQueryByInstance_AAIResponse_200.xml13
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogNetworkData.json28
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogServiceResourcesDataNoNetwork.json62
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogServiceResourcesDataNoNetworkVnf.json26
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogServiceResourcesDataServiceAllotted.json84
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogServiceResourcesServiceNetwork.json27
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogServiceResourcesServiceVnf.json40
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogVcpe.json76
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogVnfData.json1
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCustomer.xml7
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getNetwork.xml92
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/serviceDecompositionATMFW.json110
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyCreateCallback.xml (renamed from bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/SDNCTopologyCreateCallback.xml)0
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyDeactivateCallback.xml (renamed from bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/SDNCTopologyDeactivateCallback.xml)0
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyDeactivateCallbackNotFound.xml8
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyDeleteCallback.xml (renamed from bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/SDNCTopologyDeleteCallback.xml)0
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyUnassignCallback.xml (renamed from bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/SDNCTopologyUnassignCallback.xml)0
77 files changed, 9177 insertions, 2398 deletions
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
index 0000000000..c5eff73084
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy
@@ -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
+
+
+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.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.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
+
+class CreateVcpeResCustServiceTest extends GroovyTestBase {
+
+ private static String request
+
+ @Rule
+ public WireMockRule wireMockRule = new WireMockRule(PORT)
+
+ String Prefix = "CVRCS_"
+ String RbType = "DCRENI_"
+
+ @BeforeClass
+ public static void setUpBeforeClass() {
+ super.setUpBeforeClass()
+ request = FileUtil.readResourceFile("__files/VCPE/CreateVcpeResCustService/request.json")
+ }
+
+ @Before
+ public void init()
+ {
+ MockitoAnnotations.initMocks(this)
+ }
+
+ public CreateVcpeResCustServiceTest() {
+ super("CreateVcpeResCustService")
+ }
+
+
+ // ***** preProcessRequest *****
+
+ @Test
+// @Ignore
+ public void preProcessRequest() {
+ ExecutionEntity mex = setupMock()
+ def map = setupMap(mex)
+ initPreProcess(mex)
+
+ CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+ CreateVcpeResCustService.preProcessRequest(mex)
+
+ verify(mex).getVariable(DBGFLAG)
+ 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)
+ }
+
+ @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")
+ }
+
+}
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
index 0000000000..df7c0cff97
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DeleteVcpeResCustServiceTest.groovy
@@ -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
+
+
+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.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.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
+
+class DeleteVcpeResCustServiceTest extends GroovyTestBase {
+
+ private static String request
+
+ @Rule
+ public WireMockRule wireMockRule = new WireMockRule(PORT)
+
+ String Prefix = "DVRCS_"
+ String RbType = "DCRENI_"
+
+ @BeforeClass
+ public static void setUpBeforeClass() {
+ super.setUpBeforeClass()
+ request = FileUtil.readResourceFile("__files/VCPE/DeleteVcpeResCustService/request.json")
+ }
+
+ @Before
+ public void init()
+ {
+ MockitoAnnotations.initMocks(this)
+ }
+
+ public DeleteVcpeResCustServiceTest() {
+ super("DeleteVcpeResCustService")
+ }
+
+
+ // ***** preProcessRequest *****
+
+ @Test
+// @Ignore
+ public void preProcessRequest() {
+ ExecutionEntity mex = setupMock()
+ def map = setupMap(mex)
+ initPreProcess(mex)
+
+ DeleteVcpeResCustService DeleteVcpeResCustService = new DeleteVcpeResCustService()
+ DeleteVcpeResCustService.preProcessRequest(mex)
+
+ verify(mex).getVariable(DBGFLAG)
+ 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)
+ }
+
+ @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")
+ }
+}
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
index 0000000000..af532e733c
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollbackTest.groovy
@@ -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 DoCreateAllottedResourceBRGRollbackTest extends GroovyTestBase {
+
+ @Rule
+ public WireMockRule wireMockRule = new WireMockRule(PORT)
+
+ String Prefix = "DCARBRGRB_"
+ String RbType = "DCARBRG_"
+
+ @BeforeClass
+ public static void setUpBeforeClass() {
+ super.setUpBeforeClass()
+ }
+
+ @Before
+ public void init()
+ {
+ MockitoAnnotations.initMocks(this)
+ }
+
+ public DoCreateAllottedResourceBRGRollbackTest() {
+ super("DoCreateAllottedResourceBRGRollback")
+ }
+
+
+ // ***** preProcessRequest *****
+
+ @Test
+// @Ignore
+ public void preProcessRequest() {
+ ExecutionEntity mex = setupMock()
+ initPreProcess(mex)
+
+ 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, never()).setVariable("skipRollback", true)
+ }
+
+ @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")
+ }
+
+}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGTest.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGTest.groovy
index f34f84a5fd..1d4d3ea5a3 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGTest.groovy
+++ b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGTest.groovy
@@ -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
@@ -12,1120 +31,960 @@ import org.junit.Rule
import org.junit.Test
import org.junit.Ignore
import org.mockito.MockitoAnnotations
-import org.mockito.ArgumentCaptor
import org.camunda.bpm.engine.delegate.BpmnError
-import org.openecomp.mso.bpmn.common.scripts.MsoUtils
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.*;
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
-class DoCreateAllottedResourceBRGTest {
+class DoCreateAllottedResourceBRGTest extends GroovyTestBase {
@Rule
- public WireMockRule wireMockRule = new WireMockRule(28090)
-
- static def urnProps = new Properties()
- static def aaiUriPfx
-
- String Prefix="DCARBRG_"
- def utils = new MsoUtils()
+ public WireMockRule wireMockRule = new WireMockRule(PORT)
+
+ String Prefix = "DCARBRG_"
- @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")
- }
-
- @Before
- public void init()
- {
- MockitoAnnotations.initMocks(this)
- }
-
-
- // ***** preProcessRequest *****
-
- @Test
-// @Ignore
- public void preProcessRequest() {
- ExecutionEntity mex = setupMock()
- initPreProcess(mex)
+ @BeforeClass
+ public static void setUpBeforeClass() {
+ super.setUpBeforeClass()
+ }
+
+ @Before
+ public void init()
+ {
+ MockitoAnnotations.initMocks(this)
+ }
+
+ public DoCreateAllottedResourceBRGTest() {
+ super("DoCreateAllottedResourceBRG")
+ }
+
+
+ // ***** preProcessRequest *****
- DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
- DoCreateAllottedResourceBRG.preProcessRequest(mex)
+ @Test
+// @Ignore
+ public void preProcessRequest() {
+ ExecutionEntity mex = setupMock()
+ initPreProcess(mex)
+
+ DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG()
+ DoCreateAllottedResourceBRG.preProcessRequest(mex)
- verify(mex).getVariable("isDebugLogEnabled")
- verify(mex).setVariable("prefix", Prefix)
-
- 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"))
- }
-
-
- // ***** 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)
+ verify(mex).setVariable("prefix", Prefix)
+
+ 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"))
+ }
+
+
+ // ***** 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)))
- }
-
- private ExecutionEntity setupMock() {
-
- ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class)
- when(mockProcessDefinition.getKey()).thenReturn("DoCreateAllottedResourceBRG")
- RepositoryService mockRepositoryService = mock(RepositoryService.class)
- when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition)
- when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("DoCreateAllottedResourceBRG")
- when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100")
- ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class)
- when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService)
-
- ExecutionEntity mex = mock(ExecutionEntity.class)
-
- when(mex.getId()).thenReturn("100")
- when(mex.getProcessDefinitionId()).thenReturn("DoCreateAllottedResourceBRG")
- when(mex.getProcessInstanceId()).thenReturn("DoCreateAllottedResourceBRG")
- when(mex.getProcessEngineServices()).thenReturn(mockProcessEngineServices)
- when(mex.getProcessEngineServices().getRepositoryService().getProcessDefinition(mex.getProcessDefinitionId())).thenReturn(mockProcessDefinition)
-
- return mex
- }
+ 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)
+ }
}
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
index 0000000000..e5635deba7
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollbackTest.groovy
@@ -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
index 0000000000..2b6d4ba6a0
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCTest.groovy
@@ -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
+
+
+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.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.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
+
+class DoCreateAllottedResourceTXCTest extends GroovyTestBase {
+
+ @Rule
+ public WireMockRule wireMockRule = new WireMockRule(PORT)
+
+ String Prefix = "DCARTXC_"
+
+ @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")
+ }
+
+ @Before
+ public void init()
+ {
+ MockitoAnnotations.initMocks(this)
+ }
+
+ public DoCreateAllottedResourceTXCTest() {
+ super("DoCreateAllottedResourceTXC")
+ }
+
+
+ // ***** preProcessRequest *****
+
+ @Test
+// @Ignore
+ public void preProcessRequest() {
+ ExecutionEntity mex = setupMock()
+ initPreProcess(mex)
+
+ DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC()
+ DoCreateAllottedResourceTXC.preProcessRequest(mex)
+
+ verify(mex).getVariable(DBGFLAG)
+ verify(mex).setVariable("prefix", Prefix)
+
+ 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"))
+ }
+
+
+ // ***** 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)
+ }
+
+}
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
index 0000000000..f91a39c856
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRGTest.groovy
@@ -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 DoDeleteAllottedResourceBRGTest extends GroovyTestBase {
+
+ @Rule
+ public WireMockRule wireMockRule = new WireMockRule(PORT)
+
+ String Prefix = "DDARBRG_"
+
+ @BeforeClass
+ public static void setUpBeforeClass() {
+ super.setUpBeforeClass()
+ }
+
+ @Before
+ public void init()
+ {
+ MockitoAnnotations.initMocks(this)
+ }
+
+ public DoDeleteAllottedResourceBRGTest() {
+ super("DoDeleteAllottedResourceBRG")
+ }
+
+
+ // ***** preProcessRequest *****
+
+ @Test
+// @Ignore
+ public void preProcessRequest() {
+ ExecutionEntity mex = setupMock()
+ initPreProcess(mex)
+
+ DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG()
+ DoDeleteAllottedResourceBRG.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"))
+
+ 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)
+ }
+
+}
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
index 0000000000..97f714d98d
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXCTest.groovy
@@ -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
index 0000000000..121583ec10
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/GroovyTestBase.groovy
@@ -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
+
+
+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.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.MockGetAllottedResource
+import org.openecomp.mso.bpmn.core.RollbackData
+import org.openecomp.mso.bpmn.vcpe.scripts.MapSetter
+
+import com.github.tomakehurst.wiremock.junit.WireMockRule
+
+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"
+
+ static Properties urnProps = new Properties()
+ static String aaiUriPfx
+
+ String processName
+
+ 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;
+ }
+ }
+
+ public ExecutionEntity setupMock() {
+
+ ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class)
+ when(mockProcessDefinition.getKey()).thenReturn(processName)
+ RepositoryService mockRepositoryService = mock(RepositoryService.class)
+ when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition)
+ when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn(processName)
+ when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100")
+ ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class)
+ when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService)
+
+ ExecutionEntity mex = mock(ExecutionEntity.class)
+
+ when(mex.getId()).thenReturn("100")
+ when(mex.getProcessDefinitionId()).thenReturn(processName)
+ when(mex.getProcessInstanceId()).thenReturn(processName)
+ when(mex.getProcessEngineServices()).thenReturn(mockProcessEngineServices)
+ when(mex.getProcessEngineServices().getRepositoryService().getProcessDefinition(mex.getProcessDefinitionId())).thenReturn(mockProcessDefinition)
+
+ when(mex.getVariable("isAsyncProcess")).thenReturn("true")
+ when(mex.getVariable(processName+"WorkflowResponseSent")).thenReturn("false")
+
+ return mex
+ }
+
+ public Map<String,Object> setupMap(ExecutionEntity mex) {
+ MapSetter mapset = new MapSetter();
+ doAnswer(mapset).when(mex).setVariable(any(), any())
+ return mapset.getMap();
+ }
+
+}
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
index 0000000000..062cc0697e
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/MapGetter.groovy
@@ -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
index 0000000000..e3395323d7
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/MapSetter.groovy
@@ -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
index 0000000000..e7b80f12ab
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/AbstractTestBase.java
@@ -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";
+}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/CreateVcpeResCustServiceTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/CreateVcpeResCustServiceTest.java
index a94dc85d06..8f94187f48 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/CreateVcpeResCustServiceTest.java
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/CreateVcpeResCustServiceTest.java
@@ -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.
@@ -17,24 +17,22 @@
* 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
index 0000000000..88b6464de0
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DeleteVcpeResCustServiceTest.java
@@ -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;
+ }
+
+}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceBRGRollbackTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceBRGRollbackTest.java
index f5c3775273..0407e172e2 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceBRGRollbackTest.java
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceBRGRollbackTest.java
@@ -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.
@@ -17,13 +17,12 @@
* 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;
}
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceBRGTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceBRGTest.java
index 4f7b32b340..5b6f74fc7d 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceBRGTest.java
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceBRGTest.java
@@ -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.
@@ -17,13 +17,11 @@
* 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\"," +
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceTXCRollbackTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceTXCRollbackTest.java
index a887f72db0..cdce56ee63 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceTXCRollbackTest.java
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceTXCRollbackTest.java
@@ -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.
@@ -17,13 +17,12 @@
* 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;
}
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceTXCTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceTXCTest.java
index 42704bfe97..4323ccae1a 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceTXCTest.java
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceTXCTest.java
@@ -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.
@@ -17,13 +17,11 @@
* 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\"," +
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoDeleteAllottedResourceBRGTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoDeleteAllottedResourceBRGTest.java
index 46f5da46b3..03972da789 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoDeleteAllottedResourceBRGTest.java
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoDeleteAllottedResourceBRGTest.java
@@ -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.
@@ -17,13 +17,10 @@
* 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);
}
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoDeleteAllottedResourceTXCTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoDeleteAllottedResourceTXCTest.java
index 48e1349633..2b0364c3c9 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoDeleteAllottedResourceTXCTest.java
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoDeleteAllottedResourceTXCTest.java
@@ -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.
@@ -17,13 +17,10 @@
* 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
index 0000000000..b33aad7443
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/DoCreateAllottedResourceBRG.bpmn
@@ -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
index 0000000000..807efae1af
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/DoCreateAllottedResourceBRGRollback.bpmn
@@ -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
index 0000000000..b2f280d7e9
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/DoCreateAllottedResourceTXC.bpmn
@@ -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
index 0000000000..532ca867bb
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/DoCreateServiceInstanceRollback.bpmn
@@ -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
index 0000000000..5e4400e9bd
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/DoCreateVnfAndModules.bpmn
@@ -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
index 0000000000..2867a671b6
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/DoCreateVnfAndModulesRollback.bpmn
@@ -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
index 0000000000..517df36c74
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/DoDeleteVnfAndModules.bpmn
@@ -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
index 0000000000..ad4c3c816d
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/VCPE/stubprocess/Homing.bpmn
@@ -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
index 0000000000..f66c9c4fb8
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getNotFound.xml
@@ -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
index 5f810bab4c..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateServiceInstance/createServiceInstance_AAIResponse_success.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<rest:RESTResponse xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd"
- statusCode="200">
- <rest:headers>
- <rest:header name="Date" value="Thu,10 Mar 2016 00:01:18 GMT"/>
- <rest:header name="Content-Length" value="0"/>
- <rest:header name="Expires" value="Thu,01 Jan 1970 00:00:00 UTC"/>
- <rest:header name="X-AAI-TXID" value="mtcnjv9aaas03-20160310-00:01:18:551-132672"/>
- <rest:header name="Server" value="Apache-Coyote/1.1"/>
- <rest:header name="Cache-Control" value="private"/>
- </rest:headers>
-</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
index 0000000000..410ba05e5f
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryBRGCallback.xml
@@ -0,0 +1,37 @@
+<output xmlns="org:openecomp:sdnctl:vnf">
+<brg-topology xmlns="org:openecomp:sdnctl:vnf">
+ <ecomp-model-information>
+ <model-invariant-uuid>36e20198-c67a-464b-96d0-aaa99eb2639e</model-invariant-uuid>
+ <model-uuid>5b9b15d0-5dd7-47dc-95b9-0440c340a3ba</model-uuid>
+ <model-version>1.0</model-version>
+ <model-name>BRGmodelname</model-name>
+ <model-customization-uuid>013bd784-9bca-4919-ae2f-ae57af27bad9</model-customization-uuid>
+ </ecomp-model-information>
+ <allotted-resource-identifiers>
+ <parent-service-instance-id>parent-service-instance-id</parent-service-instance-id>
+ <consuming-service-intance-id>consuming-service-instance-id</consuming-service-intance-id>
+ <allotted-resource-name>namefromrequest</allotted-resource-name>
+ <allotted-resource-type>brg</allotted-resource-type>
+ <allotted-resource-id>allottedresourceidfromrequest</allotted-resource-id>
+ </allotted-resource-identifiers>
+ <brg-assignments>
+ <fq-name>fq-name</fq-name>
+ <dest-network>
+ <network-id>d1</network-id>
+ <network-role>drole</network-role>
+ </dest-network>
+ <vlan-tag>vlan-tag</vlan-tag>
+ <source-network>
+ <network-id>s2</network-id>
+ <network-role>srole</network-role>
+ </source-network>
+ <txc-id>txc-id</txc-id>
+ <txc-applied-service>
+ <service-instance-id>1</service-instance-id>
+ <vnf-id>123</vnf-id>
+ <txc-fqdn>a.b.c.d</txc-fqdn>
+ </txc-applied-service>
+ </brg-assignments>
+</brg-topology>
+
+</output>
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
index 0000000000..ac85be4e97
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryTXCCallback.xml
@@ -0,0 +1,24 @@
+<output xmlns="org:openecomp:sdnctl:vnf">
+<tunnelxconn-topology xmlns="org:openecomp:sdnctl:vnf">
+ <ecomp-model-information>
+ <model-invariant-uuid>36e20198-c67a-464b-96d0-aaa99eb2639e</model-invariant-uuid>
+ <model-uuid>5b9b15d0-5dd7-47dc-95b9-0440c340a3ba</model-uuid>
+ <model-version>1.0</model-version>
+ <model-name>TXCmodelname</model-name>
+ <model-customization-uuid>013bd784-9bca-4919-ae2f-ae57af27bad9</model-customization-uuid>
+ </ecomp-model-information>
+ <allotted-resource-identifiers>
+ <parent-service-instance-id>parent-service-instance-id</parent-service-instance-id>
+ <consuming-service-intance-id>consuming-service-instance-id</consuming-service-intance-id>
+ <allotted-resource-name>namefromrequest</allotted-resource-name>
+ <allotted-resource-type>tunnelxconn</allotted-resource-type>
+ <allotted-resource-id>allottedresourceidfromrequest</allotted-resource-id>
+ </allotted-resource-identifiers>
+ <tunnelxconn-assignments>
+ <vni>my-vni</vni>
+ <vgmux_bearer_ip>my-bearer-ip</vgmux_bearer_ip>
+ <vgmux_lan_ip>my-lan-ip</vgmux_lan_ip>
+ </tunnelxconn-assignments>
+</tunnelxconn-topology>
+
+</output>
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
index 0000000000..bb7f4c20fd
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/arGetById.xml
@@ -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>
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogServiceResourcesData.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json
index be0dfc8954..81fdcc76d0 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogServiceResourcesData.json
+++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json
@@ -63,13 +63,30 @@
"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" : {
@@ -81,13 +98,30 @@
"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
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogServiceResourcesDataServiceInstanceOnly.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/getCatalogServiceResourcesNoData.json
index 56af494d49..80692b27f5 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogServiceResourcesDataServiceInstanceOnly.json
+++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/getCatalogServiceResourcesNoData.json
@@ -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
index 0000000000..b9d88d15db
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/getCustomer.xml
@@ -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>
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/request.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/request.json
index 9141d5074a..dc4669e8d9 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/request.json
+++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/request.json
@@ -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
index 0000000000..dc9ac49a4e
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/requestNoSIName.json
@@ -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
index 0000000000..d5b0713d9f
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/requestNoSINameNoRollback.json
@@ -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
index 0000000000..3cb31464d5
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/arGetBRGById.xml
@@ -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
index 0000000000..65cee9f662
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/arGetTXCById.xml
@@ -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>
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getARUrlById.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getBRGArUrlById.xml
index e178583a34..932dbfb2ca 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getARUrlById.xml
+++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getBRGArUrlById.xml
@@ -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
index 0000000000..4f95ed2f19
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getSI.xml
@@ -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
index 0000000000..feb535c238
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getSIAfterDelArs.xml
@@ -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>
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getParentSIUrlById.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getTXCArUrlById.xml
index c29133e539..1c4f13d642 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getParentSIUrlById.xml
+++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/getTXCArUrlById.xml
@@ -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
index 0000000000..dc4669e8d9
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/request.json
@@ -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
index 0000000000..6071c51b2d
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/serviceToDelete.xml
@@ -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>
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getAR.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getAR.xml
index b6da551d23..e352ff8f1f 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getAR.xml
+++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getAR.xml
@@ -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>
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getArBrg.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getArBrg.xml
index 361d44032b..8c3976b828 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getArBrg.xml
+++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getArBrg.xml
@@ -12,11 +12,11 @@
<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
index 0000000000..650d608fb0
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getArBrg2.xml
@@ -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>
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getParentServiceInstance.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getSIandAR.xml
index bc810c6014..14c7410995 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getParentServiceInstance.xml
+++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRG/getSIandAR.xml
@@ -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>
@@ -20,11 +28,11 @@
</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>
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml
index 6a35247b09..8ed991608a 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml
+++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml
@@ -12,11 +12,11 @@
<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
index 0000000000..e352ff8f1f
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getAR.xml
@@ -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
index 0000000000..dfb7d46a68
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getArTxc.xml
@@ -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
index 0000000000..59c503036a
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getArTxc2.xml
@@ -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
index 0000000000..14c7410995
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXC/getSIandAR.xml
@@ -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>
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml
index 713ef56b50..bb7f4c20fd 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml
+++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml
@@ -12,11 +12,11 @@
<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/DoDeleteAllottedResourceBRG/arGetById.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoDeleteAllottedResourceBRG/arGetById.xml
index 6a35247b09..8ed991608a 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoDeleteAllottedResourceBRG/arGetById.xml
+++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoDeleteAllottedResourceBRG/arGetById.xml
@@ -12,11 +12,11 @@
<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/DoDeleteAllottedResourceTXC/arGetById.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoDeleteAllottedResourceTXC/arGetById.xml
index 713ef56b50..bb7f4c20fd 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoDeleteAllottedResourceTXC/arGetById.xml
+++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoDeleteAllottedResourceTXC/arGetById.xml
@@ -12,11 +12,11 @@
<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
index 49ecd0bf3f..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/VNFAdapterRestCreateCallback.xml
+++ /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
index 2f38a4f535..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/createServiceInstance_genericQueryByInstance_AAIResponse_200.xml
+++ /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
index cab2637955..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogNetworkData.json
+++ /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
index 2003acf9ea..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogServiceResourcesDataNoNetwork.json
+++ /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
index 4364eaf594..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogServiceResourcesDataNoNetworkVnf.json
+++ /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
index e865210713..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogServiceResourcesDataServiceAllotted.json
+++ /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
index 821bd04c19..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogServiceResourcesServiceNetwork.json
+++ /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
index 7893aff693..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogServiceResourcesServiceVnf.json
+++ /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
index b95e45ac46..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogVcpe.json
+++ /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
index d95b313583..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCatalogVnfData.json
+++ /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
index 6e35f24205..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getCustomer.xml
+++ /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
index 32a01b6973..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/getNetwork.xml
+++ /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
index bc54c557e1..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/serviceDecompositionATMFW.json
+++ /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/VCPE/SDNCTopologyCreateCallback.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyCreateCallback.xml
index 11022f6aec..11022f6aec 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/SDNCTopologyCreateCallback.xml
+++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyCreateCallback.xml
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/SDNCTopologyDeactivateCallback.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyDeactivateCallback.xml
index acea1459bc..acea1459bc 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/SDNCTopologyDeactivateCallback.xml
+++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyDeactivateCallback.xml
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
index 0000000000..bf2b3c0882
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyDeactivateCallbackNotFound.xml
@@ -0,0 +1,8 @@
+<output xmlns="org:openecomp:sdnctl:vnf">
+ <vnf-information>
+ <vnf-id>skask</vnf-id>
+ </vnf-information>
+ <response-code>404</response-code>
+ <svc-request-id>{{REQUEST-ID}}</svc-request-id>
+ <ack-final-indicator>Y</ack-final-indicator>
+</output>
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/SDNCTopologyDeleteCallback.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyDeleteCallback.xml
index 11022f6aec..11022f6aec 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/SDNCTopologyDeleteCallback.xml
+++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyDeleteCallback.xml
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/SDNCTopologyUnassignCallback.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyUnassignCallback.xml
index 11022f6aec..11022f6aec 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/SDNCTopologyUnassignCallback.xml
+++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/SDNCTopologyUnassignCallback.xml