aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn')
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/AAITasks/AAICreateOwningEntityTest.java35
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/BeansTest.java72
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateGenericALaCarteServiceInstanceTest.java137
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateNetworkInstanceTest.java665
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVfModuleInfraTest.java367
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVfModuleVolumeInfraV1Test.java368
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVnfInfraTest.java225
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteGenericALaCarteServiceInstanceTest.java111
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteNetworkInstanceTest.java341
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVfModuleInfraTest.java605
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVfModuleVolumeInfraV1Test.java166
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVnfInfraTest.java200
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateSIRollbackTest.java199
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstanceTest.java130
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstanceV2Test.java109
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstanceV3Test.java70
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVfModuleRollbackTest.java161
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVfModuleTest.java477
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVfModuleVolumeV2Test.java240
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVnfAndModulesRollbackTest.java425
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVnfAndModulesTest.java374
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVnfTest.java131
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteServiceInstanceTest.java108
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVfModuleFromVnfTest.java177
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVfModuleTest.java631
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVfModuleVolumeV2Test.java198
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVnfAndModulesTest.java352
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVnfTest.java140
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoUpdateVfModuleTest.java257
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoUpdateVnfAndModulesTest.java226
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/ReplaceVnfInfraTest.java264
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/RollbackVnfTest.java134
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/SetupServiceDecompTest.java65
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/StubResponseAAITest.java168
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateNetworkInstanceTest.java489
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVfModuleInfraTest.java145
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVfModuleInfraV2Test.java119
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVfModuleVolumeInfraV1Test.java143
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVnfInfraTest.java173
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/VnfConfigUpdateTest.java146
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/VnfInPlaceUpdateTest.java159
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/aai/AAIServiceInstanceTest.java114
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java73
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/AaiConnectionThrowingException.java39
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java57
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegateTest.java132
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegateTest.java50
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java59
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java94
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java84
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/bpmn/CreateAndActivatePnfResourceTest.java146
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/JsonUtilForCorrelationIdTest.java76
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java208
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/workflow/service/WorkflowResourceApplicationTest.java38
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/HeaderUtilTest.java34
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilderTest.java358
-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.java382
-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.java345
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceBRGTest.java296
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceTXCRollbackTest.java345
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceTXCTest.java302
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoDeleteAllottedResourceBRGTest.java162
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoDeleteAllottedResourceTXCTest.java162
65 files changed, 0 insertions, 13596 deletions
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/AAITasks/AAICreateOwningEntityTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/AAITasks/AAICreateOwningEntityTest.java
deleted file mode 100644
index 4f643e1119..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/AAITasks/AAICreateOwningEntityTest.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2018 Huawei 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.infrastructure.AAITasks;
-
-import org.camunda.bpm.engine.delegate.DelegateExecution;
-import org.camunda.bpm.engine.impl.pvm.runtime.ExecutionImpl;
-import org.junit.Test;
-
-public class AAICreateOwningEntityTest {
-
- DelegateExecution delegateExecution = new ExecutionImpl();
-
- @Test(expected = UnsupportedOperationException.class)
- public void executeTest() throws Exception {
- new AAICreateServiceInstance().execute(delegateExecution);
- }
-
-} \ No newline at end of file
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/BeansTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/BeansTest.java
deleted file mode 100644
index 723639c505..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/BeansTest.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*-
- * ============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.infrastructure;
-
-import org.junit.Test;
-
-import com.openpojo.validation.Validator;
-import com.openpojo.validation.ValidatorBuilder;
-import com.openpojo.validation.rule.impl.GetterMustExistRule;
-import com.openpojo.validation.rule.impl.SetterMustExistRule;
-import com.openpojo.validation.test.impl.GetterTester;
-import com.openpojo.validation.test.impl.SetterTester;
-import com.openpojo.reflection.PojoClass;
-import com.openpojo.reflection.PojoClassFilter;
-import com.openpojo.reflection.filters.FilterEnum;
-import com.openpojo.reflection.filters.FilterNonConcrete;
-import com.openpojo.reflection.filters.FilterPackageInfo;
-
-
-public class BeansTest {
-
-
- private PojoClassFilter filterTestClasses = new FilterTestClasses();
-
- private PojoClassFilter enumFilter = new FilterEnum();
-
-
- @Test
- public void pojoStructure() {
- test("org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.entity");
- }
-
- private void test(String pojoPackage) {
- Validator validator = ValidatorBuilder.create()
- .with(new GetterMustExistRule())
- .with(new SetterMustExistRule())
-
- .with(new SetterTester())
- .with(new GetterTester())
- .with(new SetterTester())
- .with(new GetterTester())
-
- .build();
-
-
- validator.validate(pojoPackage, new FilterPackageInfo(), filterTestClasses,enumFilter,new FilterNonConcrete());
- }
-
- private static class FilterTestClasses implements PojoClassFilter {
- public boolean include(PojoClass pojoClass) {
- return !pojoClass.getSourcePath().contains("/test-classes/");
- }
- }
-}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateGenericALaCarteServiceInstanceTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateGenericALaCarteServiceInstanceTest.java
deleted file mode 100644
index a1a9e35865..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateGenericALaCarteServiceInstanceTest.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*-
- * ============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.infrastructure;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.openecomp.mso.bpmn.common.BPMNUtil.executeWorkFlow;
-import static org.openecomp.mso.bpmn.common.BPMNUtil.waitForWorkflowToFinish;
-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.MockNodeQueryServiceInstanceByName;
-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;
-
-import java.io.IOException;
-import java.util.HashMap;
-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.BPMNUtil;
-import org.openecomp.mso.bpmn.common.WorkflowTest;
-import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse;
-import org.openecomp.mso.bpmn.mock.FileUtil;
-
-/**
- * Unit test cases for CreateGenericALaCarteServiceInstance.bpmn
- */
-public class CreateGenericALaCarteServiceInstanceTest extends WorkflowTest {
-
- private final CallbackSet callbacks = new CallbackSet();
-
- public CreateGenericALaCarteServiceInstanceTest() throws IOException {
- callbacks.put("assign", FileUtil.readResourceFile("__files/VfModularity/SDNCSITopologyAssignCallback.xml"));
- }
-
- /**
- * Sunny day VID scenario.
- *
- * @throws Exception
- */
- //@Ignore // File not found - unable to run the test. Also, Stubs need updating..
- @Test
- @Ignore // 1802 merge
- @Deployment(resources = {
- "process/CreateGenericALaCarteServiceInstance.bpmn",
- "subprocess/BuildingBlock/DecomposeService.bpmn",
- "subprocess/DoCreateServiceInstance.bpmn",
- "subprocess/DoCreateServiceInstanceRollback.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/GenericPutService.bpmn",
- "subprocess/GenericGetService.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/FalloutHandler.bpmn" })
- public void sunnyDayAlaCarte() throws Exception {
-
- logStart();
-
- //AAI
- MockGetCustomer("MCBH-1610", "CreateServiceInstance/createServiceInstance_queryGlobalCustomerId_AAIResponse_Success.xml");
- MockPutServiceInstance("MCBH-1610", "viprsvc", "RaaTest-1-id", "");
- MockGetServiceInstance("MCBH-1610", "viprsvc", "RaaTest-1-id", "GenericFlows/getServiceInstance.xml");
- MockNodeQueryServiceInstanceByName("RAATest-1", null);
- MockNodeQueryServiceInstanceById("RaaTest-1-id", null);
- //SDNC
- mockSDNCAdapter(200);
- //DB
- MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef","2","/VIPR/getCatalogServiceResourcesData.json");
- mockUpdateRequestDB(200, "DBUpdateResponse.xml");
- MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef","InfrastructureFlows/DoCreateServiceInstance_request.json");
-
-
- String businessKey = UUID.randomUUID().toString();
-
- //String createVfModuleRequest = FileUtil.readResourceFile("__files/SIRequest.json");
-
- Map<String, String> variables = setupVariables();
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "CreateGenericALaCarteServiceInstance", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId());
-
- String workflowResp = BPMNUtil.getVariable(processEngineRule, "CreateGenericALaCarteServiceInstance", "WorkflowResponse");
- //assertNotNull(workflowResp);
- System.out.println("Workflow (Synch) Response:\n" + workflowResp);
- String workflowException = BPMNUtil.getVariable(processEngineRule, "CreateGenericALaCarteServiceInstance", "WorkflowException");
- String completionReq = BPMNUtil.getVariable(processEngineRule, "CreateGenericALaCarteServiceInstance", "completionRequest");
- System.out.println("completionReq:\n" + completionReq);
- System.out.println("workflowException:\n" + workflowException);
- assertNotNull(completionReq);
- assertEquals(null, workflowException);
-
-
- //injectSDNCCallbacks(callbacks, "assign");
-
- logEnd();
- }
-
- // Success Scenario
- private Map<String, String> setupVariables() {
- Map<String, String> variables = new HashMap<>();
- variables.put("isDebugLogEnabled", "true");
- variables.put("bpmnRequest", getRequest());
- variables.put("mso-request-id", "RaaCSIRequestId-1");
- variables.put("serviceInstanceId","RaaTest-1-id");
- variables.put("sdncVersion", "1802");
- variables.put("serviceInstanceName", "some-junk-name");
- return variables;
- }
-
- public String getRequest() {
- String request = "{\"requestDetails\":{\"project\": {\"projectName\": \"projectName\"},\"owningEntity\": {\"owningEntityId\": \"randomStrings\",\"owningEntityName\": \"randomStrings\"},\"modelInfo\":{\"modelType\":\"service\",\"modelInvariantUuid\":\"uuid-miu-svc-011-abcdef\",\"modelVersionUuid\":\"ASDC_TOSCA_UUID\",\"modelName\":\"SIModelName1\",\"modelVersion\":\"2\"},\"subscriberInfo\":{\"globalSubscriberId\":\"MCBH-1610\",\"subscriberName\":\"Kaneohe\"},\"requestInfo\":{\"instanceName\":\"RAATest-1\",\"source\":\"VID\",\"suppressRollback\":\"true\",\"productFamilyId\":\"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\"},\"cloudConfiguration\":{\"lcpCloudRegionId\":\"mdt1\",\"tenantId\":\"8b1df54faa3b49078e3416e21370a3ba\"},\"requestParameters\":{\"subscriptionServiceType\":\"viprsvc\",\"aLaCarte\":\"false\",\"userParams\":[]}}}";
- return request;
- }
-
-}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateNetworkInstanceTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateNetworkInstanceTest.java
deleted file mode 100644
index f993d066e4..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateNetworkInstanceTest.java
+++ /dev/null
@@ -1,665 +0,0 @@
-/*-
- * ============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.infrastructure;
-
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.*;
-import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.MockUpdateRequestDB;
-import static org.openecomp.mso.bpmn.mock.StubResponseNetworkAdapter.MockNetworkAdapterPost;
-import static org.openecomp.mso.bpmn.mock.StubResponseNetworkAdapter.MockNetworkAdapterRestRollbackDelete;
-// new mock methods
-import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapterTopology;
-import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter_500;
-import org.openecomp.mso.bpmn.mock.SDNCAdapterNetworkTopologyMockTransformer;
-
-import static org.openecomp.mso.bpmn.common.BPMNUtil.executeAsyncWorkflow;
-import static org.openecomp.mso.bpmn.common.BPMNUtil.getVariable;
-import static org.junit.Assert.assertEquals;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.camunda.bpm.engine.test.Deployment;
-import org.junit.Assert;
-import org.junit.Rule;
-import org.junit.Test;
-
-import org.openecomp.mso.bpmn.common.BPMNUtil;
-import org.openecomp.mso.bpmn.common.WorkflowTest;
-import org.openecomp.mso.bpmn.common.WorkflowTestTransformer;
-import org.openecomp.mso.bpmn.common.SDNCAdapterCallbackRule;
-import com.github.tomakehurst.wiremock.extension.ResponseTransformer;
-
-/**
- * Unit test cases for CreateNetworkInstance.bpmn
- *
- */
-public class CreateNetworkInstanceTest extends WorkflowTest {
- @WorkflowTestTransformer
- public static final ResponseTransformer sdncAdapterMockTransformer =
- new SDNCAdapterNetworkTopologyMockTransformer();
-
- @Rule
- public final SDNCAdapterCallbackRule sdncAdapterCallbackRule =
- new SDNCAdapterCallbackRule(processEngineRule);
-
- /**
- * End-to-End flow - Unit test for CreateNetworkInstance.bpmn
- * - String input & String response
- */
-
-
- @Test
- //@Ignore
- @Deployment(resources = {"process/CreateNetworkInstance.bpmn",
- "subprocess/DoCreateNetworkInstance.bpmn",
- "subprocess/DoCreateNetworkInstanceRollback.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/GenericGetService.bpmn",
- "subprocess/SDNCAdapterV1.bpmn"})
-
- public void shouldInvokeServiceCreateNetworkInstance_vIPER_Success1() throws Exception {
-
- System.out.println("-----------------------------------------------------------------");
- System.out.println(" Success vIPER 1 - CreateNetworkInstance flow Started! ");
- System.out.println("-----------------------------------------------------------------");
-
- // setup simulators
- mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologyRsrcAssignResponse.xml", "SvcAction>assign");
- mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml", "SvcAction>activate");
- MockNetworkAdapterPost("CreateNetworkV2/createNetworkResponse_Success.xml", "createNetworkRequest");
- MockGetNetworkByName("MNS-25180-L-01-dmz_direct_net_1", "CreateNetworkV2/createNetwork_queryName_AAIResponse_Success.xml");
- MockGetNetworkCloudRegion("CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml", "RDM2WAGPLCP");
- MockGetNetworkByIdWithDepth("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_Success.xml", "all");
- MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017");
- MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6");
- MockGetNetworkPolicy("CreateNetworkV2/createNetwork_queryNetworkPolicy_AAIResponse_Success.xml", "cee6d136-e378-4678-a024-2cd15f0ee0cg");
- MockGetNetworkTableReference("CreateNetworkV2/createNetwork_queryNetworkTableRef1_AAIResponse_Success.xml", "refFQDN1");
- MockGetNetworkTableReference("CreateNetworkV2/createNetwork_queryNetworkTableRef2_AAIResponse_Success.xml", "refFQDN2");
- MockPutNetworkIdWithDepth("CreateNetworkV2/createNetwork_updateContrail_AAIResponse_Success.xml", "49c86598-f766-46f8-84f8-8d1c1b10f9b4", "all");
- MockUpdateRequestDB("DBUpdateResponse.xml");
- //MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml", "v8");
- MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml");
-
- Map<String, String> variables = setupVariables1();
- //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables);
- executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables);
- System.out.println("----------------------------------------------------------");
- System.out.println("- got workflow response -");
- System.out.println("----------------------------------------------------------");
- //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId());
-
- assertEquals("true", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_Success"));
- assertEquals("true", getVariable(processEngineRule, "DoCreateNetworkInstance", "CRENWKI_Success"));
- Assert.assertNotNull("CRENI_CompleteMsoProcessRequest - ", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_CompleteMsoProcessRequest"));
-
- String workflowResp = BPMNUtil.getVariable(processEngineRule, "CreateNetworkInstance", "WorkflowResponse");
- Assert.assertNotNull(workflowResp);
-
- System.out.println("----------------------------------------------------------");
- System.out.println(" Success vIPER 1 - CreateNetworkInstance flow Completed ");
- System.out.println("----------------------------------------------------------");
-
- }
-
- @Test
- //@Ignore
- @Deployment(resources = {"process/CreateNetworkInstance.bpmn",
- "subprocess/DoCreateNetworkInstance.bpmn",
- "subprocess/DoCreateNetworkInstanceRollback.bpmn",
- "subprocess/GenericGetService.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/SDNCAdapterV1.bpmn"})
-
- public void shouldInvokeServiceCreateNetworkInstance_vIPER_Success2() throws Exception {
-
- System.out.println("----------------------------------------------------------------");
- System.out.println(" Success viPER 2 - CreateNetworkInstance flow Started! ");
- System.out.println("----------------------------------------------------------------");
-
- // setup simulators
- mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologyRsrcAssignResponse.xml", "SvcAction>assign");
- mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml", "SvcAction>activate");
- MockNetworkAdapterPost("CreateNetworkV2/createNetworkResponse_Success.xml", "createNetworkRequest");
- MockGetNetworkByName_404("CreateNetworkV2/createNetwork_queryName_AAIResponse_Success.xml", "myOwn_Network");
- MockGetNetworkCloudRegion("CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml", "RDM2WAGPLCP");
- MockGetNetworkByIdWithDepth("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_Success.xml", "all");
- MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017");
- MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6");
- MockGetNetworkPolicy("CreateNetworkV2/createNetwork_queryNetworkPolicy_AAIResponse_Success.xml", "cee6d136-e378-4678-a024-2cd15f0ee0cg");
- MockGetNetworkTableReference("CreateNetworkV2/createNetwork_queryNetworkTableRef1_AAIResponse_Success.xml", "refFQDN1");
- MockGetNetworkTableReference("CreateNetworkV2/createNetwork_queryNetworkTableRef2_AAIResponse_Success.xml", "refFQDN2");
- MockPutNetworkIdWithDepth("CreateNetworkV2/createNetwork_updateContrail_AAIResponse_Success.xml", "49c86598-f766-46f8-84f8-8d1c1b10f9b4", "all");
- MockUpdateRequestDB("DBUpdateResponse.xml");
- //MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml", "v8");
- MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml");
-
- Map<String, String> variables = setupVariables2();
- //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables);
- executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables);
- //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId());
-
- assertEquals("true", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_Success"));
- assertEquals("true", getVariable(processEngineRule, "DoCreateNetworkInstance", "CRENWKI_Success"));
- Assert.assertNotNull("CRENI_CompleteMsoProcessRequest - ", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_CompleteMsoProcessRequest"));
-
- String completeMsoProcessRequest =
- "<aetgt:MsoCompletionRequest xmlns:aetgt=\"http://org.openecomp/mso/workflow/schema/v1\"" + '\n'
- + " xmlns:ns=\"http://org.openecomp/mso/request/types/v1\"" + '\n'
- + " xmlns=\"http://org.openecomp/mso/infra/vnf-request/v1\">" + '\n'
- + " <request-info>" + '\n'
- + " <request-id>testRequestId</request-id>" + '\n'
- + " <action>CREATE</action>" + '\n'
- + " <source>VID</source>" + '\n'
- + " </request-info>" + '\n'
- + " <aetgt:status-message>Network has been created successfully.</aetgt:status-message>" + '\n'
- + " <aetgt:mso-bpel-name>BPMN Network action: CREATE</aetgt:mso-bpel-name>" + '\n'
- + "</aetgt:MsoCompletionRequest>";
-
- Assert.assertEquals(completeMsoProcessRequest, getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_CompleteMsoProcessRequest"));
-
- System.out.println("---------------------------------------------------------");
- System.out.println(" Success viPER 2 - CreateNetworkInstance flow Completed ");
- System.out.println("---------------------------------------------------------");
-
- }
-
- @Test
- //@Ignore
- @Deployment(resources = {"process/CreateNetworkInstance.bpmn",
- "subprocess/DoCreateNetworkInstance.bpmn",
- "subprocess/DoCreateNetworkInstanceRollback.bpmn",
- "subprocess/GenericGetService.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/SDNCAdapterV1.bpmn"})
-
- public void shouldInvokeServiceCreateNetworkInstance_VID_1610_Network_SDNC_Rollback() throws Exception {
-
- System.out.println("--------------------------------------------------------------------------");
- System.out.println(" Network and SDNC Rollback - CreateNetworkInstance flow Started! ");
- System.out.println("--------------------------------------------------------------------------");
-
- // setup simulators
- mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml", "SvcAction>assign");
- mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml", "SvcAction>rollback");
- MockNetworkAdapterPost("CreateNetworkV2/createNetworkResponse_Success.xml", "createNetworkRequest");
- MockGetNetworkByName("MNS-25180-L-01-dmz_direct_net_1", "CreateNetworkV2/createNetwork_queryName_AAIResponse_Success.xml");
- MockGetNetworkCloudRegion("CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml", "RDM2WAGPLCP");
- MockGetNetworkByIdWithDepth("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_Success.xml", "1");
- MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017");
- MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6");
- MockGetNetworkPolicy("CreateNetworkV2/createNetwork_queryNetworkPolicy_AAIResponse_Success.xml", "cee6d136-e378-4678-a024-2cd15f0ee0cg");
- MockGetNetworkTableReference("CreateNetworkV2/createNetwork_queryNetworkTableRef1_AAIResponse_Success.xml", "refFQDN1");
- MockGetNetworkTableReference("CreateNetworkV2/createNetwork_queryNetworkTableRef2_AAIResponse_Success.xml", "refFQDN2");
- MockUpdateRequestDB("DBUpdateResponse.xml");
- //MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml", "v8");
- MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml");
- MockNetworkAdapterRestRollbackDelete("deleteNetworkResponse_Success.xml","49c86598-f766-46f8-84f8-8d1c1b10f9b4");
-
- Map<String, String> variables = setupVariablesVID1();
- executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables);
- //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables);
- //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId());
-
- assertEquals("false", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_Success"));
- assertEquals("false", getVariable(processEngineRule, "DoCreateNetworkInstance", "CRENWKI_Success"));
- Assert.assertNotNull("CRENI_FalloutHandlerRequest - ", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_FalloutHandlerRequest"));
-
- System.out.println("--------------------------------------------------------------------");
- System.out.println(" Network and SCNC Rollback - CreateNetworkInstance flow Completed ");
- System.out.println("--------------------------------------------------------------------");
-
- }
-
- @Test
- //@Ignore
- @Deployment(resources = {"process/CreateNetworkInstance.bpmn",
- "subprocess/DoCreateNetworkInstance.bpmn",
- "subprocess/DoCreateNetworkInstanceRollback.bpmn",
- "subprocess/GenericGetService.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/SDNCAdapterV1.bpmn"})
-
- public void shouldInvokeServiceCreateNetworkInstance_vIPER_1702_Network_SDNC_Rollback() throws Exception {
-
- System.out.println("--------------------------------------------------------------------------");
- System.out.println(" Network and SDNC Rollback - CreateNetworkInstance flow Started! ");
- System.out.println("--------------------------------------------------------------------------");
-
- // setup simulators
- mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologyRsrcAssignResponse.xml", "SvcAction>assign");
- mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml", "SvcAction>unassign");
- mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml", "SvcAction>activate");
- mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml", "SvcAction>deactivate");
- MockNetworkAdapterPost("CreateNetworkV2/createNetworkResponse_Success.xml", "createNetworkRequest");
- MockGetNetworkByName("MNS-25180-L-01-dmz_direct_net_1", "CreateNetworkV2/createNetwork_queryName_AAIResponse_Success.xml");
- MockGetNetworkCloudRegion("CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml", "RDM2WAGPLCP");
- MockGetNetworkByIdWithDepth("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_Success.xml", "1");
- MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017");
- MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6");
- MockGetNetworkPolicy("CreateNetworkV2/createNetwork_queryNetworkPolicy_AAIResponse_Success.xml", "cee6d136-e378-4678-a024-2cd15f0ee0cg");
- MockGetNetworkTableReference("CreateNetworkV2/createNetwork_queryNetworkTableRef1_AAIResponse_Success.xml", "refFQDN1");
- MockGetNetworkTableReference("CreateNetworkV2/createNetwork_queryNetworkTableRef2_AAIResponse_Success.xml", "refFQDN2");
- MockUpdateRequestDB("DBUpdateResponse.xml");
- //MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml", "v8");
- MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml");
- MockNetworkAdapterRestRollbackDelete("deleteNetworkResponse_Success.xml","49c86598-f766-46f8-84f8-8d1c1b10f9b4");
-
- Map<String, String> variables = setupVariables1();
- executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables);
- //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables);
- //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId());
-
- assertEquals("false", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_Success"));
- assertEquals("false", getVariable(processEngineRule, "DoCreateNetworkInstance", "CRENWKI_Success"));
- Assert.assertNotNull("CRENI_FalloutHandlerRequest - ", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_FalloutHandlerRequest"));
-
- System.out.println("--------------------------------------------------------------------");
- System.out.println(" Network and SCNC Rollback - CreateNetworkInstance flow Completed ");
- System.out.println("--------------------------------------------------------------------");
-
- }
-
- @Test
- //@Ignore
- @Deployment(resources = {"process/CreateNetworkInstance.bpmn",
- "subprocess/DoCreateNetworkInstance.bpmn",
- "subprocess/DoCreateNetworkInstanceRollback.bpmn",
- "subprocess/GenericGetService.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/SDNCAdapterV1.bpmn"})
-
- public void shouldInvokeServiceCreateNetworkInstance_sdncFailure() throws Exception {
-
- System.out.println("----------------------------------------------------------------");
- System.out.println(" SNDC Failure - CreateNetworkInstance flow Started! ");
- System.out.println("----------------------------------------------------------------");
-
- // setup simulators
- mockSDNCAdapter_500("SvcAction>query");
- MockGetNetworkByName_404("CreateNetworkV2/createNetwork_queryName_AAIResponse_Success.xml", "myOwn_Network");
- MockGetNetworkCloudRegion("CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml", "RDM2WAGPLCP");
- MockUpdateRequestDB("DBUpdateResponse.xml");
- //MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml", "v8");
- MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml");
-
- Map<String, String> variables = setupVariables2();
- //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables);
- executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables);
- //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId());
-
- assertEquals("false", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_Success"));
- assertEquals("false", getVariable(processEngineRule, "DoCreateNetworkInstance", "CRENWKI_Success"));
- Assert.assertNotNull("CRENI_FalloutHandlerRequest - ", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_FalloutHandlerRequest"));
-
- System.out.println("---------------------------------------------------------");
- System.out.println(" SNDC Failure - CreateNetworkInstance flow Completed ");
- System.out.println("---------------------------------------------------------");
-
- }
-
- @Test
- //@Ignore
- @Deployment(resources = {"process/CreateNetworkInstance.bpmn",
- "subprocess/DoCreateNetworkInstance.bpmn",
- "subprocess/DoCreateNetworkInstanceRollback.bpmn",
- "subprocess/GenericGetService.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/SDNCAdapterV1.bpmn"})
-
- public void shouldInvokeServiceCreateNetworkInstance_queryServiceInstance404() throws Exception {
-
- System.out.println("----------------------------------------------------------------------------------");
- System.out.println(" Query ServiceIntance Not found - CreateNetworkInstance flow Started! ");
- System.out.println("----------------------------------------------------------------------------------");
-
- //setup simulators
- mockSDNCAdapter_500("SvcAction>query");
- MockGetNetworkByName_404("CreateNetworkV2/createNetwork_queryName_AAIResponse_Success.xml", "myOwn_Network");
- MockUpdateRequestDB("DBUpdateResponse.xml");
- MockNodeQueryServiceInstanceById_404("f70e927b-6087-4974-9ef8-c5e4d5847ca4");
-
- Map<String, String> variables = setupVariables2();
- //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables);
- executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables);
- //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId());
-
- assertEquals("false", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_Success"));
- assertEquals("false", getVariable(processEngineRule, "DoCreateNetworkInstance", "CRENWKI_Success"));
- Assert.assertNotNull("CRENI_FalloutHandlerRequest - ", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_FalloutHandlerRequest"));
-
- System.out.println("---------------------------------------------------------------------------------");
- System.out.println(" Query ServiceIntance Not found - CreateNetworkInstance flow Completed ");
- System.out.println("---------------------------------------------------------------------------------");
-
- }
-
- @Test
- //@Ignore
- @Deployment(resources = {"process/CreateNetworkInstance.bpmn",
- "subprocess/DoCreateNetworkInstance.bpmn",
- "subprocess/DoCreateNetworkInstanceRollback.bpmn",
- "subprocess/GenericGetService.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/SDNCAdapterV1.bpmn"})
-
- public void shouldInvokeServiceCreateNetworkInstance_VID_Success1() throws Exception {
-
- System.out.println("----------------------------------------------------------");
- System.out.println(" Success VID1 - CreateNetworkInstance flow Started! ");
- System.out.println("----------------------------------------------------------");
-
- // setup simulators
- mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml", "SvcAction>assign");
- MockNetworkAdapterPost("CreateNetworkV2/createNetworkResponse_Success.xml", "createNetworkRequest");
- MockGetNetworkByName("MNS-25180-L-01-dmz_direct_net_1", "CreateNetworkV2/createNetwork_queryName_AAIResponse_Success.xml");
- MockGetNetworkCloudRegion("CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml", "RDM2WAGPLCP");
- MockGetNetworkByIdWithDepth("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_Success.xml", "all");
- MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017");
- MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6");
- MockGetNetworkPolicy("CreateNetworkV2/createNetwork_queryNetworkPolicy_AAIResponse_Success.xml", "cee6d136-e378-4678-a024-2cd15f0ee0cg");
- MockGetNetworkTableReference("CreateNetworkV2/createNetwork_queryNetworkTableRef1_AAIResponse_Success.xml", "refFQDN1");
- MockGetNetworkTableReference("CreateNetworkV2/createNetwork_queryNetworkTableRef2_AAIResponse_Success.xml", "refFQDN2");
- MockPutNetworkIdWithDepth("CreateNetworkV2/createNetwork_updateContrail_AAIResponse_Success.xml", "49c86598-f766-46f8-84f8-8d1c1b10f9b4", "all");
- MockUpdateRequestDB("DBUpdateResponse.xml");
- //MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml", "v8");
- MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml");
-
- Map<String, String> variables = setupVariablesVID1();
- //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables);
- executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables);
- System.out.println("----------------------------------------------------------");
- System.out.println("- got workflow response -");
- System.out.println("----------------------------------------------------------");
- //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId());
-
- assertEquals("true", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_Success"));
- Assert.assertNotNull("CRENI_CompleteMsoProcessRequest - ", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_CompleteMsoProcessRequest"));
-
- String workflowResp = BPMNUtil.getVariable(processEngineRule, "CreateNetworkInstance", "WorkflowResponse");
- Assert.assertNotNull(workflowResp);
-
- System.out.println("-----------------------------------------------------------");
- System.out.println(" Success VID1 - CreateNetworkInstanceInfra flow Completed ");
- System.out.println("-----------------------------------------------------------");
-
- }
-
- // *****************
- // Utility Section
- // *****************
-
- String networkModelInfo =
- " {\"modelUuid\": \"mod-inst-uuid-123\", " + '\n' +
- " \"modelName\": \"mod_inst_z_123\", " + '\n' +
- " \"modelVersion\": \"mod-inst-uuid-123\", " + '\n' +
- " \"modelCustomizationUuid\": \"z_network_123\", " + '\n' +
- " \"modelInvariantUuid\": \"mod-invar-uuid-123\" " + '\n' +
- " }";
-
- String serviceModelInfo =
- " {\"modelUuid\": \"36a3a8ea-49a6-4ac8-b06c-89a54544b9b6\", " + '\n' +
- " \"modelName\": \"HNGW Protected OAM\", " + '\n' +
- " \"modelVersion\": \"1.0\", " + '\n' +
- " \"modelInvariantUuid\": \"fcc85cb0-ad74-45d7-a5a1-17c8744fdb71\" " + '\n' +
- " }";
-
- // Success Scenario
- private Map<String, String> setupVariables1() {
- Map<String, String> variables = new HashMap<>();
- variables.put("testMessageId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56");
- variables.put("msoRequestId", "testRequestId");
- variables.put("requestId", "testRequestId");
- variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
- variables.put("networkId", "networkId");
- variables.put("networkName", "MNS-25180-L-01-dmz_direct_net_1");
- variables.put("lcpCloudRegionId", "RDM2WAGPLCP");
- variables.put("tenantId", "7dd5365547234ee8937416c65507d266");
- variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
- variables.put("disableRollback", "false"); // macro
- variables.put("failIfExists", "false");
- variables.put("sdncVersion", "1702");
- variables.put("subscriptionServiceType", "MSO-dev-service-type");
- variables.put("globalSubscriberId", "globalId_45678905678");
- variables.put("networkModelInfo", networkModelInfo);
- variables.put("serviceModelInfo", serviceModelInfo);
-
-
- return variables;
-
- }
-
- // Success Scenario 2
- private Map<String, String> setupVariables2() {
- Map<String, String> variables = new HashMap<>();
- variables.put("testMessageId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56");
- variables.put("msoRequestId", "testRequestId");
- variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
- variables.put("networkId", "networkId");
- variables.put("networkName", "myOwn_Network"); // Name Not found in AA&I
- variables.put("lcpCloudRegionId", "RDM2WAGPLCP");
- variables.put("tenantId", "7dd5365547234ee8937416c65507d266");
- variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
- variables.put("disableRollback", "false"); // 1702
- variables.put("failIfExists", "false");
- //variables.put("sdncVersion", "1702");
- variables.put("sdncVersion", "1707");
- variables.put("subscriptionServiceType", "MSO-dev-service-type");
- variables.put("globalSubscriberId", "globalId_45678905678");
- variables.put("networkModelInfo", networkModelInfo);
- variables.put("serviceModelInfo", serviceModelInfo);
-
- return variables;
-
- }
-
- // Active Scenario
- private Map<String, String> setupVariablesActive() {
- Map<String, String> variables = new HashMap<>();
- variables.put("testMessageId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56");
- variables.put("msoRequestId", "testRequestId");
- variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
- variables.put("networkId", "networkId");
- variables.put("networkName", "MNS-25180-L-01-dmz_direct_net_2"); // Unique name for Active
- variables.put("lcpCloudRegionId", "RDM2WAGPLCP");
- variables.put("tenantId", "7dd5365547234ee8937416c65507d266");
- variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
- variables.put("suppressRollback", "false");
- variables.put("disableRollback", "false");
- variables.put("failIfExists", "false");
- variables.put("sdncVersion", "1702");
- variables.put("subscriptionServiceType", "MSO-dev-service-type");
- variables.put("globalSubscriberId", "globalId_45678905678");
- variables.put("networkModelInfo", networkModelInfo);
- variables.put("serviceModelInfo", serviceModelInfo);
-
- return variables;
-
- }
-
- // Missing Name Scenario
- private Map<String, String> setupVariablesMissingName() {
- Map<String, String> variables = new HashMap<>();
- //variables.put("bpmnRequest", getCreateNetworkRequestMissingName());
- variables.put("testMessageId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56");
- variables.put("msoRequestId", "testRequestId");
- variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
- variables.put("networkId", "networkId");
- // variables.put("networkName", "MNS-25180-L-01-dmz_direct_net_2"); // Missing 'name' variable
- // variables.put("networkName", ""); // Missing 'value' of name variable
- variables.put("modelName", "CONTRAIL_EXTERNAL");
- variables.put("cloudConfiguration", "RDM2WAGPLCP");
- variables.put("tenantId", "7dd5365547234ee8937416c65507d266");
- variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
- variables.put("suppressRollback", "true");
- variables.put("failIfExists", "false");
-
- return variables;
-
- }
-
- // SDNC Rollback Scenario
- private Map<String, String> setupVariablesSDNCRollback() {
- Map<String, String> variables = new HashMap<>();
- variables.put("testMessageId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56");
- variables.put("msoRequestId", "testRequestId");
- variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
- variables.put("networkId", "networkId");
- variables.put("networkName", "MNS-25180-L-01-dmz_direct_net_3"); // Unique name for Rollback
- variables.put("modelName", "CONTRAIL_EXTERNAL");
- variables.put("cloudConfiguration", "RDM2WAGPLCP");
- variables.put("tenantId", "7dd5365547234ee8937416c65507d266");
- variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
- variables.put("suppressRollback", "true");
- variables.put("disableRollback", "false");
-
- return variables;
-
- }
-
- // old
- public String getCreateNetworkRequestActive() {
-
- String request =
- "{ \"requestDetails\": { " + '\n' +
- " \"modelInfo\": { " + '\n' +
- " \"modelType\": \"modelType\", " + '\n' +
- " \"modelId\": \"modelId\", " + '\n' +
- " \"modelCustomizationUuid\": \"modelCustUuid\", " + '\n' +
- " \"modelName\": \"CONTRAIL_EXTERNAL\", " + '\n' +
- " \"modelVersion\": \"1\" " + '\n' +
- " }, " + '\n' +
- " \"cloudConfiguration\": { " + '\n' +
- " \"lcpCloudRegionId\": \"RDM2WAGPLCP\", " + '\n' +
- " \"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\" " + '\n' +
- " }, " + '\n' +
- " \"requestInfo\": { " + '\n' +
- " \"instanceName\": \"MNS-25180-L-01-dmz_direct_net_2\", " + '\n' +
- " \"source\": \"VID\", " + '\n' +
- " \"callbackUrl\": \"\", " + '\n' +
- " \"suppressRollback\": \"false\" ," + '\n' +
- " \"productFamilyId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\" " + '\n' +
- " }, " + '\n' +
- " \"requestParameters\": { " + '\n' +
- " \"userParams\": [] " + '\n' +
- " } " + '\n' +
- " } " + '\n' +
- "}";
-
- return request;
-
- }
-
- public String getCreateNetworkRequestSDNCRollback() {
-
- String request =
- "{ \"requestDetails\": { " + '\n' +
- " \"modelInfo\": { " + '\n' +
- " \"modelType\": \"modelType\", " + '\n' +
- " \"modelId\": \"modelId\", " + '\n' +
- " \"modelNameVersionId\": \"modelNameVersionId\", " + '\n' +
- " \"modelName\": \"CONTRAIL_EXTERNAL\", " + '\n' +
- " \"modelVersion\": \"1\" " + '\n' +
- " }, " + '\n' +
- " \"cloudConfiguration\": { " + '\n' +
- " \"lcpCloudRegionId\": \"RDM2WAGPLCP\", " + '\n' +
- " \"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\" " + '\n' +
- " }, " + '\n' +
- " \"requestInfo\": { " + '\n' +
- " \"instanceName\": \"MNS-25180-L-01-dmz_direct_net_3\", " + '\n' +
- " \"source\": \"VID\", " + '\n' +
- " \"callbackUrl\": \"\", " + '\n' +
- " \"suppressRollback\": \"true\" ," + '\n' +
- " \"productFamilyId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\" " + '\n' +
- " }, " + '\n' +
- " \"requestParameters\": { " + '\n' +
- " \"userParams\": [] " + '\n' +
- " } " + '\n' +
- " } " + '\n' +
- "}";
-
-
- return request;
- }
-
-
- // VID json input
- private Map<String, String> setupVariablesVID1() {
- Map<String, String> variables = new HashMap<>();
- variables.put("bpmnRequest", getCreateNetworkRequestVID1());
- variables.put("mso-request-id", "testRequestId");
- //variables.put("msoRequestId", "testRequestId");
- variables.put("requestId", "testRequestId");
- variables.put("isBaseVfModule", "true");
- variables.put("recipeTimeout", "0");
- variables.put("requestAction", "CREATE");
- variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
- variables.put("vnfId", "");
- variables.put("vfModuleId", "");
- variables.put("volumeGroupId", "");
- //variables.put("networkId", "networkId");
- variables.put("serviceType", "vMOG");
- variables.put("vfModuleType", "");
- variables.put("networkType", "modelName");
-
- return variables;
-
- }
-
- public String getCreateNetworkRequestVID1() {
-
- String request =
- "{ \"requestDetails\": { " + '\n' +
- " \"modelInfo\": { " + '\n' +
- " \"modelType\": \"modelType\", " + '\n' +
- " \"modelCustomizationId\": \"f21df226-8093-48c3-be7e-0408fcda0422\", " + '\n' +
- " \"modelName\": \"CONTRAIL_EXTERNAL\", " + '\n' +
- " \"modelVersion\": \"1.0\" " + '\n' +
- " }, " + '\n' +
- " \"cloudConfiguration\": { " + '\n' +
- " \"lcpCloudRegionId\": \"RDM2WAGPLCP\", " + '\n' +
- " \"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\" " + '\n' +
- " }, " + '\n' +
- " \"requestInfo\": { " + '\n' +
- " \"instanceName\": \"MNS-25180-L-01-dmz_direct_net_1\", " + '\n' +
- " \"source\": \"VID\", " + '\n' +
- " \"callbackUrl\": \"\", " + '\n' +
- " \"suppressRollback\": \"false\" ," + '\n' +
- " \"productFamilyId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\" " + '\n' +
- " }, " + '\n' +
- " \"requestParameters\": { " + '\n' +
- " \"backoutOnFailure\": false, " + '\n' +
- " \"serviceId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\", " + '\n' +
- " \"userParams\": [] " + '\n' +
- " } " + '\n' +
- " } " + '\n' +
- "}";
-
- return request;
- }
-
-}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVfModuleInfraTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVfModuleInfraTest.java
deleted file mode 100644
index 1e865dfd14..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVfModuleInfraTest.java
+++ /dev/null
@@ -1,367 +0,0 @@
-/*-
- * ============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.infrastructure;
-
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchGenericVnf;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfsByVnfId;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchVfModuleId;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockAAIVfModule;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockSDNCAdapterVfModule;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockVNFAdapterRestVfModule;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDBUpdateVfModule;
-import static org.openecomp.mso.bpmn.mock.StubResponseAPPC.MockAppcError;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.UUID;
-import org.junit.Ignore;
-import org.camunda.bpm.engine.test.Deployment;
-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.mock.FileUtil;
-
-/**
- * Unit test cases for CreateVfModuleInfra.bpmn
- */
-@Ignore
-public class CreateVfModuleInfraTest extends WorkflowTest {
-
- private final CallbackSet callbacks = new CallbackSet();
-
- public CreateVfModuleInfraTest() throws IOException {
- callbacks.put("assign", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyAssignCallback.xml"));
- callbacks.put("query", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyQueryCallbackVfModule.xml"));
- callbacks.put("activate", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
- callbacks.put("vnfCreate", FileUtil.readResourceFile(
- "__files/VfModularity/VNFAdapterRestCreateCallback.xml"));
- }
-
-
- /**
- * Sunny day VID scenario with preloads.
- *
- * @throws Exception
- */
- @Test
- @Deployment(resources = {
- "process/CreateVfModuleInfra.bpmn",
- "subprocess/BuildingBlock/AppCClient.bpmn",
- "subprocess/DoCreateVfModule.bpmn",
- "subprocess/GenericGetVnf.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/GenericNotificationService.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn",
- "subprocess/ConfirmVolumeGroupTenant.bpmn",
- "subprocess/ConfirmVolumeGroupName.bpmn",
- "subprocess/CreateAAIVfModule.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/BuildingBlock/AppCClient.bpmn"
- })
- public void sunnyDayVIDWithPreloads() throws Exception {
-
- logStart();
-
- MockAAIVfModule();
- MockGetGenericVnfsByVnfId("skask","__files/AAI/AAI_genericVnfGet.json",200);
- MockPatchGenericVnf("skask");
- MockPatchVfModuleId("skask", ".*");
- MockSDNCAdapterVfModule();
- MockVNFAdapterRestVfModule();
- MockDBUpdateVfModule();
- MockAppcError();
-
- String businessKey = UUID.randomUUID().toString();
- String createVfModuleRequest =
- FileUtil.readResourceFile("__files/CreateVfModule_VID_request.json");
-
- Map<String, Object> variables = setupVariablesSunnyDayVID();
-
- TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleInfra",
- "v1", businessKey, createVfModuleRequest, variables);
-
- WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
-
- String responseBody = response.getContent();
- System.out.println("Workflow (Synch) Response:\n" + responseBody);
-
- injectSDNCCallbacks(callbacks, "assign, query");
- injectVNFRestCallbacks(callbacks, "vnfCreate");
- injectSDNCCallbacks(callbacks, "activate");
-
- // TODO add appropriate assertions
-
- waitForProcessEnd(businessKey, 10000);
- checkVariable(businessKey, "CreateVfModuleSuccessIndicator", true);
-
- logEnd();
- }
-
- /**
- * Sunny day VID scenario with no preloads.
- *
- * @throws Exception
- */
- @Test
- @Deployment(resources = {
- "process/CreateVfModuleInfra.bpmn",
- "subprocess/BuildingBlock/AppCClient.bpmn",
- "subprocess/DoCreateVfModule.bpmn",
- "subprocess/GenericGetVnf.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn",
- "subprocess/ConfirmVolumeGroupTenant.bpmn",
- "subprocess/GenericNotificationService.bpmn",
- "subprocess/ConfirmVolumeGroupName.bpmn",
- "subprocess/CreateAAIVfModule.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/BuildingBlock/AppCClient.bpmn"
- })
- public void sunnyDayVIDNoPreloads() throws Exception {
-
- logStart();
-
- MockAAIVfModule();
- MockGetGenericVnfsByVnfId("skask","__files/AAI/AAI_genericVnfGet.json",200);
- MockPatchGenericVnf("skask");
- MockPatchVfModuleId("skask", ".*");
- MockSDNCAdapterVfModule();
- MockVNFAdapterRestVfModule();
- MockDBUpdateVfModule();
- MockAppcError();
-
- String businessKey = UUID.randomUUID().toString();
- String createVfModuleRequest =
- FileUtil.readResourceFile("__files/CreateVfModule_VID_request_noPreloads.json");
-
- Map<String, Object> variables = setupVariablesSunnyDayVID();
-
- TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleInfra",
- "v1", businessKey, createVfModuleRequest, variables);
-
- WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
-
- String responseBody = response.getContent();
- System.out.println("Workflow (Synch) Response:\n" + responseBody);
-
- injectSDNCCallbacks(callbacks, "assign, query");
- injectVNFRestCallbacks(callbacks, "vnfCreate");
- injectSDNCCallbacks(callbacks, "activate");
-
- // TODO add appropriate assertions
-
- waitForProcessEnd(businessKey, 10000);
- checkVariable(businessKey, "CreateVfModuleSuccessIndicator", true);
-
- logEnd();
- }
-
- // Active Scenario
- private Map<String, Object> setupVariablesSunnyDayVID() {
- Map<String, Object> variables = new HashMap<>();
- //try {
- //variables.put("bpmnRequest", FileUtil.readResourceFile("__files/CreateVfModule_VID_request.json"));
- //}
- //catch (Exception e) {
-
- //}
- //variables.put("mso-request-id", "testRequestId");
- variables.put("requestId", "testRequestId");
- variables.put("isBaseVfModule", false);
- variables.put("isDebugLogEnabled", "true");
- variables.put("recipeTimeout", "0");
- variables.put("requestAction", "CREATE_VF_MODULE");
- variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
- variables.put("vnfId", "skask");
- variables.put("vnfType", "vSAMP12");
- variables.put("vfModuleId", "");
- variables.put("volumeGroupId", "");
- variables.put("serviceType", "MOG");
- variables.put("vfModuleType", "");
- return variables;
-
- }
-
- /**
- * Sunny day VID with volume attach scenario.
- *
- * @throws Exception
- */
- @Test
- @Ignore
- @Deployment(resources = {
- "process/CreateVfModuleInfra.bpmn",
- "subprocess/BuildingBlock/AppCClient.bpmn",
- "subprocess/DoCreateVfModule.bpmn",
- "subprocess/GenericGetVnf.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn",
- "subprocess/ConfirmVolumeGroupTenant.bpmn",
- "subprocess/ConfirmVolumeGroupName.bpmn",
- "subprocess/CreateAAIVfModule.bpmn",
- "subprocess/CreateAAIVfModuleVolumeGroup.bpmn",
- "subprocess/GenericNotificationService.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/BuildingBlock/AppCClient.bpmn"
- })
-
- public void sunnyDayVIDWithVolumeGroupAttach() throws Exception {
-
- logStart();
-
-
- MockAAIVfModule();
- MockGetGenericVnfsByVnfId("skask","__files/AAI/AAI_genericVnfGet.json",200);
- MockPatchGenericVnf("skask");
- MockPatchVfModuleId("skask", ".*");
- MockSDNCAdapterVfModule();
- MockVNFAdapterRestVfModule();
- MockDBUpdateVfModule();
- MockAppcError();
-
- String businessKey = UUID.randomUUID().toString();
- String createVfModuleRequest =
- FileUtil.readResourceFile("__files/CreateVfModuleVolumeGroup_VID_request.json");
-
- Map<String, Object> variables = setupVariablesSunnyDayVIDWVolumeAttach();
-
- TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleInfra",
- "v1", businessKey, createVfModuleRequest, variables);
-
- WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
-
- String responseBody = response.getContent();
- System.out.println("Workflow (Synch) Response:\n" + responseBody);
-
- injectSDNCCallbacks(callbacks, "assign, query");
- injectVNFRestCallbacks(callbacks, "vnfCreate");
- injectSDNCCallbacks(callbacks, "activate");
-
- // TODO add appropriate assertions
-
- waitForProcessEnd(businessKey, 10000);
- checkVariable(businessKey, "CreateVfModuleSuccessIndicator", true);
-
- logEnd();
- }
-
- // Active Scenario
- private Map<String, Object> setupVariablesSunnyDayVIDWVolumeAttach() {
- Map<String, Object> variables = new HashMap<>();
- //try {
- // variables.put("bpmnRequest", FileUtil.readResourceFile("__files/CreateVfModule_VID_request.json"));
- //}
- //catch (Exception e) {
-
- //}
- //variables.put("mso-request-id", "testRequestId");
- variables.put("requestId", "testRequestId");
- variables.put("isBaseVfModule", false);
- variables.put("isDebugLogEnabled", "true");
- variables.put("recipeTimeout", "0");
- variables.put("requestAction", "CREATE_VF_MODULE");
- variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
- variables.put("vnfId", "skask");
- variables.put("vnfType", "vSAMP12");
- variables.put("vfModuleId", "");
- variables.put("volumeGroupId", "78987");
- variables.put("serviceType", "MOG");
- variables.put("vfModuleType", "");
- return variables;
-
- }
- /**
- * Sunny day VID scenario with no preloads.
- *
- * @throws Exception
- */
- @Test
- @Deployment(resources = {
- "process/CreateVfModuleInfra.bpmn",
- "subprocess/BuildingBlock/AppCClient.bpmn",
- "subprocess/DoCreateVfModule.bpmn",
- "subprocess/GenericGetVnf.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn",
- "subprocess/ConfirmVolumeGroupTenant.bpmn",
- "subprocess/GenericNotificationService.bpmn",
- "subprocess/ConfirmVolumeGroupName.bpmn",
- "subprocess/CreateAAIVfModule.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/BuildingBlock/AppCClient.bpmn"
- })
- public void sunnyDayVIDMultipleUserParamValues() throws Exception {
-
- logStart();
-
- MockAAIVfModule();
- MockGetGenericVnfsByVnfId("skask","__files/AAI/AAI_genericVnfGet.json",200);
- MockPatchGenericVnf("skask");
- MockPatchVfModuleId("skask", ".*");
- MockSDNCAdapterVfModule();
- MockVNFAdapterRestVfModule();
- MockDBUpdateVfModule();
- MockAppcError();
-
- String businessKey = UUID.randomUUID().toString();
- String createVfModuleRequest =
- FileUtil.readResourceFile("__files/CreateVfModule_VID_request_userParam.json");
-
- Map<String, Object> variables = setupVariablesSunnyDayVID();
-
- TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleInfra",
- "v1", businessKey, createVfModuleRequest, variables);
-
- WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
-
- String responseBody = response.getContent();
- System.out.println("Workflow (Synch) Response:\n" + responseBody);
-
- injectSDNCCallbacks(callbacks, "assign, query");
- injectVNFRestCallbacks(callbacks, "vnfCreate");
- injectSDNCCallbacks(callbacks, "activate");
-
- // TODO add appropriate assertions
-
- waitForProcessEnd(businessKey, 10000);
- checkVariable(businessKey, "CreateVfModuleSuccessIndicator", true);
-
- logEnd();
- }
-
-
-}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVfModuleVolumeInfraV1Test.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVfModuleVolumeInfraV1Test.java
deleted file mode 100644
index 2e5a7a418a..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVfModuleVolumeInfraV1Test.java
+++ /dev/null
@@ -1,368 +0,0 @@
-/*-
- * ============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.infrastructure;
-
-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.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteVolumeGroupById;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfById;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetVolumeGroupByName;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutVolumeGroupById;
-import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB;
-import static org.openecomp.mso.bpmn.mock.StubResponseVNFAdapter.mockPostVNFVolumeGroup;
-import static org.openecomp.mso.bpmn.mock.StubResponseVNFAdapter.mockPutVNFVolumeGroupRollback;
-
-import java.io.IOException;
-import java.util.HashMap;
-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.mock.FileUtil;
-import org.openecomp.mso.bpmn.mock.StubResponseAAI;
-
-public class CreateVfModuleVolumeInfraV1Test extends WorkflowTest {
-
- public static final String _prefix = "CVFMODVOL2_";
-
- private final CallbackSet callbacks = new CallbackSet();
-
- public CreateVfModuleVolumeInfraV1Test() throws IOException {
- callbacks.put("volumeGroupCreate", FileUtil.readResourceFile(
- "__files/CreateVfModuleVolumeInfraV1/CreateVfModuleVolumeCallbackResponse.xml"));
- callbacks.put("volumeGroupDelete", FileUtil.readResourceFile(
- "__files/DeleteVfModuleVolumeInfraV1/DeleteVfModuleVolumeCallbackResponse.xml"));
- callbacks.put("volumeGroupException", FileUtil.readResourceFile(
- "__files/CreateVfModuleVolumeInfraV1/CreateVfModuleCallbackException.xml"));
- callbacks.put("volumeGroupRollback", FileUtil.readResourceFile(
- "__files/CreateVfModuleVolumeInfraV1/RollbackVfModuleVolumeCallbackResponse.xml"));
- }
-
- /**
- * Happy path scenario for VID
- *****************************/
- @Test
- //@Ignore
- @Deployment(resources = {"process/CreateVfModuleVolumeInfraV1.bpmn",
- "subprocess/GenericGetService.bpmn",
- "subprocess/DoCreateVfModuleVolumeV2.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn"})
- public void TestSuccess() throws Exception {
-
- logStart();
-
- MockNodeQueryServiceInstanceById("test-service-instance-id", "CreateVfModuleVolumeInfraV1/getSIUrlById.xml");
- MockGetGenericVnfById("/TEST-VNF-ID-0123", "CreateVfModuleVolumeInfraV1/GenericVnf.xml", 200);
- MockPutVolumeGroupById("AAIAIC25", "TEST-VOLUME-GROUP-ID-0123", "CreateVfModuleVolumeInfraV1/createVfModuleVolume_createVolumeName_AAIResponse_Success.xml", 201);
- MockGetVolumeGroupByName("AAIAIC25", "MSOTESTVOL101a-vSAMP12_base_vol_module-0", "CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_Success.xml", 200);
- MockPutVolumeGroupById("AAIAIC25", "8424bb3c-c3e7-4553-9662-469649ed9379", "CreateVfModuleVolumeInfraV1/createVfModuleVolume_updateVolumeName_AAIResponse_Success.xml", 200);
- mockPostVNFVolumeGroup(202);
-
- String businessKey = UUID.randomUUID().toString();
- String createVfModuleVolRequest = FileUtil.readResourceFile("__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request.json");
-
- Map<String, Object> testVariables = new HashMap<>();
- testVariables.put("requestId", "TEST-REQUEST-ID-0123");
- testVariables.put("serviceInstanceId", "test-service-instance-id");
- testVariables.put("vnfId", "TEST-VNF-ID-0123");
- testVariables.put("test-volume-group-name", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0");
- testVariables.put("test-volume-group-id", "TEST-VOLUME-GROUP-ID-0123");
-
- TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleVolumeInfraV1", "v1", businessKey, createVfModuleVolRequest, testVariables);
- WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 1000000);
-
- String responseBody = response.getContent();
- System.out.println("Workflow (Synch) Response:\n" + responseBody);
-
- injectVNFRestCallbacks(callbacks, "volumeGroupCreate");
-
- waitForProcessEnd(businessKey, 100000);
- checkVariable(businessKey, "CVMVINFRAV1_SuccessIndicator", true);
-
- logEnd();
- }
-
- /**
- * Fail - trigger rollback
- *****************************/
- @Test
- //@Ignore
- @Deployment(resources = {"process/CreateVfModuleVolumeInfraV1.bpmn",
- "subprocess/GenericGetService.bpmn",
- "subprocess/DoCreateVfModuleVolumeV2.bpmn",
- "subprocess/DoCreateVfModuleVolumeRollback.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn"})
- public void TestRollback() throws Exception {
-
- logStart();
-
- MockNodeQueryServiceInstanceById("test-service-instance-id", "CreateVfModuleVolumeInfraV1/getSIUrlById.xml");
- MockGetGenericVnfById("/TEST-VNF-ID-0123", "CreateVfModuleVolumeInfraV1/GenericVnf.xml", 200);
- MockPutVolumeGroupById("AAIAIC25", "TEST-VOLUME-GROUP-ID-0123", "CreateVfModuleVolumeInfraV1/createVfModuleVolume_createVolumeName_AAIResponse_Success.xml", 201);
- mockPostVNFVolumeGroup(202);
- mockPutVNFVolumeGroupRollback("TEST-VOLUME-GROUP-ID-0123", 202);
- MockDeleteVolumeGroupById("AAIAIC25", "8424bb3c-c3e7-4553-9662-469649ed9379", "1460134360", 202);
- StubResponseAAI.MockGetVolumeGroupByName_404("AAIAIC25", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0");
- StubResponseAAI.MockGetVolumeGroupByName("AAIAIC25", "MSOTESTVOL101a-vSAMP12_base_vol_module-0", "CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_Success.xml", 200);
- StubResponseAAI.MockDeleteVolumeGroup("AAIAIC25", "8424bb3c-c3e7-4553-9662-469649ed9379", "1460134360");
-
- String businessKey = UUID.randomUUID().toString();
- String createVfModuleVolRequest = FileUtil.readResourceFile("__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request.json");
-
- Map<String, Object> testVariables = new HashMap<>();
- testVariables.put("requestId", "TEST-REQUEST-ID-0123");
- testVariables.put("serviceInstanceId", "test-service-instance-id");
- testVariables.put("vnfId", "TEST-VNF-ID-0123");
- testVariables.put("test-volume-group-name", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0");
- testVariables.put("test-volume-group-id", "TEST-VOLUME-GROUP-ID-0123");
-
- TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleVolumeInfraV1", "v1", businessKey, createVfModuleVolRequest, testVariables);
- WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 1000000);
-
- String responseBody = response.getContent();
- System.out.println("Workflow (Synch) Response:\n" + responseBody);
-
- injectVNFRestCallbacks(callbacks, "volumeGroupCreate");
- injectVNFRestCallbacks(callbacks, "volumeGroupDelete");
-
- waitForProcessEnd(businessKey, 100000);
- checkVariable(businessKey, "CVMVINFRAV1_SuccessIndicator", false);
-
- logEnd();
- }
-
- /**
- * Happy path scenario for VID
- *****************************/
- @Test
- @Ignore
- @Deployment(resources = {"process/CreateVfModuleVolumeInfraV1.bpmn",
- "subprocess/GenericGetService.bpmn",
- "subprocess/DoCreateVfModuleVolumeV1.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn"})
- public void TestVolumeGroupAlreadyExists() throws Exception {
-
- logStart();
-
- MockGetVolumeGroupByName("AAIAIC25", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0", "CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_Success.xml", 200);
- MockGetGenericVnfById("TEST-VNF-ID-0123", "CreateVfModuleVolumeInfraV1/GenericVnf.xml", 200);
- MockNodeQueryServiceInstanceById("test-service-instance-id", "CreateVfModuleVolumeInfraV1/getSIUrlById.xml");
-
- String businessKey = UUID.randomUUID().toString();
- String createVfModuleVolRequest = FileUtil.readResourceFile("__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request.json");
-
- Map<String, Object> testVariables = new HashMap<>();
- testVariables.put("requestId", "TEST-REQUEST-ID-0123");
- testVariables.put("serviceInstanceId", "test-service-instance-id");
- testVariables.put("vnfId", "TEST-VNF-ID-0123");
- testVariables.put("test-volume-group-name", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0");
- testVariables.put("test-volume-group-id", "TEST-VOLUME-GROUP-ID-0123");
-
- TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleVolumeInfraV1", "v1", businessKey, createVfModuleVolRequest, testVariables);
- WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 1000000);
-
- String responseBody = response.getContent();
- System.out.println("Workflow (Synch) Response:\n" + responseBody);
-
- //injectVNFRestCallbacks(callbacks, "volumeGroupCreate");
-
- waitForProcessEnd(businessKey, 100000);
- checkVariable(businessKey, "CVMVINFRAV1_SuccessIndicator", false);
-
- logEnd();
- }
-
- /**
- *Vnf Create fail
- *****************************/
- @Test
- @Ignore
- @Deployment(resources = {"process/CreateVfModuleVolumeInfraV1.bpmn",
- "subprocess/GenericGetService.bpmn",
- "subprocess/DoCreateVfModuleVolumeV1.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn"})
- public void TestVNfCreateFail() throws Exception {
-
- logStart();
-
- MockNodeQueryServiceInstanceById("test-service-instance-id", "CreateVfModuleVolumeInfraV1/getSIUrlById.xml");
- MockGetGenericVnfById("/TEST-VNF-ID-0123", "CreateVfModuleVolumeInfraV1/GenericVnf.xml", 200);
- MockPutVolumeGroupById("AAIAIC25", "TEST-VOLUME-GROUP-ID-0123", "CreateVfModuleVolumeInfraV1/createVfModuleVolume_createVolumeName_AAIResponse_Success.xml", 201);
- MockGetVolumeGroupByName("AAIAIC25", "MSOTESTVOL101a-vSAMP12_base_vol_module-0", "CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_Success.xml", 200);
- MockPutVolumeGroupById("AAIAIC25", "8424bb3c-c3e7-4553-9662-469649ed9379", "CreateVfModuleVolumeInfraV1/createVfModuleVolume_updateVolumeName_AAIResponse_Success.xml", 200);
- mockPostVNFVolumeGroup(202);
- MockDeleteVolumeGroupById("AAIAIC25", "8424bb3c-c3e7-4553-9662-469649ed9379", "1460134360", 204);
-
- String businessKey = UUID.randomUUID().toString();
- String createVfModuleVolRequest = FileUtil.readResourceFile("__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request.json");
-
- Map<String, Object> testVariables = new HashMap<>();
- testVariables.put("requestId", "TEST-REQUEST-ID-0123");
- testVariables.put("serviceInstanceId", "test-service-instance-id");
- testVariables.put("vnfId", "TEST-VNF-ID-0123");
- testVariables.put("test-volume-group-name", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0");
- testVariables.put("test-volume-group-id", "TEST-VOLUME-GROUP-ID-0123");
-
- TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleVolumeInfraV1", "v1", businessKey, createVfModuleVolRequest, testVariables);
- WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 1000000);
-
- String responseBody = response.getContent();
- System.out.println("Workflow (Synch) Response:\n" + responseBody);
-
- injectVNFRestCallbacks(callbacks, "volumeGroupException");
-
- waitForProcessEnd(businessKey, 100000);
- checkVariable(businessKey, "CVMVINFRAV1_SuccessIndicator", false);
-
- logEnd();
- }
-
-
- /**
- * Error scenario - vnf not found
- ********************************/
- @Test
- @Ignore
- @Deployment(resources = {"process/CreateVfModuleVolumeInfraV1.bpmn",
- "subprocess/GenericGetService.bpmn",
- "subprocess/DoCreateVfModuleVolumeV1.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn"})
- public void TestFailVnfNotFound() throws Exception {
-
- logStart();
-
- MockNodeQueryServiceInstanceById("test-service-instance-id", "CreateVfModuleVolumeInfraV1/getSIUrlById.xml");
-
- String businessKey = UUID.randomUUID().toString();
- String createVfModuleVolRequest = FileUtil.readResourceFile("__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request_noreqparm.json");
-
- Map<String, Object> testVariables = new HashMap<>();
- testVariables.put("requestId", "TEST-REQUEST-ID-0123");
- testVariables.put("serviceInstanceId", "test-service-instance-id");
- testVariables.put("vnfId", "TEST-VNF-ID-0123");
- testVariables.put("test-volume-group-name", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0");
-
- TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleVolumeInfraV1", "v1", businessKey, createVfModuleVolRequest, testVariables);
- WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 1000000);
-
- String responseBody = response.getContent();
- System.out.println("Workflow (Synch) Response:\n" + responseBody);
-
- //injectVNFRestCallbacks(callbacks, "volumeGroupCreate");
-
- waitForProcessEnd(businessKey, 100000);
- checkVariable(businessKey, "CVMVINFRAV1_SuccessIndicator", false);
-
- logEnd();
- }
-
- /**
- * Error scenario - error in validation
- **************************************/
- @Test
- @Ignore
- @Deployment(resources = {"process/CreateVfModuleVolumeInfraV1.bpmn",
- "subprocess/GenericGetService.bpmn",
- "subprocess/DoCreateVfModuleVolumeV1.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn"})
- public void TestFailNoVnfPassed() throws Exception {
-
- logStart();
-
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- String createVfModuleVolRequest = FileUtil.readResourceFile("__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request.json");
-
- Map<String, Object> testVariables = new HashMap<>();
- testVariables.put("requestId", "TEST-REQUEST-ID-0123");
- testVariables.put("serviceInstanceId", "test-service-instance-id");
- //testVariables.put("vnfId", "TEST-VNF-ID-0123");
- testVariables.put("test-volume-group-name", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0");
-
- TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleVolumeInfraV1", "v1", businessKey, createVfModuleVolRequest, testVariables);
- WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 1000000);
-
- String responseBody = response.getContent();
- System.out.println("Workflow (Synch) Response:\n" + responseBody);
- waitForProcessEnd(businessKey, 100000);
- checkVariable(businessKey, "CVMVINFRAV1_SuccessIndicator", false);
-
- logEnd();
- }
-
- /**
- * Error scenario - service instance not found
- *********************************************/
- @Test
- @Ignore
- @Deployment(resources = {"process/CreateVfModuleVolumeInfraV1.bpmn",
- "subprocess/GenericGetService.bpmn",
- "subprocess/DoCreateVfModuleVolumeV1.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn"})
- public void TestFailServiceInstanceNotFound() throws Exception {
-
- logStart();
-
- MockNodeQueryServiceInstanceById("test-service-instance-id", "CreateVfModuleVolumeInfraV1/getSIUrlById.xml");
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- String createVfModuleVolRequest = FileUtil.readResourceFile("__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request.json");
-
- Map<String, Object> testVariables = new HashMap<>();
- testVariables.put("requestId", "TEST-REQUEST-ID-0123");
- testVariables.put("serviceInstanceId", "test-service-instance-id");
- //testVariables.put("vnfId", "TEST-VNF-ID-0123");
- testVariables.put("test-volume-group-name", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0");
-
- TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleVolumeInfraV1", "v1", businessKey, createVfModuleVolRequest, testVariables);
- WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 1000000);
-
- String responseBody = response.getContent();
- System.out.println("Workflow (Synch) Response:\n" + responseBody);
- waitForProcessEnd(businessKey, 100000);
- checkVariable(businessKey, "CVMVINFRAV1_SuccessIndicator", false);
-
- logEnd();
- }
-}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVnfInfraTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVnfInfraTest.java
deleted file mode 100644
index db43de7f14..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVnfInfraTest.java
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
- * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property.
- */
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.bpmn.infrastructure;
-
-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.openecomp.mso.bpmn.common.BPMNUtil.executeWorkFlow;
-import static org.openecomp.mso.bpmn.common.BPMNUtil.waitForWorkflowToFinish;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByName_404;
-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.MockNodeQueryServiceInstanceById_404;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutGenericVnf;
-import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.MockGetVnfCatalogDataCustomizationUuid;
-import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB;
-import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter;
-
-import java.io.IOException;
-import java.util.HashMap;
-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.BPMNUtil;
-import org.openecomp.mso.bpmn.common.WorkflowTest;
-import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse;
-import org.openecomp.mso.bpmn.mock.FileUtil;
-
-/**
- * Unit Test for the CreateVnfInfra Flow
- */
-public class CreateVnfInfraTest extends WorkflowTest {
-
- private String createVnfInfraRequest;
- private final CallbackSet callbacks = new CallbackSet();
-
-
- public CreateVnfInfraTest() throws IOException {
- createVnfInfraRequest = FileUtil.readResourceFile("__files/InfrastructureFlows/CreateVnfInfraRequest.json");
- callbacks.put("assign", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyAssignCallback.xml"));
- callbacks.put("activate", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
- }
-
- @Test
- @Deployment(resources = {"subprocess/DoCreateVnf.bpmn",
- "subprocess/GenericGetService.bpmn",
- "subprocess/GenericGetVnf.bpmn",
- "subprocess/GenericPutVnf.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "process/CreateVnfInfra.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/CompleteMsoProcess.bpmn"})
- public void testCreateVnfInfra_success() throws Exception{
-
- MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlById.xml");
- MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml");
- MockGetGenericVnfByName_404();
- MockPutGenericVnf();
- MockGetVnfCatalogDataCustomizationUuid("customizationId123", "VIPR/getCatalogVnfData.json");
- mockSDNCAdapter("/SDNCAdapter", "vnf-type>STMTN", 200, "VfModularity/StandardSDNCSynchResponse.xml");
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariablesSuccess(variables, createVnfInfraRequest, "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET");
- TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVnfInfra",
- "v1", businessKey, createVnfInfraRequest, variables);
-
- WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
-
- String responseBody = response.getContent();
- System.out.println("Workflow (Synch) Response:\n" + responseBody);
-
- //injectSDNCCallbacks(callbacks, "assign, query");
- //injectSDNCCallbacks(callbacks, "activate");
-
- // TODO add appropriate assertions
-
- waitForProcessEnd(businessKey, 10000);
- String status = BPMNUtil.getVariable(processEngineRule, "CreateVnfInfra", "CreateVnfInfraStatus");
- assertEquals("Success", status);
-
- logEnd();
-
- //WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "CreateVnfInfra", variables);
- // injectSDNCCallbacks(callbacks, "assign");
- // injectSDNCCallbacks(callbacks, "activate");
- //waitForProcessEnd(businessKey, 10000);
- //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId());
-
- //assertVariables("true", "true", "false", "true", "Success", null);
-
- }
-
- @Test
- @Deployment(resources = {"subprocess/GenericGetService.bpmn", "subprocess/GenericGetVnf.bpmn", "subprocess/GenericPutVnf.bpmn", "process/CreateVnfInfra.bpmn", "subprocess/FalloutHandler.bpmn", "subprocess/CompleteMsoProcess.bpmn"})
- public void testCreateVnfInfra_error_badRequest() throws Exception{
-
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- Map<String, String> variables = new HashMap<>();
- setVariables(variables, null, "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET");
-
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "CreateVnfInfra", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId());
-
- assertVariables(null, null, null, null, null, "WorkflowException[processKey=CreateVnfInfra,errorCode=2500,errorMessage=Internal Error - WorkflowException Object and/or RequestInfo is null! CreateVnfInfra]");
-
- }
-
- @Test
- @Ignore
- @Deployment(resources = {"subprocess/DoCreateVnf.bpmn", "subprocess/GenericGetService.bpmn", "subprocess/GenericGetVnf.bpmn", "subprocess/GenericPutVnf.bpmn", "process/CreateVnfInfra.bpmn", "subprocess/FalloutHandler.bpmn", "subprocess/CompleteMsoProcess.bpmn"})
- public void testCreateVnfInfra_error_siNotFound() throws Exception{
-
- MockNodeQueryServiceInstanceById_404("MIS%2F1604%2F0026%2FSW_INTERNET");
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- Map<String, String> variables = new HashMap<>();
- setVariables(variables, createVnfInfraRequest, "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET");
-
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "CreateVnfInfra", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId());
-
- assertVariables(null, null, null, null, null, "WorkflowException[processKey=DoCreateVnf,errorCode=404,errorMessage=Service Instance Not Found]");
-
- }
-
- @Test
- @Ignore
- @Deployment(resources = {"subprocess/DoCreateVnf.bpmn",
- "subprocess/GenericGetService.bpmn",
- "subprocess/GenericGetVnf.bpmn",
- "subprocess/GenericPutVnf.bpmn",
- "process/CreateVnfInfra.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/CompleteMsoProcess.bpmn"})
- public void testCreateVnfInfra_error_vnfExist() throws Exception{
- MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlById.xml");
- MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml");
-
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=testVnfName123&depth=1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("GenericFlows/getGenericVnfResponse.xml")));
-
- MockPutGenericVnf();
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- Map<String, String> variables = new HashMap<>();
- setVariables(variables, createVnfInfraRequest, "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET");
-
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "CreateVnfInfra", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId());
-
- assertVariables(null, null, null, null, null, "WorkflowException[processKey=DoCreateVnf,errorCode=5000,errorMessage=Generic Vnf Already Exist.]");
-
- }
-
- private void assertVariables(String exSIFound, String exSISucc, String exVnfFound, String exVnfSucc, String exResponse, String exWorkflowException) {
-
- String siFound = BPMNUtil.getVariable(processEngineRule, "CreateVnfInfra", "GENGS_FoundIndicator");
- String siSucc = BPMNUtil.getVariable(processEngineRule, "CreateVnfInfra", "GENGS_SuccessIndicator");
- String vnfFound = BPMNUtil.getVariable(processEngineRule, "CreateVnfInfra", "GENGV_FoundIndicator");
- String vnfSucc = BPMNUtil.getVariable(processEngineRule, "CreateVnfInfra", "GENGV_SuccessIndicator");
- String response = BPMNUtil.getVariable(processEngineRule, "CreateVnfInfra", "WorkflowResponse");
- String workflowException = BPMNUtil.getVariable(processEngineRule, "CreateVnfInfra", "SavedWorkflowException1");
-
- assertEquals(exSIFound, siFound);
- assertEquals(exSISucc, siSucc);
- assertEquals(exVnfFound, vnfFound);
- assertEquals(exVnfSucc, vnfSucc);
- assertEquals(exResponse, response);
- assertEquals(exWorkflowException, workflowException);
- }
-
- private void setVariables(Map<String, String> variables, String request, String requestId, String siId) {
- variables.put("isDebugLogEnabled", "true");
- variables.put("bpmnRequest", request);
- variables.put("mso-request-id", requestId);
- variables.put("serviceInstanceId",siId);
- variables.put("testVnfId","testVnfId123");
- variables.put("vnfType", "STMTN");
- }
-
- private void setVariablesSuccess(Map<String, Object> variables, String request, String requestId, String siId) {
- variables.put("isDebugLogEnabled", "true");
- //variables.put("bpmnRequest", request);
- //variables.put("mso-request-id", requestId);
- variables.put("serviceInstanceId",siId);
- variables.put("requestId", requestId);
- variables.put("testVnfId","testVnfId123");
- variables.put("vnfType", "STMTN");
- }
-
-}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteGenericALaCarteServiceInstanceTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteGenericALaCarteServiceInstanceTest.java
deleted file mode 100644
index 1a52041bd7..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteGenericALaCarteServiceInstanceTest.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*-
- * ============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.infrastructure;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.openecomp.mso.bpmn.common.BPMNUtil.executeWorkFlow;
-import static org.openecomp.mso.bpmn.common.BPMNUtil.waitForWorkflowToFinish;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteServiceInstance;
-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.StubResponseDatabase.mockUpdateRequestDB;
-
-import java.io.IOException;
-import java.util.HashMap;
-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.BPMNUtil;
-import org.openecomp.mso.bpmn.common.WorkflowTest;
-import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse;
-
-/**
- * Unit test cases for DelServiceInstance.bpmn
- */
-public class DeleteGenericALaCarteServiceInstanceTest extends WorkflowTest {
-
- public DeleteGenericALaCarteServiceInstanceTest() throws IOException {
- }
-
- /**
- * Sunny day VID scenario.
- *
- * @throws Exception
- */
- @Ignore // IGNORED FOR 1710 MERGE TO ONAP
- @Test
- @Deployment(resources = {
- "process/DeleteGenericALaCarteServiceInstance.bpmn",
- "subprocess/DoDeleteServiceInstance.bpmn",
- "subprocess/GenericDeleteService.bpmn",
- "subprocess/GenericGetService.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/FalloutHandler.bpmn" })
- public void sunnyDayAlaCarte() throws Exception {
-
- logStart();
-
- //AAI
- MockDeleteServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "");
- MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getSINoRelations.xml");
- MockNodeQueryServiceInstanceById("MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getSIUrlById.xml");
- //DB
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
-
- Map<String, String> variables = setupVariables();
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "DeleteGenericALaCarteServiceInstance", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId());
-
- String workflowResp = BPMNUtil.getVariable(processEngineRule, "DeleteGenericALaCarteServiceInstance", "WorkflowResponse");
- //assertNotNull(workflowResp);
- System.out.println("Workflow (Synch) Response:\n" + workflowResp);
- String workflowException = BPMNUtil.getVariable(processEngineRule, "DeleteGenericALaCarteServiceInstance", "WorkflowException");
- String completionReq = BPMNUtil.getVariable(processEngineRule, "DeleteGenericALaCarteServiceInstance", "completionRequest");
- System.out.println("completionReq:\n" + completionReq);
- System.out.println("workflowException:\n" + workflowException);
- assertNotNull(completionReq);
- assertEquals(null, workflowException);
-
- logEnd();
- }
-
- // Success Scenario
- private Map<String, String> setupVariables() {
- Map<String, String> variables = new HashMap<>();
- variables.put("isDebugLogEnabled", "true");
- variables.put("bpmnRequest", getRequest());
- variables.put("mso-request-id", "RaaTestRequestId-1");
- variables.put("serviceInstanceId","MIS%252F1604%252F0026%252FSW_INTERNET");
- return variables;
- }
-
- public String getRequest() {
- String request = "{\"requestDetails\":{\"modelInfo\":{\"modelType\":\"service\",\"modelInvariantUuid\":\"uuid-miu-svc-011-abcdef\",\"modelUuid\":\"ASDC_TOSCA_UUID\",\"modelName\":\"SIModelName1\",\"modelVersion\":\"2\"},\"subscriberInfo\":{\"globalSubscriberId\":\"SDN-ETHERNET-INTERNET\",\"subscriberName\":\"\"},\"requestInfo\":{\"instanceName\":\"1604-MVM-26\",\"source\":\"VID\",\"suppressRollback\":\"true\",\"productFamilyId\":\"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\"},\"cloudConfiguration\":{\"lcpCloudRegionId\":\"mdt1\",\"tenantId\":\"8b1df54faa3b49078e3416e21370a3ba\"},\"requestParameters\":{\"subscriptionServiceType\":\"123456789\",\"aLaCarte\":\"false\",\"userParams\":\"somep\"}}}";
- return request;
- }
-
-}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteNetworkInstanceTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteNetworkInstanceTest.java
deleted file mode 100644
index 9c32abe373..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteNetworkInstanceTest.java
+++ /dev/null
@@ -1,341 +0,0 @@
-/*-
- * ============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.infrastructure;
-
-import static org.openecomp.mso.bpmn.common.BPMNUtil.executeAsyncWorkflow;
-import static org.openecomp.mso.bpmn.common.BPMNUtil.getVariable;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetCloudRegion;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetNetworkByIdWithDepth;
-import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB;
-import static org.openecomp.mso.bpmn.mock.StubResponseNetworkAdapter.MockNetworkAdapter;
-import static org.openecomp.mso.bpmn.mock.StubResponseNetworkAdapter.MockNetworkAdapterContainingRequest;
-import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter;
-import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapterTopology;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.camunda.bpm.engine.test.Deployment;
-import org.junit.Assert;
-import org.junit.Rule;
-import org.junit.Test;
-import org.openecomp.mso.bpmn.common.BPMNUtil;
-import org.openecomp.mso.bpmn.common.SDNCAdapterCallbackRule;
-import org.openecomp.mso.bpmn.common.WorkflowTest;
-import org.openecomp.mso.bpmn.common.WorkflowTestTransformer;
-import org.openecomp.mso.bpmn.mock.SDNCAdapterNetworkTopologyMockTransformer;
-
-import com.github.tomakehurst.wiremock.extension.ResponseTransformer;
-
-
-/**
- * Unit test cases for DeleteNetworkInstance.bpmn
- *
- */
-//@Ignore
-public class DeleteNetworkInstanceTest extends WorkflowTest {
- @WorkflowTestTransformer
- public static final ResponseTransformer sdncAdapterMockTransformer =
- new SDNCAdapterNetworkTopologyMockTransformer();
-
- @Rule
- public final SDNCAdapterCallbackRule sdncAdapterCallbackRule =
- new SDNCAdapterCallbackRule(processEngineRule);
-
- /**
- * End-to-End flow - Unit test for DeleteNetworkInstance.bpmn
- * - String input & String response
- */
-
- @Test
- //@Ignore
- @Deployment(resources = {"process/DeleteNetworkInstance.bpmn",
- "subprocess/DoDeleteNetworkInstance.bpmn",
- "subprocess/DoDeleteNetworkInstanceRollback.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/SDNCAdapterV1.bpmn"})
-
- public void shouldInvokeServiceDeleteNetworkInstance_VID_Success() throws Exception {
-
- System.out.println("----------------------------------------------------------");
- System.out.println(" Success VID - DeleteNetworkInstance flow Started! ");
- System.out.println("----------------------------------------------------------");
-
- // setup simulators
- mockSDNCAdapterTopology("DeleteNetworkV2mock/sdncDeleteNetworkTopologySimResponse.xml", "SvcAction>delete");
- MockNetworkAdapter("bdc5efe8-404a-409b-85f6-0dcc9eebae30", 200, "deleteNetworkResponse_Success.xml");
- MockGetNetworkByIdWithDepth("bdc5efe8-404a-409b-85f6-0dcc9eebae30", "DeleteNetworkV2/deleteNetworkAAIResponse_Success.xml", "all");
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
- MockGetCloudRegion("RDM2WAGPLCP", 200, "DeleteNetworkV2/cloudRegion30_AAIResponse_Success.xml");
-
- Map<String, String> variables = new HashMap<>();
- variables.put("mso-request-id", "testRequestId");
- variables.put("requestId", "testRequestId");
- variables.put("isBaseVfModule", "true");
- variables.put("recipeTimeout", "0");
- variables.put("requestAction", "DELETE");
- variables.put("serviceInstanceId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
- variables.put("vnfId", "");
- variables.put("vfModuleId", "");
- variables.put("volumeGroupId", "");
- variables.put("networkId", "bdc5efe8-404a-409b-85f6-0dcc9eebae30");
- variables.put("serviceType", "MOG");
- variables.put("vfModuleType", "");
- variables.put("networkType", "modelName");
- variables.put("bpmnRequest", getDeleteNetworkInstanceInfraRequest());
-
- executeAsyncWorkflow(processEngineRule, "DeleteNetworkInstance", variables);
-
- Assert.assertNotNull("DELNI_CompleteMsoProcessRequest - ", getVariable(processEngineRule, "DeleteNetworkInstance", "DELNI_CompleteMsoProcessRequest"));
- Assert.assertEquals("true", getVariable(processEngineRule, "DeleteNetworkInstance", "DELNI_Success"));
-
- String workflowResp = BPMNUtil.getVariable(processEngineRule, "DeleteNetworkInstance", "WorkflowResponse");
- Assert.assertNotNull(workflowResp);
- System.out.println("DeleteNetworkInstanceTest.shouldInvokeServiceDeleteNetworkInstance_Success() WorkflowResponse:\n" + workflowResp);
-
- String completeMsoProcessRequest =
- "<aetgt:MsoCompletionRequest xmlns:aetgt=\"http://org.openecomp/mso/workflow/schema/v1\"" + '\n'
- + " xmlns:ns=\"http://org.openecomp/mso/request/types/v1\"" + '\n'
- + " xmlns=\"http://org.openecomp/mso/infra/vnf-request/v1\">" + '\n'
- + " <request-info>" + '\n'
- + " <request-id>testRequestId</request-id>" + '\n'
- + " <action>DELETE</action>" + '\n'
- + " <source>VID</source>" + '\n'
- + " </request-info>" + '\n'
- + " <aetgt:status-message>Network has been deleted successfully.</aetgt:status-message>" + '\n'
- + " <aetgt:mso-bpel-name>BPMN Network action: DELETE</aetgt:mso-bpel-name>" + '\n'
- + "</aetgt:MsoCompletionRequest>";
-
- Assert.assertEquals(completeMsoProcessRequest, getVariable(processEngineRule, "DeleteNetworkInstance", "DELNI_CompleteMsoProcessRequest"));
-
- System.out.println("----------------------------------------------------------");
- System.out.println(" Success VID - DeleteNetworkInstance flow Completed ");
- System.out.println("----------------------------------------------------------");
-
-
- }
-
- @Test
- //@Ignore
- @Deployment(resources = {"process/DeleteNetworkInstance.bpmn",
- "subprocess/DoDeleteNetworkInstance.bpmn",
- //"subprocess/DoDeleteNetworkInstanceRollback.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/SDNCAdapterV1.bpmn"})
-
- public void shouldInvokeServiceDeleteNetworkInstance_vIPER_Success() throws Exception {
-
- System.out.println("----------------------------------------------------------");
- System.out.println(" Success vIPER - DeleteNetworkInstance flow Started! ");
- System.out.println("----------------------------------------------------------");
-
- // setup simulators
- mockSDNCAdapterTopology("DeleteNetworkV2mock/sdncDeleteNetworkTopologySimResponse.xml", "SvcAction>unassign");
- mockSDNCAdapterTopology("DeleteNetworkV2mock/sdncDeleteNetworkTopologySimResponse.xml", "SvcAction>deactivate");
- MockNetworkAdapter("bdc5efe8-404a-409b-85f6-0dcc9eebae30", 200, "deleteNetworkResponse_Success.xml");
- MockGetNetworkByIdWithDepth("bdc5efe8-404a-409b-85f6-0dcc9eebae30", "DeleteNetworkV2/deleteNetworkAAIResponse_Success.xml", "all");
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
- MockGetCloudRegion("RDM2WAGPLCP", 200, "DeleteNetworkV2/cloudRegion30_AAIResponse_Success.xml");
-
- String networkModelInfo = " {\"modelName\": \"modelName\", " + '\n' +
- " \"networkType\": \"modelName\" }";
-
- Map<String, String> variables = new HashMap<>();
- variables.put("testMessageId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56");
- variables.put("msoRequestId", "testRequestId");
- variables.put("requestId", "testRequestId");
- variables.put("serviceInstanceId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
- variables.put("networkId", "bdc5efe8-404a-409b-85f6-0dcc9eebae30");
- variables.put("networkName", "HSL_direct_net_2");
- variables.put("lcpCloudRegionId", "RDM2WAGPLCP");
- variables.put("tenantId", "88a6ca3ee0394ade9403f075db23167e");
- variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
- variables.put("disableRollback", "false"); // 1702
- variables.put("failIfExists", "false");
- //variables.put("sdncVersion", "1702");
- variables.put("sdncVersion", "1707");
- variables.put("subscriptionServiceType", "MSO-dev-service-type");
- variables.put("networkModelInfo", networkModelInfo);
-
- executeAsyncWorkflow(processEngineRule, "DeleteNetworkInstance", variables);
-
- Assert.assertNotNull("DELNI_CompleteMsoProcessRequest - ", getVariable(processEngineRule, "DeleteNetworkInstance", "DELNI_CompleteMsoProcessRequest"));
- Assert.assertEquals("true", getVariable(processEngineRule, "DeleteNetworkInstance", "DELNI_Success"));
-
- String workflowResp = BPMNUtil.getVariable(processEngineRule, "DeleteNetworkInstance", "WorkflowResponse");
- Assert.assertNotNull(workflowResp);
- System.out.println("DeleteNetworkInstanceTest.shouldInvokeServiceDeleteNetworkInstance_vIPER_Success() WorkflowResponse:\n" + workflowResp);
-
- String completeMsoProcessRequest =
- "<aetgt:MsoCompletionRequest xmlns:aetgt=\"http://org.openecomp/mso/workflow/schema/v1\"" + '\n'
- + " xmlns:ns=\"http://org.openecomp/mso/request/types/v1\"" + '\n'
- + " xmlns=\"http://org.openecomp/mso/infra/vnf-request/v1\">" + '\n'
- + " <request-info>" + '\n'
- + " <request-id>testRequestId</request-id>" + '\n'
- + " <action>DELETE</action>" + '\n'
- + " <source>VID</source>" + '\n'
- + " </request-info>" + '\n'
- + " <aetgt:status-message>Network has been deleted successfully.</aetgt:status-message>" + '\n'
- + " <aetgt:mso-bpel-name>BPMN Network action: DELETE</aetgt:mso-bpel-name>" + '\n'
- + "</aetgt:MsoCompletionRequest>";
-
- Assert.assertEquals(completeMsoProcessRequest, getVariable(processEngineRule, "DeleteNetworkInstance", "DELNI_CompleteMsoProcessRequest"));
-
- System.out.println("----------------------------------------------------------");
- System.out.println(" Success VID - DeleteNetworkInstance flow Completed ");
- System.out.println("----------------------------------------------------------");
-
-
- }
-
- @Test
- //@Ignore
- @Deployment(resources = {"process/DeleteNetworkInstance.bpmn",
- "subprocess/DoDeleteNetworkInstance.bpmn",
- "subprocess/DoDeleteNetworkInstanceRollback.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/SDNCAdapterV1.bpmn"})
-
- public void shouldInvokeServiceDeleteNetworkInstanceInfra_vIPER_Rollback() throws Exception {
- // Rollback is not Applicable for DeleteNetwork (no requirements). Rollback should not be invoked.
- System.out.println("----------------------------------------------------------");
- System.out.println(" Rollback - DeleteNetworkInstance flow Started! ");
- System.out.println("----------------------------------------------------------");
-
- // setup simulatores
- mockSDNCAdapter("/SDNCAdapter", "SvcAction>unassign", 500, "");
- mockSDNCAdapterTopology("DeleteNetworkV2mock/sdncDeleteNetworkTopologySimResponse.xml", "SvcAction>deactivate");
- mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml", "SvcAction>activate");
- MockNetworkAdapter("bdc5efe8-404a-409b-85f6-0dcc9eebae30", 200, "deleteNetworkResponse_Success.xml");
- MockNetworkAdapterContainingRequest("createNetworkRequest", 200, "CreateNetworkV2/createNetworkResponse_Success.xml");
- MockGetNetworkByIdWithDepth ("bdc5efe8-404a-409b-85f6-0dcc9eebae30", "DeleteNetworkV2/deleteNetworkAAIResponse_Success.xml", "all");
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
- MockGetCloudRegion("RDM2WAGPLCP", 200, "DeleteNetworkV2/cloudRegion30_AAIResponse_Success.xml");
-
- String networkModelInfo = " {\"modelCustomizationId\": \"uuid-nrc-001-1234\", " + '\n' +
- " \"modelInvariantId\": \"was-ist-das-001-1234\" }";
-
- Map<String, String> variables = new HashMap<>();
- variables.put("testMessageId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56");
- variables.put("msoRequestId", "testRequestId");
- variables.put("requestId", "testRequestId");
- variables.put("serviceInstanceId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
- variables.put("networkId", "bdc5efe8-404a-409b-85f6-0dcc9eebae30");
- variables.put("networkName", "HSL_direct_net_2");
- variables.put("lcpCloudRegionId", "RDM2WAGPLCP");
- variables.put("tenantId", "88a6ca3ee0394ade9403f075db23167e");
- variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
- variables.put("disableRollback", "false"); // 1702
- variables.put("failIfExists", "false");
- variables.put("sdncVersion", "1702");
- variables.put("subscriptionServiceType", "MSO-dev-service-type");
- variables.put("networkModelInfo", networkModelInfo);
-
- executeAsyncWorkflow(processEngineRule, "DeleteNetworkInstance", variables);
- //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "DeleteNetworkInstance", variables);
- //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId());
-
- String workflowResp = BPMNUtil.getVariable(processEngineRule, "DeleteNetworkInstance", "WorkflowResponse");
- Assert.assertNotNull(workflowResp);
-
- Assert.assertNotNull("DELNI_FalloutHandlerRequest - ", getVariable(processEngineRule, "DeleteNetworkInstance", "DELNI_FalloutHandlerRequest"));
- Assert.assertEquals("false", getVariable(processEngineRule, "DeleteNetworkInstance", "DELNI_Success"));
- Assert.assertEquals("false", BPMNUtil.getVariable(processEngineRule, "DoDeleteNetworkInstance", "DELNWKI_Success"));
-
- System.out.println("----------------------------------------------------------");
- System.out.println(" Rollback - DeleteNetworkInstanceModular flow Completed ");
- System.out.println("----------------------------------------------------------");
-
-
- }
-
-
- // *****************
- // Utility Section
- // *****************
-
- public String getDeleteNetworkInstanceInfraRequest() {
-
- String request =
- "{ \"requestDetails\": { " + '\n' +
- " \"modelInfo\": { " + '\n' +
- " \"modelType\": \"modelType\", " + '\n' +
- " \"modelCustomizationId\": \"f21df226-8093-48c3-be7e-0408fcda0422\", " + '\n' +
- " \"modelName\": \"CONTRAIL_EXTERNAL\", " + '\n' +
- " \"modelVersion\": \"1.0\" " + '\n' +
- " }, " + '\n' +
- " \"cloudConfiguration\": { " + '\n' +
- " \"lcpCloudRegionId\": \"RDM2WAGPLCP\", " + '\n' +
- " \"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\" " + '\n' +
- " }, " + '\n' +
- " \"requestInfo\": { " + '\n' +
- " \"instanceName\": \"HSL_direct_net_2\", " + '\n' +
- " \"source\": \"VID\", " + '\n' +
- " \"suppressRollback\": \"false\", " + '\n' +
- " \"callbackUrl\": \"\" " + '\n' +
- " }, " + '\n' +
- " \"requestParameters\": { " + '\n' +
- " \"backoutOnFailure\": true, " + '\n' +
- " \"serviceId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\", " + '\n' +
- " \"userParams\": {} " + '\n' +
- " } " + '\n' +
- " } " + '\n' +
- "}";
- return request;
-
- }
-
-
- public String getDeleteNetworkInstanceInfraRequest_MissingId() {
-
- String request =
- "{ \"requestDetails\": { " + '\n' +
- " \"modelInfo\": { " + '\n' +
- " \"modelType\": \"modelType\", " + '\n' +
- " \"modelId\": \"modelId\", " + '\n' +
- " \"modelNameVersionId\": \"modelNameVersionId\", " + '\n' +
- " \"modelName\": \"CONTRAIL_EXTERNAL\", " + '\n' +
- " \"modelVersion\": \"1\" " + '\n' +
- " }, " + '\n' +
- " \"cloudConfiguration\": { " + '\n' +
- " \"lcpCloudRegionId\": \"RDM2WAGPLCP\", " + '\n' +
- " \"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\" " + '\n' +
- " }, " + '\n' +
- " \"requestInfo\": { " + '\n' +
- " \"instanceName\": \"HSL_direct_net_2\", " + '\n' +
- " \"source\": \"VID\", " + '\n' +
- " \"callbackUrl\": \"\" " + '\n' +
- " }, " + '\n' +
- " \"requestParameters\": { " + '\n' +
- " \"backoutOnFailure\": true, " + '\n' +
- " \"serviceId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\", " + '\n' +
- " \"userParams\": [] " + '\n' +
- " } " + '\n' +
- " } " + '\n' +
- "}";
- return request;
-
- }
-
-}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVfModuleInfraTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVfModuleInfraTest.java
deleted file mode 100644
index ba375f5d78..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVfModuleInfraTest.java
+++ /dev/null
@@ -1,605 +0,0 @@
-/*-
- * ============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.infrastructure;
-
-import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
-import static com.github.tomakehurst.wiremock.client.WireMock.containing;
-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.post;
-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.urlEqualTo;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchVfModuleId;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockVNFAdapterRestVfModule;
-import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB;
-import static org.openecomp.mso.bpmn.mock.StubResponseVNFAdapter.mockVNFDelete;
-
-import java.io.IOException;
-import java.util.HashMap;
-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.core.WorkflowException;
-import org.openecomp.mso.bpmn.mock.FileUtil;
-
-import com.github.tomakehurst.wiremock.client.WireMock;
-/**
- * Unit test for DoDeleteVfModule.bpmn.
- */
-public class DeleteVfModuleInfraTest extends WorkflowTest {
- private final CallbackSet callbacks = new CallbackSet();
-
- private static final String EOL = "\n";
-
- private final String vnfAdapterDeleteCallback =
- "<deleteVfModuleResponse>" + EOL +
- " <vnfId>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnfId>" + EOL +
- " <vfModuleId>973ed047-d251-4fb9-bf1a-65b8949e0a73</vfModuleId>" + EOL +
- " <vfModuleDeleted>true</vfModuleDeleted>" + EOL +
- " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
- "</deleteVfModuleResponse>" + EOL;
-
- //private final String vnfAdapterDeleteCallback =
- // "<deleteVfModuleResponse>" + EOL +
- // " <vnfId>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnfId>" + EOL +
- // " <vfModuleId>973ed047-d251-4fb9-bf1a-65b8949e0a73</vfModuleId>" + EOL +
- // " <vfModuleDeleted>true</vfModuleDeleted>" + EOL +
- // " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
- // " <vfModuleOutputs>" + EOL +
- // " <entry>" + EOL +
- // " <key>policyKey1_contrail_network_policy_fqdn</key>" + EOL +
- // " <value>MSOTest:DefaultPolicyFQDN1</value>" + EOL +
- // "</entry>" + EOL +
- // "<entry>" + EOL +
- // "<key>policyKey2_contrail_network_policy_fqdn</key>" + EOL +
- // "<value>MSOTest:DefaultPolicyFQDN2</value>" + EOL +
- // "</entry>" + EOL +
- // " <entry>" + EOL +
- // " <key>oam_management_v4_address</key>" + EOL +
- // " <value>1234</value>" + EOL +
- // "</entry>" + EOL +
- // " <entry>" + EOL +
- // " <key>oam_management_v6_address</key>" + EOL +
- // " <value>1234</value>" + EOL +
- // "</entry>" + EOL +
- // "</vfModuleOutputs>" + EOL +
- // "</deleteVfModuleResponse>" + EOL;
-
- private final String vnfAdapterDeleteCallbackFail =
- "<vfModuleException>" + EOL +
- " <message>Error processing request to VNF-Async. Not Found.</message>" + EOL +
- " <category>INTERNAL</category>" + EOL +
- " <rolledBack>false</rolledBack>" + EOL +
- " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
- "</vfModuleException>" + EOL;
-
- private final String sdncAdapterDeleteCallback =
- "<output xmlns=\"org:onap:sdnctl:l3api\">" + EOL +
- " <svc-request-id>{{REQUEST-ID}}</svc-request-id>" + EOL +
- " <ack-final-indicator>Y</ack-final-indicator>" + EOL +
- "</output>" + EOL;
-
- public DeleteVfModuleInfraTest() throws IOException {
- callbacks.put("sdncChangeDelete", sdncAdapterDeleteCallback);
- callbacks.put("sdncDelete", sdncAdapterDeleteCallback);
- callbacks.put("vnfDelete", FileUtil.readResourceFile(
- "__files/DeleteVfModuleCallbackResponse.xml"));
- //callbacks.put("vnfDelete", vnfAdapterDeleteCallback);
- callbacks.put("vnfDeleteFail", vnfAdapterDeleteCallbackFail);
- }
-
- @Test
- @Ignore // 1802 merge
- @Deployment(resources = {
- "process/DeleteVfModuleInfra.bpmn",
- "subprocess/DoDeleteVfModule.bpmn",
- "subprocess/PrepareUpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn",
- "subprocess/DeleteAAIVfModule.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/FalloutHandler.bpmn"
- })
-
- public void TestDeleteVfModuleSuccess() throws Exception {
- // delete the Base Module
- // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73
- String request =
- "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL +
- " <request-info>" + EOL +
- " <request-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</request-id>" + EOL +
- " <action>DELETE_VF_MODULE</action>" + EOL +
- " <source>PORTAL</source>" + EOL +
- " </request-info>" + EOL +
- " <vnf-inputs>" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
- " <vnf-type>asc_heat-int</vnf-type>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
- " <service-id>00000000-0000-0000-0000-000000000000</service-id>" + EOL +
- " <service-type>SDN-ETHERNET-INTERNET</service-type>" + EOL +
- " <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id>" + EOL +
- " <orchestration-status>pending-delete</orchestration-status>" + EOL +
- " <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>" + EOL +
- " </vnf-inputs>" + EOL +
- " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL +
- "</vnf-request>" + EOL;
- logStart();
- WireMock.reset();
-
- stubFor(post(urlEqualTo("/SDNCAdapter"))
- .withRequestBody(containing("SvcAction>changedelete"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml")));
- stubFor(post(urlEqualTo("/SDNCAdapter"))
- .withRequestBody(containing("SvcAction>delete"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml")));
-
- //mockVNFDelete("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73", 202);
- MockDoDeleteVfModule_DeleteVNFSuccess();
- MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
- // MockVNFAdapterRestVfModule();
-// MockAAIGenericVnfSearch();
-// MockAAIVfModulePUT(false);
-// MockAAIDeleteGenericVnf();
-// MockAAIDeleteVfModule();
- mockUpdateRequestDB(200, "VfModularity/DBUpdateResponse.xml");
-
- stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a73/[?]resource-version=0000073"))
- .willReturn(aResponse()
- .withStatus(200)));
- stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c720/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a75/[?]resource-version=0000075"))
- .willReturn(aResponse()
- .withStatus(200)));
- stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c718/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a78/[?]resource-version=0000078"))
- .willReturn(aResponse()
- .withStatus(200)));
- stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c719/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a77/[?]resource-version=0000077"))
- .willReturn(aResponse()
- .withStatus(500)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("aaiFault.xml")));
- stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy\\?network-policy-fqdn=.*"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml")));
-
- stubFor(delete(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/.*"))
- .willReturn(aResponse()
- .withStatus(200)));
-
-
- stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/[?]resource-version=0000021"))
- .willReturn(aResponse()
- .withStatus(200)));
- stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c718/[?]resource-version=0000018"))
- .willReturn(aResponse()
- .withStatus(500)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("aaiFault.xml")));
-
- stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*/vf-modules/vf-module/.*"))
- .withRequestBody(containing("MMSC"))
- .willReturn(aResponse()
- .withStatus(200)));
- stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*/vf-modules/vf-module/.*"))
- .withRequestBody(containing("PCRF"))
- .willReturn(aResponse()
- .withStatus(500)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("aaiFault.xml")));
- stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721"))
- .willReturn(aResponse()
- .withStatus(200)));
-
- String body;
-
- // The following stubs are for CreateAAIVfModule and UpdateAAIVfModule
-
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC23&depth=1"))
- .willReturn(aResponse()
- .withStatus(500)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("aaiFault.xml")));
-
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC22&depth=1"))
- .willReturn(aResponse()
- .withStatus(404)
- .withHeader("Content-Type", "text/xml")
- .withBody("Generic VNF Not Found")));
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/768073c7-f41f-4822-9323-b75962763d74[?]depth=1"))
- .willReturn(aResponse()
- .withStatus(404)
- .withHeader("Content-Type", "text/xml")
- .withBody("Generic VNF Not Found")));
-
- body =
- "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
- " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
- " <service-id>SDN-MOBILITY</service-id>" + EOL +
- " <equipment-role>vMMSC</equipment-role>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <in-maint>false</in-maint>" + EOL +
- " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
- " <resource-version>1508691</resource-version>" + EOL +
- " <vf-modules>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>true</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>1508692</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " </vf-modules>" + EOL +
- " <relationship-list/>" + EOL +
- " <l-interfaces/>" + EOL +
- " <lag-interfaces/>" + EOL +
- "</generic-vnf>" + EOL;
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC21&depth=1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBody(body)));
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721[?]depth=1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBody(body)));
-
- body =
- "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
- " <vnf-id>2f6aee38-1e2a-11e6-82d1-ffc7d9ee8aa4</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC20</vnf-name>" + EOL +
- " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
- " <service-id>SDN-MOBILITY</service-id>" + EOL +
- " <equipment-role>vMMSC</equipment-role>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <in-maint>false</in-maint>" + EOL +
- " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
- " <resource-version>1508691</resource-version>" + EOL +
- " <vf-modules>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC20-MMSC::module-0-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>true</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>1508692</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC20-MMSC::module-1-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>false</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>1508692</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " </vf-modules>" + EOL +
- " <relationship-list/>" + EOL +
- " <l-interfaces/>" + EOL +
- " <lag-interfaces/>" + EOL +
- "</generic-vnf>" + EOL;
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC20&depth=1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBody(body)));
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/2f6aee38-1e2a-11e6-82d1-ffc7d9ee8aa4[?]depth=1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBody(body)));
-
- // The following stubs are for DeleteAAIVfModule
-
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c723[?]depth=1"))
- .willReturn(aResponse()
- .withStatus(500)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("aaiFault.xml")));
-
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c722[?]depth=1"))
- .willReturn(aResponse()
- .withStatus(404)
- .withHeader("Content-Type", "text/xml")
- .withBody("Generic VNF Not Found")));
-
- body =
- "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
- " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
- " <service-id>SDN-MOBILITY</service-id>" + EOL +
- " <equipment-role>vMMSC</equipment-role>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <in-maint>false</in-maint>" + EOL +
- " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
- " <resource-version>0000021</resource-version>" + EOL +
- " <vf-modules>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>true</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>0000073</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " </vf-modules>" + EOL +
- " <relationship-list/>" + EOL +
- " <l-interfaces/>" + EOL +
- " <lag-interfaces/>" + EOL +
- "</generic-vnf>" + EOL;
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721[?]depth=1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBody(body)));
-
- body =
- "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c720</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC20</vnf-name>" + EOL +
- " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
- " <service-id>SDN-MOBILITY</service-id>" + EOL +
- " <equipment-role>vMMSC</equipment-role>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <in-maint>false</in-maint>" + EOL +
- " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
- " <resource-version>0000020</resource-version>" + EOL +
- " <vf-modules>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC20-MMSC::module-0-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>true</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>0000074</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a75</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC20-MMSC::module-1-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a75</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>false</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>0000075</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " </vf-modules>" + EOL +
- " <relationship-list/>" + EOL +
- " <l-interfaces/>" + EOL +
- " <lag-interfaces/>" + EOL +
- "</generic-vnf>" + EOL;
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c720[?]depth=1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBody(body)));
-
- body =
- "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c719</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC19</vnf-name>" + EOL +
- " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
- " <service-id>SDN-MOBILITY</service-id>" + EOL +
- " <equipment-role>vMMSC</equipment-role>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <in-maint>false</in-maint>" + EOL +
- " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
- " <resource-version>0000019</resource-version>" + EOL +
- " <vf-modules>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a76</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC19-MMSC::module-0-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a76</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>true</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>0000076</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a77</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC19-MMSC::module-1-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a77</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>false</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>0000077</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " </vf-modules>" + EOL +
- " <relationship-list/>" + EOL +
- " <l-interfaces/>" + EOL +
- " <lag-interfaces/>" + EOL +
- "</generic-vnf>" + EOL;
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c719[?]depth=1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBody(body)));
-
- body =
- "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c718</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC18</vnf-name>" + EOL +
- " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
- " <service-id>SDN-MOBILITY</service-id>" + EOL +
- " <equipment-role>vMMSC</equipment-role>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <in-maint>false</in-maint>" + EOL +
- " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
- " <resource-version>0000018</resource-version>" + EOL +
- " <vf-modules>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a78</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC18-MMSC::module-0-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a78</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>true</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>0000078</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " </vf-modules>" + EOL +
- " <relationship-list/>" + EOL +
- " <l-interfaces/>" + EOL +
- " <lag-interfaces/>" + EOL +
- "</generic-vnf>" + EOL;
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c718[?]depth=1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBody(body)));
-
- body =
- "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
- " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
- " <service-id>SDN-MOBILITY</service-id>" + EOL +
- " <equipment-role>vMMSC</equipment-role>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <in-maint>false</in-maint>" + EOL +
- " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
- " <resource-version>0000021</resource-version>" + EOL +
- " <vf-modules>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>true</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>0000073</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " </vf-modules>" + EOL +
- " <relationship-list/>" + EOL +
- " <l-interfaces/>" + EOL +
- " <lag-interfaces/>" + EOL +
- "</generic-vnf>" + EOL;
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a73"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBody(body)));
-
- String businessKey = UUID.randomUUID().toString();
- String deleteVfModuleRequest =
- FileUtil.readResourceFile("__files/DeleteVfModule_VID_request.json");
- //Map<String, Object> variables = new HashMap<>();
-
- //variables.put("isDebugLogEnabled","true");
-// variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
-// variables.put("mso-service-instance-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
-
- Map<String, Object> variables = setupVariablesSunnyDayVID();
-
- TestAsyncResponse asyncResponse = invokeAsyncProcess("DeleteVfModuleInfra",
- "v1", businessKey, deleteVfModuleRequest, variables);
- WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
- String responseBody = response.getContent();
- System.out.println("Workflow (Synch) Response:\n" + responseBody);
-
- // "changedelete" operation not required for deleting a Vf Module
-// injectSDNCCallbacks(callbacks, "sdncChangeDelete");
- injectVNFRestCallbacks(callbacks, "vnfDelete");
- waitForRunningProcessCount("vnfAdapterDeleteV1", 0, 120000);
- injectSDNCCallbacks(callbacks, "sdncDelete");
-
- waitForProcessEnd(businessKey, 10000);
- WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- checkVariable(businessKey, "DeleteVfModuleInfraSuccessIndicator", true);
- checkVariable(businessKey, "WorkflowException", null);
- if (wfe != null) {
- System.out.println("TestDeleteVfModuleInfraSuccess: ErrorCode=" + wfe.getErrorCode() +
- ", ErrorMessage=" + wfe.getErrorMessage());
- }
- logEnd();
- }
-
- // Active Scenario
- private Map<String, Object> setupVariablesSunnyDayVID() {
- Map<String, Object> variables = new HashMap<>();
- //try {
- // variables.put("bpmnRequest", FileUtil.readResourceFile("__files/CreateVfModule_VID_request.json"));
- //}
- //catch (Exception e) {
-
- //}
- //variables.put("mso-request-id", "testRequestId");
- variables.put("requestId", "testRequestId");
- variables.put("isBaseVfModule", "true");
- variables.put("isDebugLogEnabled", "true");
- variables.put("recipeTimeout", "0");
- variables.put("requestAction", "DELETE_VF_MODULE");
- variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
- variables.put("vnfId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("vfModuleId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
- variables.put("volumeGroupId", "");
- variables.put("serviceType", "MOG");
- variables.put("vfModuleType", "");
- return variables;
-
- }
-
- public static void MockDoDeleteVfModule_DeleteVNFSuccess() {
- stubFor(delete(urlMatching("/vnfs/v1/vnfs/.*/vf-modules/.*"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/xml")));
- stubFor(delete(urlMatching("/vnfs/v1/volume-groups/78987"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/xml")));
- }
-
-}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVfModuleVolumeInfraV1Test.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVfModuleVolumeInfraV1Test.java
deleted file mode 100644
index 0e2cf1b6b3..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVfModuleVolumeInfraV1Test.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/*-
- * ============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.infrastructure;
-
-import java.io.IOException;
-import java.util.HashMap;
-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.mock.FileUtil;
-
-/**
- * Unit test cases for UpdateVfModuleVolume.bpmn
- */
-public class DeleteVfModuleVolumeInfraV1Test extends WorkflowTest {
-
- private final CallbackSet callbacks = new CallbackSet();
-
- public DeleteVfModuleVolumeInfraV1Test() throws IOException {
- callbacks.put("volumeGroupDelete", FileUtil.readResourceFile(
- "__files/DeleteVfModuleVolumeInfraV1/DeleteVfModuleVolumeCallbackResponse.xml"));
- }
-
- /**
- * Happy path scenario.
- *
- * @throws Exception
- */
- @Test
- @Ignore // BROKEN TEST
- @Deployment(resources = {"process/DeleteVfModuleVolumeInfraV1.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn"})
- public void happyPath() throws Exception {
-
- logStart();
-
-// DeleteVfModuleVolumeInfraV1_success();
-
- String businessKey = UUID.randomUUID().toString();
- String deleteVfModuleVolRequest =
- FileUtil.readResourceFile("__files/DeleteVfModuleVolumeInfraV1/deleteVfModuleVolume_VID_request_st.json");
-
- Map<String, Object> testVariables = new HashMap<>();
- testVariables.put("requestId", "TEST-REQUEST-ID-0123");
- testVariables.put("volumeGroupId", "78987");
- testVariables.put("serviceInstanceId", "test-service-instance-id-0123");
-
- TestAsyncResponse asyncResponse = invokeAsyncProcess("DeleteVfModuleVolumeInfraV1",
- "v1", businessKey, deleteVfModuleVolRequest, testVariables);
- WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 100000);
-
- String responseBody = response.getContent();
- System.out.println("Workflow (Synch) Response:\n" + responseBody);
-
- injectVNFRestCallbacks(callbacks, "volumeGroupDelete");
-
- waitForProcessEnd(businessKey, 100000);
- checkVariable(businessKey, "DELVfModVol_TransactionSuccessIndicator", true);
-
- logEnd();
- }
-
- /**
- * Test fails - vf module in use
- *
- * @throws Exception
- */
- @Test
- @Deployment(resources = {"process/DeleteVfModuleVolumeInfraV1.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn"})
- public void TestVfModuleInUseError() throws Exception {
-
- logStart();
-
-// DeleteVfModuleVolumeInfraV1_inUseError(); // no assertions to check
-
- String businessKey = UUID.randomUUID().toString();
- String deleteVfModuleVolRequest =
- FileUtil.readResourceFile("__files/DeleteVfModuleVolumeInfraV1/deleteVfModuleVolume_VID_request_st.json");
-
- Map<String, Object> testVariables = new HashMap<>();
- testVariables.put("requestId", "TEST-REQUEST-ID-0123");
- testVariables.put("volumeGroupId", "78987");
-
- TestAsyncResponse asyncResponse = invokeAsyncProcess("DeleteVfModuleVolumeInfraV1",
- "v1", businessKey, deleteVfModuleVolRequest, testVariables);
- WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 100000);
-
- String responseBody = response.getContent();
- System.out.println("Workflow (Synch) Response:\n" + responseBody);
-
- //injectVNFRestCallbacks(callbacks, "volumeGroupDelete");
-
- waitForProcessEnd(businessKey, 100000);
- checkVariable(businessKey, "DELVfModVol_TransactionSuccessIndicator", false);
-
- logEnd();
- }
-
- /**
- * Test fails on vnf adapter call
- *
- * @throws Exception
- */
- @Test
- @Ignore // BROKEN TEST
- @Deployment(resources = {"process/DeleteVfModuleVolumeInfraV1.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn"})
- public void TestVnfAdapterCallfail() throws Exception {
-
- logStart();
-
-// DeleteVfModuleVolumeInfraV1_fail();
-
- String businessKey = UUID.randomUUID().toString();
- String deleteVfModuleVolRequest =
- FileUtil.readResourceFile("__files/DeleteVfModuleVolumeInfraV1/deleteVfModuleVolume_VID_request_st.json");
-
- Map<String, Object> testVariables = new HashMap<>();
- testVariables.put("requestId", "TEST-REQUEST-ID-0123");
- testVariables.put("volumeGroupId", "78987");
-
- TestAsyncResponse asyncResponse = invokeAsyncProcess("DeleteVfModuleVolumeInfraV1",
- "v1", businessKey, deleteVfModuleVolRequest, testVariables);
- WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 100000);
-
- String responseBody = response.getContent();
- System.out.println("Workflow (Synch) Response:\n" + responseBody);
-
- //injectVNFRestCallbacks(callbacks, "volumeGroupDelete");
-
- waitForProcessEnd(businessKey, 100000);
- checkVariable(businessKey, "DELVfModVol_TransactionSuccessIndicator", false);
-
- logEnd();
- }
-}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVnfInfraTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVnfInfraTest.java
deleted file mode 100644
index 3ab3f713f4..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVnfInfraTest.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property.
- */
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.bpmn.infrastructure;
-
-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.openecomp.mso.bpmn.common.BPMNUtil.executeWorkFlow;
-import static org.openecomp.mso.bpmn.common.BPMNUtil.waitForWorkflowToFinish;
-import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteGenericVnf;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteGenericVnf_404;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfById;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.camunda.bpm.engine.test.Deployment;
-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.common.workflow.service.WorkflowResponse;
-import org.openecomp.mso.bpmn.mock.FileUtil;
-
-/**
- * Please describe the DeleteVnfInfra.java class
- *
- */
-public class DeleteVnfInfraTest extends WorkflowTest {
-
- private String deleteVnfInfraRequest;
- private String deleteVnfInfraRequestCascadeDelete;
-
- public DeleteVnfInfraTest () throws IOException {
- deleteVnfInfraRequest = FileUtil.readResourceFile("__files/InfrastructureFlows/CreateVnfInfraRequest.json");
- deleteVnfInfraRequestCascadeDelete = FileUtil.readResourceFile("__files/InfrastructureFlows/DeleteVnfInfraRequestCascadeDelete.json");
- }
-
- @Test
- @Deployment(resources = {"subprocess/GenericGetVnf.bpmn",
- "subprocess/GenericDeleteVnf.bpmn",
- "subprocess/DoDeleteVnf.bpmn",
- "process/DeleteVnfInfra.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/CompleteMsoProcess.bpmn"})
- public void testDeleteVnfInfra_success() throws Exception{
-
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[?]depth=1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("GenericFlows/getGenericVnfByNameResponse.xml")));
-
- MockDeleteGenericVnf();
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- Map<String, String> variables = new HashMap<>();
- setVariables(variables, deleteVnfInfraRequest, "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET");
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "DeleteVnfInfra", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId());
- Object cascadeDelete = BPMNUtil.getRawVariable(processEngineRule, "DeleteVnfInfra", "DELVI_cascadeDelete");
- String found = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "GENGV_FoundIndicator") ;
- String inUse = BPMNUtil.getVariable(processEngineRule, "DeleteVnfInfra", "DELVI_vnfInUse");
- String response = BPMNUtil.getVariable(processEngineRule, "DeleteVnfInfra", "WorkflowResponse");
- String workflowException = BPMNUtil.getVariable(processEngineRule, "DeleteVnfInfra", "WorkflowException");
-
- assertEquals(false, cascadeDelete);
- assertEquals("true", found);
- assertEquals("false", inUse);
- assertEquals("Success", response);
- assertEquals(null, workflowException);
- }
-
- @Test
- @Ignore // DoDeleteVnfAndModules not complete yet
- @Deployment(resources = {"subprocess/GenericGetVnf.bpmn",
- "subprocess/GenericDeleteVnf.bpmn",
- "subprocess/DoDeleteVnfAndModules.bpmn",
- "process/DeleteVnfInfra.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/CompleteMsoProcess.bpmn"})
- public void testDeleteVnfInfra_cascadeDelete() throws Exception{
- MockGetGenericVnfById();
- MockDeleteGenericVnf();
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- Map<String, String> variables = new HashMap<>();
- setVariables(variables, deleteVnfInfraRequestCascadeDelete, "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET");
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "DeleteVnfInfra", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId());
-
- String found = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "GENGV_FoundIndicator") ;
- String inUse = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "DoDVNF_vnfInUse");
- String response = BPMNUtil.getVariable(processEngineRule, "DeleteVnfInfra", "WorkflowResponse");
- String workflowException = BPMNUtil.getVariable(processEngineRule, "DeleteVnfInfra", "WorkflowException");
- Object cascadeDelete = BPMNUtil.getRawVariable(processEngineRule, "DeleteVnfInfra", "DELVI_cascadeDelete");
-
- assertEquals(true, cascadeDelete);
- assertEquals("true", found);
- assertEquals("false", inUse);
- assertEquals("Success", response);
- assertEquals(null, workflowException);
- }
-
- @Test
- @Deployment(resources = {"subprocess/GenericGetVnf.bpmn",
- "subprocess/GenericDeleteVnf.bpmn",
- "subprocess/DoDeleteVnf.bpmn",
- "process/DeleteVnfInfra.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/CompleteMsoProcess.bpmn"})
- public void testDeleteVnfInfra_success_vnfNotFound() throws Exception{
-
- MockDeleteGenericVnf_404();
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- Map<String, String> variables = new HashMap<>();
- setVariables(variables, deleteVnfInfraRequest, "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET");
-
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "DeleteVnfInfra", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId());
-
- String found = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "GENGV_FoundIndicator") ;
- String inUse = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "DoDVNF_vnfInUse");
- String response = BPMNUtil.getVariable(processEngineRule, "DeleteVnfInfra", "WorkflowResponse");
- String workflowException = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "WorkflowException");
-
- assertEquals("false", found);
- assertEquals("false", inUse);
- assertEquals("Success", response);
- assertEquals(null, workflowException);
- }
-
- @Test
- @Deployment(resources = {"subprocess/GenericGetVnf.bpmn",
- "subprocess/GenericDeleteVnf.bpmn",
- "subprocess/DoDeleteVnf.bpmn",
- "process/DeleteVnfInfra.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/CompleteMsoProcess.bpmn"})
- public void testDeleteVnfInfra_error_vnfInUse() throws Exception{
-
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[?]depth=1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("GenericFlows/getGenericVnfResponse_hasRelationships.xml")));
- MockDeleteGenericVnf();
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- Map<String, String> variables = new HashMap<>();
- setVariables(variables, deleteVnfInfraRequest, "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET");
-
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "DeleteVnfInfra", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId());
-
- String found = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "GENGV_FoundIndicator") ;
- String inUse = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "DoDVNF_vnfInUse");
- String workflowException = BPMNUtil.getVariable(processEngineRule, "DeleteVnfInfra", "SavedWorkflowException1");
-
- String exWfex = "WorkflowException[processKey=DoDeleteVnf,errorCode=5000,errorMessage=Can't Delete Generic Vnf. Generic Vnf is still in use.]";
-
- assertEquals("true", found);
- assertEquals("true", inUse);
- assertEquals(exWfex, workflowException);
- }
-
- private void setVariables(Map<String, String> variables, String request, String requestId, String siId) {
- variables.put("isDebugLogEnabled", "true");
- variables.put("bpmnRequest", request);
- variables.put("mso-request-id", requestId);
- variables.put("serviceInstanceId",siId);
- variables.put("vnfId","testVnfId123");
- }
-}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateSIRollbackTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateSIRollbackTest.java
deleted file mode 100644
index 8a6c61c89c..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateSIRollbackTest.java
+++ /dev/null
@@ -1,199 +0,0 @@
-/*-
- * ============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.infrastructure;
-
-import static org.junit.Assert.assertEquals;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteServiceInstance;
-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.StubResponseDatabase.mockUpdateRequestDB;
-import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter;
-
-import java.io.IOException;
-import java.util.HashMap;
-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;
-
-/**
- * Unit test cases for DoCreateServiceInstanceRollback.bpmn
- */
-public class DoCreateSIRollbackTest extends WorkflowTest {
- private static final String EOL = "\n";
- private final CallbackSet callbacks = new CallbackSet();
- private final String sdncAdapterCallback =
- "<output xmlns=\"com:att:sdnctl:l3api\">" + EOL +
- " <svc-request-id>((REQUEST-ID))</svc-request-id>" + EOL +
- " <ack-final-indicator>Y</ack-final-indicator>" + EOL +
- "</output>" + EOL;
-
- public DoCreateSIRollbackTest() throws IOException {
- callbacks.put("deactivate", sdncAdapterCallback);
- callbacks.put("delete", sdncAdapterCallback);
- }
-
- /**
- * Sunny day VID scenario.
- *
- * @throws Exception
- */
- //@Ignore // File not found - unable to run the test. Also, Stubs need updating..
- @Test
- @Deployment(resources = {
- "subprocess/DoCreateServiceInstanceRollback.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/GenericDeleteService.bpmn",
- "subprocess/GenericGetService.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/FalloutHandler.bpmn" })
- public void sunnyDay() throws Exception {
-
- logStart();
-
- //AAI
- MockDeleteServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "");
- MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getSINoRelations.xml");
- MockNodeQueryServiceInstanceById("MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getSIUrlById.xml");
- //SDNC
- mockSDNCAdapter(200);
- //DB
- mockUpdateRequestDB(200, "DBUpdateResponse.xml");
- String businessKey = UUID.randomUUID().toString();
-
- Map<String, Object> variables = new HashMap<>();
- setupVariables(variables);
- invokeSubProcess("DoCreateServiceInstanceRollback", businessKey, variables);
- injectSDNCCallbacks(callbacks, "deactivate");
- injectSDNCCallbacks(callbacks, "delete");
- waitForProcessEnd(businessKey, 10000);
- Assert.assertTrue(isProcessEnded(businessKey));
- String workflowException = BPMNUtil.getVariable(processEngineRule, "DoCreateServiceInstanceRollback", "WorkflowException");
- System.out.println("workflowException:\n" + workflowException);
- assertEquals(null, workflowException);
-
- logEnd();
- }
-
- // Success Scenario
- private void setupVariables(Map<String, Object> variables) {
- variables.put("isDebugLogEnabled", "true");
- variables.put("msoRequestId", "RaaTestRequestId-1");
- variables.put("mso-request-id", "RaaTestRequestId-1");
- variables.put("serviceInstanceId","MIS%252F1604%252F0026%252FSW_INTERNET");
-
- RollbackData rollbackData = new RollbackData();
-
- rollbackData.put("SERVICEINSTANCE", "serviceInstanceId", "MIS%252F1604%252F0026%252FSW_INTERNET");
- rollbackData.put("SERVICEINSTANCE", "globalCustomerId", "SDN-ETHERNET-INTERNET");
- rollbackData.put("SERVICEINSTANCE", "serviceSubscriptionType", "123456789");
- rollbackData.put("SERVICEINSTANCE", "disablerollback", "false");
- rollbackData.put("SERVICEINSTANCE", "rollbackAAI", "true");
- rollbackData.put("SERVICEINSTANCE", "rollbackSDNC", "true");
-
- String req = "<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5=\"http://org.openecomp/mso/request/types/v1\"" + EOL +
- "xmlns:sdncadapter=\"http://org.openecomp.mso/workflow/sdnc/adapter/schema/v1\" " + EOL +
- "xmlns:sdncadapterworkflow=\"http://org.openecomp/mso/workflow/schema/v1\">" + EOL +
- "<sdncadapter:RequestHeader>" + EOL +
- "<sdncadapter:RequestId>b043d290-140d-4a38-a9b6-95d3b8bd27d4</sdncadapter:RequestId>" + EOL +
- "<sdncadapter:SvcInstanceId>MIS%252F1604%252F0026%252FSW_INTERNET</sdncadapter:SvcInstanceId>" + EOL +
- "<sdncadapter:SvcAction>deactivate</sdncadapter:SvcAction>" + EOL +
- "<sdncadapter:SvcOperation>service-topology-operation</sdncadapter:SvcOperation>" + EOL +
- "<sdncadapter:CallbackUrl>http://localhost:8080/mso/SDNCAdapterCallbackService</sdncadapter:CallbackUrl>" + EOL +
- "</sdncadapter:RequestHeader>" + EOL +
- "<sdncadapterworkflow:SDNCRequestData>" + EOL +
- "<request-information>" + EOL +
- "<request-id>RaaTestRequestId-1</request-id>" + EOL +
- "<source>MSO</source>" + EOL +
- "<notification-url/>" + EOL +
- "<order-number/>" + EOL +
- "<order-version/>" + EOL +
- "<request-action>DeleteServiceInstance</request-action>" + EOL +
- "</request-information>" + EOL +
- "<service-information>" + EOL +
- "<service-id/>" + EOL +
- "<subscription-service-type>123456789</subscription-service-type>" + EOL +
- "<ecomp-model-information>" + EOL +
- "<model-invariant-uuid/>" + EOL +
- "<model-uuid/>" + EOL +
- "<model-version/>" + EOL +
- "<model-name/>" + EOL +
- "</ecomp-model-information>" + EOL +
- "<service-instance-id>MIS%252F1604%252F0026%252FSW_INTERNET</service-instance-id>" + EOL +
- "<subscriber-name/>" + EOL +
- "<global-customer-id>SDN-ETHERNET-INTERNET</global-customer-id>" + EOL +
- "</service-information>" + EOL +
- "<service-request-input>" + EOL +
- "<service-instance-name/>" + EOL +
- "</service-request-input>" + EOL +
- "</sdncadapterworkflow:SDNCRequestData>" + EOL +
- "</sdncadapterworkflow:SDNCAdapterWorkflowRequest>";
-
- String req1 = "<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5=\"http://org.openecomp/mso/request/types/v1\"" + EOL +
- "xmlns:sdncadapter=\"http://org.openecomp.mso/workflow/sdnc/adapter/schema/v1\" " + EOL +
- "xmlns:sdncadapterworkflow=\"http://org.openecomp/mso/workflow/schema/v1\">" + EOL +
- "<sdncadapter:RequestHeader>" + EOL +
- "<sdncadapter:RequestId>bca4fede-0804-4c13-af69-9e80b378150f</sdncadapter:RequestId>" + EOL +
- "<sdncadapter:SvcInstanceId>MIS%252F1604%252F0026%252FSW_INTERNET</sdncadapter:SvcInstanceId>" + EOL +
- "<sdncadapter:SvcAction>delete</sdncadapter:SvcAction>" + EOL +
- "<sdncadapter:SvcOperation>service-topology-operation</sdncadapter:SvcOperation>" + EOL +
- "<sdncadapter:CallbackUrl>http://localhost:8080/mso/SDNCAdapterCallbackService</sdncadapter:CallbackUrl>" + EOL +
- "</sdncadapter:RequestHeader>" + EOL +
- "<sdncadapterworkflow:SDNCRequestData>" + EOL +
- "<request-information>" + EOL +
- "<request-id>RaaTestRequestId-1</request-id>" + EOL +
- "<source>MSO</source>" + EOL +
- "<notification-url/>" + EOL +
- "<order-number/>" + EOL +
- "<order-version/>" + EOL +
- "<request-action>DeleteServiceInstance</request-action>" + EOL +
- "</request-information>" + EOL +
- "<service-information>" + EOL +
- "<service-id/>" + EOL +
- "<subscription-service-type>123456789</subscription-service-type>" + EOL +
- "<ecomp-model-information>" + EOL +
- "<model-invariant-uuid/>" + EOL +
- "<model-uuid/>" + EOL +
- "<model-version/>" + EOL +
- "<model-name/>" + EOL +
- "</ecomp-model-information>" + EOL +
- "<service-instance-id>MIS%252F1604%252F0026%252FSW_INTERNET</service-instance-id>" + EOL +
- "<subscriber-name/>" + EOL +
- "<global-customer-id>SDN-ETHERNET-INTERNET</global-customer-id>" + EOL +
- "</service-information>" + EOL +
- "<service-request-input>" + EOL +
- "<service-instance-name/>" + EOL +
- "</service-request-input>" + EOL +
- "</sdncadapterworkflow:SDNCRequestData>" + EOL +
- "</sdncadapterworkflow:SDNCAdapterWorkflowRequest>";
-
- rollbackData.put("SERVICEINSTANCE", "sdncDeactivate", req);
-
- rollbackData.put("SERVICEINSTANCE", "sdncDelete",req1);
- variables.put("rollbackData",rollbackData);
-
- }
-}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstanceTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstanceTest.java
deleted file mode 100644
index 4619d33ac5..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstanceTest.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*-
- * ============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.infrastructure;
-
-import static org.junit.Assert.assertEquals;
-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.MockNodeQueryServiceInstanceByName;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutServiceInstance;
-import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB;
-import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter;
-import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.MockGetServiceResourcesCatalogData;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-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;
-
-/**
- * Unit test cases for DoCreateServiceInstance.bpmn
- */
-public class DoCreateServiceInstanceTest extends WorkflowTest {
- private static final String EOL = "\n";
- private final CallbackSet callbacks = new CallbackSet();
- private final String sdncAdapterCallback =
- "<output xmlns=\"com:att:sdnctl:l3api\">" + EOL +
- " <svc-request-id>((REQUEST-ID))</svc-request-id>" + EOL +
- " <ack-final-indicator>Y</ack-final-indicator>" + EOL +
- "</output>" + EOL;
- private final String input = FileUtil.readResourceFile("__files/CreateServiceInstance/DoCreateServiceInstanceInput.json");
-
-
- public DoCreateServiceInstanceTest() throws IOException {
- callbacks.put("assign", sdncAdapterCallback);
- }
-
- /**
- * Sunny day VID scenario.
- *
- * @throws Exception
- */
- @Test
- @Ignore // 1802 merge
- @Deployment(resources = {
- "subprocess/DoCreateServiceInstance.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/GenericGetService.bpmn",
- "subprocess/GenericPutService.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/DoCreateServiceInstanceRollback.bpmn",
- "subprocess/FalloutHandler.bpmn" })
- public void sunnyDay() throws Exception {
-
- logStart();
-
- //AAI
- MockGetCustomer("MCBH-1610", "CreateServiceInstance/createServiceInstance_queryGlobalCustomerId_AAIResponse_Success.xml");
- MockPutServiceInstance("MCBH-1610", "viprsvc", "RaaTest-si-id", "");
- MockGetServiceInstance("MCBH-1610", "viprsvc", "RaaTest-si-id", "GenericFlows/getServiceInstance.xml");
- MockNodeQueryServiceInstanceByName("RAATest-si", "");
-
- MockNodeQueryServiceInstanceById("RaaTest-si-id", "");
- MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getSINoRelations.xml");
- MockNodeQueryServiceInstanceById("MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getSIUrlById.xml");
- //SDNC
- mockSDNCAdapter(200);
- //DB
- mockUpdateRequestDB(200, "DBUpdateResponse.xml");
- //Catalog DB
- MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef","InfrastructureFlows/DoCreateServiceInstance_request.json");
-
- String businessKey = UUID.randomUUID().toString();
-
- Map<String, Object> variables = new HashMap<>();
- setupVariables(variables);
- invokeSubProcess("DoCreateServiceInstance", businessKey, variables);
- injectSDNCCallbacks(callbacks, "assign");
- waitForProcessEnd(businessKey, 10000);
- Assert.assertTrue(isProcessEnded(businessKey));
- String workflowException = BPMNUtil.getVariable(processEngineRule, "DoCreateServiceInstance", "WorkflowException");
- System.out.println("workflowException:\n" + workflowException);
- assertEquals(null, workflowException);
-
- logEnd();
- }
-
- // Success Scenario
- private void setupVariables(Map<String, Object> variables) {
- variables.put("mso-request-id", "RaaDSITest1");
- variables.put("isDebugLogEnabled", "true");
- variables.put("msoRequestId", "RaaDSITestRequestId-1");
- variables.put("serviceInstanceId","RaaTest-si-id");
- variables.put("serviceModelInfo", "{\"modelType\":\"service\",\"modelInvariantUuid\":\"uuid-miu-svc-011-abcdef\",\"modelVersionUuid\":\"ASDC_TOSCA_UUID\",\"modelName\":\"SIModelName1\",\"modelVersion\":\"2\",\"projectName\":\"proj123\",\"owningEntityId\":\"id123\",\"owningEntityName\":\"name123\"}");
- variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
- variables.put("globalSubscriberId", "MCBH-1610");
- variables.put("subscriptionServiceType", "viprsvc");
- variables.put("instanceName", "RAATest-1");
- variables.put("serviceInstanceName", "RAT-123");
- variables.put("sdncVersion", "1611");
- variables.put("serviceType", "PORT-MIRROR");
- variables.put("requestJson", input);
- }
-} \ No newline at end of file
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstanceV2Test.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstanceV2Test.java
deleted file mode 100644
index a61c8298bc..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstanceV2Test.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*-
- * ============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.infrastructure;
-
-import static org.junit.Assert.assertEquals;
-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;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-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.core.domain.ServiceDecomposition;
-import org.openecomp.mso.bpmn.mock.FileUtil;
-/**
- * Unit test cases for DoCreateServiceInstanceV2.bpmn
- */
-public class DoCreateServiceInstanceV2Test extends WorkflowTest {
-
- private final String input = FileUtil.readResourceFile("__files/CreateServiceInstance/DoCreateServiceInstanceInput.json");
- ServiceDecomposition serviceDecomposition = new ServiceDecomposition("{\"serviceResources\":{\"project\": {\"projectName\": \"projectName\"},\"owningEntity\": {\"owningEntityId\": \"id123\",\"owningEntityName\": \"name123\"}}}","abc123");
-
- public DoCreateServiceInstanceV2Test() throws IOException {
-
-
- }
-
- /**
- * Sunny day VID scenario.
- *
- * @throws Exception
- */
- @Ignore // 1802 merge
- @Test
- @Deployment(resources = {
- "subprocess/DoCreateServiceInstanceV2.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/DoCreateServiceInstanceRollback.bpmn",
- "subprocess/DoCreateServiceInstanceRollbackV2.bpmn",
- "subprocess/FalloutHandler.bpmn" })
-
- public void sunnyDay() throws Exception {
-
- logStart();
-
- //SDNC
- mockSDNCAdapter(200);
- //DB
- mockUpdateRequestDB(200, "DBUpdateResponse.xml");
- //Catalog DB
- MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef","InfrastructureFlows/DoCreateServiceInstance_request.json");
-
- String businessKey = UUID.randomUUID().toString();
-
- Map<String, Object> variables = new HashMap<String, Object>();
- setupVariables(variables);
- invokeSubProcess("DoCreateServiceInstanceV2", businessKey, variables);
- waitForProcessEnd(businessKey, 10000);
- Assert.assertTrue(isProcessEnded(businessKey));
- String workflowException = BPMNUtil.getVariable(processEngineRule, "DoCreateServiceInstanceV2", "WorkflowException");
- System.out.println("workflowException:\n" + workflowException);
- assertEquals(null, workflowException);
-
- logEnd();
- }
-
- // Success Scenario
- private void setupVariables(Map<String, Object> variables) {
- variables.put("isDebugLogEnabled", "true");
- variables.put("msoRequestId", "RaaDSITestRequestId-1");
- variables.put("serviceInstanceId","RaaTest-si-id");
- //variables.put("serviceModelInfo", "{\"modelType\":\"service\",\"modelInvariantUuid\":\"uuid-miu-svc-011-abcdef\",\"modelVersionUuid\":\"ASDC_TOSCA_UUID\",\"modelName\":\"SIModelName1\",\"modelVersion\":\"2\",\"projectName\":\"proj123\",\"owningEntityId\":\"id123\",\"owningEntityName\":\"name123\"}");
- variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
- variables.put("globalSubscriberId", "MCBH-1610");
- variables.put("subscriptionServiceType", "viprsvc");
- variables.put("serviceInstanceName", "RAT-123");
- variables.put("sdncVersion", "1611");
- variables.put("serviceModelInfo", input);
- variables.put("serviceDecomposition", serviceDecomposition);
- variables.put("serviceType", "12e");
- }
-} \ No newline at end of file
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstanceV3Test.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstanceV3Test.java
deleted file mode 100644
index 88a329b027..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstanceV3Test.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*-
- * ============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.infrastructure;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-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.WorkflowTest;
-import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition;
-import org.openecomp.mso.bpmn.core.json.JsonDecomposingException;
-
-/**
- * Unit test cases for DoCreateServiceInstanceV3.bpmn
- */
-public class DoCreateServiceInstanceV3Test extends WorkflowTest {
-
- public DoCreateServiceInstanceV3Test() throws IOException {
-
- }
-
- @Test
- @Deployment(resources = { "subprocess/DoCreateServiceInstanceV3.bpmn",
- "subprocess/DoCreateServiceInstanceV3Rollback.bpmn"
- })
- @Ignore // 1802 merge
- public void sunnyDay() throws Exception {
- logStart();
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<String, Object>();
- setupVariables(variables);
- invokeSubProcess("DoCreateServiceInstanceV3", businessKey, variables);
- waitForProcessEnd(businessKey, 10000);
- Assert.assertTrue(isProcessEnded(businessKey));
- logEnd();
- }
-
- // Success Scenario
- private void setupVariables(Map<String, Object> variables) throws JsonDecomposingException {
- variables.put("abc", "thevalueisabc");
- variables.put("mso-request-id", "213");
- ServiceDecomposition serviceDecomp = new ServiceDecomposition("{\"serviceResources\":{}}", "123");
- serviceDecomp.setServiceType("PORT-MIRRO");
- serviceDecomp.setSdncVersion("1610");
- variables.put("serviceDecomposition", serviceDecomp);
- }
-} \ No newline at end of file
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVfModuleRollbackTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVfModuleRollbackTest.java
deleted file mode 100644
index 25787c79b6..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVfModuleRollbackTest.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/*-
- * ============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.infrastructure;
-
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteGenericVnf;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteVfModuleId;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithDepth;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetVfModuleId;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchGenericVnf;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchVfModuleId;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutGenericVnf;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutVfModuleIdNoResponse;
-import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter;
-import static org.openecomp.mso.bpmn.mock.StubResponseVNFAdapter.mockVNFDelete;
-
-import java.io.IOException;
-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.WorkflowTest;
-import org.openecomp.mso.bpmn.core.RollbackData;
-import org.openecomp.mso.bpmn.core.WorkflowException;
-
-/**
- * Unit test for DoDeleteVfModule.bpmn.
- */
-public class DoCreateVfModuleRollbackTest extends WorkflowTest {
- private final CallbackSet callbacks = new CallbackSet();
-
- private static final String EOL = "\n";
-
- private final String vnfAdapterDeleteCallback =
- "<deleteVfModuleResponse>" + EOL +
- " <vnfId>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnfId>" + EOL +
- " <vfModuleId>973ed047-d251-4fb9-bf1a-65b8949e0a73</vfModuleId>" + EOL +
- " <vfModuleDeleted>true</vfModuleDeleted>" + EOL +
- " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
- "</deleteVfModuleResponse>" + EOL;
-
- private final String vnfAdapterDeleteCallbackFail =
- "<vfModuleException>" + EOL +
- " <message>Error processing request to VNF-Async. Not Found.</message>" + EOL +
- " <category>INTERNAL</category>" + EOL +
- " <rolledBack>false</rolledBack>" + EOL +
- " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
- "</vfModuleException>" + EOL;
-
- private final String sdncAdapterDeleteCallback =
- "<output xmlns=\"org:onap:sdnctl:l3api\">" + EOL +
- " <svc-request-id>{{REQUEST-ID}}</svc-request-id>" + EOL +
- " <ack-final-indicator>Y</ack-final-indicator>" + EOL +
- "</output>" + EOL;
-
- public DoCreateVfModuleRollbackTest() throws IOException {
- callbacks.put("sdncChangeDelete", sdncAdapterDeleteCallback);
- callbacks.put("sdncDelete", sdncAdapterDeleteCallback);
- callbacks.put("vnfDelete", vnfAdapterDeleteCallback);
- callbacks.put("vnfDeleteFail", vnfAdapterDeleteCallbackFail);
- }
-
- @Test
-
- @Deployment(resources = {
- "subprocess/DoCreateVfModuleRollback.bpmn",
- "subprocess/PrepareUpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn",
- "subprocess/DeleteAAIVfModule.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn"
- })
- public void TestCreateVfModuleRollbackSuccess() {
- logStart();
-
- mockSDNCAdapter("/SDNCAdapter", "SvcAction>delete", 200, "DeleteGenericVNFV1/sdncAdapterResponse.xml");
- mockVNFDelete("a27ce5a9-29c4-4c22-a017-6615ac73c721", "/973ed047-d251-4fb9-bf1a-65b8949e0a73", 202);
- MockDeleteGenericVnf("a27ce5a9-29c4-4c22-a017-6615ac73c721", "0000021", 200);
- MockDeleteVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73", "0000073", 200);
- MockPutVfModuleIdNoResponse("a27ce5a9-29c4-4c22-a017-6615ac73c721", "MMSC", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
- MockPutGenericVnf("a27ce5a9-29c4-4c22-a017-6615ac73c721");
- MockGetGenericVnfByIdWithDepth("a27ce5a9-29c4-4c22-a017-6615ac73c721", 1, "DoCreateVfModuleRollback/GenericVnf.xml");
- MockGetVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73", "DoCreateVfModuleRollback/GenericVnfVfModule.xml", 200);
- MockPatchGenericVnf("a27ce5a9-29c4-4c22-a017-6615ac73c721");
- MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- RollbackData rollbackData = new RollbackData();
- rollbackData.put("VFMODULE", "source", "PORTAL");
- rollbackData.put("VFMODULE", "vnfid", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- rollbackData.put("VFMODULE", "vnfname", "STMTN5MMSC21");
- rollbackData.put("VFMODULE", "vnftype", "asc_heat-int");
- rollbackData.put("VFMODULE", "vfmoduleid", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
- rollbackData.put("VFMODULE", "vfmodulename", "STMTN5MMSC21-MMSC::module-0-0");
- rollbackData.put("VFMODULE", "tenantid", "fba1bd1e195a404cacb9ce17a9b2b421");
- rollbackData.put("VFMODULE", "aiccloudregion", "RDM2WAGPLCP");
- rollbackData.put("VFMODULE", "heatstackid", "thisisaheatstack");
- rollbackData.put("VFMODULE", "contrailNetworkPolicyFqdn0", "MSOTest:DefaultPolicyFQDN1");
- rollbackData.put("VFMODULE", "contrailNetworkPolicyFqdn1", "MSOTest:DefaultPolicyFQDN2");
- rollbackData.put("VFMODULE", "oamManagementV6Address", "2000:abc:bce:1111");
- rollbackData.put("VFMODULE", "oamManagementV4Address", "127.0.0.1");
-
- rollbackData.put("VFMODULE", "rollbackPrepareUpdateVfModule", "true");
- rollbackData.put("VFMODULE", "rollbackVnfAdapterCreate", "true");
- rollbackData.put("VFMODULE", "rollbackUpdateAAIVfModule", "true");
- rollbackData.put("VFMODULE", "rollbackSDNCRequestActivate", "true");
- rollbackData.put("VFMODULE", "rollbackCreateAAIVfModule", "true");
- rollbackData.put("VFMODULE", "rollbackCreateNetworkPoliciesAAI", "true");
- rollbackData.put("VFMODULE", "rollbackUpdateVnfAAI", "true");
-
-
-
- variables.put("isDebugLogEnabled","true");
- variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("mso-service-instance-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- rollbackData.put("VFMODULE", "msorequestid", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- rollbackData.put("VFMODULE", "serviceinstanceid", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("rollbackData", rollbackData);
- variables.put("sdncVersion", "1702");
- invokeSubProcess("DoCreateVfModuleRollback", businessKey, variables);
-
- // "changedelete" operation not required for deleting a Vf Module
-// injectSDNCCallbacks(callbacks, "sdncChangeDelete");
- injectVNFRestCallbacks(callbacks, "vnfDelete");
- waitForRunningProcessCount("vnfAdapterDeleteV1", 0, 120000);
- injectSDNCCallbacks(callbacks, "sdncDelete");
-
- waitForProcessEnd(businessKey, 10000);
- WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- checkVariable(businessKey, "WorkflowException", null);
- if (wfe != null) {
- System.out.println("TestCreateVfModuleSuccess: ErrorCode=" + wfe.getErrorCode() +
- ", ErrorMessage=" + wfe.getErrorMessage());
- }
- logEnd();
- }
-
-
-}
-
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVfModuleTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVfModuleTest.java
deleted file mode 100644
index 490d31023b..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVfModuleTest.java
+++ /dev/null
@@ -1,477 +0,0 @@
-/*-
- * ============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.infrastructure;
-
-
-import static org.openecomp.mso.bpmn.common.BPMNUtil.getRawVariable;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockAAIVfModule;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithDepth;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithPriority;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetVfModuleByName;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchGenericVnf;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchVfModuleId;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutGenericVnf;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutNetwork;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutVfModuleIdNoResponse;
-import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.MockGetServiceResourcesCatalogData;
-import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.MockGetVnfCatalogDataCustomizationUuid;
-import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB;
-import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter;
-import static org.openecomp.mso.bpmn.mock.StubResponseVNFAdapter.mockVNFPost;
-
-import java.io.IOException;
-import java.util.HashMap;
-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.WorkflowTest;
-import org.openecomp.mso.bpmn.mock.FileUtil;
-
-/**
- * Unit tests for DoCreateVfModuleTest.bpmn.
- */
-public class DoCreateVfModuleTest extends WorkflowTest {
-
- private final CallbackSet callbacks = new CallbackSet();
-
- public DoCreateVfModuleTest() throws IOException {
- callbacks.put("assign", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyAssignCallback.xml"));
- callbacks.put("query", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyQueryCallback.xml"));
- callbacks.put("queryVnf", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyQueryCallbackVnf.xml"));
- callbacks.put("queryModuleNoVnf", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyQueryCallbackVfModuleNoVnf.xml"));
- callbacks.put("queryModule", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyQueryCallbackVfModule.xml"));
- callbacks.put("activate", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
- callbacks.put("vnfCreate", FileUtil.readResourceFile(
- "__files/VfModularity/VNFAdapterRestCreateCallback.xml"));
- }
-
- /**
- * Test the sunny day scenario.
- */
- @Test
-
- @Deployment(resources = {
- "subprocess/DoCreateVfModule.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/GenericGetVnf.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn",
- "subprocess/ConfirmVolumeGroupTenant.bpmn",
- "subprocess/ConfirmVolumeGroupName.bpmn",
- "subprocess/CreateAAIVfModule.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/CreateAAIVfModuleVolumeGroup.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn"
- })
- public void sunnyDay() throws IOException {
-
- logStart();
-
- MockAAIVfModule();
- MockPatchGenericVnf("skask");
- MockPatchVfModuleId("skask", ".*");
- mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml");
- mockVNFPost("", 202, "skask");
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
- //Catalog DB
- MockGetServiceResourcesCatalogData("aa5256d2-5a33-55df-13ab-12abad84e7ff","InfrastructureFlows/DoCreateServiceInstance_request.json");
-
- String businessKey = UUID.randomUUID().toString();
- //RuntimeService runtimeService = processEngineRule.getRuntimeService();
-
- Map<String, Object> variables = setupVariablesSunnyDayBuildingBlocks();
- //runtimeService.startProcessInstanceByKey("DoCreateVfModule", variables);
- invokeSubProcess("DoCreateVfModule", businessKey, variables);
-
- injectSDNCCallbacks(callbacks, "queryVnf");
- injectSDNCCallbacks(callbacks, "assign, queryModuleNoVnf");
- injectVNFRestCallbacks(callbacks, "vnfCreate");
- injectSDNCCallbacks(callbacks, "activate");
-
- waitForProcessEnd(businessKey, 10000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- Assert.assertTrue((boolean) getRawVariable(processEngineRule, "DoCreateVfModule", "DCVFM_SuccessIndicator"));
-
- logEnd();
- }
-
- /**
- * Test the sunny day scenario with 1702 SDNC interaction.
- */
- @Test
-
- @Deployment(resources = {
- "subprocess/DoCreateVfModule.bpmn",
- "subprocess/GenericGetVnf.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn",
- "subprocess/ConfirmVolumeGroupTenant.bpmn",
- "subprocess/ConfirmVolumeGroupName.bpmn",
- "subprocess/CreateAAIVfModule.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/CreateAAIVfModuleVolumeGroup.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn"
- })
- public void sunnyDay_1702() throws IOException {
-
- logStart();
-
- MockGetGenericVnfByIdWithPriority("skask", ".*", 200, "VfModularity/VfModule-new.xml", 5);
- MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml");
- MockPutVfModuleIdNoResponse("skask", "PCRF", ".*");
- MockPutNetwork(".*", "VfModularity/AddNetworkPolicy_AAIResponse_Success.xml", 200);
- MockPutGenericVnf("skask");
- mockSDNCAdapter("/SDNCAdapter", "vnf-type>STMTN", 200, "VfModularity/StandardSDNCSynchResponse.xml");
- mockSDNCAdapter("/SDNCAdapter", "SvcAction>query", 200, "VfModularity/StandardSDNCSynchResponse.xml");
- mockVNFPost("", 202, "skask");
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
- MockPatchGenericVnf("skask");
- MockPatchVfModuleId("skask", ".*");
- //Catalog DB
- MockGetServiceResourcesCatalogData("aa5256d2-5a33-55df-13ab-12abad84e7ff","InfrastructureFlows/DoCreateServiceInstance_request.json");
-
-
- String businessKey = UUID.randomUUID().toString();
- //RuntimeService runtimeService = processEngineRule.getRuntimeService();
-
- Map<String, Object> variables = setupVariablesSunnyDayBuildingBlocks();
- variables.put("sdncVersion", "1702");
- //runtimeService.startProcessInstanceByKey("DoCreateVfModule", variables);
- invokeSubProcess("DoCreateVfModule", businessKey, variables);
-
-
- injectSDNCCallbacks(callbacks, "assign, queryModule");
- injectVNFRestCallbacks(callbacks, "vnfCreate");
- injectSDNCCallbacks(callbacks, "activate");
-
- waitForProcessEnd(businessKey, 10000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- Assert.assertTrue((boolean) getRawVariable(processEngineRule, "DoCreateVfModule", "DCVFM_SuccessIndicator"));
-
- logEnd();
- }
-
- /**
- * Test the sunny day scenario.
- */
- @Test
-
- @Deployment(resources = {
- "subprocess/DoCreateVfModule.bpmn",
- "subprocess/GenerateVfModuleName.bpmn",
- "subprocess/GenericGetVnf.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn",
- "subprocess/ConfirmVolumeGroupTenant.bpmn",
- "subprocess/ConfirmVolumeGroupName.bpmn",
- "subprocess/CreateAAIVfModule.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/CreateAAIVfModuleVolumeGroup.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn"
- })
- public void sunnyDay_withVfModuleNameGeneration() throws IOException {
-
- logStart();
-
- MockGetGenericVnfByIdWithPriority("skask", ".*", 200, "VfModularity/VfModule-new.xml", 5);
- MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml");
- MockPutVfModuleIdNoResponse("skask", "PCRF", ".*");
- MockPutNetwork(".*", "VfModularity/AddNetworkPolicy_AAIResponse_Success.xml", 200);
- MockPutGenericVnf("skask");
- MockAAIVfModule();
- mockSDNCAdapter("/SDNCAdapter", "vnf-type>STMTN", 200, "VfModularity/StandardSDNCSynchResponse.xml");
- mockSDNCAdapter("/SDNCAdapter", "SvcAction>query", 200, "VfModularity/StandardSDNCSynchResponse.xml");
- mockVNFPost("", 202, "skask");
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
- MockPatchGenericVnf("skask");
- MockPatchVfModuleId("skask", ".*");
- //Catalog DB
- MockGetServiceResourcesCatalogData("aa5256d2-5a33-55df-13ab-12abad84e7ff","InfrastructureFlows/DoCreateServiceInstance_request.json");
-
- String businessKey = UUID.randomUUID().toString();
- //RuntimeService runtimeService = processEngineRule.getRuntimeService();
-
- Map<String, Object> variables = setupVariablesSunnyDayBuildingBlocks();
- variables.put("vfModuleName", null);
- variables.put("vfModuleLabel", "MODULELABEL");
- variables.put("sdncVersion", "1702");
- //runtimeService.startProcessInstanceByKey("DoCreateVfModule", variables);
- invokeSubProcess("DoCreateVfModule", businessKey, variables);
-
- injectSDNCCallbacks(callbacks, "assign, query");
- injectVNFRestCallbacks(callbacks, "vnfCreate");
- injectSDNCCallbacks(callbacks, "activate");
-
- waitForProcessEnd(businessKey, 10000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- Assert.assertTrue((boolean) getRawVariable(processEngineRule, "DoCreateVfModule", "DCVFM_SuccessIndicator"));
-
- logEnd();
- }
-
- /**
- * Test the sunny day scenario for the aLaCarte request with no multiStageDesign
- */
- @Test
-
- @Deployment(resources = {
- "subprocess/DoCreateVfModule.bpmn",
- "subprocess/GenericGetVnf.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn",
- "subprocess/ConfirmVolumeGroupTenant.bpmn",
- "subprocess/ConfirmVolumeGroupName.bpmn",
- "subprocess/CreateAAIVfModule.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/CreateAAIVfModuleVolumeGroup.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn"
- })
- public void sunnyDay_aLaCarte_noMultistage() throws IOException {
-
- logStart();
-
- MockGetGenericVnfByIdWithPriority("skask", ".*", 200, "VfModularity/VfModule-new.xml", 5);
- MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml");
- MockPutVfModuleIdNoResponse("skask", "PCRF", ".*");
- MockPutNetwork(".*", "VfModularity/AddNetworkPolicy_AAIResponse_Success.xml", 200);
- MockPutGenericVnf("skask");
- mockSDNCAdapter("/SDNCAdapter", "vnf-type>STMTN", 200, "VfModularity/StandardSDNCSynchResponse.xml");
- mockSDNCAdapter("/SDNCAdapter", "SvcAction>query", 200, "VfModularity/StandardSDNCSynchResponse.xml");
- mockVNFPost("", 202, "skask");
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
- MockPatchGenericVnf("skask");
- MockPatchVfModuleId("skask", ".*");
- //Catalog DB
- MockGetServiceResourcesCatalogData("aa5256d2-5a33-55df-13ab-12abad84e7ff","InfrastructureFlows/DoCreateServiceInstance_request.json");
- MockGetVnfCatalogDataCustomizationUuid("VNF-MODEL-123", "VIPR/getCatalogVnfNoTwoPhasedForVfModule.json");
-
- String businessKey = UUID.randomUUID().toString();
- //RuntimeService runtimeService = processEngineRule.getRuntimeService();
-
- Map<String, Object> variables = setupVariablesSunnyDayBuildingBlocks();
- variables.put("sdncVersion", "1702");
- variables.put("aLaCarte", true);
- //runtimeService.startProcessInstanceByKey("DoCreateVfModule", variables);
- invokeSubProcess("DoCreateVfModule", businessKey, variables);
-
-
- injectSDNCCallbacks(callbacks, "assign, queryModule");
- injectVNFRestCallbacks(callbacks, "vnfCreate");
- injectSDNCCallbacks(callbacks, "activate");
-
- waitForProcessEnd(businessKey, 10000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- Assert.assertTrue((boolean) getRawVariable(processEngineRule, "DoCreateVfModule", "DCVFM_SuccessIndicator"));
-
- logEnd();
- }
-
- /**
- * Test the sunny day scenario for the first stage of multistage design.
- */
- @Test
-
- @Deployment(resources = {
- "subprocess/DoCreateVfModule.bpmn",
- "subprocess/GenericGetVnf.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn",
- "subprocess/ConfirmVolumeGroupTenant.bpmn",
- "subprocess/ConfirmVolumeGroupName.bpmn",
- "subprocess/CreateAAIVfModule.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/CreateAAIVfModuleVolumeGroup.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn"
- })
- public void sunnyDay_1st_of_multistage() throws IOException {
-
- logStart();
-
- MockGetGenericVnfByIdWithPriority("skask", ".*", 200, "VfModularity/VfModule-new.xml", 5);
- MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml");
- MockPutVfModuleIdNoResponse("skask", "PCRF", ".*");
- MockPutNetwork(".*", "VfModularity/AddNetworkPolicy_AAIResponse_Success.xml", 200);
- MockPutGenericVnf("skask");
- mockSDNCAdapter("/SDNCAdapter", "vnf-type>STMTN", 200, "VfModularity/StandardSDNCSynchResponse.xml");
- mockSDNCAdapter("/SDNCAdapter", "SvcAction>query", 200, "VfModularity/StandardSDNCSynchResponse.xml");
- mockVNFPost("", 202, "skask");
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
- MockPatchGenericVnf("skask");
- MockPatchVfModuleId("skask", ".*");
- //Catalog DB
- MockGetServiceResourcesCatalogData("aa5256d2-5a33-55df-13ab-12abad84e7ff","InfrastructureFlows/DoCreateServiceInstance_request.json");
- MockGetVnfCatalogDataCustomizationUuid("VNF-MODEL-123", "VIPR/getCatalogVnfYesTwoPhasedForVfModule.json");
-
- String businessKey = UUID.randomUUID().toString();
- //RuntimeService runtimeService = processEngineRule.getRuntimeService();
-
- Map<String, Object> variables = setupVariablesSunnyDayBuildingBlocks();
- variables.put("sdncVersion", "1702");
- variables.put("aLaCarte", true);
- //runtimeService.startProcessInstanceByKey("DoCreateVfModule", variables);
- invokeSubProcess("DoCreateVfModule", businessKey, variables);
-
- injectSDNCCallbacks(callbacks, "assign");
-
- waitForProcessEnd(businessKey, 10000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- Assert.assertTrue((boolean) getRawVariable(processEngineRule, "DoCreateVfModule", "DCVFM_SuccessIndicator"));
-
- logEnd();
- }
-
- /**
- * Test the sunny day scenario for the second stage of multiStageDesign
- */
- @Test
-
- @Deployment(resources = {
- "subprocess/DoCreateVfModule.bpmn",
- "subprocess/GenericGetVnf.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn",
- "subprocess/ConfirmVolumeGroupTenant.bpmn",
- "subprocess/ConfirmVolumeGroupName.bpmn",
- "subprocess/CreateAAIVfModule.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/CreateAAIVfModuleVolumeGroup.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn"
- })
- public void sunnyDay_2nd_of_multistage() throws IOException {
-
- logStart();
-
- MockGetGenericVnfByIdWithPriority("skask", ".*", 200, "VfModularity/VfModule-new.xml", 5);
- MockGetVfModuleByName("skask", "PCRF%3A%3Amodule-0-2","VfModularity/VfModule-new-PendingActivation.xml", 200);
- MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml");
- MockPutVfModuleIdNoResponse("skask", "PCRF", ".*");
- MockPutNetwork(".*", "VfModularity/AddNetworkPolicy_AAIResponse_Success.xml", 200);
- MockPutGenericVnf("skask");
- mockSDNCAdapter("/SDNCAdapter", "vnf-type>STMTN", 200, "VfModularity/StandardSDNCSynchResponse.xml");
- mockSDNCAdapter("/SDNCAdapter", "SvcAction>query", 200, "VfModularity/StandardSDNCSynchResponse.xml");
- mockVNFPost("", 202, "skask");
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
- MockPatchGenericVnf("skask");
- MockPatchVfModuleId("skask", ".*");
- //Catalog DB
- MockGetServiceResourcesCatalogData("aa5256d2-5a33-55df-13ab-12abad84e7ff","InfrastructureFlows/DoCreateServiceInstance_request.json");
-
-
- String businessKey = UUID.randomUUID().toString();
- //RuntimeService runtimeService = processEngineRule.getRuntimeService();
-
- Map<String, Object> variables = setupVariablesSunnyDayBuildingBlocks();
- variables.put("sdncVersion", "1702");
- variables.put("aLaCarte", true);
- //runtimeService.startProcessInstanceByKey("DoCreateVfModule", variables);
- invokeSubProcess("DoCreateVfModule", businessKey, variables);
-
- injectSDNCCallbacks(callbacks, "queryModule");
- injectVNFRestCallbacks(callbacks, "vnfCreate");
- injectSDNCCallbacks(callbacks, "activate");
-
- waitForProcessEnd(businessKey, 10000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- Assert.assertTrue((boolean) getRawVariable(processEngineRule, "DoCreateVfModule", "DCVFM_SuccessIndicator"));
-
- logEnd();
- }
-
-
- private Map<String, Object> setupVariablesSunnyDayBuildingBlocks() {
- Map<String, Object> variables = new HashMap<>();
- //try {
- // variables.put("bpmnRequest", FileUtil.readResourceFile("__files/CreateVfModule_VID_request.json"));
- //}
- //catch (Exception e) {
-
- //}
-
- variables.put("mso-request-id", "testRequestId");
-
- variables.put("msoRequestId", "testRequestId");
- variables.put("isBaseVfModule", false);
- variables.put("isDebugLogEnabled", "true");
- variables.put("disableRollback", "true");
- //variables.put("recipeTimeout", "0");
- //variables.put("requestAction", "CREATE_VF_MODULE");
- variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
- variables.put("vnfId", "skask");
- variables.put("vnfName", "vnfname");
- variables.put("vfModuleName", "PCRF::module-0-2");
- variables.put("vnfType", "vSAMP12");
- variables.put("vfModuleId", "");
- variables.put("volumeGroupId", "");
- variables.put("serviceType", "MOG");
- variables.put("vfModuleType", "");
- variables.put("isVidRequest", "true");
- variables.put("asdcServiceModelVersion", "1.0");
- variables.put("usePreload", true);
-
- String vfModuleModelInfo = "{ "+ "\"modelType\": \"vfModule\"," +
- "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," +
- "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," +
- "\"modelName\": \"STMTN5MMSC21-MMSC::model-1-0\"," +
- "\"modelVersion\": \"1\"," +
- "\"modelCustomizationUuid\": \"MODEL-123\"" + "}";
- variables.put("vfModuleModelInfo", vfModuleModelInfo);
-
- variables.put("sdncVersion", "1707");
-
- variables.put("lcpCloudRegionId", "MDTWNJ21");
- variables.put("tenantId", "fba1bd1e195a404cacb9ce17a9b2b421");
-
- String serviceModelInfo = "{ "+ "\"modelType\": \"service\"," +
- "\"modelInvariantUuid\": \"aa5256d2-5a33-55df-13ab-12abad84e7ff\"," +
- "\"modelUuid\": \"bb6478e5-ea33-3346-ac12-ab121484a3fe\"," +
- "\"modelName\": \"SVC-STMTN5MMSC21-MMSC::model-1-0\"," +
- "\"modelVersion\": \"1\"," +
- "}";
- variables.put("serviceModelInfo", serviceModelInfo);
-
- String vnfModelInfo = "{ "+ "\"modelType\": \"vnf\"," +
- "\"modelInvariantUuid\": \"445256d2-5a33-55df-13ab-12abad84e7ff\"," +
- "\"modelUuid\": \"f26478e5-ea33-3346-ac12-ab121484a3fe\"," +
- "\"modelName\": \"VNF-STMTN5MMSC21-MMSC::model-1-0\"," +
- "\"modelVersion\": \"1\"," +
- "\"modelCustomizationUuid\": \"VNF-MODEL-123\"" + "}";
- variables.put("vnfModelInfo", vnfModelInfo);
-
- variables.put("vnfQueryPath", "/restconf/vnfQueryPath");
-
- return variables;
-
- }
-}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVfModuleVolumeV2Test.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVfModuleVolumeV2Test.java
deleted file mode 100644
index e9082d9d65..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVfModuleVolumeV2Test.java
+++ /dev/null
@@ -1,240 +0,0 @@
-/*-
- * ============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.infrastructure;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-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.WorkflowTest;
-import org.openecomp.mso.bpmn.core.WorkflowException;
-import org.openecomp.mso.bpmn.mock.FileUtil;
-
-@Ignore
-public class DoCreateVfModuleVolumeV2Test extends WorkflowTest {
-
- public static final String _prefix = "CVFMODVOL2_";
-
- private final CallbackSet callbacks = new CallbackSet();
-
- public DoCreateVfModuleVolumeV2Test() throws IOException {
- callbacks.put("volumeGroupCreate", FileUtil.readResourceFile(
- "__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeCallbackResponse.xml"));
- callbacks.put("volumeGroupRollback", FileUtil.readResourceFile(
- "__files/DoCreateVfModuleVolumeV1/RollbackVfModuleVolumeCallbackResponse.xml"));
- }
-
- /**
- * Happy Path
- * @throws Exception
- */
- @Test
- //@Ignore
- @Deployment(resources = {"subprocess/DoCreateVfModuleVolumeV2.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/vnfAdapterRestV1.bpmn",
- "subprocess/DoCreateVfModuleVolumeRollback.bpmn"})
- public void TestHappyPath() throws Exception {
-
- logStart();
-
-// DoCreateVfModuleVolume_Success();
-
- String businessKey = UUID.randomUUID().toString();
- String createVfModuleVolRequest = FileUtil.readResourceFile("__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeRequest.xml");
-
- Map<String, Object> testVariables = new HashMap<>();
- testVariables.put("volumeGroupId", "TEST-VOLUME-VOLUME-GROUP-ID-0123");
- testVariables.put("vnfId", "TEST-VNF-ID-0123");
- testVariables.put("lcpCloudRegionId", "AAIAIC25");
- testVariables.put("test-volume-group-name", "MSOTESTVOL101a-vSAMP12_base_vol_module-01");
- testVariables.put("test-volume-group-id", "TEST-VOLUME-GROUP-ID-0123");
- //testVariables.put("DoCreateVfModuleVolumeV1Request", createVfModuleVolRequest);
- TestAsyncResponse asyncResponse = invokeAsyncProcess("DoCreateVfModuleVolumeV2", "v1", businessKey, createVfModuleVolRequest, testVariables);
-
- injectVNFRestCallbacks(callbacks, "volumeGroupCreate");
-
- waitForProcessEnd(businessKey, 100000);
- checkVariable(businessKey, "DCVFMODVOLV2_SuccessIndicator", true);
-
- logEnd();
- }
-
- @Test
-// @Ignore
- @Deployment(resources = {"subprocess/DoCreateVfModuleVolumeV2.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/vnfAdapterRestV1.bpmn",
- "subprocess/DoCreateVfModuleVolumeRollback.bpmn"})
- public void TestVolumeGroupExistError() throws Exception {
-
- logStart();
-
-// DoCreateVfModuleVolume_VolumeGroupExistsFail();
-
- String businessKey = UUID.randomUUID().toString();
- String createVfModuleVolRequest = FileUtil.readResourceFile("__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeRequest.xml");
-
- Map<String, Object> testVariables = new HashMap<>();
- testVariables.put("DCVFMODVOLV2_volumeGroupId", "TEST-VOLUME-VOLUME-GROUP-ID-0123");
- testVariables.put("vnf-id", "TEST-VNF-ID-0123");
- testVariables.put("volume-group-id", "TEST-VOLUME-GROUP-ID-0123");
- testVariables.put("test-volume-group-name", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0");
- testVariables.put("DoCreateVfModuleVolumeV1Request", createVfModuleVolRequest);
- TestAsyncResponse asyncResponse = invokeAsyncProcess("DoCreateVfModuleVolumeV2", "v1", businessKey, createVfModuleVolRequest, testVariables);
-
- //injectVNFRestCallbacks(callbacks, "volumeGroupCreate");
-
- waitForProcessEnd(businessKey, 100000);
- WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "SavedWorkflowException1");
- Assert.assertTrue(wfe.getErrorCode() == 2500);
- Assert.assertTrue(wfe.getErrorMessage().startsWith("Generic vnf null was not found in AAI. Return code: 404."));
- checkVariable(businessKey, "DCVFMODVOLV2_SuccessIndicator", false);
-
- logEnd();
- }
-
- /**
- * Will trigger AAI create rollback
- * @throws Exception
- */
- @Test
-// @Ignore
- @Deployment(resources = {"subprocess/DoCreateVfModuleVolumeV2.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/vnfAdapterRestV1.bpmn",
- "subprocess/DoCreateVfModuleVolumeRollback.bpmn"})
- public void TestVnfVolumeGroupCreateError() throws Exception {
-
- logStart();
-
-// DoCreateVfModuleVolume_VnfCreateVolumeGroupFail();
-
- String businessKey = UUID.randomUUID().toString();
- String createVfModuleVolRequest = FileUtil.readResourceFile("__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeRequest.xml");
-
- Map<String, Object> testVariables = new HashMap<>();
- testVariables.put("DCVFMODVOLV2_volumeGroupId", "TEST-VOLUME-VOLUME-GROUP-ID-0123");
- testVariables.put("vnf-id", "TEST-VNF-ID-0123");
- testVariables.put("volume-group-id", "TEST-VOLUME-GROUP-ID-0123");
- testVariables.put("test-volume-group-name", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0");
- testVariables.put("test-volume-group-id", "TEST-VOLUME-GROUP-ID-0123");
- testVariables.put("DoCreateVfModuleVolumeV1Request", createVfModuleVolRequest);
- TestAsyncResponse asyncResponse = invokeAsyncProcess("DoCreateVfModuleVolumeV2", "v1", businessKey, createVfModuleVolRequest, testVariables);
-
- //injectVNFRestCallbacks(callbacks, "volumeGroupCreate");
-
- waitForProcessEnd(businessKey, 100000);
- checkVariable(businessKey, "DCVFMODVOLV2_SuccessIndicator", false);
-
- logEnd();
- }
-
- /**
- * Will trigger AAI create rollback
- * @throws Exception
- */
- @Test
-// @Ignore
- @Deployment(resources = {"subprocess/DoCreateVfModuleVolumeV2.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/vnfAdapterRestV1.bpmn",
- "subprocess/DoCreateVfModuleVolumeRollback.bpmn"})
- public void TestUpdateAaiVolumeGroupError() throws Exception {
-
- logStart();
-
-// DoCreateVfModuleVolume_AaiVolumeGroupUpdateFail();
-
- String businessKey = UUID.randomUUID().toString();
- String createVfModuleVolRequest = FileUtil.readResourceFile("__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeRequest.xml");
-
- Map<String, Object> testVariables = new HashMap<>();
- testVariables.put("DCVFMODVOLV2_volumeGroupId", "TEST-VOLUME-VOLUME-GROUP-ID-0123");
- testVariables.put("vnf-id", "TEST-VNF-ID-0123");
- testVariables.put("volume-group-id", "TEST-VOLUME-GROUP-ID-0123");
- testVariables.put("test-volume-group-name", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0");
- testVariables.put("test-volume-group-id", "TEST-VOLUME-GROUP-ID-0123");
- testVariables.put("DoCreateVfModuleVolumeV1Request", createVfModuleVolRequest);
- TestAsyncResponse asyncResponse = invokeAsyncProcess("DoCreateVfModuleVolumeV2", "v1", businessKey, createVfModuleVolRequest, testVariables);
-
- // VNF callback not needed fort this failure scenario
-// injectVNFRestCallbacks(callbacks, "volumeGroupCreate,volumeGroupRollback");
-
- waitForProcessEnd(businessKey, 100000);
- WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "SavedWorkflowException1");
- Assert.assertTrue(wfe.getErrorCode() == 2500);
- Assert.assertTrue(wfe.getErrorMessage().startsWith("Generic vnf null was not found in AAI. Return code: 404."));
- checkVariable(businessKey, "DCVFMODVOLV2_SuccessIndicator", false);
-
- logEnd();
- }
-
- /**
- * Will trigger not trigger rollback
- * @throws Exception
- */
- @Test
-// @Ignore
- @Deployment(resources = {"subprocess/DoCreateVfModuleVolumeV2.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/vnfAdapterRestV1.bpmn",
- "subprocess/DoCreateVfModuleVolumeRollback.bpmn"})
- public void TestUpdateAaiVolumeGroupErrorNoRollback() throws Exception {
-
- logStart();
-
-// DoCreateVfModuleVolume_AaiVolumeGroupUpdateFail();
-
- String businessKey = UUID.randomUUID().toString();
- String createVfModuleVolRequest = FileUtil.readResourceFile("__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeNoRollbackRequest.xml");
-
- Map<String, Object> testVariables = new HashMap<>();
- testVariables.put("DCVFMODVOLV2_volumeGroupId", "TEST-VOLUME-VOLUME-GROUP-ID-0123");
- testVariables.put("vnf-id", "TEST-VNF-ID-0123");
- testVariables.put("volume-group-id", "TEST-VOLUME-GROUP-ID-0123");
- testVariables.put("test-volume-group-name", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0");
- testVariables.put("test-volume-group-id", "TEST-VOLUME-GROUP-ID-0123");
- testVariables.put("DoCreateVfModuleVolumeV1Request", createVfModuleVolRequest);
- TestAsyncResponse asyncResponse = invokeAsyncProcess("DoCreateVfModuleVolumeV2", "v1", businessKey, createVfModuleVolRequest, testVariables);
-
- // VNF callback not needed fort this failure scenario
-// injectVNFRestCallbacks(callbacks, "volumeGroupCreate");
-
- waitForProcessEnd(businessKey, 100000);
- WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "SavedWorkflowException1");
- Assert.assertTrue(wfe.getErrorCode() == 2500);
- Assert.assertTrue(wfe.getErrorMessage().startsWith("Generic vnf null was not found in AAI. Return code: 404."));
- checkVariable(businessKey, "DCVFMODVOLV2_SuccessIndicator", false);
-
- logEnd();
- }
-}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVnfAndModulesRollbackTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVnfAndModulesRollbackTest.java
deleted file mode 100644
index fb2160d970..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVnfAndModulesRollbackTest.java
+++ /dev/null
@@ -1,425 +0,0 @@
-/*-
- * ============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.infrastructure;
-
-import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
-import static com.github.tomakehurst.wiremock.client.WireMock.containing;
-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.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteGenericVnf;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteVfModuleId;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfById;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithDepth;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByName;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchGenericVnf;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchVfModuleId;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutVfModuleId;
-import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB;
-import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter;
-import static org.openecomp.mso.bpmn.mock.StubResponseVNFAdapter.mockVNFDelete;
-import static org.openecomp.mso.bpmn.mock.StubResponseVNFAdapter.mockVfModuleDelete;
-
-import java.io.IOException;
-import java.util.HashMap;
-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.core.RollbackData;
-import org.openecomp.mso.bpmn.core.WorkflowException;
-import org.openecomp.mso.bpmn.mock.FileUtil;
-
-/**
- * Unit test for DoCreateVnfAndModulesRollback.bpmn.
- */
-public class DoCreateVnfAndModulesRollbackTest extends WorkflowTest {
- private final CallbackSet callbacks = new CallbackSet();
-
- private static final String EOL = "\n";
-
-
-
- private final String vnfAdapterDeleteCallback =
- "<deleteVfModuleResponse>" + EOL +
- " <vnfId>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnfId>" + EOL +
- " <vfModuleId>973ed047-d251-4fb9-bf1a-65b8949e0a73</vfModuleId>" + EOL +
- " <vfModuleDeleted>true</vfModuleDeleted>" + EOL +
- " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
- "</deleteVfModuleResponse>" + EOL;
-
- private final String vnfAdapterDeleteCallbackFail =
- "<vfModuleException>" + EOL +
- " <message>Error processing request to VNF-Async. Not Found.</message>" + EOL +
- " <category>INTERNAL</category>" + EOL +
- " <rolledBack>false</rolledBack>" + EOL +
- " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
- "</vfModuleException>" + EOL;
-
- private final String sdncAdapterDeleteCallback =
- "<output xmlns=\"com:att:sdnctl:l3api\">" + EOL +
- " <svc-request-id>{{REQUEST-ID}}</svc-request-id>" + EOL +
- " <ack-final-indicator>Y</ack-final-indicator>" + EOL +
- "</output>" + EOL;
-
- public DoCreateVnfAndModulesRollbackTest() throws IOException {
- callbacks.put("sdncChangeDelete", sdncAdapterDeleteCallback);
- callbacks.put("sdncDelete", sdncAdapterDeleteCallback);
- callbacks.put("vnfDelete", vnfAdapterDeleteCallback);
- callbacks.put("vnfDeleteFail", vnfAdapterDeleteCallbackFail);
- callbacks.put("deactivate", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
- callbacks.put("unassign", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
- }
-
- @Test
- @Ignore
- @Deployment(resources = {
- "subprocess/DoCreateVnfAndModulesRollback.bpmn",
- "subprocess/DoCreateVfModuleRollback.bpmn",
- "subprocess/PrepareUpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn",
- "subprocess/DeleteAAIVfModule.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn",
- "subprocess/GenericGetVnf.bpmn",
- "subprocess/GenericDeleteVnf.bpmn",
- "subprocess/DoDeleteVnf.bpmn"
- })
- public void TestDoCreateVnfAndModulesRollbackSuccess_BaseOnly() {
- // delete the Base Module and Generic Vnf
- // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73
- String request =
- "<vnf-request xmlns=\"http://org.openecomp/mso/infra/vnf-request/v1\">" + EOL +
- " <request-info>" + EOL +
- " <action>DELETE_VF_MODULE</action>" + EOL +
- " <source>PORTAL</source>" + EOL +
- " </request-info>" + EOL +
- " <vnf-inputs>" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
- " <vnf-type>asc_heat-int</vnf-type>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
- " <service-id>00000000-0000-0000-0000-000000000000</service-id>" + EOL +
- " <service-type>SDN-ETHERNET-INTERNET</service-type>" + EOL +
- " <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id>" + EOL +
- " <orchestration-status>pending-delete</orchestration-status>" + EOL +
- " <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>" + EOL +
- " </vnf-inputs>" + EOL +
- " <vnf-params xmlns:tns=\"http://org.openecomp/mso/infra/vnf-request/v1\"/>" + EOL +
- "</vnf-request>" + EOL;
- logStart();
- mockSDNCAdapter("/SDNCAdapter", "SvcAction>changedelete", 200, "DeleteGenericVNFV1/sdncAdapterResponse.xml");
- mockSDNCAdapter("/SDNCAdapter", "SvcAction>delete", 200, "DeleteGenericVNFV1/sdncAdapterResponse.xml");
- mockVNFDelete(".*", "/.*", 202);
- mockVfModuleDelete("78987");
- MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
- MockPatchGenericVnf("a27ce5a9-29c4-4c22-a017-6615ac73c721");
- MockGetGenericVnfByName("STMTN5MMSC21", "DoCreateVfModule_getVnfResponse.xml");
- MockGetGenericVnfById("/a27ce5a9-29c4-4c22-a017-6615ac73c721.*", "DoCreateVfModule_getVnfResponse.xml", 200);
- MockPutVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
- MockDeleteGenericVnf("a27ce5a9-29c4-4c22-a017-6615ac73c721", "0000021");
- MockDeleteVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73", "0000073", 200);
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- RollbackData rollbackData = new RollbackData();
-
- rollbackData.put("VFMODULE_BASE", "source", "PORTAL");
- rollbackData.put("VFMODULE_BASE", "vnfid", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- rollbackData.put("VFMODULE_BASE", "vnfname", "STMTN5MMSC21");
- rollbackData.put("VFMODULE_BASE", "vnftype", "asc_heat-int");
- rollbackData.put("VFMODULE_BASE", "vfmoduleid", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
- rollbackData.put("VFMODULE_BASE", "vfmodulename", "STMTN5MMSC21-MMSC::module-0-0");
- rollbackData.put("VFMODULE_BASE", "tenantid", "fba1bd1e195a404cacb9ce17a9b2b421");
- rollbackData.put("VFMODULE_BASE", "aiccloudregion", "RDM2WAGPLCP");
- rollbackData.put("VFMODULE_BASE", "heatstackid", "thisisaheatstack");
- rollbackData.put("VFMODULE_BASE", "contrailNetworkPolicyFqdn0", "MSOTest:DefaultPolicyFQDN1");
- rollbackData.put("VFMODULE_BASE", "contrailNetworkPolicyFqdn1", "MSOTest:DefaultPolicyFQDN2");
- rollbackData.put("VFMODULE_BASE", "oamManagementV6Address", "2000:abc:bce:1111");
- rollbackData.put("VFMODULE_BASE", "oamManagementV4Address", "127.0.0.1");
-
- rollbackData.put("VFMODULE_BASE", "rollbackPrepareUpdateVfModule", "true");
- rollbackData.put("VFMODULE_BASE", "rollbackVnfAdapterCreate", "true");
- rollbackData.put("VFMODULE_BASE", "rollbackUpdateAAIVfModule", "true");
- rollbackData.put("VFMODULE_BASE", "rollbackSDNCRequestActivate", "true");
- rollbackData.put("VFMODULE_BASE", "rollbackCreateAAIVfModule", "true");
- rollbackData.put("VFMODULE_BASE", "rollbackCreateNetworkPoliciesAAI", "true");
- rollbackData.put("VFMODULE_BASE", "rollbackUpdateVnfAAI", "true");
-
- rollbackData.put("VNF", "vnfId", "testVnfId123");
-
- rollbackData.put("VNFANDMODULES", "numOfCreatedAddOnModules", "0");
-
- variables.put("isDebugLogEnabled","true");
- variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("mso-service-instance-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- rollbackData.put("VFMODULE_BASE", "msorequestid", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- rollbackData.put("VFMODULE_BASE", "serviceinstanceid", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
-
- variables.put("rollbackData", rollbackData);
- invokeSubProcess("DoCreateVnfAndModulesRollback", businessKey, variables);
-
- // "changedelete" operation not required for deleting a Vf Module
-// injectSDNCCallbacks(callbacks, "sdncChangeDelete");
- injectVNFRestCallbacks(callbacks, "vnfDelete");
- //waitForRunningProcessCount("DoCreateVnfAndModulesRollback", 0, 120000);
- injectSDNCCallbacks(callbacks, "sdncDelete");
-
- waitForProcessEnd(businessKey, 10000);
- WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- checkVariable(businessKey, "WorkflowException", null);
- if (wfe != null) {
- System.out.println("TestCreateVfModuleSuccess: ErrorCode=" + wfe.getErrorCode() +
- ", ErrorMessage=" + wfe.getErrorMessage());
- }
- logEnd();
- }
-
- @Test
- @Deployment(resources = {
- "subprocess/DoCreateVnfAndModulesRollback.bpmn",
- "subprocess/PrepareUpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn",
- "subprocess/DeleteAAIVfModule.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/GenericGetVnf.bpmn",
- "subprocess/GenericDeleteVnf.bpmn",
- "subprocess/DoDeleteVnf.bpmn"
- })
- public void TestDoCreateVnfAndModulesRollbackSuccess_vnfOnly() {
- // delete the Base Module and Generic Vnf
- // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73
- String request =
- "<vnf-request xmlns=\"http://org.openecomp/mso/infra/vnf-request/v1\">" + EOL +
- " <request-info>" + EOL +
- " <action>DELETE_VF_MODULE</action>" + EOL +
- " <source>PORTAL</source>" + EOL +
- " </request-info>" + EOL +
- " <vnf-inputs>" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
- " <vnf-type>asc_heat-int</vnf-type>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
- " <service-id>00000000-0000-0000-0000-000000000000</service-id>" + EOL +
- " <service-type>SDN-ETHERNET-INTERNET</service-type>" + EOL +
- " <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id>" + EOL +
- " <orchestration-status>pending-delete</orchestration-status>" + EOL +
- " <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>" + EOL +
- " </vnf-inputs>" + EOL +
- " <vnf-params xmlns:tns=\"http://org.openecomp/mso/infra/vnf-request/v1\"/>" + EOL +
- "</vnf-request>" + EOL;
- logStart();
- MockGetGenericVnfById("testVnfId123.*", "GenericFlows/getGenericVnfByNameResponse.xml");
- MockDeleteGenericVnf("testVnfId123", "testReVer123");
- MockDoDeleteVfModule_SDNCSuccess();
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- RollbackData rollbackData = new RollbackData();
-
- rollbackData.put("VNF", "vnfId", "testVnfId123");
- rollbackData.put("VNF", "rollbackVnfCreate", "true");
- rollbackData.put("VNF", "rollbackSDNCAssign", "true");
- rollbackData.put("VNF", "rollbackSDNCActivate", "true");
- rollbackData.put("VNFANDMODULES", "numOfCreatedAddOnModules", "0");
-
-
- variables.put("isDebugLogEnabled","true");
- variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("mso-service-instance-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
-
-
- variables.put("rollbackData", rollbackData);
- variables.put("sdncVersion", "1707");
- invokeSubProcess("DoCreateVnfAndModulesRollback", businessKey, variables);
-
- // "changedelete" operation not required for deleting a Vf Module
-// injectSDNCCallbacks(callbacks, "sdncChangeDelete");
-
- //waitForRunningProcessCount("DoCreateVnfAndModulesRollback", 0, 120000);
- // injectSDNCCallbacks(callbacks, "sdncDelete");
-
- waitForProcessEnd(businessKey, 10000);
- WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- checkVariable(businessKey, "WorkflowException", null);
- if (wfe != null) {
- System.out.println("TestCreateVfModuleSuccess: ErrorCode=" + wfe.getErrorCode() +
- ", ErrorMessage=" + wfe.getErrorMessage());
- }
- logEnd();
- }
-
- @Test
- @Ignore
- @Deployment(resources = {
- "subprocess/DoCreateVnfAndModulesRollback.bpmn",
- "subprocess/DoCreateVfModuleRollback.bpmn",
- "subprocess/PrepareUpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn",
- "subprocess/DeleteAAIVfModule.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn",
- "subprocess/GenericGetVnf.bpmn",
- "subprocess/GenericDeleteVnf.bpmn",
- "subprocess/DoDeleteVnf.bpmn"
- })
- public void TestDoCreateVnfAndModulesRollbackSuccess_AddOn() {
- // delete the Base Module and Generic Vnf
- // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73
- String request =
- "<vnf-request xmlns=\"http://org.openecomp/mso/infra/vnf-request/v1\">" + EOL +
- " <request-info>" + EOL +
- " <action>DELETE_VF_MODULE</action>" + EOL +
- " <source>PORTAL</source>" + EOL +
- " </request-info>" + EOL +
- " <vnf-inputs>" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
- " <vnf-type>asc_heat-int</vnf-type>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
- " <service-id>00000000-0000-0000-0000-000000000000</service-id>" + EOL +
- " <service-type>SDN-ETHERNET-INTERNET</service-type>" + EOL +
- " <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id>" + EOL +
- " <orchestration-status>pending-delete</orchestration-status>" + EOL +
- " <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>" + EOL +
- " </vnf-inputs>" + EOL +
- " <vnf-params xmlns:tns=\"http://org.openecomp/mso/infra/vnf-request/v1\"/>" + EOL +
- "</vnf-request>" + EOL;
- logStart();
- mockSDNCAdapter("/SDNCAdapter", "SvcAction>changedelete", 200, "DeleteGenericVNFV1/sdncAdapterResponse.xml");
- mockSDNCAdapter("/SDNCAdapter", "SvcAction>delete", 200, "DeleteGenericVNFV1/sdncAdapterResponse.xml");
- mockVNFDelete(".*", "/.*", 202);
- mockVfModuleDelete("78987");
- MockGetGenericVnfByName("STMTN5MMSC21", "DoCreateVfModule_getVnfResponse.xml");
- MockGetGenericVnfById("/a27ce5a9-29c4-4c22-a017-6615ac73c721", "DoCreateVfModule_getVnfResponse.xml", 200);
- MockGetGenericVnfByIdWithDepth("a27ce5a9-29c4-4c22-a017-6615ac73c721", 1, "DoCreateVfModuleRollback/GenericVnf.xml");
- MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
- MockPatchGenericVnf("a27ce5a9-29c4-4c22-a017-6615ac73c721");
- MockPutVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
- MockDeleteGenericVnf("a27ce5a9-29c4-4c22-a017-6615ac73c721", "0000021");
- MockDeleteVfModuleId("", "", "", 200);
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- RollbackData rollbackData = new RollbackData();
-
- rollbackData.put("VFMODULE_BASE", "source", "PORTAL");
- rollbackData.put("VFMODULE_BASE", "vnfid", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- rollbackData.put("VFMODULE_BASE", "vnfname", "STMTN5MMSC21");
- rollbackData.put("VFMODULE_BASE", "vnftype", "asc_heat-int");
- rollbackData.put("VFMODULE_BASE", "vfmoduleid", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
- rollbackData.put("VFMODULE_BASE", "vfmodulename", "STMTN5MMSC21-MMSC::module-0-0");
- rollbackData.put("VFMODULE_BASE", "tenantid", "fba1bd1e195a404cacb9ce17a9b2b421");
- rollbackData.put("VFMODULE_BASE", "aiccloudregion", "RDM2WAGPLCP");
- rollbackData.put("VFMODULE_BASE", "heatstackid", "thisisaheatstack");
- rollbackData.put("VFMODULE_BASE", "contrailNetworkPolicyFqdn0", "MSOTest:DefaultPolicyFQDN1");
- rollbackData.put("VFMODULE_BASE", "contrailNetworkPolicyFqdn1", "MSOTest:DefaultPolicyFQDN2");
- rollbackData.put("VFMODULE_BASE", "oamManagementV6Address", "2000:abc:bce:1111");
- rollbackData.put("VFMODULE_BASE", "oamManagementV4Address", "127.0.0.1");
- rollbackData.put("VFMODULE_BASE", "rollbackPrepareUpdateVfModule", "true");
- rollbackData.put("VFMODULE_BASE", "rollbackVnfAdapterCreate", "true");
- rollbackData.put("VFMODULE_BASE", "rollbackUpdateAAIVfModule", "true");
- rollbackData.put("VFMODULE_BASE", "rollbackSDNCRequestActivate", "true");
- rollbackData.put("VFMODULE_BASE", "rollbackCreateAAIVfModule", "true");
- rollbackData.put("VFMODULE_BASE", "rollbackCreateNetworkPoliciesAAI", "true");
- rollbackData.put("VFMODULE_BASE", "rollbackUpdateVnfAAI", "true");
- rollbackData.put("VFMODULE_BASE", "msorequestid", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- rollbackData.put("VFMODULE_BASE", "serviceinstanceid", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
-
-
- rollbackData.put("VFMODULE_ADDON_1", "source", "PORTAL");
- rollbackData.put("VFMODULE_ADDON_1", "vnfid", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- rollbackData.put("VFMODULE_ADDON_1", "vnfname", "STMTN5MMSC21");
- rollbackData.put("VFMODULE_ADDON_1", "vnftype", "asc_heat-int");
- rollbackData.put("VFMODULE_ADDON_1", "vfmoduleid", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
- rollbackData.put("VFMODULE_ADDON_1", "vfmodulename", "STMTN5MMSC21-MMSC::module-0-0");
- rollbackData.put("VFMODULE_ADDON_1", "tenantid", "fba1bd1e195a404cacb9ce17a9b2b421");
- rollbackData.put("VFMODULE_ADDON_1", "aiccloudregion", "RDM2WAGPLCP");
- rollbackData.put("VFMODULE_ADDON_1", "heatstackid", "thisisaheatstack");
- rollbackData.put("VFMODULE_ADDON_1", "contrailNetworkPolicyFqdn0", "MSOTest:DefaultPolicyFQDN1");
- rollbackData.put("VFMODULE_ADDON_1", "contrailNetworkPolicyFqdn1", "MSOTest:DefaultPolicyFQDN2");
- rollbackData.put("VFMODULE_ADDON_1", "oamManagementV6Address", "2000:abc:bce:1111");
- rollbackData.put("VFMODULE_ADDON_1", "oamManagementV4Address", "127.0.0.1");
- rollbackData.put("VFMODULE_ADDON_1", "rollbackPrepareUpdateVfModule", "true");
- rollbackData.put("VFMODULE_ADDON_1", "rollbackVnfAdapterCreate", "true");
- rollbackData.put("VFMODULE_ADDON_1", "rollbackUpdateAAIVfModule", "true");
- rollbackData.put("VFMODULE_ADDON_1", "rollbackSDNCRequestActivate", "true");
- rollbackData.put("VFMODULE_ADDON_1", "rollbackCreateAAIVfModule", "true");
- rollbackData.put("VFMODULE_ADDON_1", "rollbackCreateNetworkPoliciesAAI", "true");
- rollbackData.put("VFMODULE_ADDON_1", "rollbackUpdateVnfAAI", "true");
- rollbackData.put("VFMODULE_ADDON_1", "msorequestid", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- rollbackData.put("VFMODULE_ADDON_1", "serviceinstanceid", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
-
- rollbackData.put("VNF", "vnfId", "testVnfId123");
-
- rollbackData.put("VNFANDMODULES", "numOfCreatedAddOnModules", "1");
-
- variables.put("isDebugLogEnabled","true");
- variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("mso-service-instance-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
-
-
- variables.put("rollbackData", rollbackData);
- invokeSubProcess("DoCreateVnfAndModulesRollback", businessKey, variables);
-
- // "changedelete" operation not required for deleting a Vf Module
- // injectSDNCCallbacks(callbacks, "sdncChangeDelete");
- injectVNFRestCallbacks(callbacks, "vnfDelete");
- injectVNFRestCallbacks(callbacks, "vnfDelete");
- //waitForRunningProcessCount("DoCreateVnfAndModulesRollback", 0, 120000);
- injectSDNCCallbacks(callbacks, "sdncDelete");
-
- waitForProcessEnd(businessKey, 10000);
- WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- checkVariable(businessKey, "WorkflowException", null);
- if (wfe != null) {
- System.out.println("TestCreateVfModuleSuccess: ErrorCode=" + wfe.getErrorCode() +
- ", ErrorMessage=" + wfe.getErrorMessage());
- }
- logEnd();
- }
-
- public static void MockDoDeleteVfModule_SDNCSuccess() {
- stubFor(post(urlEqualTo("/SDNCAdapter"))
- .withRequestBody(containing("SvcAction>deactivate"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml")));
- stubFor(post(urlEqualTo("/SDNCAdapter"))
- .withRequestBody(containing("SvcAction>unassign"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml")));
- }
-
-
-} \ No newline at end of file
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVnfAndModulesTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVnfAndModulesTest.java
deleted file mode 100644
index dc0af4186e..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVnfAndModulesTest.java
+++ /dev/null
@@ -1,374 +0,0 @@
-/*-
- * ============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.infrastructure;
-
-import static org.junit.Assert.assertEquals;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockAAIVfModule;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDBUpdateVfModule;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfById_404;
-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.MockPatchGenericVnf;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchVfModuleId;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutGenericVnf;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockSDNCAdapterVfModule;
-import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockVNFAdapterRestVfModule;
-import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-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.core.domain.ModelInfo;
-import org.openecomp.mso.bpmn.core.domain.ModuleResource;
-import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition;
-import org.openecomp.mso.bpmn.core.domain.VnfResource;
-import org.openecomp.mso.bpmn.mock.FileUtil;
-
-/**
- * Unit Test for the DoCreateVnfAndModules Flow
- *
- */
-public class DoCreateVnfAndModulesTest extends WorkflowTest {
-
- private final CallbackSet callbacks = new CallbackSet();
-
- public DoCreateVnfAndModulesTest() throws IOException {
-
- callbacks.put("assign", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyAssignCallback.xml"));
- callbacks.put("activate", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
- callbacks.put("query", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyQueryCallback.xml"));
- callbacks.put("queryVnf", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyQueryCallbackVnf.xml"));
- callbacks.put("queryModuleNoVnf", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyQueryCallbackVfModuleNoVnf.xml"));
- callbacks.put("queryModule", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyQueryCallbackVfModule.xml"));
- callbacks.put("vnfCreate", FileUtil.readResourceFile(
- "__files/VfModularity/VNFAdapterRestCreateCallback.xml"));
- }
-
- @Test
-
- @Deployment(resources = {"subprocess/GenericGetService.bpmn",
- "subprocess/GenericGetVnf.bpmn",
- "subprocess/GenericPutVnf.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/DoCreateVnf.bpmn",
- "subprocess/GenerateVfModuleName.bpmn",
- "subprocess/DoCreateVfModule.bpmn",
- "subprocess/DoCreateVnfAndModules.bpmn",
- "subprocess/GenericGetVnf.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn",
- "subprocess/ConfirmVolumeGroupTenant.bpmn",
- "subprocess/ConfirmVolumeGroupName.bpmn",
- "subprocess/CreateAAIVfModule.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/CreateAAIVfModuleVolumeGroup.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn",
- "subprocess/DoCreateVnfAndModulesRollback.bpmn"})
- public void testDoCreateVnfAndModulesBaseOnly_success() throws Exception{
-
- MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlByIdVipr.xml");
- MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml");
- MockGetGenericVnfById_404("testVnfId");
- MockPutGenericVnf(".*");
- MockAAIVfModule();
- MockPatchGenericVnf("skask");
- MockPatchVfModuleId("skask", ".*");
- mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml");
- MockVNFAdapterRestVfModule();
- MockDBUpdateVfModule();
-
- mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml");
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariablesSuccess(variables, "", "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET");
- invokeSubProcess("DoCreateVnfAndModules", businessKey, variables);
-
- injectSDNCCallbacks(callbacks, "assign");
- injectSDNCCallbacks(callbacks, "query");
- injectSDNCCallbacks(callbacks, "activate");
- injectSDNCCallbacks(callbacks, "queryVnf");
- injectSDNCCallbacks(callbacks, "assign, queryModuleNoVnf");
- injectVNFRestCallbacks(callbacks, "vnfCreate");
- injectSDNCCallbacks(callbacks, "activate");
- waitForProcessEnd(businessKey, 10000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- assertVariables("true", "true", "false", "true", "Success", null);
-
- }
-
- @Test
-
- @Deployment(resources = {"subprocess/GenericGetService.bpmn",
- "subprocess/GenericGetVnf.bpmn",
- "subprocess/GenericPutVnf.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/DoCreateVnf.bpmn",
- "subprocess/GenerateVfModuleName.bpmn",
- "subprocess/DoCreateVfModule.bpmn",
- "subprocess/DoCreateVnfAndModules.bpmn",
- "subprocess/GenericGetVnf.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn",
- "subprocess/ConfirmVolumeGroupTenant.bpmn",
- "subprocess/ConfirmVolumeGroupName.bpmn",
- "subprocess/CreateAAIVfModule.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/CreateAAIVfModuleVolumeGroup.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn",
- "subprocess/DoCreateVnfAndModulesRollback.bpmn"})
- public void testDoCreateVnfAndModulesWithAddon_success() throws Exception{
-
- MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlByIdVipr.xml");
- MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml");
- MockGetGenericVnfById_404("testVnfId");
- MockPutGenericVnf(".*");
- MockAAIVfModule();
- MockPatchGenericVnf("skask");
- MockPatchVfModuleId("skask", ".*");
- mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml");
- MockVNFAdapterRestVfModule();
- MockDBUpdateVfModule();
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
- mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariablesAddonSuccess(variables, "", "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET");
- invokeSubProcess("DoCreateVnfAndModules", businessKey, variables);
-
- injectSDNCCallbacks(callbacks, "assign");
- injectSDNCCallbacks(callbacks, "query");
- injectSDNCCallbacks(callbacks, "activate");
- injectSDNCCallbacks(callbacks, "queryVnf");
- injectSDNCCallbacks(callbacks, "assign, queryModuleNoVnf");
- injectVNFRestCallbacks(callbacks, "vnfCreate");
- injectSDNCCallbacks(callbacks, "activate");
- injectSDNCCallbacks(callbacks, "queryVnf");
- injectSDNCCallbacks(callbacks, "assign, queryModuleNoVnf");
- injectVNFRestCallbacks(callbacks, "vnfCreate");
- injectSDNCCallbacks(callbacks, "activate");
- waitForProcessEnd(businessKey, 10000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- assertVariables("true", "true", "false", "true", "Success", null);
-
- }
-
- private void assertVariables(String exSIFound, String exSISucc, String exVnfFound, String exVnfSucc, String exResponse, String exWorkflowException) {
-
- String siFound = BPMNUtil.getVariable(processEngineRule, "DoCreateVnf", "GENGS_FoundIndicator");
- String siSucc = BPMNUtil.getVariable(processEngineRule, "DoCreateVnf", "GENGS_SuccessIndicator");
- String vnfFound = BPMNUtil.getVariable(processEngineRule, "DoCreateVnf", "GENGV_FoundIndicator");
- String vnfSucc = BPMNUtil.getVariable(processEngineRule, "DoCreateVnf", "GENGV_SuccessIndicator");
- String response = BPMNUtil.getVariable(processEngineRule, "DoCreateVnf", "WorkflowResponse");
- String workflowException = BPMNUtil.getVariable(processEngineRule, "DoCreateVnf", "SavedWorkflowException1");
-
- //assertEquals(exSIFound, siFound);
- //assertEquals(exSISucc, siSucc);
- //assertEquals(exVnfFound, vnfFound);
- //assertEquals(exVnfSucc, vnfSucc);
- //assertEquals(exResponse, response);
- assertEquals(exWorkflowException, workflowException);
- }
-
- private void setVariables(Map<String, String> variables, String request, String requestId, String siId) {
- variables.put("isDebugLogEnabled", "true");
- variables.put("bpmnRequest", request);
- variables.put("mso-request-id", requestId);
- variables.put("serviceInstanceId",siId);
- variables.put("testVnfId","testVnfId123");
- variables.put("vnfType", "STMTN");
- }
-
- private void setVariablesSuccess(Map<String, Object> variables, String request, String requestId, String siId) {
- variables.put("isDebugLogEnabled", "true");
- variables.put("mso-request-id", requestId);
- variables.put("requestId", requestId);
- variables.put("msoRequestId", requestId);
- variables.put("serviceInstanceId",siId);
- variables.put("disableRollback", "true");
- //variables.put("testVnfId","testVnfId123");
- variables.put("vnfType", "STMTN");
-
- String serviceModelInfo = "{ "+ "\"modelType\": \"service\"," +
- "\"modelInvariantUuid\": \"995256d2-5a33-55df-13ab-12abad84e7ff\"," +
- "\"modelUuid\": \"ab6478e5-ea33-3346-ac12-ab121484a3fe\"," +
- "\"modelName\": \"ServicevSAMP12\"," +
- "\"modelVersion\": \"1.0\"," +
- "}";
- variables.put("serviceModelInfo", serviceModelInfo);
- variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
- String vnfModelInfo = "{" + "\"modelType\": \"vnf\"," +
- "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," +
- "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," +
- "\"modelName\": \"vSAMP12\"," +
- "\"modelVersion\": \"1.0\"," +
- "\"modelCustomizationUuid\": \"MODEL-ID-1234\"" + "}";
- variables.put("vnfModelInfo", vnfModelInfo);
-
- String cloudConfiguration = "{" + "\"cloudConfiguration\": { " +
- "\"lcpCloudRegionId\": \"mdt1\"," +
- "\"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\"" + "}}";
- variables.put("cloudConfiguration", cloudConfiguration);
- variables.put("sdncVersion", "1707");
- variables.put("globalSubscriberId", "subscriber123");
-
- try {
- String serviceDecomposition = FileUtil.readResourceFile("__files/VIPR/serviceDecompositionATMFW.json");
- ServiceDecomposition sd = new ServiceDecomposition();
- ModelInfo serviceModel = new ModelInfo();
- serviceModel.setModelName("servicewithVNFs");
- sd.setModelInfo(serviceModel);
- VnfResource vr = new VnfResource();
- ModelInfo mvr = new ModelInfo();
- mvr.setModelName("vSAMP12");
- mvr.setModelInstanceName("v123");
- mvr.setModelInvariantUuid("");
- mvr.setModelVersion("1.0");
- mvr.setModelCustomizationUuid("MODEL-ID-1234");
- vr.setModelInfo(mvr);
- vr.constructVnfType("vnf1");
- vr.setNfType("somenftype");
- vr.setNfRole("somenfrole");
- vr.setNfFunction("somenffunction");
- vr.setNfNamingCode("somenamingcode");
- ModuleResource mr = new ModuleResource();
- ModelInfo mvmr = new ModelInfo();
- mvmr.setModelInvariantUuid("ff5256d2-5a33-55df-13ab-12abad84e7ff");
- mvmr.setModelName("STMTN5MMSC21-MMSC::model-1-0");
- mvmr.setModelVersion("1");
- mvmr.setModelCustomizationUuid("MODEL-123");
- mr.setModelInfo(mvmr);
- mr.setIsBase(true);
- mr.setVfModuleLabel("MODULELABEL");
- vr.addVfModule(mr);
- sd.addVnfResource(vr);
-
- variables.put("serviceDecomposition", sd);
- variables.put("isTest", true);
- } catch(Exception e) {
-
- }
-
- }
-
- private void setVariablesAddonSuccess(Map<String, Object> variables, String request, String requestId, String siId) {
- variables.put("isDebugLogEnabled", "true");
- variables.put("mso-request-id", requestId);
- variables.put("requestId", requestId);
- variables.put("msoRequestId", requestId);
- variables.put("serviceInstanceId",siId);
- variables.put("disableRollback", "true");
- //variables.put("testVnfId","testVnfId123");
- variables.put("vnfType", "STMTN");
-
- String serviceModelInfo = "{ "+ "\"modelType\": \"service\"," +
- "\"modelInvariantUuid\": \"995256d2-5a33-55df-13ab-12abad84e7ff\"," +
- "\"modelUuid\": \"ab6478e5-ea33-3346-ac12-ab121484a3fe\"," +
- "\"modelName\": \"ServicevSAMP12\"," +
- "\"modelVersion\": \"1.0\"," +
- "}";
- variables.put("serviceModelInfo", serviceModelInfo);
- variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
- String vnfModelInfo = "{" + "\"modelType\": \"vnf\"," +
- "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," +
- "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," +
- "\"modelName\": \"vSAMP12\"," +
- "\"modelVersion\": \"1.0\"," +
- "\"modelCustomizationUuid\": \"MODEL-ID-1234\"" + "}";
- variables.put("vnfModelInfo", vnfModelInfo);
-
- String cloudConfiguration = "{" + "\"cloudConfiguration\": { " +
- "\"lcpCloudRegionId\": \"mdt1\"," +
- "\"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\"" + "}}";
- variables.put("cloudConfiguration", cloudConfiguration);
- variables.put("sdncVersion", "1707");
- variables.put("globalSubscriberId", "subscriber123");
-
- try {
- String serviceDecomposition = FileUtil.readResourceFile("__files/VIPR/serviceDecompositionATMFW.json");
- ServiceDecomposition sd = new ServiceDecomposition();
- ModelInfo serviceModel = new ModelInfo();
- serviceModel.setModelName("servicewithVNFs");
- sd.setModelInfo(serviceModel);
- VnfResource vr = new VnfResource();
- ModelInfo mvr = new ModelInfo();
- mvr.setModelName("vSAMP12");
- mvr.setModelInstanceName("v123");
- mvr.setModelInvariantUuid("");
- mvr.setModelVersion("1.0");
- mvr.setModelCustomizationUuid("MODEL-ID-1234");
- vr.setModelInfo(mvr);
- vr.setNfType("somenftype");
- vr.setNfRole("somenfrole");
- vr.setNfFunction("somenffunction");
- vr.setNfNamingCode("somenamingcode");
- ModuleResource mr = new ModuleResource();
- ModelInfo mvmr = new ModelInfo();
- mvmr.setModelInvariantUuid("ff5256d2-5a33-55df-13ab-12abad84e7ff");
- mvmr.setModelName("STMTN5MMSC21-MMSC::model-1-0");
- mvmr.setModelVersion("1");
- mvmr.setModelCustomizationUuid("MODEL-123");
- mr.setModelInfo(mvmr);
- mr.setIsBase(true);
- mr.setVfModuleLabel("MODULELABEL");
- vr.addVfModule(mr);
- ModuleResource mr1 = new ModuleResource();
- ModelInfo mvmr1 = new ModelInfo();
- mvmr1.setModelInvariantUuid("ff5256d2-5a33-55df-13ab-12abad84e7ff");
- mvmr1.setModelName("STMTN5MMSC21-MMSC::model-1-0");
- mvmr1.setModelVersion("1");
- mvmr1.setModelCustomizationUuid("MODEL-123");
- mr1.setModelInfo(mvmr1);
- mr1.setIsBase(false);
- mr1.setVfModuleLabel("MODULELABEL");
- mr1.setInitialCount(1);
- vr.addVfModule(mr1);
-
- sd.addVnfResource(vr);
-
- variables.put("serviceDecomposition", sd);
- variables.put("isTest", true);
- } catch(Exception e) {
-
-
-
- }
- }
-}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVnfTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVnfTest.java
deleted file mode 100644
index 7537ffa4c0..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVnfTest.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property.
- */
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.bpmn.infrastructure;
-
-import static org.junit.Assert.assertEquals;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByName_404;
-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.MockPutGenericVnf;
-import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB;
-import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter;
-
-import java.io.IOException;
-import java.util.HashMap;
-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.common.WorkflowTest.CallbackSet;
-import org.openecomp.mso.bpmn.core.domain.VnfResource;
-import org.openecomp.mso.bpmn.mock.FileUtil;
-
-/**
- * Unit Test for the DoCreateVnf Flow
- *
- */
-public class DoCreateVnfTest extends WorkflowTest {
-
- private String createVnfInfraRequest;
- private final CallbackSet callbacks = new CallbackSet();
-
-
- public DoCreateVnfTest() throws IOException {
- createVnfInfraRequest = FileUtil.readResourceFile("__files/InfrastructureFlows/CreateVnfInfraRequest.json");
- callbacks.put("assign", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyAssignCallback.xml"));
- callbacks.put("activate", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
- }
-
- @Test
- @Deployment(resources = {"subprocess/GenericGetService.bpmn", "subprocess/GenericGetVnf.bpmn", "subprocess/GenericPutVnf.bpmn", "subprocess/SDNCAdapterV1.bpmn", "subprocess/DoCreateVnf.bpmn"})
- public void testDoCreateVnfInfra_success() throws Exception{
-
- MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlById.xml");
- MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml");
- MockGetGenericVnfByName_404("testVnfName123");
- MockPutGenericVnf("testVnfId123");
- mockSDNCAdapter("/SDNCAdapter", "vnf-type>STMTN", 200, "VfModularity/StandardSDNCSynchResponse.xml");
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariablesSuccess(variables, createVnfInfraRequest, "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET");
- invokeSubProcess("DoCreateVnf", businessKey, variables);
-
- waitForProcessEnd(businessKey, 10000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- assertVariables("true", "true", "false", "true", "Success", null);
- }
-
- private void assertVariables(String exSIFound, String exSISucc, String exVnfFound, String exVnfSucc, String exResponse, String exWorkflowException) {
- String workflowException = BPMNUtil.getVariable(processEngineRule, "DoCreateVnf", "SavedWorkflowException1");
-
- assertEquals(exWorkflowException, workflowException);
- }
-
- private void setVariablesSuccess(Map<String, Object> variables, String request, String requestId, String siId) {
- variables.put("isDebugLogEnabled", "true");
- //variables.put("bpmnRequest", request);
- variables.put("mso-request-id", requestId);
- variables.put("serviceInstanceId",siId);
- variables.put("vnfName", "testVnfName123");
- variables.put("disableRollback", "true");
- variables.put("requestId", requestId);
- variables.put("testVnfId","testVnfId123");
- variables.put("vnfType", "STMTN");
- variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
- String vnfModelInfo = "{ "+ "\"modelType\": \"vnf\"," +
- "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," +
- "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," +
- "\"modelName\": \"vSAMP12\"," +
- "\"modelVersion\": \"1.0\"," +
- "\"modelCustomizationUuid\": \"MODEL-ID-1234\"," +
- "}";
- variables.put("vnfModelInfo", vnfModelInfo);
-
- String cloudConfiguration = "{ " +
- "\"lcpCloudRegionId\": \"mdt1\"," +
- "\"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\"" + "}";
- variables.put("cloudConfiguration", cloudConfiguration);
-
- String serviceModelInfo = "{ "+ "\"modelType\": \"service\"," +
- "\"modelInvariantUuid\": \"995256d2-5a33-55df-13ab-12abad84e7ff\"," +
- "\"modelUuid\": \"ab6478e5-ea33-3346-ac12-ab121484a3fe\"," +
- "\"modelName\": \"ServicevSAMP12\"," +
- "\"modelVersion\": \"1.0\"," +
- "}";
- variables.put("serviceModelInfo", serviceModelInfo);
- variables.put("globalSubscriberId", "MSO-1610");
- VnfResource vnfResource = new VnfResource();
- variables.put("vnfResourceDecomposition", vnfResource);
- }
-
-}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteServiceInstanceTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteServiceInstanceTest.java
deleted file mode 100644
index 37814999ba..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteServiceInstanceTest.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*-
- * ============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.infrastructure;
-
-import static org.junit.Assert.assertEquals;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteServiceInstance;
-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.StubResponseDatabase.mockUpdateRequestDB;
-import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter;
-
-import java.io.IOException;
-import java.util.HashMap;
-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;
-
-/**
- * Unit test cases for DoDeleteServiceInstance.bpmn
- */
-public class DoDeleteServiceInstanceTest extends WorkflowTest {
-
- private final CallbackSet callbacks = new CallbackSet();
- private static final String EOL = "\n";
- private final String sdncAdapterCallback =
- "<output xmlns=\"com:att:sdnctl:l3api\">" + EOL +
- " <svc-request-id>((REQUEST-ID))</svc-request-id>" + EOL +
- " <ack-final-indicator>Y</ack-final-indicator>" + EOL +
- "</output>" + EOL;
-
- public DoDeleteServiceInstanceTest() throws IOException {
- callbacks.put("deactivate", sdncAdapterCallback);
- callbacks.put("delete", sdncAdapterCallback);
- }
-
- /**
- * Sunny day VID scenario.
- *
- * @throws Exception
- */
- //@Ignore // File not found - unable to run the test. Also, Stubs need updating..
- @Test
- @Deployment(resources = {
- "subprocess/DoDeleteServiceInstance.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/GenericDeleteService.bpmn",
- "subprocess/GenericGetService.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/FalloutHandler.bpmn" })
- public void sunnyDay() throws Exception {
-
- logStart();
-
- //AAI
- MockDeleteServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "", 204);
- MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getSINoRelations.xml");
- MockNodeQueryServiceInstanceById("MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getSIUrlById.xml");
- //SDNC
- mockSDNCAdapter(200);
- //DB
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
- String businessKey = UUID.randomUUID().toString();
-
- Map<String, Object> variables = new HashMap<>();
- setupVariables(variables);
- invokeSubProcess("DoDeleteServiceInstance", businessKey, variables);
- injectSDNCCallbacks(callbacks, "deactivate");
- injectSDNCCallbacks(callbacks, "delete");
- waitForProcessEnd(businessKey, 10000);
- Assert.assertTrue(isProcessEnded(businessKey));
- String workflowException = BPMNUtil.getVariable(processEngineRule, "DoDeleteServiceInstance", "WorkflowException");
- System.out.println("workflowException:\n" + workflowException);
- assertEquals(null, workflowException);
-
- logEnd();
- }
-
- // Success Scenario
- private void setupVariables(Map<String, Object> variables) {
- variables.put("isDebugLogEnabled", "true");
- variables.put("msoRequestId", "RaaDDSIRequestId-1");
- variables.put("mso-request-id", "RaaDDSIRequestId-1");
- variables.put("serviceInstanceId","MIS%252F1604%252F0026%252FSW_INTERNET");
- }
-}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVfModuleFromVnfTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVfModuleFromVnfTest.java
deleted file mode 100644
index 13b2f5432d..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVfModuleFromVnfTest.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/*-
- * ============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.infrastructure;
-
-import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
-import static com.github.tomakehurst.wiremock.client.WireMock.containing;
-import static com.github.tomakehurst.wiremock.client.WireMock.delete;
-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 com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
-import static org.openecomp.mso.bpmn.common.DeleteAAIVfModuleTest.MockAAIDeleteVfModule;
-import static org.openecomp.mso.bpmn.common.DeleteAAIVfModuleTest.MockAAIGenericVnfSearch;
-
-import java.io.IOException;
-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.WorkflowTest;
-import org.openecomp.mso.bpmn.core.WorkflowException;
-
-public class DoDeleteVfModuleFromVnfTest extends WorkflowTest {
- private final CallbackSet callbacks = new CallbackSet();
-
- private static final String EOL = "\n";
-
- private final String vnfAdapterDeleteCallback =
- "<deleteVfModuleResponse>" + EOL +
- " <vnfId>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnfId>" + EOL +
- " <vfModuleId>973ed047-d251-4fb9-bf1a-65b8949e0a73</vfModuleId>" + EOL +
- " <vfModuleDeleted>true</vfModuleDeleted>" + EOL +
- " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
- "</deleteVfModuleResponse>" + EOL;
-
- private final String vnfAdapterDeleteCallbackFail =
- "<vfModuleException>" + EOL +
- " <message>Error processing request to VNF-Async. Not Found.</message>" + EOL +
- " <category>INTERNAL</category>" + EOL +
- " <rolledBack>false</rolledBack>" + EOL +
- " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
- "</vfModuleException>" + EOL;
-
- private final String sdncAdapterDeleteCallback =
- "<output xmlns=\"com:att:sdnctl:l3api\">" + EOL +
- " <svc-request-id>{{REQUEST-ID}}</svc-request-id>" + EOL +
- " <ack-final-indicator>Y</ack-final-indicator>" + EOL +
- "</output>" + EOL;
-
- public DoDeleteVfModuleFromVnfTest() throws IOException {
- callbacks.put("deactivate", sdncAdapterDeleteCallback);
- callbacks.put("unassign", sdncAdapterDeleteCallback);
- callbacks.put("vnfDelete", vnfAdapterDeleteCallback);
- callbacks.put("vnfDeleteFail", vnfAdapterDeleteCallbackFail);
- }
-
- private final String wfeString = "WorkflowException";
-
- @Test
- @Deployment(resources = {
- "subprocess/DoDeleteVfModuleFromVnf.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn",
- "subprocess/DeleteAAIVfModule.bpmn"
- })
- public void TestDoDeleteVfModuleFromVnfSuccess() {
- // delete the Base Module and Generic Vnf
- // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73
- String request =
- "<vnf-request xmlns=\"http://org.openecomp/mso/infra/vnf-request/v1\">" + EOL +
- " <request-info>" + EOL +
- " <action>DELETE_VF_MODULE</action>" + EOL +
- " <source>PORTAL</source>" + EOL +
- " </request-info>" + EOL +
- " <vnf-inputs>" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
- " <vnf-type>asc_heat-int</vnf-type>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
- " <service-id>00000000-0000-0000-0000-000000000000</service-id>" + EOL +
- " <service-type>SDN-ETHERNET-INTERNET</service-type>" + EOL +
- " <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id>" + EOL +
- " <orchestration-status>pending-delete</orchestration-status>" + EOL +
- " <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>" + EOL +
- " </vnf-inputs>" + EOL +
- " <vnf-params xmlns:tns=\"http://org.openecomp/mso/infra/vnf-request/v1\"/>" + EOL +
- "</vnf-request>" + EOL;
- logStart();
- MockDoDeleteVfModule_SDNCSuccess();
- MockDoDeleteVfModule_DeleteVNFSuccess();
- MockAAIGenericVnfSearch();
- MockAAIDeleteVfModule();
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("isDebugLogEnabled","true");
- variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("msoRequestId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("serviceInstanceId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("vnfId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("vfModuleId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
- variables.put("lcpCloudRegionId", "RDM2WAGPLCP");
- variables.put("tenantId", "fba1bd1e195a404cacb9ce17a9b2b421");
- variables.put("sdncVersion", "1707");
-
- invokeSubProcess("DoDeleteVfModuleFromVnf", businessKey, variables);
-
- injectSDNCCallbacks(callbacks, "deactivate");
- injectVNFRestCallbacks(callbacks, "vnfDelete");
- //waitForRunningProcessCount("vnfAdapterDeleteV1", 0, 120000);
- injectSDNCCallbacks(callbacks, "unassign");
-
- waitForProcessEnd(businessKey, 10000);
- WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, wfeString);
- checkVariable(businessKey, wfeString, null);
- if (wfe != null) {
- System.out.println("TestDoDeleteVfModuleSuccess: ErrorCode=" + wfe.getErrorCode() +
- ", ErrorMessage=" + wfe.getErrorMessage());
- }
- logEnd();
- }
-
-
- // start of mocks used locally and by other VF Module unit tests
-
-
-
- public static void MockDoDeleteVfModule_SDNCSuccess() {
- stubFor(post(urlEqualTo("/SDNCAdapter"))
- .withRequestBody(containing("SvcAction>deactivate"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml")));
- stubFor(post(urlEqualTo("/SDNCAdapter"))
- .withRequestBody(containing("SvcAction>unassign"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml")));
- }
-
-
- public static void MockDoDeleteVfModule_DeleteVNFSuccess() {
- stubFor(delete(urlMatching("/vnfs/v1/vnfs/.*/vf-modules/.*"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/xml")));
- stubFor(delete(urlMatching("/vnfs/v1/volume-groups/78987"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/xml")));
- }
-
-
-} \ No newline at end of file
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVfModuleTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVfModuleTest.java
deleted file mode 100644
index 8f5f63d4c4..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVfModuleTest.java
+++ /dev/null
@@ -1,631 +0,0 @@
-/*-
- * ============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.infrastructure;
-
-import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
-import static com.github.tomakehurst.wiremock.client.WireMock.containing;
-import static com.github.tomakehurst.wiremock.client.WireMock.delete;
-import static com.github.tomakehurst.wiremock.client.WireMock.post;
-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.urlEqualTo;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
-import static org.openecomp.mso.bpmn.common.DeleteAAIVfModuleTest.MockAAIDeleteGenericVnf;
-import static org.openecomp.mso.bpmn.common.DeleteAAIVfModuleTest.MockAAIDeleteVfModule;
-import static org.openecomp.mso.bpmn.common.DeleteAAIVfModuleTest.MockAAIGenericVnfSearch;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchVfModuleId;
-
-import java.io.IOException;
-import java.util.HashMap;
-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.WorkflowTest;
-import org.openecomp.mso.bpmn.core.WorkflowException;
-import org.openecomp.mso.bpmn.mock.FileUtil;
-
-/**
- * Unit test for DoDeleteVfModule.bpmn.
- */
-public class DoDeleteVfModuleTest extends WorkflowTest {
- private final CallbackSet callbacks = new CallbackSet();
-
- private static final String EOL = "\n";
-
- private final String vnfAdapterDeleteCallback =
- "<deleteVfModuleResponse>" + EOL +
- " <vnfId>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnfId>" + EOL +
- " <vfModuleId>973ed047-d251-4fb9-bf1a-65b8949e0a73</vfModuleId>" + EOL +
- " <vfModuleDeleted>true</vfModuleDeleted>" + EOL +
- " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
- "</deleteVfModuleResponse>" + EOL;
-
- private final String vnfAdapterDeleteCallbackFail =
- "<vfModuleException>" + EOL +
- " <message>Error processing request to VNF-Async. Not Found.</message>" + EOL +
- " <category>INTERNAL</category>" + EOL +
- " <rolledBack>false</rolledBack>" + EOL +
- " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
- "</vfModuleException>" + EOL;
-
- private final String sdncAdapterDeleteCallback =
- "<output xmlns=\"org:onap:sdnctl:l3api\">" + EOL +
- " <svc-request-id>{{REQUEST-ID}}</svc-request-id>" + EOL +
- " <ack-final-indicator>Y</ack-final-indicator>" + EOL +
- "</output>" + EOL;
-
- public DoDeleteVfModuleTest() throws IOException {
- callbacks.put("sdncChangeDelete", sdncAdapterDeleteCallback);
- callbacks.put("sdncDelete", sdncAdapterDeleteCallback);
- callbacks.put("vnfDelete", FileUtil.readResourceFile(
- "__files/DeleteVfModuleCallbackResponse.xml"));
- callbacks.put("vnfDeleteFail", vnfAdapterDeleteCallbackFail);
- }
-
- private final String wfeString = "WorkflowException";
-
- @Test
- @Deployment(resources = {
- "subprocess/DoDeleteVfModule.bpmn",
- "subprocess/PrepareUpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn",
- "subprocess/DeleteAAIVfModule.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn"
- })
- public void TestDoDeleteVfModuleSuccess() {
- // delete the Base Module and Generic Vnf
- // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73
- String request =
- "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL +
- " <request-info>" + EOL +
- " <action>DELETE_VF_MODULE</action>" + EOL +
- " <source>PORTAL</source>" + EOL +
- " </request-info>" + EOL +
- " <vnf-inputs>" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
- " <vnf-type>asc_heat-int</vnf-type>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
- " <service-id>00000000-0000-0000-0000-000000000000</service-id>" + EOL +
- " <service-type>SDN-ETHERNET-INTERNET</service-type>" + EOL +
- " <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id>" + EOL +
- " <orchestration-status>pending-delete</orchestration-status>" + EOL +
- " <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>" + EOL +
- " </vnf-inputs>" + EOL +
- " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL +
- "</vnf-request>" + EOL;
- logStart();
- MockDoDeleteVfModule_SDNCSuccess();
- MockDoDeleteVfModule_DeleteVNFSuccess();
- MockAAIGenericVnfSearch();
- MockAAIVfModulePUT(false);
- MockAAIDeleteGenericVnf();
- MockAAIDeleteVfModule();
- MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("isDebugLogEnabled","true");
- variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("mso-service-instance-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("DoDeleteVfModuleRequest",request);
- variables.put("isVidRequest", "true");
- invokeSubProcess("DoDeleteVfModule", businessKey, variables);
-
- // "changedelete" operation not required for deleting a Vf Module
-// injectSDNCCallbacks(callbacks, "sdncChangeDelete");
- injectVNFRestCallbacks(callbacks, "vnfDelete");
- waitForRunningProcessCount("vnfAdapterDeleteV1", 0, 120000);
- injectSDNCCallbacks(callbacks, "sdncDelete");
-
- waitForProcessEnd(businessKey, 10000);
- WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, wfeString);
- checkVariable(businessKey, wfeString, null);
- if (wfe != null) {
- System.out.println("TestDoDeleteVfModuleSuccess: ErrorCode=" + wfe.getErrorCode() +
- ", ErrorMessage=" + wfe.getErrorMessage());
- }
- logEnd();
- }
-
- @Test
- @Deployment(resources = {
- "subprocess/DoDeleteVfModule.bpmn",
- "subprocess/PrepareUpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn",
- "subprocess/DeleteAAIVfModule.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn"
- })
- public void TestDoDeleteVfModule_Building_Block_Success() {
- logStart();
- MockDoDeleteVfModule_SDNCSuccess();
- MockDoDeleteVfModule_DeleteVNFSuccess();
- MockAAIGenericVnfSearch();
- MockAAIVfModulePUT(false);
- MockAAIDeleteGenericVnf();
- MockAAIDeleteVfModule();
- MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
-
- variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("requestId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("isDebugLogEnabled","true");
- variables.put("vnfId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("vfModuleId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
- variables.put("serviceInstanceId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("vfModuleName", "STMTN5MMSC21-MMSC::module-0-0");
- variables.put("sdncVersion", "1610");
- variables.put("isVidRequest", "true");
- variables.put("retainResources", false);
- String vfModuleModelInfo = "{" + "\"modelType\": \"vnf\"," +
- "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," +
- "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," +
- "\"modelName\": \"vSAMP12\"," +
- "\"modelVersion\": \"1.0\"," +
- "\"modelCustomizationUuid\": \"MODEL-ID-1234\"," +
- "}";
- variables.put("vfModuleModelInfo", vfModuleModelInfo);
-
- String cloudConfiguration = "{" +
- "\"lcpCloudRegionId\": \"RDM2WAGPLCP\"," +
- "\"tenantId\": \"fba1bd1e195a404cacb9ce17a9b2b421\"" + "}";
- variables.put("cloudConfiguration", cloudConfiguration);
-
-
- invokeSubProcess("DoDeleteVfModule", businessKey, variables);
-
- // "changedelete" operation not required for deleting a Vf Module
-// injectSDNCCallbacks(callbacks, "sdncChangeDelete");
- injectVNFRestCallbacks(callbacks, "vnfDelete");
- waitForRunningProcessCount("vnfAdapterDeleteV1", 0, 120000);
- injectSDNCCallbacks(callbacks, "sdncDelete");
-
- waitForProcessEnd(businessKey, 10000);
- WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, wfeString);
- checkVariable(businessKey, wfeString, null);
- if (wfe != null) {
- System.out.println("TestDoDeleteVfModule_Building_Block_Success: ErrorCode=" + wfe.getErrorCode() +
- ", ErrorMessage=" + wfe.getErrorMessage());
- }
- logEnd();
- }
-
- @Test
- @Deployment(resources = {
- "subprocess/DoDeleteVfModule.bpmn",
- "subprocess/PrepareUpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn",
- "subprocess/DeleteAAIVfModule.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn"
- })
- public void TestDoDeleteVfModule_Building_Block_ModuleInAssignedState() {
- logStart();
- MockDoDeleteVfModule_SDNCSuccess();
- MockDoDeleteVfModule_DeleteVNFSuccess();
- MockAAIGenericVnfSearch();
- MockAAIVfModulePUT(false);
- MockAAIDeleteGenericVnf();
- MockAAIDeleteVfModule();
- MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
-
- variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("requestId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("isDebugLogEnabled","true");
- variables.put("vnfId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("vfModuleId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
- variables.put("serviceInstanceId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("vfModuleName", "STMTN5MMSC21-MMSC::module-0-0");
- variables.put("sdncVersion", "1610");
- variables.put("isVidRequest", "true");
- variables.put("retainResources", false);
- variables.put("aLaCarte", true);
- String vfModuleModelInfo = "{" + "\"modelType\": \"vnf\"," +
- "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," +
- "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," +
- "\"modelName\": \"vSAMP12\"," +
- "\"modelVersion\": \"1.0\"," +
- "\"modelCustomizationUuid\": \"MODEL-ID-1234\"," +
- "}";
- variables.put("vfModuleModelInfo", vfModuleModelInfo);
-
- String cloudConfiguration = "{" +
- "\"lcpCloudRegionId\": \"RDM2WAGPLCP\"," +
- "\"tenantId\": \"fba1bd1e195a404cacb9ce17a9b2b421\"" + "}";
- variables.put("cloudConfiguration", cloudConfiguration);
-
-
- invokeSubProcess("DoDeleteVfModule", businessKey, variables);
-
- // "changedelete" operation not required for deleting a Vf Module
-// injectSDNCCallbacks(callbacks, "sdncChangeDelete");
- injectVNFRestCallbacks(callbacks, "vnfDelete");
- waitForRunningProcessCount("vnfAdapterDeleteV1", 0, 120000);
- injectSDNCCallbacks(callbacks, "sdncDelete");
-
- waitForProcessEnd(businessKey, 10000);
- WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, wfeString);
- checkVariable(businessKey, wfeString, null);
- if (wfe != null) {
- System.out.println("TestDoDeleteVfModule_Building_Block_Success: ErrorCode=" + wfe.getErrorCode() +
- ", ErrorMessage=" + wfe.getErrorMessage());
- }
- logEnd();
- }
-
-
- @Test
- @Deployment(resources = {
- "subprocess/DoDeleteVfModule.bpmn",
- "subprocess/PrepareUpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn",
- "subprocess/DeleteAAIVfModule.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn"
- })
- public void TestDoDeleteVfModuleSDNCFailure() {
- // delete the Base Module and Generic Vnf - SDNCAdapter failure
- // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73
- String request =
- "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL +
- " <request-info>" + EOL +
- " <action>DELETE_VF_MODULE</action>" + EOL +
- " <source>PORTAL</source>" + EOL +
- " </request-info>" + EOL +
- " <vnf-inputs>" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
- " <vnf-type>asc_heat-int</vnf-type>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
- " <service-id>00000000-0000-0000-0000-000000000000</service-id>" + EOL +
- " <service-type>SDN-ETHERNET-INTERNET</service-type>" + EOL +
- " <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id>" + EOL +
- " <orchestration-status>pending-delete</orchestration-status>" + EOL +
- " <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>" + EOL +
- " </vnf-inputs>" + EOL +
- " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL +
- "</vnf-request>" + EOL;
-
- logStart();
- MockDoDeleteVfModule_SDNCFailure();
- MockDoDeleteVfModule_DeleteVNFSuccess();
- MockAAIGenericVnfSearch();
- MockAAIVfModulePUT(false);
- MockAAIDeleteGenericVnf();
- MockAAIDeleteVfModule();
- MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("isDebugLogEnabled","true");
- variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("mso-service-instance-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("DoDeleteVfModuleRequest", request);
- variables.put("isVidRequest", "true");
- invokeSubProcess("DoDeleteVfModule", businessKey, variables);
-
- // "changedelete" operation not required for deleting a Vf Module
-// injectSDNCCallbacks(callbacks, "sdncChangeDelete");
- injectVNFRestCallbacks(callbacks, "vnfDelete");
- waitForRunningProcessCount("vnfAdapterDeleteV1", 0, 120000);
- // cause a failure by not injecting a callback
-// injectSDNCCallbacks(callbacks, "sdncDelete");
-
- waitForProcessEnd(businessKey, 10000);
- WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, wfeString);
- Assert.assertNotNull(wfe);
- if (wfe != null) {
- System.out.println("TestDoDeleteVfModuleSDNCFailure: ErrorCode=" + wfe.getErrorCode() +
- ", ErrorMessage=" + wfe.getErrorMessage());
- Assert.assertTrue(wfe.getErrorCode() == 7000);
- Assert.assertTrue(wfe.getErrorMessage().startsWith("Could not communicate"));
- }
- logEnd();
- }
-
- @Test
- @Deployment(resources = {
- "subprocess/DoDeleteVfModule.bpmn",
- "subprocess/PrepareUpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn",
- "subprocess/DeleteAAIVfModule.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn"
- })
- public void TestDoDeleteVfModuleSDNCCallbackFailure() {
- // delete the Base Module and Generic Vnf - SDNCAdapter Callback failure
- // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73
- String request =
- "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL +
- " <request-info>" + EOL +
- " <action>DELETE_VF_MODULE</action>" + EOL +
- " <source>PORTAL</source>" + EOL +
- " </request-info>" + EOL +
- " <vnf-inputs>" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
- " <vnf-type>asc_heat-int</vnf-type>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
- " <service-id>00000000-0000-0000-0000-000000000000</service-id>" + EOL +
- " <service-type>SDN-ETHERNET-INTERNET</service-type>" + EOL +
- " <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id>" + EOL +
- " <orchestration-status>pending-delete</orchestration-status>" + EOL +
- " <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>" + EOL +
- " </vnf-inputs>" + EOL +
- " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL +
- "</vnf-request>" + EOL;
-
- logStart();
- MockDoDeleteVfModule_SDNCSuccess();
- MockDoDeleteVfModule_DeleteVNFSuccess();
- MockAAIGenericVnfSearch();
- MockAAIVfModulePUT(false);
- MockAAIDeleteGenericVnf();
- MockAAIDeleteVfModule();
- MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("isDebugLogEnabled","true");
- variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("mso-service-instance-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("DoDeleteVfModuleRequest",request);
- variables.put("isVidRequest", "true");
- invokeSubProcess("DoDeleteVfModule", businessKey, variables);
-
- // "changedelete" operation not required for deleting a Vf Module
-// injectSDNCCallbacks(callbacks, "sdncChangeDelete:ERR");
- injectVNFRestCallbacks(callbacks, "vnfDelete");
- waitForRunningProcessCount("vnfAdapterDeleteV1", 0, 120000);
- // return a failure in the callback
- injectSDNCCallbacks(callbacks, "sdncDelete:ERR");
-
- waitForProcessEnd(businessKey, 10000);
- WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, wfeString);
- Assert.assertNotNull(wfe);
- if (wfe != null) {
- System.out.println("TestDoDeleteVfModuleSDNCCallbackFailure: ErrorCode=" + wfe.getErrorCode() +
- ", ErrorMessage=" + wfe.getErrorMessage());
- Assert.assertTrue(wfe.getErrorCode() == 5310);
- Assert.assertTrue(wfe.getErrorMessage().startsWith("Received error from SDN-C"));
- }
- logEnd();
- }
-
- @Test
- @Deployment(resources = {
- "subprocess/DoDeleteVfModule.bpmn",
- "subprocess/PrepareUpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn",
- "subprocess/DeleteAAIVfModule.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn"
- })
- public void TestDoDeleteVfModuleVNFFailure() {
- // delete the Base Module and Generic Vnf - VNFAdapter failure
- // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73
- String request =
- "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL +
- " <request-info>" + EOL +
- " <action>DELETE_VF_MODULE</action>" + EOL +
- " <source>PORTAL</source>" + EOL +
- " </request-info>" + EOL +
- " <vnf-inputs>" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
- " <vnf-type>asc_heat-int</vnf-type>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
- " <service-id>00000000-0000-0000-0000-000000000000</service-id>" + EOL +
- " <service-type>SDN-ETHERNET-INTERNET</service-type>" + EOL +
- " <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id>" + EOL +
- " <orchestration-status>pending-delete</orchestration-status>" + EOL +
- " <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>" + EOL +
- " </vnf-inputs>" + EOL +
- " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL +
- "</vnf-request>" + EOL;
-
- logStart();
- MockDoDeleteVfModule_SDNCSuccess();
- MockDoDeleteVfModule_DeleteVNFFailure();
- MockAAIGenericVnfSearch();
- MockAAIVfModulePUT(false);
- MockAAIDeleteGenericVnf();
- MockAAIDeleteVfModule();
- MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("isDebugLogEnabled","true");
- variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("mso-service-instance-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("DoDeleteVfModuleRequest",request);
- invokeSubProcess("DoDeleteVfModule", businessKey, variables);
-
- // "changedelete" operation not required for deleting a Vf Module
-// injectSDNCCallbacks(callbacks, "sdncChangeDelete");
- // cause a failure by not injecting a callback
-// injectVNFRestCallbacks(callbacks, "vnfDelete");
-// waitForRunningProcessCount("vnfAdapterDeleteV1", 0, 120000);
-// injectSDNCCallbacks(callbacks, "sdncDelete");
-
- waitForProcessEnd(businessKey, 10000);
- WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, wfeString);
- Assert.assertNotNull(wfe);
- if (wfe != null) {
- System.out.println("TestDoDeleteVfModuleVNFFailure: ErrorCode=" + wfe.getErrorCode() +
- ", ErrorMessage=" + wfe.getErrorMessage());
- Assert.assertTrue(wfe.getErrorCode() == 7020);
- Assert.assertTrue(wfe.getErrorMessage().startsWith("Received error from VnfAdapter"));
- }
- logEnd();
- }
-
- @Test
- @Deployment(resources = {
- "subprocess/DoDeleteVfModule.bpmn",
- "subprocess/PrepareUpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn",
- "subprocess/DeleteAAIVfModule.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn"
- })
- public void TestDoDeleteVfModuleVNFCallbackFailure() {
- // delete the Base Module and Generic Vnf - VNFAdapter Callback failure
- // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73
- String request =
- "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL +
- " <request-info>" + EOL +
- " <action>DELETE_VF_MODULE</action>" + EOL +
- " <source>PORTAL</source>" + EOL +
- " </request-info>" + EOL +
- " <vnf-inputs>" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
- " <vnf-type>asc_heat-int</vnf-type>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
- " <service-id>00000000-0000-0000-0000-000000000000</service-id>" + EOL +
- " <service-type>SDN-ETHERNET-INTERNET</service-type>" + EOL +
- " <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id>" + EOL +
- " <orchestration-status>pending-delete</orchestration-status>" + EOL +
- " <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>" + EOL +
- " </vnf-inputs>" + EOL +
- " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL +
- "</vnf-request>" + EOL;
-
- logStart();
- MockDoDeleteVfModule_SDNCSuccess();
- MockDoDeleteVfModule_DeleteVNFSuccess();
- MockAAIGenericVnfSearch();
- MockAAIVfModulePUT(false);
- MockAAIDeleteGenericVnf();
- MockAAIDeleteVfModule();
- MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("isDebugLogEnabled","true");
- variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("mso-service-instance-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("DoDeleteVfModuleRequest",request);
- invokeSubProcess("DoDeleteVfModule", businessKey, variables);
-
- // "changedelete" operation not required for deleting a Vf Module
-// injectSDNCCallbacks(callbacks, "sdncChangeDelete");
- injectVNFRestCallbacks(callbacks, "vnfDeleteFail");
- waitForRunningProcessCount("vnfAdapterDeleteV1", 0, 120000);
-// injectSDNCCallbacks(callbacks, "sdncDelete");
-
- waitForProcessEnd(businessKey, 10000);
- WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, wfeString);
- Assert.assertNotNull(wfe);
- if (wfe != null) {
- System.out.println("TestDoDeleteVfModuleVNFCallbackFailure: ErrorCode=" + wfe.getErrorCode() +
- ", ErrorMessage=" + wfe.getErrorMessage());
- Assert.assertTrue(wfe.getErrorCode() == 7020);
- Assert.assertTrue(wfe.getErrorMessage().startsWith("Received vfModuleException from VnfAdapter"));
- }
- logEnd();
- }
-
- // start of mocks used locally and by other VF Module unit tests
- public static void MockAAIVfModulePUT(boolean isCreate){
- stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*/vf-modules/vf-module/.*"))
- .withRequestBody(containing("MMSC"))
- .willReturn(aResponse()
- .withStatus(isCreate ? 201 : 200)));
- stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*/vf-modules/vf-module/.*"))
- .withRequestBody(containing("PCRF"))
- .willReturn(aResponse()
- .withStatus(500)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("aaiFault.xml")));
- stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721"))
- .willReturn(aResponse()
- .withStatus(200)));
- }
-
- public static void MockDoDeleteVfModule_SDNCSuccess() {
- stubFor(post(urlEqualTo("/SDNCAdapter"))
- .withRequestBody(containing("SvcAction>changedelete"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml")));
- stubFor(post(urlEqualTo("/SDNCAdapter"))
- .withRequestBody(containing("SvcAction>delete"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml")));
- }
-
- public static void MockDoDeleteVfModule_SDNCFailure() {
- stubFor(post(urlEqualTo("/SDNCAdapter"))
- .withRequestBody(containing("SvcAction>changedelete"))
- .willReturn(aResponse()
- .withStatus(500)));
- stubFor(post(urlEqualTo("/SDNCAdapter"))
- .withRequestBody(containing("SvcAction>delete"))
- .willReturn(aResponse()
- .withStatus(500)));
- }
-
- public static void MockDoDeleteVfModule_DeleteVNFSuccess() {
- stubFor(delete(urlMatching("/vnfs/v1/vnfs/.*/vf-modules/.*"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/xml")));
- stubFor(delete(urlMatching("/vnfs/v1/volume-groups/78987"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/xml")));
- }
-
- public static void MockDoDeleteVfModule_DeleteVNFFailure() {
- stubFor(delete(urlMatching("/vnfs/v1/vnfs/.*/vf-modules/.*"))
- .willReturn(aResponse()
- .withStatus(500)
- .withHeader("Content-Type", "application/xml")));
- }
-}
-
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVfModuleVolumeV2Test.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVfModuleVolumeV2Test.java
deleted file mode 100644
index 165debe7f1..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVfModuleVolumeV2Test.java
+++ /dev/null
@@ -1,198 +0,0 @@
-/*-
- * ============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.infrastructure;
-
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteVolumeGroupById;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetNetworkCloudRegion;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetVolumeGroupById;
-import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB;
-import static org.openecomp.mso.bpmn.mock.StubResponseVNFAdapter.mockPutVNFVolumeGroup;
-import static org.openecomp.mso.bpmn.mock.StubResponseVNFAdapter.mockVfModuleDelete;
-
-import java.io.IOException;
-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.WorkflowTest;
-import org.openecomp.mso.bpmn.core.WorkflowException;
-import org.openecomp.mso.bpmn.mock.FileUtil;
-
-public class DoDeleteVfModuleVolumeV2Test extends WorkflowTest {
-
- private final CallbackSet callbacks = new CallbackSet();
-
- public DoDeleteVfModuleVolumeV2Test() throws IOException {
- callbacks.put("volumeGroupDelete", FileUtil.readResourceFile(
- "__files/DeleteVfModuleVolumeInfraV1/DeleteVfModuleVolumeCallbackResponse.xml"));
- }
-
- @Test
- //@Ignore
- @Deployment(resources = {"subprocess/DoDeleteVfModuleVolumeV2.bpmn", "subprocess/VnfAdapterRestV1.bpmn"})
- public void happyPath() throws Exception {
-
- logStart();
-
- MockGetNetworkCloudRegion("MDTWNJ21", "CreateNetworkV2/cloudRegion30_AAIResponse_Success.xml");
- MockGetVolumeGroupById("RDM2WAGPLCP", "78987", "DeleteVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml");
- MockDeleteVolumeGroupById("RDM2WAGPLCP", "78987", "0000020", 200);
- mockPutVNFVolumeGroup("78987", 202);
- mockVfModuleDelete("78987");
- MockDeleteVolumeGroupById("AAIAIC25", "78987", "0000020", 200);
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
- MockGetVolumeGroupById("AAIAIC25", "78987", "VfModularity/VolumeGroup.xml");
- String businessKey = UUID.randomUUID().toString();
-
- Map<String, Object> testVariables = new HashMap<>();
- testVariables.put("mso-request-id", "TEST-REQUEST-ID-0123");
- testVariables.put("msoRequestId", "TEST-REQUEST-ID-0123");
- testVariables.put("isDebugLogEnabled", "true");
- //testVariables.put("lcpCloudRegionId", "MDTWNJ21");
- //testVariables.put("tenantId", "fba1bd1e195a404cacb9ce17a9b2b421");
- testVariables.put("volumeGroupId", "78987");
- testVariables.put("serviceInstanceId", "test-service-instance-id-0123");
-
- String cloudConfiguration = "{" +
- "\"lcpCloudRegionId\": \"MDTWNJ21\"," +
- "\"tenantId\": \"fba1bd1e195a404cacb9ce17a9b2b421\"" + "}";
- testVariables.put("cloudConfiguration", cloudConfiguration);
-
- invokeSubProcess("DoDeleteVfModuleVolumeV2", businessKey, testVariables);
-
- injectVNFRestCallbacks(callbacks, "volumeGroupDelete");
-
- waitForProcessEnd(businessKey, 100000);
- checkVariable(businessKey, "wasDeleted", "true");
-
- logEnd();
- }
-
-
- @Test
- //@Ignore
- @Deployment(resources = {"subprocess/DoDeleteVfModuleVolumeV2.bpmn", "subprocess/VnfAdapterRestV1.bpmn"})
- public void testVolumeGroupInUse() throws Exception {
-
- logStart();
- MockGetNetworkCloudRegion("MDTWNJ21", "CreateNetworkV2/cloudRegion30_AAIResponse_Success.xml");
- MockGetVolumeGroupById("RDM2WAGPLCP", "78987", "DeleteVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_HasVfModRelationship.xml");
- MockDeleteVolumeGroupById("RDM2WAGPLCP", "78987", "0000020", 200);
- mockVfModuleDelete("78987");
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
- String businessKey = UUID.randomUUID().toString();
-
- Map<String, Object> testVariables = new HashMap<>();
- testVariables.put("mso-request-id", "TEST-REQUEST-ID-0123");
- testVariables.put("msoRequestId", "TEST-REQUEST-ID-0123");
- testVariables.put("isDebugLogEnabled", "true");
- testVariables.put("volumeGroupId", "78987");
- testVariables.put("serviceInstanceId", "test-service-instance-id-0123");
-
- String cloudConfiguration = "{" +
- "\"lcpCloudRegionId\": \"MDTWNJ21\"," +
- "\"tenantId\": \"fba1bd1e195a404cacb9ce17a9b2b421\"" + "}";
- testVariables.put("cloudConfiguration", cloudConfiguration);
-
- invokeSubProcess("DoDeleteVfModuleVolumeV2", businessKey, testVariables);
-
- waitForProcessEnd(businessKey, 100000);
- checkVariable(businessKey, "wasDeleted", "false");
- WorkflowException msoException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- System.out.println("WorkflowException - Code: " + msoException.getErrorCode() + " Message: " + msoException.getErrorMessage());
-
-
- logEnd();
- }
-
- @Test
- //@Ignore
- @Deployment(resources = {"subprocess/DoDeleteVfModuleVolumeV2.bpmn", "subprocess/VnfAdapterRestV1.bpmn"})
- public void testTenantIdMismatch() throws Exception {
-
- logStart();
- MockGetNetworkCloudRegion("MDTWNJ21", "CreateNetworkV2/cloudRegion30_AAIResponse_Success.xml");
- MockGetVolumeGroupById("RDM2WAGPLCP", "78987", "DeleteVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml");
- MockDeleteVolumeGroupById("RDM2WAGPLCP", "78987", "0000020", 200);
- mockVfModuleDelete("78987", 404);
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
- String businessKey = UUID.randomUUID().toString();
-
- Map<String, Object> testVariables = new HashMap<>();
- testVariables.put("mso-request-id", "TEST-REQUEST-ID-0123");
- testVariables.put("msoRequestId", "TEST-REQUEST-ID-0123");
- testVariables.put("isDebugLogEnabled", "true");
- testVariables.put("volumeGroupId", "78987");
- testVariables.put("serviceInstanceId", "test-service-instance-id-0123");
-
- String cloudConfiguration = "{" +
- "\"lcpCloudRegionId\": \"MDTWNJ21\"," +
- "\"tenantId\": \"fba1bd1e195a404cacb9ce17a9b2b421xxx\"" + "}";
- testVariables.put("cloudConfiguration", cloudConfiguration);
-
- invokeSubProcess("DoDeleteVfModuleVolumeV2", businessKey, testVariables);
-
- waitForProcessEnd(businessKey, 100000);
- checkVariable(businessKey, "wasDeleted", "false");
- WorkflowException msoException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- System.out.println("WorkflowException - Code: " + msoException.getErrorCode() + " Message: " + msoException.getErrorMessage());
-
-
- logEnd();
- }
-
- @Test
- //@Ignore
- @Deployment(resources = {"subprocess/DoDeleteVfModuleVolumeV2.bpmn", "subprocess/VnfAdapterRestV1.bpmn"})
- public void testVnfAdapterCallfail() throws Exception {
-
- logStart();
- MockGetNetworkCloudRegion("MDTWNJ21", "CreateNetworkV2/cloudRegion30_AAIResponse_Success.xml");
- MockGetVolumeGroupById("RDM2WAGPLCP", "78987", "DeleteVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml");
- MockDeleteVolumeGroupById("RDM2WAGPLCP", "78987", "0000020", 200);
- mockVfModuleDelete("78987", 404);
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
- String businessKey = UUID.randomUUID().toString();
-
- Map<String, Object> testVariables = new HashMap<>();
- testVariables.put("mso-request-id", "TEST-REQUEST-ID-0123");
- testVariables.put("msoRequestId", "TEST-REQUEST-ID-0123");
- testVariables.put("isDebugLogEnabled", "true");
- testVariables.put("volumeGroupId", "78987");
- testVariables.put("serviceInstanceId", "test-service-instance-id-0123");
-
- String cloudConfiguration = "{" +
- "\"lcpCloudRegionId\": \"MDTWNJ21\"," +
- "\"tenantId\": \"fba1bd1e195a404cacb9ce17a9b2b421\"" + "}";
- testVariables.put("cloudConfiguration", cloudConfiguration);
-
- invokeSubProcess("DoDeleteVfModuleVolumeV2", businessKey, testVariables);
-
- waitForProcessEnd(businessKey, 100000);
- checkVariable(businessKey, "wasDeleted", "false");
- WorkflowException msoException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- System.out.println("WorkflowException - Code: " + msoException.getErrorCode() + " Message: " + msoException.getErrorMessage());
-
- logEnd();
- }
-}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVnfAndModulesTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVnfAndModulesTest.java
deleted file mode 100644
index c53beb1446..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVnfAndModulesTest.java
+++ /dev/null
@@ -1,352 +0,0 @@
-/*-
- * ============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.infrastructure;
-
-import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
-import static com.github.tomakehurst.wiremock.client.WireMock.containing;
-import static com.github.tomakehurst.wiremock.client.WireMock.delete;
-import static com.github.tomakehurst.wiremock.client.WireMock.post;
-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.urlEqualTo;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.openecomp.mso.bpmn.common.DeleteAAIVfModuleTest.MockAAIDeleteGenericVnf;
-import static org.openecomp.mso.bpmn.common.DeleteAAIVfModuleTest.MockAAIDeleteVfModule;
-import static org.openecomp.mso.bpmn.common.DeleteAAIVfModuleTest.MockAAIGenericVnfSearch;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteGenericVnf;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfById;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchVfModuleId;
-import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB;
-import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-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;
-import org.openecomp.mso.bpmn.core.domain.ModelInfo;
-import org.openecomp.mso.bpmn.core.domain.ModuleResource;
-import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition;
-import org.openecomp.mso.bpmn.core.domain.VnfResource;
-
-public class DoDeleteVnfAndModulesTest extends WorkflowTest {
- private final CallbackSet callbacks = new CallbackSet();
- private static final String EOL = "\n";
- private final String vnfAdapterDeleteCallback =
- "<deleteVfModuleResponse>" + EOL +
- " <vnfId>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnfId>" + EOL +
- " <vfModuleId>973ed047-d251-4fb9-bf1a-65b8949e0a73</vfModuleId>" + EOL +
- " <vfModuleDeleted>true</vfModuleDeleted>" + EOL +
- " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
- "</deleteVfModuleResponse>" + EOL;
- private final String sdncAdapterDeleteCallback =
- "<output xmlns=\"org:openecomp:sdnctl:l3api\">" + EOL +
- " <svc-request-id>{{REQUEST-ID}}</svc-request-id>" + EOL +
- " <ack-final-indicator>Y</ack-final-indicator>" + EOL +
- "</output>" + EOL;
-
- public DoDeleteVnfAndModulesTest () throws IOException {
- callbacks.put("deactivate", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
- callbacks.put("unassign", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
- callbacks.put("vnfDelete", vnfAdapterDeleteCallback);
- callbacks.put("sdncDelete", sdncAdapterDeleteCallback);
-
- }
-
- @Test
- @Deployment(resources = {"subprocess/DoDeleteVnfAndModules.bpmn", "subprocess/SDNCAdapterV1.bpmn", "subprocess/GenericGetVnf.bpmn", "subprocess/GenericDeleteVnf.bpmn", "subprocess/DoDeleteVnf.bpmn", "subprocess/DoDeleteVfModule.bpmn"})
- public void testDoDeleteVnfAndModules_successVnfOnly() throws Exception{
- MockGetGenericVnfById("testVnfId123.*", "GenericFlows/getGenericVnfByNameResponse.xml");
- MockDeleteGenericVnf("testVnfId123", "testReVer123");
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
- mockSDNCAdapter(200);
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariablesVnfOnly(variables);
- invokeSubProcess("DoDeleteVnfAndModules", businessKey, variables);
-
- injectSDNCCallbacks(callbacks, "deactivate");
- injectSDNCCallbacks(callbacks, "unassign");
-
- waitForProcessEnd(businessKey, 10000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
-
- String workflowException = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnfAndModules", "WorkflowException");
-
- assertEquals(null, workflowException);
- }
-
-
- private void setVariablesVnfOnly(Map<String, Object> variables) {
- variables.put("mso-request-id", "testRequestId123");
- variables.put("isDebugLogEnabled", "true");
- variables.put("vnfId","testVnfId123");
- variables.put("serviceInstanceId", "MIS%2F1604%2F0026%2FSW_INTERNET");
- //variables.put("vnfName", "testVnfName123");
- variables.put("disableRollback", "true");
- variables.put("msoRequestId", "testVnfId123");
- variables.put("testVnfId","testVnfId123");
- //variables.put("vnfType", "STMTN");
- variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
- String vnfModelInfo = "{ "+ "\"modelType\": \"vnf\"," +
- "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," +
- "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," +
- "\"modelName\": \"vSAMP12\"," +
- "\"modelVersion\": \"1.0\"," +
- "\"modelCustomizationUuid\": \"MODEL-ID-1234\"," +
- "}";
- //variables.put("vnfModelInfo", vnfModelInfo);
-
- variables.put("lcpCloudRegionId", "mdt1");
- variables.put("tenantId", "88a6ca3ee0394ade9403f075db23167e");
-
- String serviceModelInfo = "{ "+ "\"modelType\": \"service\"," +
- "\"modelInvariantUuid\": \"995256d2-5a33-55df-13ab-12abad84e7ff\"," +
- "\"modelUuid\": \"ab6478e5-ea33-3346-ac12-ab121484a3fe\"," +
- "\"modelName\": \"ServicevSAMP12\"," +
- "\"modelVersion\": \"1.0\"," +
- "}";
- //variables.put("serviceModelInfo", serviceModelInfo);
- variables.put("globalSubscriberId", "MSO-1610");
- variables.put("sdncVersion", "1707");
-
- }
-
- @Test
- @Deployment(resources = {"subprocess/DoDeleteVnfAndModules.bpmn", "subprocess/SDNCAdapterV1.bpmn", "subprocess/GenericGetVnf.bpmn", "subprocess/GenericDeleteVnf.bpmn", "subprocess/DoDeleteVnf.bpmn", "subprocess/DoDeleteVfModuleFromVnf.bpmn", "subprocess/VnfAdapterRestV1.bpmn", "subprocess/DeleteAAIVfModule.bpmn"})
- public void testDoDeleteVnfAndModules_successVnfAndModules() throws Exception{
- MockAAIGenericVnfSearch();
- MockGetGenericVnfById("testVnfId123.*", "GenericFlows/getGenericVnfByNameResponse.xml");
- MockDeleteGenericVnf("testVnfId123", "testReVer123");
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
- mockSDNCAdapter(200);
- MockDoDeleteVfModule_SDNCSuccess();
- MockDoDeleteVfModule_DeleteVNFSuccess();
- MockAAIDeleteVfModule();
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariablesVnfAndModules(variables);
- invokeSubProcess("DoDeleteVnfAndModules", businessKey, variables);
-
- injectSDNCCallbacks(callbacks, "deactivate");
- injectSDNCCallbacks(callbacks, "deactivate");
- injectVNFRestCallbacks(callbacks, "vnfDelete");
- injectSDNCCallbacks(callbacks, "unassign");
- MockGetGenericVnfById("a27ce5a9-29c4-4c22-a017-6615ac73c721", "GenericFlows/getGenericVnfByNameResponse.xml");
- injectSDNCCallbacks(callbacks, "unassign");
- //MockGetGenericVnfById("a27ce5a9-29c4-4c22-a017-6615ac73c721", "GenericFlows/getGenericVnfByNameResponse.xml");
-
- waitForProcessEnd(businessKey, 10000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
-
- String workflowException = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnfAndModules", "WorkflowException");
-
- assertEquals(null, workflowException);
- }
-
-
- private void setVariablesVnfAndModules(Map<String, Object> variables) {
- variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("isDebugLogEnabled", "true");
- variables.put("vnfId","a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("serviceInstanceId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
-
- variables.put("msoRequestId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- //variables.put("testVnfId","testVnfId123");
-
- variables.put("lcpCloudRegionId", "RDM2WAGPLCP");
- variables.put("tenantId", "fba1bd1e195a404cacb9ce17a9b2b421");
-
- variables.put("sdncVersion", "1707");
-
-
- ServiceDecomposition sd = new ServiceDecomposition();
- ModelInfo serviceModel = new ModelInfo();
- serviceModel.setModelName("servicewithVNFs");
- sd.setModelInfo(serviceModel);
- VnfResource vr = new VnfResource();
- ModelInfo mvr = new ModelInfo();
- mvr.setModelName("vSAMP12");
- mvr.setModelInstanceName("v123");
- mvr.setModelInvariantUuid("");
- mvr.setModelVersion("1.0");
- mvr.setModelCustomizationUuid("MODEL-ID-1234");
- vr.setModelInfo(mvr);
- vr.constructVnfType("vnf1");
- vr.setNfType("somenftype");
- vr.setNfRole("somenfrole");
- vr.setNfFunction("somenffunction");
- vr.setNfNamingCode("somenamingcode");
- ModuleResource mr = new ModuleResource();
- ModelInfo mvmr = new ModelInfo();
- mvmr.setModelInvariantUuid("ff5256d2-5a33-55df-13ab-12abad84e7ff");
- mvmr.setModelName("STMTN5MMSC21-MMSC::model-1-0");
- mvmr.setModelUuid("1.0");
- mvmr.setModelCustomizationUuid("MODEL-123");
- mr.setModelInfo(mvmr);
- mr.setIsBase(true);
- mr.setVfModuleLabel("MODULELABEL");
- vr.addVfModule(mr);
- sd.addVnfResource(vr);
- variables.put("serviceDecomposition", sd);
-
- }
-
- @Test
- @Deployment(resources = {"subprocess/DoDeleteVnfAndModules.bpmn", "subprocess/SDNCAdapterV1.bpmn", "subprocess/GenericGetVnf.bpmn", "subprocess/GenericDeleteVnf.bpmn", "subprocess/DoDeleteVnf.bpmn", "subprocess/DoDeleteVfModule.bpmn", "subprocess/UpdateAAIVfModule.bpmn", "subprocess/PrepareUpdateAAIVfModule.bpmn", "subprocess/DoDeleteVfModuleFromVnf.bpmn", "subprocess/VnfAdapterRestV1.bpmn", "subprocess/DeleteAAIVfModule.bpmn"})
- public void testDoDeleteVnfAndModulesDirectDelete_successVnfAndModules() throws Exception{
- MockDoDeleteVfModule_SDNCSuccess();
- MockDoDeleteVfModule_DeleteVNFSuccess();
- mockSDNCAdapter(200);
- MockAAIGenericVnfSearch();
- MockAAIVfModulePUT(false);
- MockAAIDeleteGenericVnf();
- MockAAIDeleteVfModule();
- MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariablesVnfAndModulesDirectDelete(variables);
- invokeSubProcess("DoDeleteVnfAndModules", businessKey, variables);
-
- injectVNFRestCallbacks(callbacks, "vnfDelete");
- injectSDNCCallbacks(callbacks, "sdncDelete");
- MockGetGenericVnfById("a27ce5a9-29c4-4c22-a017-6615ac73c721", "GenericFlows/getGenericVnfByNameResponse.xml");
-
- waitForProcessEnd(businessKey, 10000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
-
- String workflowException = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnfAndModules", "WorkflowException");
-
- // WorkflowException is expected here, since empty VNF cannot be simulated here
- assertNotEquals(null, workflowException);
- }
-
-
- private void setVariablesVnfAndModulesDirectDelete(Map<String, Object> variables) {
- variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("isDebugLogEnabled", "true");
- variables.put("vnfId","a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("serviceInstanceId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
-
- variables.put("msoRequestId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- //variables.put("testVnfId","testVnfId123");
-
- variables.put("lcpCloudRegionId", "RDM2WAGPLCP");
- variables.put("tenantId", "fba1bd1e195a404cacb9ce17a9b2b421");
-
- variables.put("sdncVersion", "1702");
-
-
- ServiceDecomposition sd = new ServiceDecomposition();
- ModelInfo serviceModel = new ModelInfo();
- serviceModel.setModelName("servicewithVNFs");
- sd.setModelInfo(serviceModel);
- VnfResource vr = new VnfResource();
- ModelInfo mvr = new ModelInfo();
- mvr.setModelName("vSAMP12");
- mvr.setModelInstanceName("v123");
- mvr.setModelInvariantUuid("");
- mvr.setModelVersion("1.0");
- mvr.setModelCustomizationUuid("MODEL-ID-1234");
- vr.setModelInfo(mvr);
- vr.constructVnfType("vnf1");
- vr.setNfType("somenftype");
- vr.setNfRole("somenfrole");
- vr.setNfFunction("somenffunction");
- vr.setNfNamingCode("somenamingcode");
- ModuleResource mr = new ModuleResource();
- ModelInfo mvmr = new ModelInfo();
- mvmr.setModelInvariantUuid("ff5256d2-5a33-55df-13ab-12abad84e7ff");
- mvmr.setModelName("STMTN5MMSC21-MMSC::model-1-0");
- mvmr.setModelUuid("1.0");
- mvmr.setModelCustomizationUuid("MODEL-123");
- mr.setModelInfo(mvmr);
- mr.setIsBase(true);
- mr.setVfModuleLabel("MODULELABEL");
- vr.addVfModule(mr);
- sd.addVnfResource(vr);
- variables.put("serviceDecomposition", sd);
-
- }
-
- public static void MockAAIVfModulePUT(boolean isCreate){
- stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*/vf-modules/vf-module/.*"))
- .withRequestBody(containing("MMSC"))
- .willReturn(aResponse()
- .withStatus(isCreate ? 201 : 200)));
- stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*/vf-modules/vf-module/.*"))
- .withRequestBody(containing("PCRF"))
- .willReturn(aResponse()
- .withStatus(500)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("aaiFault.xml")));
- stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721"))
- .willReturn(aResponse()
- .withStatus(200)));
- }
-
-
-
-
- public static void MockDoDeleteVfModule_SDNCSuccess() {
- stubFor(post(urlEqualTo("/SDNCAdapter"))
- .withRequestBody(containing("SvcAction>deactivate"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml")));
- stubFor(post(urlEqualTo("/SDNCAdapter"))
- .withRequestBody(containing("SvcAction>unassign"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml")));
- }
-
-
- public static void MockDoDeleteVfModule_DeleteVNFSuccess() {
- stubFor(delete(urlMatching("/vnfs/v1/vnfs/.*/vf-modules/.*"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/xml")));
- stubFor(delete(urlMatching("/vnfs/v1/volume-groups/78987"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/xml")));
- }
-}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVnfTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVnfTest.java
deleted file mode 100644
index 8caa9f22a2..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVnfTest.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property.
- */
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.bpmn.infrastructure;
-
-import static org.junit.Assert.assertEquals;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteGenericVnf;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithDepth;
-import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB;
-
-import java.util.HashMap;
-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;
-
-/**
- * Please describe the DeleteVnfInfra.java class
- *
- */
-public class DoDeleteVnfTest extends WorkflowTest {
-
-
- @Test
- @Deployment(resources = {"subprocess/GenericGetVnf.bpmn", "subprocess/GenericDeleteVnf.bpmn", "subprocess/DoDeleteVnf.bpmn"})
- public void testDoDeleteVnf_success() throws Exception{
-
- MockGetGenericVnfByIdWithDepth("testVnfId123", 1, "GenericFlows/getGenericVnfByNameResponse.xml");
- MockDeleteGenericVnf("testVnfId123", "testReVer123");
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariables(variables);
- invokeSubProcess("DoDeleteVnf", businessKey, variables);
- // Disabled until SDNC support is there
-// injectSDNCCallbacks(callbacks, "assign");
-// injectSDNCCallbacks(callbacks, "activate");
-
- waitForProcessEnd(businessKey, 10000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- String found = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "GENGV_FoundIndicator") ;
- String inUse = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "DoDVNF_vnfInUse");
- String workflowException = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "WorkflowException");
-
- assertEquals("true", found);
- assertEquals("false", inUse);
- assertEquals(null, workflowException);
- }
-
- @Test
- @Deployment(resources = {"subprocess/GenericGetVnf.bpmn", "subprocess/GenericDeleteVnf.bpmn", "subprocess/DoDeleteVnf.bpmn"})
- public void testDeleteVnfInfra_success_vnfNotFound() throws Exception{
-
- MockDeleteGenericVnf("testVnfId123", "testReVer123", 404);
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariables(variables);
-
- invokeSubProcess("DoDeleteVnf", businessKey, variables);
- // Disabled until SDNC support is there
-// injectSDNCCallbacks(callbacks, "assign");
-// injectSDNCCallbacks(callbacks, "activate");
-
- waitForProcessEnd(businessKey, 10000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- String found = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "GENGV_FoundIndicator") ;
- String inUse = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "DoDVNF_vnfInUse");
- String workflowException = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "WorkflowException");
-
- assertEquals("false", found);
- assertEquals("false", inUse);
- assertEquals(null, workflowException);
- }
-
- @Test
- @Deployment(resources = {"subprocess/GenericGetVnf.bpmn", "subprocess/GenericDeleteVnf.bpmn", "subprocess/DoDeleteVnf.bpmn"})
- public void testDeleteVnfInfra_error_vnfInUse() throws Exception{
-
- MockGetGenericVnfByIdWithDepth("testVnfId123", 1, "GenericFlows/getGenericVnfResponse_hasRelationships.xml");
- MockDeleteGenericVnf("testVnfId123", "testReVer123");
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariables(variables);
-
- invokeSubProcess("DoDeleteVnf", businessKey, variables);
-// Disabled until SDNC support is there
-// injectSDNCCallbacks(callbacks, "assign");
-// injectSDNCCallbacks(callbacks, "activate");
-
- waitForProcessEnd(businessKey, 10000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
-
- String found = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "GENGV_FoundIndicator") ;
- String inUse = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "DoDVNF_vnfInUse");
- String workflowException = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "WorkflowException");
- String exWfex = "WorkflowException[processKey=DoDeleteVnf,errorCode=5000,errorMessage=Can't Delete Generic Vnf. Generic Vnf is still in use.]";
-
- assertEquals("true", found);
- assertEquals("true", inUse);
- assertEquals(exWfex, workflowException);
- }
-
- private void setVariables(Map<String, Object> variables) {
- variables.put("mso-request-id", "123");
- variables.put("isDebugLogEnabled", "true");
- variables.put("vnfId","testVnfId123");
- }
-}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoUpdateVfModuleTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoUpdateVfModuleTest.java
deleted file mode 100644
index a955c4eb86..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoUpdateVfModuleTest.java
+++ /dev/null
@@ -1,257 +0,0 @@
-/*-
- * ============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.infrastructure;
-
-
-
-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.put;
-import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockAAIVfModule;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithDepth;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithPriority;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetVfModuleIdNoResponse;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetVolumeGroupById;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchGenericVnf;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchVfModuleId;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutGenericVnf;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutVfModuleIdNoResponse;
-import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.MockGetServiceResourcesCatalogData;
-import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter;
-import static org.openecomp.mso.bpmn.mock.StubResponseVNFAdapter.mockVNFPut;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-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.WorkflowTest;
-import org.openecomp.mso.bpmn.mock.FileUtil;
-
-/**
- * Unit tests for DoUpdateVfModule.bpmn.
- */
-public class DoUpdateVfModuleTest extends WorkflowTest {
-
- private final CallbackSet callbacks = new CallbackSet();
-
- public DoUpdateVfModuleTest() throws IOException {
- callbacks.put("changeassign", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyChangeAssignCallback.xml"));
- callbacks.put("query", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyQueryCallback.xml"));
- callbacks.put("activate", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
- callbacks.put("vnfUpdate", FileUtil.readResourceFile(
- "__files/VfModularity/VNFAdapterRestUpdateCallback.xml"));
- }
-
- /**
- * Test the happy path through the flow.
- */
- @Test
- @Ignore
- @Deployment(resources = {
- "subprocess/DoUpdateVfModule.bpmn",
- "subprocess/PrepareUpdateAAIVfModule.bpmn",
- "subprocess/ConfirmVolumeGroupTenant.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn"
- })
- public void happyPath() throws IOException {
-
- logStart();
-
- String doUpdateVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/DoUpdateVfModuleRequest.xml");
- MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml");
- MockGetVfModuleIdNoResponse("skask", "PCRF", "supercool");
- MockPutVfModuleIdNoResponse("skask", "PCRF", "supercool");
- MockGetVolumeGroupById("MDTWNJ21", "78987", "VfModularity/VolumeGroup.xml");
- mockSDNCAdapter("/SDNCAdapter", "SvcAction>query", 200, "VfModularity/StandardSDNCSynchResponse.xml");
- mockSDNCAdapter("/SDNCAdapter", "SvcInstanceId><", 200, "VfModularity/StandardSDNCSynchResponse.xml");
- mockVNFPut("skask", "/supercool", 202);
- MockPutGenericVnf("skask");
- MockGetGenericVnfByIdWithPriority("skask", "supercool", 200, "VfModularity/VfModule-supercool.xml", 1);
- //Catalog DB
- MockGetServiceResourcesCatalogData("aa5256d2-5a33-55df-13ab-12abad84e7ff","InfrastructureFlows/DoCreateServiceInstance_request.json");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("mso-request-id", "DEV-VF-0011");
- variables.put("isDebugLogEnabled","true");
- variables.put("DoUpdateVfModuleRequest", doUpdateVfModuleRequest);
- invokeSubProcess("DoUpdateVfModule", businessKey, variables);
-
- injectSDNCCallbacks(callbacks, "changeassign, query");
- injectVNFRestCallbacks(callbacks, "vnfUpdate");
- injectSDNCCallbacks(callbacks, "activate");
-
- waitForProcessEnd(businessKey, 10000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- checkVariable(businessKey, "DoUpdateVfModuleSuccessIndicator", true);
-
- String heatStackId = (String) getVariableFromHistory(businessKey, "DOUPVfMod_heatStackId");
- System.out.println("Heat stack Id from AAI: " + heatStackId);
-
- logEnd();
- }
-
- /**
- * Test the happy path through the flow with Building Blocks interface.
- */
- @Test
-
- @Deployment(resources = {
- "subprocess/DoUpdateVfModule.bpmn",
- "subprocess/PrepareUpdateAAIVfModule.bpmn",
- "subprocess/ConfirmVolumeGroupTenant.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn"
- })
- public void happyPathBB() throws IOException {
-
- logStart();
-
- MockAAIVfModule();
- MockPatchGenericVnf("skask");
- MockPatchVfModuleId("skask", ".*");
- MockSDNCAdapterVfModule();
- MockVNFAdapterRestVfModule();
- //Catalog DB
- MockGetServiceResourcesCatalogData("aa5256d2-5a33-55df-13ab-12abad84e7ff","InfrastructureFlows/DoCreateServiceInstance_request.json");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("mso-request-id", "DEV-VF-0011");
- variables.put("isDebugLogEnabled","true");
- variables.put("msoRequestId", "DEV-VF-0011");
- variables.put("isBaseVfModule", "false");
- variables.put("isDebugLogEnabled", "true");
- variables.put("disableRollback", "true");
- variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
- variables.put("vnfId", "skask");
- variables.put("vfModuleId", "supercool");
- variables.put("vnfType", "pcrf-capacity");
- variables.put("isVidRequest", "true");
- variables.put("volumeGroupId", "78987");
- variables.put("usePreload", true);
-
- variables.put("sdncVersion", "1702");
-
- variables.put("lcpCloudRegionId", "MDTWNJ21");
- variables.put("tenantId", "fba1bd1e195a404cacb9ce17a9b2b421");
-
- String vfModuleModelInfo = "{ "+ "\"modelType\": \"vfModule\"," +
- "\"modelInvariantUuid\": \"introvert\"," +
- "\"modelUuid\": \"3.14\"," +
- "\"modelName\": \"STMTN5MMSC21-MMSC::model-1-0\"," +
- "\"modelVersion\": \"1\"," +
- "\"modelCustomizationUuid\": \"MODEL-123\"" + "}";
- variables.put("vfModuleModelInfo", vfModuleModelInfo);
-
- String vnfModelInfo = "{ "+ "\"modelType\": \"vnf\"," +
- "\"modelInvariantUuid\": \"introvert\"," +
- "\"modelUuid\": \"3.14\"," +
- "\"modelName\": \"VNF-STMTN5MMSC21-MMSC::model-1-0\"," +
- "\"modelVersion\": \"1\"," +
- "\"modelCustomizationUuid\": \"VNF-MODEL-123\"" + "}";
- variables.put("vnfModelInfo", vnfModelInfo);
-
- String serviceModelInfo = "{ "+ "\"modelType\": \"service\"," +
- "\"modelInvariantUuid\": \"aa5256d2-5a33-55df-13ab-12abad84e7ff\"," +
- "\"modelUuid\": \"bb6478e5-ea33-3346-ac12-ab121484a3fe\"," +
- "\"modelName\": \"SVC-STMTN5MMSC21-MMSC::model-1-0\"," +
- "\"modelVersion\": \"1\"," +
- "}";
- variables.put("serviceModelInfo", serviceModelInfo);
-
- invokeSubProcess("DoUpdateVfModule", businessKey, variables);
-
- injectSDNCCallbacks(callbacks, "changeassign, query");
- injectVNFRestCallbacks(callbacks, "vnfUpdate");
- injectSDNCCallbacks(callbacks, "activate");
-
- waitForProcessEnd(businessKey, 10000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- checkVariable(businessKey, "DoUpdateVfModuleSuccessIndicator", true);
-
- String heatStackId = (String) getVariableFromHistory(businessKey, "DOUPVfMod_heatStackId");
- System.out.println("Heat stack Id from AAI: " + heatStackId);
-
- logEnd();
- }
-
- // 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")));
- }
-
- public static void MockVNFAdapterRestVfModule() {
- stubFor(put(urlEqualTo("/vnfs/v1/vnfs/skask/vf-modules/supercool"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/xml")));
- stubFor(post(urlMatching("/vnfs/v1/vnfs/.*/vf-modules"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/xml")));
- stubFor(post(urlEqualTo("/vnfs/v1/vnfs/skask/vf-modules"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/xml")));
- stubFor(put(urlEqualTo("/vnfs/v1/volume-groups/78987"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/xml")));
- }
-}
-
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoUpdateVnfAndModulesTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoUpdateVnfAndModulesTest.java
deleted file mode 100644
index 2a5a646fb2..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoUpdateVnfAndModulesTest.java
+++ /dev/null
@@ -1,226 +0,0 @@
-/*-
- * ============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.infrastructure;
-
-import static org.junit.Assert.assertEquals;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockAAIVfModule;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDBUpdateVfModule;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithDepth;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfById_404;
-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.MockPatchGenericVnf;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchVfModuleId;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutGenericVnf;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockSDNCAdapterVfModule;
-import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter;
-import static org.openecomp.mso.bpmn.mock.StubResponseVNFAdapter.mockVNFPut;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockVNFAdapterRestVfModule;
-import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-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.core.domain.ModelInfo;
-import org.openecomp.mso.bpmn.core.domain.ModuleResource;
-import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition;
-import org.openecomp.mso.bpmn.core.domain.VnfResource;
-import org.openecomp.mso.bpmn.mock.FileUtil;
-
-/**
- * Unit Test for the DoUpdateVnfAndModules Flow
- *
- */
-public class DoUpdateVnfAndModulesTest extends WorkflowTest {
-
- private final CallbackSet callbacks = new CallbackSet();
-
- public DoUpdateVnfAndModulesTest() throws IOException {
-
- callbacks.put("changeassign", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyChangeAssignCallback.xml"));
- callbacks.put("activate", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
- callbacks.put("query", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyQueryCallback.xml"));
- callbacks.put("vnfUpdate", FileUtil.readResourceFile(
- "__files/VfModularity/VNFAdapterRestUpdateCallback.xml"));
- }
-
- @Test
-
- @Deployment(resources = {
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/PrepareUpdateAAIVfModule.bpmn",
- "subprocess/DoUpdateVfModule.bpmn",
- "subprocess/DoUpdateVnfAndModules.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn",
- "subprocess/ConfirmVolumeGroupTenant.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn"})
- public void testDoUpdateVnfAndModules_success() throws Exception{
-
- MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlByIdVipr.xml");
- MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml");
- //MockGetGenericVnfById_404("testVnfId");
- MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml");
- MockPutGenericVnf(".*");
- MockAAIVfModule();
- MockPatchGenericVnf("skask");
- MockPatchVfModuleId("skask", ".*");
- mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml");
- mockVNFPut("skask", "/supercool", 202);
- mockVNFPut("skask", "/lukewarm", 202);
- MockVNFAdapterRestVfModule();
- MockDBUpdateVfModule();
-
- mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml");
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariablesSuccess(variables, "", "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET");
- invokeSubProcess("DoUpdateVnfAndModules", businessKey, variables);
-
- injectSDNCCallbacks(callbacks, "changeassign, query");
- injectVNFRestCallbacks(callbacks, "vnfUpdate");
- injectSDNCCallbacks(callbacks, "activate");
- injectSDNCCallbacks(callbacks, "changeassign, query");
- injectVNFRestCallbacks(callbacks, "vnfUpdate");
- injectSDNCCallbacks(callbacks, "activate");
- waitForProcessEnd(businessKey, 10000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- assertVariables("2", "200", null);
-
- }
-
-
-
- private void assertVariables(String exModuleCount, String exVnfFound, String exWorkflowException) {
-
- String moduleCount = BPMNUtil.getVariable(processEngineRule, "DoUpdateVnfAndModules", "DUVAM_moduleCount");
- String vnfFound = BPMNUtil.getVariable(processEngineRule, "DoUpdateVnfAndModules", "DUVAM_queryAAIVfModuleResponseCode");
- String workflowException = BPMNUtil.getVariable(processEngineRule, "DoUpdateVnfAndModules", "SavedWorkflowException1");
-
- assertEquals(exModuleCount, moduleCount);
- assertEquals(exVnfFound, vnfFound);
- assertEquals(exWorkflowException, workflowException);
- }
-
- private void setVariables(Map<String, String> variables, String request, String requestId, String siId) {
- variables.put("isDebugLogEnabled", "true");
- variables.put("bpmnRequest", request);
- variables.put("msoRequestUdid", requestId);
- variables.put("serviceInstanceId",siId);
- variables.put("testVnfId","testVnfId123");
- variables.put("vnfType", "STMTN");
-
- }
-
- private void setVariablesSuccess(Map<String, Object> variables, String request, String requestId, String siId) {
- variables.put("isDebugLogEnabled", "true");
- variables.put("requestId", requestId);
- variables.put("msoRequestId", requestId);
- variables.put("serviceInstanceId",siId);
- variables.put("disableRollback", "true");
- //variables.put("testVnfId","testVnfId123");
- variables.put("vnfType", "STMTN");
- variables.put("vnfId", "skask");
- variables.put("tenantId", "fba1bd1e195a404cacb9ce17a9b2b421");
- variables.put("lcpCloudRegionId", "mdt1");
-
- String serviceModelInfo = "{ "+ "\"modelType\": \"service\"," +
- "\"modelInvariantUuid\": \"995256d2-5a33-55df-13ab-12abad84e7ff\"," +
- "\"modelUuid\": \"ab6478e5-ea33-3346-ac12-ab121484a3fe\"," +
- "\"modelName\": \"ServicevSAMP12\"," +
- "\"modelVersion\": \"1.0\"," +
- "}";
- variables.put("serviceModelInfo", serviceModelInfo);
- variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
- String vnfModelInfo = "{" + "\"modelType\": \"vnf\"," +
- "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," +
- "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," +
- "\"modelName\": \"vSAMP12\"," +
- "\"modelVersion\": \"1.0\"," +
- "\"modelCustomizationUuid\": \"MODEL-ID-1234\"" + "}";
- variables.put("vnfModelInfo", vnfModelInfo);
-
- String cloudConfiguration = "{" + "\"cloudConfiguration\": { " +
- "\"lcpCloudRegionId\": \"mdt1\"," +
- "\"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\"" + "}}";
- variables.put("cloudConfiguration", cloudConfiguration);
- variables.put("sdncVersion", "1702");
- variables.put("globalSubscriberId", "subscriber123");
- variables.put("asdcServiceModelVersion", "serviceVersion01");
-
- try {
- VnfResource vr = new VnfResource();
- ModelInfo mvr = new ModelInfo();
- mvr.setModelName("vSAMP12");
- mvr.setModelInstanceName("v123");
- mvr.setModelInvariantUuid("extrovert");
- mvr.setModelVersion("1.0");
- mvr.setModelCustomizationUuid("MODEL-ID-1234");
- vr.setModelInfo(mvr);
- vr.constructVnfType("vnf1");
- vr.setNfType("somenftype");
- vr.setNfRole("somenfrole");
- vr.setNfFunction("somenffunction");
- vr.setNfNamingCode("somenamingcode");
- ModuleResource mr = new ModuleResource();
- ModelInfo mvmr = new ModelInfo();
- mvmr.setModelInvariantUuid("introvert");
- mvmr.setModelName("STMTN5MMSC21-MMSC::model-1-0");
- mvmr.setModelVersion("1");
- mvmr.setModelCustomizationUuid("MODEL-123");
- mr.setModelInfo(mvmr);
- mr.setIsBase(true);
- mr.setVfModuleLabel("MODULELABEL");
- vr.addVfModule(mr);
- ModuleResource mr1 = new ModuleResource();
- ModelInfo mvmr1 = new ModelInfo();
- mvmr1.setModelInvariantUuid("extrovert");
- mvmr1.setModelName("SECONDMODELNAME");
- mvmr1.setModelVersion("1");
- mvmr1.setModelCustomizationUuid("MODEL-123");
- mr1.setModelInfo(mvmr1);
- mr1.setIsBase(false);
- mr1.setVfModuleLabel("MODULELABEL1");
- vr.addVfModule(mr1);
- variables.put("vnfResourceDecomposition", vr);
- variables.put("isTest", true);
- } catch(Exception e) {
-
- }
-
- }
-
-
-}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/ReplaceVnfInfraTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/ReplaceVnfInfraTest.java
deleted file mode 100644
index 4161431297..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/ReplaceVnfInfraTest.java
+++ /dev/null
@@ -1,264 +0,0 @@
-/*-
- * ============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.infrastructure;
-
-import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
-import static com.github.tomakehurst.wiremock.client.WireMock.containing;
-import static com.github.tomakehurst.wiremock.client.WireMock.delete;
-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 com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
-import static org.openecomp.mso.bpmn.common.DeleteAAIVfModuleTest.MockAAIDeleteVfModule;
-import static org.openecomp.mso.bpmn.common.DeleteAAIVfModuleTest.MockAAIGenericVnfSearch;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockAAIVfModule;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDBUpdateVfModule;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteGenericVnf;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteVfModuleId;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfById;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetDefaultCloudRegionByCloudRegionId;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithDepth;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithPriority;
-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.MockGetPserverByVnfId;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfsByVnfId;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchGenericVnf;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchVfModuleId;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutGenericVnf;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutVfModuleIdNoResponse;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockVNFAdapterRestVfModule;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockSetInMaintFlagByVnfId;
-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.StubResponsePolicy.MockPolicyAbort;
-import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter;
-import static org.openecomp.mso.bpmn.mock.StubResponseVNFAdapter.mockVNFPut;
-import static org.openecomp.mso.bpmn.mock.StubResponsePolicy.MockPolicySkip;
-
-import java.io.IOException;
-import java.util.HashMap;
-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.mock.FileUtil;
-
-/**
- * Unit test cases for UpdateVnfInfra.bpmn
- */
-public class ReplaceVnfInfraTest extends WorkflowTest {
-
- private final CallbackSet callbacks = new CallbackSet();
- private static final String EOL = "\n";
- private final String vnfAdapterDeleteCallback =
- "<deleteVfModuleResponse>" + EOL +
- " <vnfId>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnfId>" + EOL +
- " <vfModuleId>973ed047-d251-4fb9-bf1a-65b8949e0a73</vfModuleId>" + EOL +
- " <vfModuleDeleted>true</vfModuleDeleted>" + EOL +
- " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
- "</deleteVfModuleResponse>" + EOL;
-
- public ReplaceVnfInfraTest() throws IOException {
- callbacks.put("deactivate", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
- callbacks.put("unassign", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
- callbacks.put("vnfDelete", vnfAdapterDeleteCallback);
- callbacks.put("changeassign", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyChangeAssignCallback.xml"));
- callbacks.put("activate", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
- callbacks.put("query", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyQueryCallback.xml"));
- callbacks.put("vnfUpdate", FileUtil.readResourceFile(
- "__files/VfModularity/VNFAdapterRestUpdateCallback.xml"));
- }
-
- /**
- * Sunny day scenario.
- *
- * @throws Exception
- */
- @Test
- @Ignore // 1802 merge
- @Deployment(resources = {
- "process/ReplaceVnfInfra.bpmn",
- "subprocess/RollbackVnf.bpmn",
- "subprocess/DoDeleteVfModule.bpmn",
- "subprocess/DoDeleteVnfAndModules.bpmn",
- "subprocess/DeleteAAIVfModule.bpmn",
- "subprocess/PrepareUpdateAAIVfModule.bpmn",
- "subprocess/ConfirmVolumeGroupTenant.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/DoDeleteVnfAndModules.bpmn",
- "subprocess/GenericDeleteVnf.bpmn",
- "subprocess/DoDeleteVnf.bpmn",
- "subprocess/DoDeleteVfModule.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/GenericGetService.bpmn",
- "subprocess/GenericGetVnf.bpmn",
- "subprocess/GenericPutVnf.bpmn",
- "subprocess/DoCreateVnf.bpmn",
- "subprocess/GenerateVfModuleName.bpmn",
- "subprocess/DoCreateVfModule.bpmn",
- "subprocess/DoCreateVnfAndModules.bpmn",
- "subprocess/ConfirmVolumeGroupName.bpmn",
- "subprocess/CreateAAIVfModule.bpmn",
- "subprocess/CreateAAIVfModuleVolumeGroup.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/DoCreateVnfAndModulesRollback.bpmn",
- "subprocess/BuildingBlock/DecomposeService.bpmn",
- "subprocess/BuildingBlock/RainyDayHandler.bpmn",
- "subprocess/BuildingBlock/ManualHandling.bpmn",
- "subprocess/BuildingBlock/AppCClient.bpmn"
-
- })
- public void sunnyDay() throws Exception {
-
- logStart();
- MockAAIGenericVnfSearch();
- MockGetGenericVnfById("testVnfId123.*", "GenericFlows/getGenericVnfByNameResponse.xml");
- MockDeleteGenericVnf("testVnfId123", "testReVer123");
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
- mockSDNCAdapter(200);
- MockDoDeleteVfModule_SDNCSuccess();
- MockDoDeleteVfModule_DeleteVNFSuccess();
- MockAAIDeleteVfModule();
-
- MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlByIdVipr.xml");
- MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml");
- //MockGetGenericVnfById_404("testVnfId");
- MockGetServiceResourcesCatalogData("995256d2-5a33-55df-13ab-12abad84e7ff", "1.0", "VIPR/getCatalogServiceResourcesDataForReplaceVnfInfra.json");
- MockGetServiceResourcesCatalogData("995256d2-5a33-55df-13ab-12abad84e7ff", "VIPR/getCatalogServiceResourcesDataForReplaceVnfInfra.json");
- //MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml");
- //MockPutGenericVnf(".*");
- MockGetDefaultCloudRegionByCloudRegionId("mdt1", "AAI/AAI_defaultCloudRegionByCloudRegionId.json", 200);
- MockAAIVfModule();
- MockPatchGenericVnf("a27ce5a9-29c4-4c22-a017-6615ac73c721");
- MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", ".*");
- mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml");
- mockVNFPut("skask", "/supercool", 202);
- mockVNFPut("skask", "/lukewarm", 202);
- MockVNFAdapterRestVfModule();
- MockDBUpdateVfModule();
- MockGetPserverByVnfId("skask", "AAI/AAI_pserverByVnfId.json", 200);
- MockGetGenericVnfsByVnfId("skask", "AAI/AAI_genericVnfsByVnfId.json", 200);
- MockSetInMaintFlagByVnfId("skask", "AAI/AAI_genericVnfsByVnfId.json", 200);
- MockPolicySkip();
-
- //mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml");
- //mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- String updaetVnfRequest =
- FileUtil.readResourceFile("__files/InfrastructureFlows/ReplaceVnf_VID_request.json");
-
- Map<String, Object> variables = setupVariablesSunnyDayVID();
-
-
- TestAsyncResponse asyncResponse = invokeAsyncProcess("ReplaceVnfInfra",
- "v1", businessKey, updaetVnfRequest, variables);
-
- WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
-
- String responseBody = response.getContent();
- System.out.println("Workflow (Synch) Response:\n" + responseBody);
-
- //injectSDNCCallbacks(callbacks, "deactivate");
- //injectSDNCCallbacks(callbacks, "deactivate");
- injectVNFRestCallbacks(callbacks, "vnfDelete");
- //injectSDNCCallbacks(callbacks, "unassign");
- MockGetGenericVnfById("a27ce5a9-29c4-4c22-a017-6615ac73c721", "GenericFlows/getGenericVnfByNameResponse.xml");
- injectSDNCCallbacks(callbacks, "unassign");
-
-
- injectSDNCCallbacks(callbacks, "changeassign, query");
- injectVNFRestCallbacks(callbacks, "vnfUpdate");
- injectSDNCCallbacks(callbacks, "activate");
- injectSDNCCallbacks(callbacks, "changeassign, query");
- injectVNFRestCallbacks(callbacks, "vnfUpdate");
- injectSDNCCallbacks(callbacks, "activate");
-
- // TODO add appropriate assertions
-
- waitForProcessEnd(businessKey, 10000);
- checkVariable(businessKey, "ReplaceVfModuleInfraSuccessIndicator", true);
-
- logEnd();
- }
-
- // Active Scenario
- private Map<String, Object> setupVariablesSunnyDayVID() {
- Map<String, Object> variables = new HashMap<>();
- //try {
- // variables.put("bpmnRequest", FileUtil.readResourceFile("__files/CreateVfModule_VID_request.json"));
- //}
- //catch (Exception e) {
-
- //}
- //variables.put("mso-request-id", "testRequestId");
- variables.put("requestId", "testRequestId");
- variables.put("isDebugLogEnabled", "true");
- variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
- variables.put("vnfId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("vnfType", "vSAMP12");
- variables.put("serviceType", "MOG");
-
- return variables;
-
- }
-
- public static void MockDoDeleteVfModule_SDNCSuccess() {
- stubFor(post(urlEqualTo("/SDNCAdapter"))
- .withRequestBody(containing("SvcAction>deactivate"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml")));
- stubFor(post(urlEqualTo("/SDNCAdapter"))
- .withRequestBody(containing("SvcAction>unassign"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml")));
- }
-
-
- public static void MockDoDeleteVfModule_DeleteVNFSuccess() {
- stubFor(delete(urlMatching("/vnfs/v1/vnfs/.*/vf-modules/.*"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/xml")));
- stubFor(delete(urlMatching("/vnfs/v1/volume-groups/78987"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/xml")));
- }
-
-}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/RollbackVnfTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/RollbackVnfTest.java
deleted file mode 100644
index 598e783c52..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/RollbackVnfTest.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*-
- * ============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.infrastructure;
-
-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.put;
-import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockAAIVfModule;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDBUpdateVfModule;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithDepth;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithPriority;
-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.MockGetPserverByVnfId;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfsByVnfId;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockSetInMaintFlagByVnfId;
-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.StubResponsePolicy.MockPolicySkip;
-import static org.openecomp.mso.bpmn.mock.StubResponseAPPC.MockAppcError;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-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.WorkflowTest;
-import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse;
-import org.openecomp.mso.bpmn.mock.FileUtil;
-import org.openecomp.mso.client.aai.AAIObjectType;
-import org.openecomp.mso.client.aai.entities.uri.AAIResourceUri;
-import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory;
-
-/**
- * Unit test cases for RollbackVnf.bpmn
- */
-public class RollbackVnfTest extends WorkflowTest {
-
- public RollbackVnfTest() throws IOException {
-
- }
-
- /**
- * Sunny day scenario.
- *
- * @throws Exception
- */
- @Test
-
-
- @Deployment(resources = {
- "subprocess/RollbackVnf.bpmn",
- "subprocess/BuildingBlock/AppCClient.bpmn"
-
- })
- public void sunnyDay() throws Exception {
-
- //logStart();
- System.setProperty("mso.config.path", "src/test/resources");
- AAIResourceUri path = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "skask");
- wireMockRule.stubFor(get(
- urlPathEqualTo("/aai/v11" + path.build()))
- .willReturn(
- aResponse()
- .withHeader("Content-Type", "application/json")
- .withBodyFile("AAI/mockObject.json")
- .withStatus(200)));
-
-
- MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlByIdVipr.xml");
- MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml");
- MockAAIVfModule();
- MockGetGenericVnfsByVnfId("skask", "AAI/AAI_genericVnfsByVnfId.json", 200);
- MockSetInMaintFlagByVnfId("skask", "AAI/AAI_genericVnfsByVnfId.json", 200);
- MockAppcError();
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = setupVariablesSunnyDayVID();
-
- invokeSubProcess("RollbackVnf", businessKey, variables);
-
- // TODO add appropriate assertions
-
- waitForProcessEnd(businessKey, 10000);
- Assert.assertTrue(isProcessEnded(businessKey));
- // assertVariables("true", "true", "false", "true", "Success", null);
-
- //logEnd();
- }
-
- // Active Scenario
- private Map<String, Object> setupVariablesSunnyDayVID() {
- Map<String, Object> variables = new HashMap<String, Object>();
-
- variables.put("msoRequestId", "testRequestId");
- variables.put("isDebugLogEnabled", "true");
- variables.put("vnfId", "skask");
- variables.put("rollbackVnfStop", true);
- variables.put("rollbackVnfLock", true);
- variables.put("rollbackQuiesceTraffic", false);
- variables.put("rollbackSetClosedLoopDisabledFlag", true);
- variables.put("rollbackSetVnfInMaintenanceFlag", true);
- variables.put("errorCode", "1005");
-
- return variables;
-
- }
-
-}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/SetupServiceDecompTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/SetupServiceDecompTest.java
deleted file mode 100644
index 264bf6e2be..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/SetupServiceDecompTest.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*-
- * ============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.infrastructure;
-
-import java.io.IOException;
-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.WorkflowTest;
-import org.openecomp.mso.bpmn.mock.FileUtil;
-
-public class SetupServiceDecompTest extends WorkflowTest {
-
- private String input = FileUtil.readResourceFile("__files/CreateServiceInstance/SetupServiceDecompJson.json");
-
- public SetupServiceDecompTest() throws IOException {
- }
-
- @Test
- @Deployment(resources = {
- "subprocess/CreateServiceInstanceV3.bpmn",
- "subprocess/CreateServiceInstanceV3Rollback.bpmn",
- "subprocess/SetRefactorServiceDecomp.bpmn"
- })
- public void sunnyDay() throws Exception {
-
- logStart();
-
- String businessKey = UUID.randomUUID().toString();
-
- Map<String, Object> variables = new HashMap<String, Object>();
- setupVariables(variables);
- invokeSubProcess("SetRefactorServiceDecomp", businessKey, variables);
- waitForProcessEnd(businessKey, 10000);
- logEnd();
- }
-
- // Success Scenario
- private void setupVariables(Map<String, Object> variables) {
- variables.put("bpmnRequest", input);
- variables.put("msoRequestId", "RaaDSITestRequestId-1");
- variables.put("isDebugLogEnabled", "true");
- }
-} \ No newline at end of file
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/StubResponseAAITest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/StubResponseAAITest.java
deleted file mode 100644
index 8f16ed3b1e..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/StubResponseAAITest.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 Huawei 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.infrastructure;
-
-import org.junit.Test;
-import org.openecomp.mso.bpmn.common.WorkflowTest;
-import org.openecomp.mso.bpmn.mock.StubResponseAAI;
-
-public class StubResponseAAITest extends WorkflowTest{
-
- @Test
- public void testStubResponseAAIforNullAndDefaultInputs()
- {
- try{
- StubResponseAAI.MockPutTunnelXConnect(null, null, null, null, null);
- StubResponseAAI.MockGetAllottedResource(null, null, null, null, null);
- StubResponseAAI.MockPutAllottedResource(null, null, null, null);
- StubResponseAAI.MockPutAllottedResource_500(null, null, null, null);
- StubResponseAAI.MockDeleteAllottedResource(null, null, null, null, null);
- StubResponseAAI.MockPatchAllottedResource(null, null, null, null);
- StubResponseAAI.MockQueryAllottedResourceById(null, null);
- StubResponseAAI.MockGetServiceInstance(null, null, null, null);
- StubResponseAAI.MockGetServiceInstance_404(null, null, null);
- StubResponseAAI.MockGetServiceInstance_500(null, null, null);
- StubResponseAAI.MockGetServiceInstance_500(null, null, null, null);
- StubResponseAAI.MockNodeQueryServiceInstanceByName(null, null);
- StubResponseAAI.MockNodeQueryServiceInstanceByName_404(null);
- StubResponseAAI.MockNodeQueryServiceInstanceByName_500(null);
- StubResponseAAI.MockNodeQueryServiceInstanceById(null, null);
- StubResponseAAI.MockNodeQueryServiceInstanceById_404(null);
- StubResponseAAI.MockNodeQueryServiceInstanceById_500(null);
- StubResponseAAI.MockDeleteServiceInstance(null, null, null, null);
- StubResponseAAI.MockGetServiceInstance(null, null, null, null, 0);
- StubResponseAAI.MockGetServiceInstance(null, null, null, 0);
- StubResponseAAI.MockDeleteServiceInstance(null, null, null, null, 0);
- StubResponseAAI.MockDeleteServiceInstance(null, null, null, 0);
- StubResponseAAI.MockDeleteServiceInstance_404(null, null, null, null);
- StubResponseAAI.MockDeleteServiceInstance_500(null, null, null, null);
- StubResponseAAI.MockPutServiceInstance(null, null, null, null);
- StubResponseAAI.MockPutServiceInstance_500(null, null, null);
- StubResponseAAI.MockGetServiceSubscription(null, null, null);
- StubResponseAAI.MockDeleteServiceSubscription(null, null, 0);
- StubResponseAAI.MockDeleteServiceInstanceId(null, null, null);
- StubResponseAAI.MockPutServiceSubscription(null, null);
- StubResponseAAI.MockGetServiceSubscription(null, null, 0);
- StubResponseAAI.MockGetCustomer(null, null);
- StubResponseAAI.MockDeleteCustomer(null);
- StubResponseAAI.MockPutCustomer(null);
- StubResponseAAI.MockPutCustomer_500(null);
- StubResponseAAI.MockGetGenericVnfById(null, null);
- StubResponseAAI.MockGetGenericVnfById(null, null, 0);
- StubResponseAAI.MockGetGenericVnfByIdWithPriority(null, 0, null);
- StubResponseAAI.MockGetGenericVnfByIdWithPriority(null, null, 0, null, 0);
- StubResponseAAI.MockGetGenericVnfByIdWithDepth(null, 0, null);
- StubResponseAAI.MockGetGenericVnfById_404(null);
- StubResponseAAI.MockGetGenericVnfById_500(null);
- StubResponseAAI.MockGetGenericVnfByName(null, null);
- StubResponseAAI.MockGetGenericVnfByNameWithDepth(null, 0, null);
- StubResponseAAI.MockGetGenericVnfByName_404(null);
- StubResponseAAI.MockDeleteGenericVnf(null, null);
- StubResponseAAI.MockDeleteGenericVnf(null, null, 0);
- StubResponseAAI.MockDeleteGenericVnf_500(null, null);
- StubResponseAAI.MockPutGenericVnf(null);
- StubResponseAAI.MockPutGenericVnf(null, null, 0);
- StubResponseAAI.MockPutGenericVnf(null, 0);
- StubResponseAAI.MockPutGenericVnf_Bad(null, 0);
- StubResponseAAI.MockPatchGenericVnf(null);
- StubResponseAAI.MockGetVceById(null, null);
- StubResponseAAI.MockGetVceByName(null, null);
- StubResponseAAI.MockDeleteVce(null, null, 0);
- StubResponseAAI.MockPutVce(null);
- StubResponseAAI.MockGetGenericVceByNameWithDepth(null, 0, null);
- StubResponseAAI.MockGetVceGenericQuery(null, 0, 0, null);
- StubResponseAAI.MockGetTenantGenericQuery(null, null, null);
- StubResponseAAI.MockGetTenant(null, null);
- StubResponseAAI.MockGetNetwork(null, null, 0);
- StubResponseAAI.MockGetNetworkByIdWithDepth(null, null, null);
- StubResponseAAI.MockGetNetworkCloudRegion(null, null);
- StubResponseAAI.MockGetNetworkByName(null, null);
- StubResponseAAI.MockGetNetworkByName_404(null, null);
- StubResponseAAI.MockGetNetworkCloudRegion_404(null);
- StubResponseAAI.MockPutNetwork(null, 0, null);
- StubResponseAAI.MockPutNetwork(null, null, 0);
- StubResponseAAI.MockGetNetworkName(null, null, 0);
- StubResponseAAI.MockGetNetworkVpnBinding(null, null);
- StubResponseAAI.MockGetNetworkPolicy(null, null);
- StubResponseAAI.MockGetNetworkVpnBinding(null, null, 0);
- StubResponseAAI.MockGetNetworkPolicy(null, null, 0);
- StubResponseAAI.MockGetNetworkTableReference(null, null);
- StubResponseAAI.MockPutNetworkIdWithDepth(null, null, null);
- StubResponseAAI.MockGetNetworkPolicyfqdn(null, null, 0);
- StubResponseAAI.MockGetNetworkRouteTable(null, null, 0);
- StubResponseAAI.MockPatchVfModuleId(null, null);
- StubResponseAAI.MockVNFAdapterRestVfModule();
- StubResponseAAI.MockDBUpdateVfModule();
- StubResponseAAI.MockSDNCAdapterVfModule();
- StubResponseAAI.MockAAIVfModule();
- StubResponseAAI.MockGetCloudRegion(null, 0, null);
- StubResponseAAI.MockGetVolumeGroupById(null, null, null);
- StubResponseAAI.MockPutVolumeGroupById(null, null, null, 0);
- StubResponseAAI.MockGetVolumeGroupByName(null, null, null, 0);
- StubResponseAAI.MockDeleteVolumeGroupById(null, null, null, 0);
- StubResponseAAI.MockGetVolumeGroupByName_404(null, null);
- StubResponseAAI.MockDeleteVolumeGroup(null, null, null);
- StubResponseAAI.MockGetVfModuleId(null, null, null, 0);
- StubResponseAAI.MockGetVfModuleByNameWithDepth(null, null, 0, null, 0);
- StubResponseAAI.MockGetVfModuleIdNoResponse(null, null, null);
- StubResponseAAI.MockPutVfModuleIdNoResponse(null, null, null);
- StubResponseAAI.MockPutVfModuleId(null, null);
- StubResponseAAI.MockPutVfModuleId(null, null, 0);
- StubResponseAAI.MockDeleteVfModuleId(null, null, null, 0);
- StubResponseAAI.MockAAIVfModuleBadPatch(null, 0);
- StubResponseAAI.MockGetPserverByVnfId(null, null, 0);
- StubResponseAAI.MockGetGenericVnfsByVnfId(null, null, 0);
- StubResponseAAI.MockSetInMaintFlagByVnfId(null, 0);
- StubResponseAAI.MockGetVceById();
- StubResponseAAI.MockGetVceByName();
- StubResponseAAI.MockPutVce();
- StubResponseAAI.MockDeleteVce();
- StubResponseAAI.MockDeleteVce_404();
- StubResponseAAI.MockDeleteServiceSubscription();
- StubResponseAAI.MockGetServiceSubscription();
- StubResponseAAI.MockGetServiceSubscription_200Empty();
- StubResponseAAI.MockGetServiceSubscription_404();
- StubResponseAAI.MockGENPSIPutServiceInstance();
- StubResponseAAI.MockGENPSIPutServiceSubscription();
- StubResponseAAI.MockGENPSIPutServiceInstance_get500();
- StubResponseAAI.MockGetGenericVnfById();
- StubResponseAAI.MockGetGenericVnfById_404();
- StubResponseAAI.MockGetGenericVnfByName();
- StubResponseAAI.MockGetGenericVnfByName_hasRelationships();
- StubResponseAAI.MockGetGenericVnfById_hasRelationships();
- StubResponseAAI.MockGetGenericVnfById_500();
- StubResponseAAI.MockGetGenericVnfByName_404();
- StubResponseAAI.MockPutGenericVnf();
- StubResponseAAI.MockPutGenericVnf_400();
- StubResponseAAI.MockDeleteGenericVnf();
- StubResponseAAI.MockDeleteGenericVnf_404();
- StubResponseAAI.MockDeleteGenericVnf_500();
- StubResponseAAI.MockDeleteGenericVnf_412();
- }
- catch(Exception ex)
- {
-
- System.err.println(ex);
- }
-
- }
-}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateNetworkInstanceTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateNetworkInstanceTest.java
deleted file mode 100644
index 80a4518599..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateNetworkInstanceTest.java
+++ /dev/null
@@ -1,489 +0,0 @@
-/*-
- * ============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.infrastructure;
-
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.*;
-import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.MockUpdateRequestDB;
-import static org.openecomp.mso.bpmn.mock.StubResponseNetworkAdapter.MockNetworkAdapterRestPut;
-import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapterTopology;
-import static org.openecomp.mso.bpmn.common.BPMNUtil.executeAsyncWorkflow;
-import static org.openecomp.mso.bpmn.common.BPMNUtil.getVariable;
-import static org.junit.Assert.assertEquals;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.camunda.bpm.engine.test.Deployment;
-import org.junit.Assert;
-import org.junit.Ignore;
-import org.junit.Rule;
-import org.junit.Test;
-
-import org.openecomp.mso.bpmn.common.BPMNUtil;
-import org.openecomp.mso.bpmn.common.WorkflowTest;
-import org.openecomp.mso.bpmn.common.WorkflowTestTransformer;
-import org.openecomp.mso.bpmn.common.SDNCAdapterCallbackRule;
-import org.openecomp.mso.bpmn.mock.SDNCAdapterNetworkTopologyMockTransformer;
-
-import com.github.tomakehurst.wiremock.extension.ResponseTransformer;
-
-/**
- * Unit test cases for DoUpdateNetworkInstance.bpmn
- *
- */
-public class UpdateNetworkInstanceTest extends WorkflowTest {
- @WorkflowTestTransformer
- public static final ResponseTransformer sdncAdapterMockTransformer =
- new SDNCAdapterNetworkTopologyMockTransformer();
-
- @Rule
- public final SDNCAdapterCallbackRule sdncAdapterCallbackRule =
- new SDNCAdapterCallbackRule(processEngineRule);
-
- /**
- * End-to-End flow - Unit test for DoUpdateNetworkInstance.bpmn
- * - String input & String response
- */
-
- @Test
- @Ignore // 1802 merge
- @Deployment(resources = {"process/UpdateNetworkInstance.bpmn",
- "subprocess/DoUpdateNetworkInstance.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/GenericGetService.bpmn",
- "subprocess/SDNCAdapterV1.bpmn"})
-
- public void shouldInvokeServiceUpdateNetworkInstance_SuccessVID1() throws Exception {
-
- System.out.println("----------------------------------------------------------");
- System.out.println(" Success1 - UpdateNetworkInstance flow Started! ");
- System.out.println("----------------------------------------------------------");
-
- // setup simulators
- mockSDNCAdapterTopology("UpdateNetworkV2mock/sdncUpdateNetworkTopologySimResponse.xml", "SvcAction>changeassign");
- MockNetworkAdapterRestPut("UpdateNetworkV2/updateNetworkResponse_Success.xml", "49c86598-f766-46f8-84f8-8d1c1b10f9b4");
- MockGetNetworkCloudRegion("CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml", "RDM2WAGPLCP");
- MockGetNetworkByIdWithDepth("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_Success.xml", "all");
- MockPutNetworkIdWithDepth("UpdateNetworkV2/updateNetwork_updateContrail_AAIResponse_Success.xml", "49c86598-f766-46f8-84f8-8d1c1b10f9b4", "all");
- MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017");
- MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6");
- MockGetNetworkPolicy("UpdateNetworkV2/updateNetwork_queryNetworkPolicy_AAIResponse_Success.xml", "cee6d136-e378-4678-a024-2cd15f0ee0cg");
- MockGetNetworkTableReference("UpdateNetworkV2/updateNetwork_queryNetworkTableRef1_AAIResponse_Success.xml", "refFQDN1");
- MockGetNetworkTableReference("UpdateNetworkV2/updateNetwork_queryNetworkTableRef2_AAIResponse_Success.xml", "refFQDN2");
- MockUpdateRequestDB("DBUpdateResponse.xml");
- //MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "UpdateNetworkV2/updateNetwork_queryInstance_Success.xml", "v8");
- MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "UpdateNetworkV2/updateNetwork_queryInstance_Success.xml");
-
- Map<String, String> variables = setupVariablesVID1();
- //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "UpdateNetworkInstance", variables);
- executeAsyncWorkflow(processEngineRule, "UpdateNetworkInstance", variables);
- System.out.println("----------------------------------------------------------");
- System.out.println("- got workflow response -");
- System.out.println("----------------------------------------------------------");
- //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId());
-
- assertEquals("true", getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_Success"));
- Assert.assertNotNull("UPDNI_CompleteMsoProcessRequest - ", getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_CompleteMsoProcessRequest"));
-
- String workflowResp = BPMNUtil.getVariable(processEngineRule, "UpdateNetworkInstance", "WorkflowResponse");
- Assert.assertNotNull(workflowResp);
-
- System.out.println("----------------------------------------------------------");
- System.out.println(" Success1 - UpdateNetworkInstance flow Completed ");
- System.out.println("----------------------------------------------------------");
-
- }
-
- @Test
- @Ignore // 1802 merge
- @Deployment(resources = {"process/UpdateNetworkInstance.bpmn",
- "subprocess/DoUpdateNetworkInstance.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/GenericGetService.bpmn",
- "subprocess/SDNCAdapterV1.bpmn"})
-
- public void shouldInvokeServiceUpdateNetworkInstance_SuccessVIPER1() throws Exception {
-
- System.out.println("----------------------------------------------------------");
- System.out.println(" Success2 - UpdateNetworkInstance flow Started! ");
- System.out.println("----------------------------------------------------------");
-
- // setup simulators
- mockSDNCAdapterTopology("UpdateNetworkV2mock/sdncUpdateNetworkTopologySimResponse.xml", "SvcAction>changeassign");
- MockNetworkAdapterRestPut("UpdateNetworkV2/updateNetworkResponse_Success.xml", "49c86598-f766-46f8-84f8-8d1c1b10f9b4");
- MockGetNetworkCloudRegion("CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml", "RDM2WAGPLCP");
- MockGetNetworkByIdWithDepth("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_Success.xml", "all");
- MockPutNetworkIdWithDepth("UpdateNetworkV2/updateNetwork_updateContrail_AAIResponse_Success.xml", "49c86598-f766-46f8-84f8-8d1c1b10f9b4", "all");
- MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017");
- MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6");
- MockGetNetworkPolicy("UpdateNetworkV2/updateNetwork_queryNetworkPolicy_AAIResponse_Success.xml", "cee6d136-e378-4678-a024-2cd15f0ee0cg");
- MockGetNetworkTableReference("UpdateNetworkV2/updateNetwork_queryNetworkTableRef1_AAIResponse_Success.xml", "refFQDN1");
- MockGetNetworkTableReference("UpdateNetworkV2/updateNetwork_queryNetworkTableRef2_AAIResponse_Success.xml", "refFQDN2");
- MockUpdateRequestDB("DBUpdateResponse.xml");
- //MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "UpdateNetworkV2/updateNetwork_queryInstance_Success.xml", "v8");
- MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "UpdateNetworkV2/updateNetwork_queryInstance_Success.xml");
-
- Map<String, String> variables = setupVariablesVIPER1();
- //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "UpdateNetworkInstance", variables);
- executeAsyncWorkflow(processEngineRule, "UpdateNetworkInstance", variables);
- //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId());
-
- assertEquals("true", getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_Success"));
- Assert.assertNotNull("UPDNI_CompleteMsoProcessRequest - ", getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_CompleteMsoProcessRequest"));
-
- String completeMsoProcessRequest =
- "<aetgt:MsoCompletionRequest xmlns:aetgt=\"http://org.openecomp/mso/workflow/schema/v1\"" + '\n'
- + " xmlns:ns=\"http://org.openecomp/mso/request/types/v1\"" + '\n'
- + " xmlns=\"http://org.openecomp/mso/infra/vnf-request/v1\">" + '\n'
- + " <request-info>" + '\n'
- + " <request-id>testRequestId</request-id>" + '\n'
- + " <action>UPDATE</action>" + '\n'
- + " <source>VID</source>" + '\n'
- + " </request-info>" + '\n'
- + " <aetgt:status-message>Network has been updated successfully.</aetgt:status-message>" + '\n'
- + " <aetgt:mso-bpel-name>BPMN Network action: UPDATE</aetgt:mso-bpel-name>" + '\n'
- + "</aetgt:MsoCompletionRequest>";
-
- Assert.assertEquals(completeMsoProcessRequest, getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_CompleteMsoProcessRequest"));
-
- System.out.println("----------------------------------------------------------");
- System.out.println(" Success2 - UpdateNetworkInstance flow Completed ");
- System.out.println("----------------------------------------------------------");
-
- }
-
-
- @Test
- //@Ignore
- @Deployment(resources = {"process/UpdateNetworkInstance.bpmn",
- "subprocess/DoUpdateNetworkInstance.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/GenericGetService.bpmn",
- "subprocess/SDNCAdapterV1.bpmn"})
-
- public void shouldInvokeServiceUpdateNetworkInstance_MissingNetworkId() throws Exception {
-
- System.out.println("--------------------------------------------------------------------");
- System.out.println(" Missing networkId - UpdateNetworkInstance flow Started! ");
- System.out.println("--------------------------------------------------------------------");
-
- // setup simulators
- MockUpdateRequestDB("DBUpdateResponse.xml");
- //MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "UpdateNetworkV2/updateNetwork_queryInstance_Success.xml", "v8");
- MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "UpdateNetworkV2/updateNetwork_queryInstance_Success.xml");
-
- Map<String, String> variables = setupVariablesMissingNetworkId();
- //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "UpdateNetworkInstance", variables);
- executeAsyncWorkflow(processEngineRule, "UpdateNetworkInstance", variables);
- //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId());
-
- assertEquals("false", getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_Success"));
- Assert.assertNotNull("UPDNI_FalloutHandlerRequest - ", getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_FalloutHandlerRequest"));
-
- String falloutHandlerActual = getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_FalloutHandlerRequest");
- String falloutHandlerExpected =
-"<aetgt:FalloutHandlerRequest xmlns:aetgt=\"http://org.openecomp/mso/workflow/schema/v1\"" + "\n" +
-" xmlns:ns=\"http://org.openecomp/mso/request/types/v1\"" + "\n" +
-" xmlns:wfsch=\"http://org.openecomp/mso/workflow/schema/v1\">" + "\n" +
-" <request-info xmlns=\"http://org.openecomp/mso/infra/vnf-request/v1\">" + "\n" +
-" <request-id>88f65519-9a38-4c4b-8445-9eb4a5a5af56</request-id>" + "\n" +
-" <action>UPDATE</action>" + "\n" +
-" <source>VID</source>" + "\n" +
-" </request-info>" + "\n" +
-" <aetgt:WorkflowException xmlns:aetgt=\"http://org.openecomp/mso/workflow/schema/v1\">" + "\n" +
-" <aetgt:ErrorMessage>Variable 'network-id' value/element is missing.</aetgt:ErrorMessage>" + "\n" +
-" <aetgt:ErrorCode>7000</aetgt:ErrorCode>" + "\n" +
-" </aetgt:WorkflowException>" + "\n" +
-" </aetgt:FalloutHandlerRequest>";
-
- assertEquals("Response", falloutHandlerExpected, falloutHandlerActual);
-
- System.out.println("------------------------------------------------------------------");
- System.out.println(" Missing networkId - UpdateNetworkInstance flow Completed ");
- System.out.println("------------------------------------------------------------------");
-
- }
-
-
- @Test
- //@Ignore
- @Deployment(resources = {"process/UpdateNetworkInstance.bpmn",
- "subprocess/DoUpdateNetworkInstance.bpmn",
- "subprocess/DoUpdateNetworkInstanceRollback.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/GenericGetService.bpmn",
- "subprocess/SDNCAdapterV1.bpmn"})
-
- public void shouldInvokeServiceUpdateNetworkInstance_Network_SDNC_Rollback() throws Exception {
-
- System.out.println("---------------------------------------------------------------");
- System.out.println(" Network and SDNC Rollback - UpdateNetworkInstance flow Started! ");
- System.out.println("---------------------------------------------------------------");
-
- // setup simulators
- mockSDNCAdapterTopology("UpdateNetworkV2mock/sdncUpdateNetworkTopologySimResponse.xml", "SvcAction>changeassign");
- mockSDNCAdapterTopology("UpdateNetworkV2mock/sdncUpdateNetworkTopologySimResponse.xml", "SvcAction>rollback");
- MockNetworkAdapterRestPut("UpdateNetworkV2/updateNetworkResponse_Success.xml", "49c86598-f766-46f8-84f8-8d1c1b10f9b4");
- MockGetNetworkCloudRegion("CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml", "RDM2WAGPLCP");
- MockGetNetworkByIdWithDepth("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_Success.xml", "1");
- MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017");
- MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6");
- MockGetNetworkPolicy("UpdateNetworkV2/updateNetwork_queryNetworkPolicy_AAIResponse_Success.xml", "cee6d136-e378-4678-a024-2cd15f0ee0cg");
- MockGetNetworkTableReference("UpdateNetworkV2/updateNetwork_queryNetworkTableRef1_AAIResponse_Success.xml", "refFQDN1");
- MockGetNetworkTableReference("UpdateNetworkV2/updateNetwork_queryNetworkTableRef2_AAIResponse_Success.xml", "refFQDN2");
- MockUpdateRequestDB("DBUpdateResponse.xml");
- //MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "UpdateNetworkV2/updateNetwork_queryInstance_Success.xml", "v8");
- MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "UpdateNetworkV2/updateNetwork_queryInstance_Success.xml");
-
- Map<String, String> variables = setupVariablesVID1();
- //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "UpdateNetworkInstance", variables);
- executeAsyncWorkflow(processEngineRule, "UpdateNetworkInstance", variables);
- //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceId());
-
- assertEquals("false", getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_Success"));
- Assert.assertNotNull("UPDNI_FalloutHandlerRequest - ", getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_FalloutHandlerRequest"));
-
- System.out.println("---------------------------------------------------------------------");
- System.out.println(" Network and SCNC Rollback - UpdateNetworkInstance flow Completed ");
- System.out.println("---------------------------------------------------------------------");
-
- }
-
- // *****************
- // Utility Section
- // *****************
-
- String networkModelInfo =
- " {\"modelUuid\": \"mod-inst-uuid-123\", " + '\n' +
- " \"modelName\": \"mod_inst_z_123\", " + '\n' +
- " \"modelVersion\": \"1.0\", " + '\n' +
- " \"modelCustomizationUuid\": \"mod-inst-uuid-123\", " + '\n' +
- " \"modelInvariantUuid\": \"mod-invar-uuid-123\" " + '\n' +
- " }";
-
- String serviceModelInfo =
- " {\"modelUuid\": \"36a3a8ea-49a6-4ac8-b06c-89a54544b9b6\", " + '\n' +
- " \"modelName\": \"HNGW Protected OAM\", " + '\n' +
- " \"modelVersion\": \"1.0\", " + '\n' +
- " \"modelInvariantUuid\": \"fcc85cb0-ad74-45d7-a5a1-17c8744fdb71\" " + '\n' +
- " }";
-
- // Success Scenario
- private Map<String, String> setupVariablesVID1() {
- Map<String, String> variables = new HashMap<>();
- variables.put("bpmnRequest", getCreateNetworkRequest1());
- variables.put("mso-request-id", "testRequestId");
- variables.put("requestId", "testRequestId");
- variables.put("isBaseVfModule", "true");
- variables.put("recipeTimeout", "0");
- variables.put("requestAction", "UPDATE");
- variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
- variables.put("vnfId", "");
- variables.put("vfModuleId", "");
- variables.put("volumeGroupId", "");
- variables.put("networkId", "49c86598-f766-46f8-84f8-8d1c1b10f9b4");
- variables.put("serviceType", "vMOG");
- variables.put("vfModuleType", "");
- variables.put("networkType", "modelName");
- return variables;
-
- }
-
- public String getCreateNetworkRequest1() {
-
- String request =
- "{ \"requestDetails\": { " + '\n' +
- " \"modelInfo\": { " + '\n' +
- " \"modelType\": \"modelType\", " + '\n' +
- " \"modelCustomizationId\": \"f21df226-8093-48c3-be7e-0408fcda0422\", " + '\n' +
- " \"modelName\": \"CONTRAIL_EXTERNAL\", " + '\n' +
- " \"modelVersion\": \"1.0\" " + '\n' +
- " }, " + '\n' +
- " \"cloudConfiguration\": { " + '\n' +
- " \"lcpCloudRegionId\": \"RDM2WAGPLCP\", " + '\n' +
- " \"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\" " + '\n' +
- " }, " + '\n' +
- " \"requestInfo\": { " + '\n' +
- " \"instanceName\": \"MNS-25180-L-01-dmz_direct_net_1\", " + '\n' +
- " \"source\": \"VID\", " + '\n' +
- " \"callbackUrl\": \"\", " + '\n' +
- " \"suppressRollback\": \"false\" ," + '\n' +
- " \"productFamilyId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\" " + '\n' +
- " }, " + '\n' +
- " \"requestParameters\": { " + '\n' +
- " \"backoutOnFailure\": true, " + '\n' +
- " \"serviceId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\", " + '\n' +
- " \"userParams\": [] " + '\n' +
- " } " + '\n' +
- " } " + '\n' +
- "}";
-
- return request;
- }
-
- public String getCreateNetworkRequest2() {
-
- String request =
- "{ \"requestDetails\": { " + '\n' +
- " \"modelInfo\": { " + '\n' +
- " \"modelType\": \"modelType\", " + '\n' +
- " \"modelId\": \"modelId\", " + '\n' +
- " \"modelNameVersionId\": \"modelNameVersionId\", " + '\n' +
- " \"modelName\": \"CONTRAIL_EXTERNAL\", " + '\n' +
- " \"modelVersion\": \"1\" " + '\n' +
- " }, " + '\n' +
- " \"cloudConfiguration\": { " + '\n' +
- " \"lcpCloudRegionId\": \"RDM2WAGPLCP\", " + '\n' +
- " \"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\" " + '\n' +
- " }, " + '\n' +
- " \"requestInfo\": { " + '\n' +
- " \"instanceName\": \"myOwn_Network\", " + '\n' +
- " \"source\": \"VID\", " + '\n' +
- " \"callbackUrl\": \"\", " + '\n' +
- " \"suppressRollback\": \"true\" ," + '\n' +
- " \"productFamilyId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\" " + '\n' +
- " }, " + '\n' +
- " \"requestParameters\": { " + '\n' +
- " \"backoutOnFailure\": true, " + '\n' +
- " \"serviceId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\", " + '\n' +
- " \"userParams\": [] " + '\n' +
- " } " + '\n' +
- " } " + '\n' +
- "}";
-
- return request;
-
- }
-
- // Success Scenario
- private Map<String, String> setupVariablesVIPER1() {
- Map<String, String> variables = new HashMap<>();
- variables.put("testMessageId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56");
- variables.put("msoRequestId", "testRequestId");
- variables.put("requestId", "testRequestId");
- variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
- variables.put("networkId", "49c86598-f766-46f8-84f8-8d1c1b10f9b4");
- variables.put("networkName", "MNS-25180-L-01-dmz_direct_net_1");
- variables.put("lcpCloudRegionId", "RDM2WAGPLCP");
- variables.put("tenantId", "88a6ca3ee0394ade9403f075db23167e");
- variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
- variables.put("disableRollback", "false"); // macro
- variables.put("failIfExists", "false");
- //variables.put("sdncVersion", "1702");
- variables.put("sdncVersion", "1707");
- variables.put("subscriptionServiceType", "MSO-dev-service-type");
- variables.put("globalSubscriberId", "globalId_45678905678");
- variables.put("networkModelInfo", networkModelInfo);
- variables.put("serviceModelInfo", serviceModelInfo);
- return variables;
-
- }
-
- // Missing Name Scenario
- private Map<String, String> setupVariablesMissingNetworkId() {
- Map<String, String> variables = new HashMap<>();
- variables.put("mso-request-id", "88f65519-9a38-4c4b-8445-9eb4a5a5af56");
- variables.put("bpmnRequest", getCreateNetworkRequestNetworkId());
- variables.put("requestId", "testRequestId");
- variables.put("isBaseVfModule", "true");
- variables.put("recipeTimeout", "0");
- variables.put("requestAction", "UPDATE");
- variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
- variables.put("vnfId", "");
- variables.put("vfModuleId", "");
- variables.put("volumeGroupId", "");
- //variables.put("networkId", "49c86598-f766-46f8-84f8-8d1c1b10f9b4"); // missing, ok
- variables.put("serviceType", "vMOG");
- variables.put("vfModuleType", "");
- variables.put("networkType", "modelName");
-
- return variables;
-
- }
-
- public String getCreateNetworkRequestNetworkId() {
-
- String request =
- "{ \"requestDetails\": { " + '\n' +
- " \"modelInfo\": { " + '\n' +
- " \"modelType\": \"modelType\", " + '\n' +
- " \"modelId\": \"modelId\", " + '\n' +
- " \"modelNameVersionId\": \"modelNameVersionId\", " + '\n' +
- " \"modelName\": \"CONTRAIL_EXTERNAL\", " + '\n' +
- " \"modelVersion\": \"1\" " + '\n' +
- " }, " + '\n' +
- " \"cloudConfiguration\": { " + '\n' +
- " \"lcpCloudRegionId\": \"RDM2WAGPLCP\", " + '\n' +
- " \"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\" " + '\n' +
- " }, " + '\n' +
- " \"requestInfo\": { " + '\n' +
- " \"source\": \"VID\", " + '\n' +
- " \"callbackUrl\": \"\", " + '\n' +
- " \"suppressRollback\": \"true\" ," + '\n' +
- " \"productFamilyId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\" " + '\n' +
- " }, " + '\n' +
- " \"requestParameters\": { " + '\n' +
- " \"userParams\": [] " + '\n' +
- " } " + '\n' +
- " } " + '\n' +
- "}";
-
- return request;
-
- }
-
- public String getCreateNetworkRequestSDNCRollback() {
-
- String request =
- "{ \"requestDetails\": { " + '\n' +
- " \"modelInfo\": { " + '\n' +
- " \"modelType\": \"modelType\", " + '\n' +
- " \"modelId\": \"modelId\", " + '\n' +
- " \"modelNameVersionId\": \"modelNameVersionId\", " + '\n' +
- " \"modelName\": \"CONTRAIL_EXTERNAL\", " + '\n' +
- " \"modelVersion\": \"1\" " + '\n' +
- " }, " + '\n' +
- " \"cloudConfiguration\": { " + '\n' +
- " \"lcpCloudRegionId\": \"RDM2WAGPLCP\", " + '\n' +
- " \"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\" " + '\n' +
- " }, " + '\n' +
- " \"requestInfo\": { " + '\n' +
- " \"instanceName\": \"MNS-25180-L-01-dmz_direct_net_3\", " + '\n' +
- " \"source\": \"VID\", " + '\n' +
- " \"callbackUrl\": \"\", " + '\n' +
- " \"suppressRollback\": \"true\" ," + '\n' +
- " \"productFamilyId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\" " + '\n' +
- " }, " + '\n' +
- " \"requestParameters\": { " + '\n' +
- " \"userParams\": [] " + '\n' +
- " } " + '\n' +
- " } " + '\n' +
- "}";
-
-
- return request;
- }
-
-}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVfModuleInfraTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVfModuleInfraTest.java
deleted file mode 100644
index 63cf62d17d..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVfModuleInfraTest.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*-
- * ============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.infrastructure;
-
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithDepth;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithPriority;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutVfModuleIdNoResponse;
-import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB;
-import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter;
-import static org.openecomp.mso.bpmn.mock.StubResponseVNFAdapter.mockVNFPut;
-
-import java.io.IOException;
-import java.util.HashMap;
-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.mock.FileUtil;
-
-/**
- * Unit test cases for UpdateVfModule.bpmn
- */
-public class UpdateVfModuleInfraTest extends WorkflowTest {
-
- private final CallbackSet callbacks = new CallbackSet();
-
- public UpdateVfModuleInfraTest() throws IOException {
- callbacks.put("changeassign", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyChangeAssignCallback.xml"));
- callbacks.put("query", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyQueryCallback.xml"));
- callbacks.put("activate", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
- callbacks.put("vnfUpdate", FileUtil.readResourceFile(
- "__files/VfModularity/VNFAdapterRestUpdateCallback.xml"));
- }
-
- /**
- * Sunny day scenario.
- *
- * @throws Exception
- */
- @Test
- @Ignore
- @Deployment(resources = {
- "process/UpdateVfModuleInfra.bpmn",
- "subprocess/DoUpdateVfModule.bpmn",
- "subprocess/PrepareUpdateAAIVfModule.bpmn",
- "subprocess/ConfirmVolumeGroupTenant.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/FalloutHandler.bpmn"
- })
- public void sunnyDay() throws Exception {
-
- logStart();
-
- MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml");
- MockPutVfModuleIdNoResponse("skask", "PCRF", "supercool");
- MockGetGenericVnfByIdWithPriority("skask", "supercool", 200, "VfModularity/VfModule-supercool.xml", 1);
- mockSDNCAdapter("/SDNCAdapter", "SvcInstanceId><", 200, "VfModularity/StandardSDNCSynchResponse.xml");
- mockSDNCAdapter("/SDNCAdapter", "vnf-type>STMTN", 200, "VfModularity/StandardSDNCSynchResponse.xml");
- mockSDNCAdapter("/SDNCAdapter", "SvcAction>query", 200, "VfModularity/StandardSDNCSynchResponse.xml");
- mockVNFPut("skask", "/supercool", 202);
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- String updaetVfModuleRequest =
- FileUtil.readResourceFile("__files/InfrastructureFlows/UpdateVfModule_VID_request.json");
-
- Map<String, Object> variables = setupVariablesSunnyDayVID();
-
-
- TestAsyncResponse asyncResponse = invokeAsyncProcess("UpdateVfModuleInfra",
- "v1", businessKey, updaetVfModuleRequest, variables);
-
- WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
-
- String responseBody = response.getContent();
- System.out.println("Workflow (Synch) Response:\n" + responseBody);
-
- injectSDNCCallbacks(callbacks, "changeassign, query");
- injectVNFRestCallbacks(callbacks, "vnfUpdate");
- injectSDNCCallbacks(callbacks, "activate");
-
- // TODO add appropriate assertions
-
- waitForProcessEnd(businessKey, 10000);
- checkVariable(businessKey, "UpdateVfModuleInfraSuccessIndicator", true);
-
- logEnd();
- }
-
- // Active Scenario
- private Map<String, Object> setupVariablesSunnyDayVID() {
- Map<String, Object> variables = new HashMap<>();
- //try {
- // variables.put("bpmnRequest", FileUtil.readResourceFile("__files/CreateVfModule_VID_request.json"));
- //}
- //catch (Exception e) {
-
- //}
- //variables.put("mso-request-id", "testRequestId");
- variables.put("requestId", "testRequestId");
- variables.put("isBaseVfModule", false);
- variables.put("isDebugLogEnabled", "true");
- variables.put("recipeTimeout", "0");
- variables.put("requestAction", "UPDATE_VF_MODULE");
- variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
- variables.put("vnfId", "skask");
- variables.put("vnfType", "vSAMP12");
- variables.put("vfModuleId", "supercool");
- variables.put("volumeGroupId", "");
- variables.put("serviceType", "MOG");
- variables.put("vfModuleType", "");
- return variables;
-
- }
-
-}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVfModuleInfraV2Test.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVfModuleInfraV2Test.java
deleted file mode 100644
index 65a514c804..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVfModuleInfraV2Test.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*-
- * ============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.infrastructure;
-
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithDepth;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithPriority;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutVfModuleIdNoResponse;
-import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB;
-import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter;
-import static org.openecomp.mso.bpmn.mock.StubResponseVNFAdapter.mockVNFPut;
-
-import java.io.IOException;
-import java.util.HashMap;
-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.WorkflowTest.CallbackSet;
-import org.openecomp.mso.bpmn.common.WorkflowTest.TestAsyncResponse;
-import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse;
-import org.openecomp.mso.bpmn.mock.FileUtil;
-
-/**
- * Unit test cases for UpdateVfModuleV2.bpmn
- */
-public class UpdateVfModuleInfraV2Test extends WorkflowTest {
-
- private final CallbackSet callbacks = new CallbackSet();
-
- public UpdateVfModuleInfraV2Test() throws IOException {
- /*callbacks.put("changeassign", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyChangeAssignCallback.xml"));
- callbacks.put("query", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyQueryCallback.xml"));
- callbacks.put("activate", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
- callbacks.put("vnfUpdate", FileUtil.readResourceFile(
- "__files/VfModularity/VNFAdapterRestUpdateCallback.xml"));*/
- }
-
- @Test
- @Ignore // IGNORED FOR 1710 MERGE TO ONAP
- @Deployment(resources = {
- "process/UpdateVfModuleInfraV2.bpmn",
- "subprocess/DoUpdateVfModule.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- })
-
- public void sunnyDay() throws Exception {
- //logStart();
-
-
- MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml");
- MockPutVfModuleIdNoResponse("skask", "PCRF", "supercool");
- MockGetGenericVnfByIdWithPriority("skask", "supercool", 200, "VfModularity/VfModule-supercool.xml", 1);
- mockSDNCAdapter("/SDNCAdapter", "SvcInstanceId><", 200, "VfModularity/StandardSDNCSynchResponse.xml");
- mockSDNCAdapter("/SDNCAdapter", "vnf-type>STMTN", 200, "VfModularity/StandardSDNCSynchResponse.xml");
- mockSDNCAdapter("/SDNCAdapter", "SvcAction>query", 200, "VfModularity/StandardSDNCSynchResponse.xml");
- mockVNFPut("skask", "/supercool", 202);
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = setupVariablesSunnyDayVID();
-
- String updateVfModuleRequest =
- FileUtil.readResourceFile("__files/InfrastructureFlows/UpdateVfModule_VID_request.json");
- TestAsyncResponse asyncResponse = invokeAsyncProcess("UpdateVfModuleInfraV2",
- "v1", businessKey, updateVfModuleRequest, variables);
-
- WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
-
- //String responseBody = response.getResponse();
- //System.out.println("Workflow (Synch) Response:\n" + responseBody);
-
- //logEnd();
- }
-
- // Active Scenario
- private Map<String, Object> setupVariablesSunnyDayVID() {
- Map<String, Object> variables = new HashMap<>();
- variables.put("requestId", "testRequestId");
- variables.put("isBaseVfModule", false);
- variables.put("isDebugLogEnabled", "true");
- variables.put("recipeTimeout", "0");
- variables.put("requestAction", "UPDATE_VF_MODULE");
- variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
- variables.put("vnfId", "skask");
- variables.put("vnfType", "vSAMP12");
- variables.put("vfModuleId", "supercool");
- variables.put("volumeGroupId", "");
- variables.put("serviceType", "MOG");
- variables.put("vfModuleType", "");
- variables.put("moduleUuid", "fe6985cd-ea33-3346-ac12-ab121484a3fe");
- return variables;
-
- }
-
-}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVfModuleVolumeInfraV1Test.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVfModuleVolumeInfraV1Test.java
deleted file mode 100644
index 91327b087e..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVfModuleVolumeInfraV1Test.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*-
- * ============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.infrastructure;
-
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfById;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetVfModuleId;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetVolumeGroupById;
-import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB;
-import static org.openecomp.mso.bpmn.mock.StubResponseVNFAdapter.mockPutVNFVolumeGroup;
-
-import java.io.IOException;
-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.WorkflowTest;
-import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse;
-import org.openecomp.mso.bpmn.mock.FileUtil;
-
-/**
- * Unit test cases for UpdateVfModuleVolume.bpmn
- */
-public class UpdateVfModuleVolumeInfraV1Test extends WorkflowTest {
-
- private final CallbackSet callbacks = new CallbackSet();
-
- public UpdateVfModuleVolumeInfraV1Test() throws IOException {
- callbacks.put("volumeGroupUpdate", FileUtil.readResourceFile(
- "__files/VfModularity/VNFAdapterRestVolumeGroupCallback.xml"));
- }
-
- /**
- * Happy path scenario.
- *
- * @throws Exception
- */
- @Test
- @Deployment(resources = {
- "process/UpdateVfModuleVolumeInfraV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/GenericNotificationService.bpmn",
- "subprocess/FalloutHandler.bpmn"
- })
- public void happyPath() throws Exception {
-
- logStart();
-
- MockGetGenericVnfById("/TEST-VNF-ID-0123", "CreateVfModuleVolumeInfraV1/GenericVnf.xml", 200);
- MockGetVolumeGroupById("mdt1", "78987", "UpdateVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml");
- MockGetVfModuleId("9e48f6ea-f786-46de-800a-d480e5ccc846", "6a1dc898-b590-47b9-bbf0-34424a7a2ec3/", "UpdateVfModuleVolumeInfraV1/vf_module_aai_response.xml", 200);
- mockPutVNFVolumeGroup("78987", 202);
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- String updaetVfModuleVolRequest =
- FileUtil.readResourceFile("__files/UpdateVfModuleVolumeInfraV1/updateVfModuleVolume_VID_request.json");
-
- Map<String, Object> testVariables = new HashMap<>();
- testVariables.put("requestId", "TEST-REQUEST-ID-0123");
- testVariables.put("serviceInstanceId", "test-service-instance-id");
- testVariables.put("volumeGroupId", "78987");
- testVariables.put("vnfId", "TEST-VNF-ID-0123");
- TestAsyncResponse asyncResponse = invokeAsyncProcess("UpdateVfModuleVolumeInfraV1", "v1", businessKey, updaetVfModuleVolRequest, testVariables);
- WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
-
- String responseBody = response.getContent();
- System.out.println("Workflow (Synch) Response:\n" + responseBody);
-
- injectVNFRestCallbacks(callbacks, "volumeGroupUpdate");
-
- waitForProcessEnd(businessKey, 10000);
- checkVariable(businessKey, "UpdateVfModuleVolumeSuccessIndicator", true);
-
- logEnd();
- }
-
- /**
- * VF Module Personal model id does not match request model invariant id
- * @throws Exception
- */
- @Test
- //@Ignore
- @Deployment(resources = {
- "process/UpdateVfModuleVolumeInfraV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/GenericNotificationService.bpmn",
- "subprocess/FalloutHandler.bpmn"
- })
- public void testPersonaModelIdNotMatch() throws Exception {
-
- logStart();
-
- MockGetVolumeGroupById("mdt1", "78987", "UpdateVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml");
- MockGetGenericVnfById("/TEST-VNF-ID-0123", "CreateVfModuleVolumeInfraV1/GenericVnf.xml", 200);
- MockGetVfModuleId("9e48f6ea-f786-46de-800a-d480e5ccc846", "6a1dc898-b590-47b9-bbf0-34424a7a2ec3/", "UpdateVfModuleVolumeInfraV1/vf_module_aai_response.xml", 200);
- mockPutVNFVolumeGroup("78987", 202);
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- String updaetVfModuleVolRequest =
- FileUtil.readResourceFile("__files/UpdateVfModuleVolumeInfraV1/updateVfModuleVolume_VID_request_2.json");
-
- Map<String, Object> testVariables = new HashMap<>();
- testVariables.put("requestId", "TEST-REQUEST-ID-0123");
- testVariables.put("serviceInstanceId", "test-service-instance-id");
- testVariables.put("volumeGroupId", "78987");
- testVariables.put("vnfId", "TEST-VNF-ID-0123");
- TestAsyncResponse asyncResponse = invokeAsyncProcess("UpdateVfModuleVolumeInfraV1", "v1", businessKey, updaetVfModuleVolRequest, testVariables);
- WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
-
- String responseBody = response.getContent();
- System.out.println("Workflow (Synch) Response:\n" + responseBody);
-
- injectVNFRestCallbacks(callbacks, "volumeGroupUpdate");
-
- waitForProcessEnd(businessKey, 10000);
- checkVariable(businessKey, "UpdateVfModuleVolumeSuccessIndicator", true);
-
- logEnd();
- }
-}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVnfInfraTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVnfInfraTest.java
deleted file mode 100644
index 5ab1a04809..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVnfInfraTest.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/*-
- * ============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.infrastructure;
-
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockAAIVfModule;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDBUpdateVfModule;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithDepth;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithPriority;
-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.MockGetDefaultCloudRegionByCloudRegionId;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetPserverByVnfId;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfsByVnfId;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchGenericVnf;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchVfModuleId;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutGenericVnf;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutVfModuleIdNoResponse;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockVNFAdapterRestVfModule;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockSetInMaintFlagByVnfId;
-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;
-import static org.openecomp.mso.bpmn.mock.StubResponseVNFAdapter.mockVNFPut;
-import static org.openecomp.mso.bpmn.mock.StubResponsePolicy.MockPolicySkip;
-
-import java.io.IOException;
-import java.util.HashMap;
-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.mock.FileUtil;
-
-/**
- * Unit test cases for UpdateVnfInfra.bpmn
- */
-public class UpdateVnfInfraTest extends WorkflowTest {
-
- private final CallbackSet callbacks = new CallbackSet();
-
- public UpdateVnfInfraTest() throws IOException {
- callbacks.put("changeassign", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyChangeAssignCallback.xml"));
- callbacks.put("activate", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
- callbacks.put("query", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyQueryCallback.xml"));
- callbacks.put("vnfUpdate", FileUtil.readResourceFile(
- "__files/VfModularity/VNFAdapterRestUpdateCallback.xml"));
- }
-
- /**
- * Sunny day scenario.
- *
- * @throws Exception
- */
- @Test
- @Ignore // 1802 merge
- @Deployment(resources = {
- "process/UpdateVnfInfra.bpmn",
- "subprocess/RollbackVnf.bpmn",
- "subprocess/DoUpdateVfModule.bpmn",
- "subprocess/DoUpdateVnfAndModules.bpmn",
- "subprocess/PrepareUpdateAAIVfModule.bpmn",
- "subprocess/ConfirmVolumeGroupTenant.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/BuildingBlock/DecomposeService.bpmn",
- "subprocess/BuildingBlock/RainyDayHandler.bpmn",
- "subprocess/BuildingBlock/ManualHandling.bpmn",
- "subprocess/BuildingBlock/AppCClient.bpmn"
-
- })
- public void sunnyDay() throws Exception {
-
- logStart();
-
- MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlByIdVipr.xml");
- MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml");
- //MockGetGenericVnfById_404("testVnfId");
- MockGetServiceResourcesCatalogData("995256d2-5a33-55df-13ab-12abad84e7ff", "1.0", "VIPR/getCatalogServiceResourcesDataForUpdateVnfInfra.json");
- MockGetServiceResourcesCatalogData("995256d2-5a33-55df-13ab-12abad84e7ff", "VIPR/getCatalogServiceResourcesDataForUpdateVnfInfra.json");
- MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml");
- MockGetDefaultCloudRegionByCloudRegionId("mdt1", "AAI/AAI_defaultCloudRegionByCloudRegionId.json", 200);
- MockPutGenericVnf(".*");
- MockAAIVfModule();
- MockPatchGenericVnf("skask");
- MockPatchVfModuleId("skask", ".*");
- mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml");
- mockVNFPut("skask", "/supercool", 202);
- mockVNFPut("skask", "/lukewarm", 202);
- MockVNFAdapterRestVfModule();
- MockDBUpdateVfModule();
- MockGetPserverByVnfId("skask", "AAI/AAI_pserverByVnfId.json", 200);
- MockGetGenericVnfsByVnfId("skask", "AAI/AAI_genericVnfsByVnfId.json", 200);
- MockSetInMaintFlagByVnfId("skask", "AAI/AAI_genericVnfsByVnfId.json", 200);
- MockPolicySkip();
-
- mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml");
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- String updaetVnfRequest =
- FileUtil.readResourceFile("__files/InfrastructureFlows/UpdateVnf_VID_request.json");
-
- Map<String, Object> variables = setupVariablesSunnyDayVID();
-
-
- TestAsyncResponse asyncResponse = invokeAsyncProcess("UpdateVnfInfra",
- "v1", businessKey, updaetVnfRequest, variables);
-
- WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
-
- String responseBody = response.getContent();
- System.out.println("Workflow (Synch) Response:\n" + responseBody);
-
- injectSDNCCallbacks(callbacks, "changeassign, query");
- injectVNFRestCallbacks(callbacks, "vnfUpdate");
- injectSDNCCallbacks(callbacks, "activate");
- injectSDNCCallbacks(callbacks, "changeassign, query");
- injectVNFRestCallbacks(callbacks, "vnfUpdate");
- injectSDNCCallbacks(callbacks, "activate");
-
- // TODO add appropriate assertions
-
- waitForProcessEnd(businessKey, 10000);
- checkVariable(businessKey, "UpdateVfModuleInfraSuccessIndicator", true);
-
- logEnd();
- }
-
- // Active Scenario
- private Map<String, Object> setupVariablesSunnyDayVID() {
- Map<String, Object> variables = new HashMap<>();
-
- variables.put("requestId", "testRequestId");
- variables.put("isDebugLogEnabled", "true");
- variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
- variables.put("vnfId", "skask");
- variables.put("vnfType", "vSAMP12");
- variables.put("serviceType", "MOG");
-
- return variables;
-
- }
-
-}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/VnfConfigUpdateTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/VnfConfigUpdateTest.java
deleted file mode 100644
index aca60026dc..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/VnfConfigUpdateTest.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*-
- * ============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.infrastructure;
-
-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.urlPathEqualTo;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockAAIVfModule;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDBUpdateVfModule;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithDepth;
-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.MockGetPserverByVnfId;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfsByVnfId;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockSetInMaintFlagByVnfId;
-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.StubResponsePolicy.MockPolicySkip;
-import static org.openecomp.mso.bpmn.mock.StubResponseAPPC.MockAppcError;
-
-import java.io.IOException;
-import java.util.HashMap;
-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.mock.FileUtil;
-import org.openecomp.mso.client.aai.AAIObjectType;
-import org.openecomp.mso.client.aai.entities.uri.AAIResourceUri;
-import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory;
-
-/**
- * Unit test cases for VnfConfigUpdate.bpmn
- */
-public class VnfConfigUpdateTest extends WorkflowTest {
-
- public VnfConfigUpdateTest() throws IOException {
-
- }
-
- /**
- * Sunny day scenario.
- *
- * @throws Exception
- */
- @Test
- @Ignore // 1802 merge
- @Deployment(resources = {
- "process/VnfConfigUpdate.bpmn",
- "subprocess/RollbackVnf.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/BuildingBlock/RainyDayHandler.bpmn",
- "subprocess/BuildingBlock/ManualHandling.bpmn",
- "subprocess/BuildingBlock/AppCClient.bpmn"
-
- })
- public void sunnyDay() throws Exception {
-
- logStart();
-
- System.setProperty("mso.config.path", "src/test/resources");
- AAIResourceUri path = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "comx9906v");
- wireMockRule.stubFor(get(
- urlPathEqualTo("/aai/v11" + path.build()))
- .willReturn(
- aResponse()
- .withHeader("Content-Type", "application/json")
- .withBodyFile("AAI/mockObject.json")
- .withStatus(200)));
-
-
- MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlByIdVipr.xml");
- MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml");
- //MockGetGenericVnfById_404("testVnfId");
- MockGetGenericVnfByIdWithDepth("comx9906v", 1, "AAI/AAI_genericVnfsByVnfIdVnfConfig.json");
- MockAAIVfModule();
- MockDBUpdateVfModule();
- MockGetPserverByVnfId("comx9906v", "AAI/AAI_pserverByVnfId.json", 200);
- MockGetGenericVnfsByVnfId("comx9906v", "AAI/AAI_genericVnfsByVnfIdVnfConfig.json", 200);
- MockSetInMaintFlagByVnfId("comx9906v", "AAI/AAI_genericVnfsByVnfIdVnfConfig.json", 200);
- MockPolicySkip();
- MockAppcError();
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- String updaetVnfRequest =
- FileUtil.readResourceFile("__files/InfrastructureFlows/ConfigVnf_VID_request.json");
-
- Map<String, Object> variables = setupVariablesSunnyDayVID();
-
-
- TestAsyncResponse asyncResponse = invokeAsyncProcess("VnfConfigUpdate",
- "v1", businessKey, updaetVnfRequest, variables);
-
- WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
-
- String responseBody = response.getContent();
- System.out.println("Workflow (Synch) Response:\n" + responseBody);
-
- // TODO add appropriate assertions
-
- waitForProcessEnd(businessKey, 1000000);
- checkVariable(businessKey, "VnfConfigUpdateSuccessIndicator", true);
-
- logEnd();
- }
-
- // Active Scenario
- private Map<String, Object> setupVariablesSunnyDayVID() {
- Map<String, Object> variables = new HashMap<String, Object>();
-
- variables.put("requestId", "testRequestId");
- variables.put("isDebugLogEnabled", "true");
- variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
- variables.put("vnfId", "comx9906v");
- variables.put("vnfType", "vSAMP12");
- variables.put("serviceType", "MOG");
-
- return variables;
-
- }
-
-}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/VnfInPlaceUpdateTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/VnfInPlaceUpdateTest.java
deleted file mode 100644
index 7d8a7e1856..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/VnfInPlaceUpdateTest.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*-
- * ============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.infrastructure;
-
-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.put;
-import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockAAIVfModule;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDBUpdateVfModule;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithDepth;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithPriority;
-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.MockGetPserverByVnfId;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfsByVnfId;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockSetInMaintFlagByVnfId;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetDefaultCloudRegionByCloudRegionId;
-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.StubResponsePolicy.MockPolicySkip;
-import static org.openecomp.mso.bpmn.mock.StubResponseAPPC.MockAppcError;
-
-import java.io.IOException;
-import java.util.HashMap;
-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.mock.FileUtil;
-import org.openecomp.mso.client.aai.AAIObjectType;
-import org.openecomp.mso.client.aai.entities.uri.AAIResourceUri;
-import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory;
-
-/**
- * Unit test cases for VnfInPlaceUpdate.bpmn
- */
-public class VnfInPlaceUpdateTest extends WorkflowTest {
-
- public VnfInPlaceUpdateTest() throws IOException {
-
- }
-
- /**
- * Sunny day scenario.
- *
- * @throws Exception
- */
- @Test
-
-
- @Deployment(resources = {
- "process/VnfInPlaceUpdate.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/BuildingBlock/RainyDayHandler.bpmn",
- "subprocess/BuildingBlock/ManualHandling.bpmn",
- "subprocess/BuildingBlock/AppCClient.bpmn"
-
- })
- public void sunnyDay() throws Exception {
-
- logStart();
- System.setProperty("mso.config.path", "src/test/resources");
- AAIResourceUri path = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "skask");
- wireMockRule.stubFor(get(
- urlPathEqualTo("/aai/v11" + path.build()))
- .willReturn(
- aResponse()
- .withHeader("Content-Type", "application/json")
- .withBodyFile("AAI/mockObject.json")
- .withStatus(200)));
-
- //
-
- //AAIResourceUri path1 = AAIUriFactory.createResourceUri(AAIObjectType.CUSTOM_QUERY).queryParam("format", "RESOURCE");
- //wireMockRule.stubFor(put(
- // urlMatching("/aai/v10/query/pservers-fromVnf"))
- // .willReturn(
- // aResponse()
- // .withHeader("Content-Type", "application/json")
- // .withBodyFile("AAI/AAI_pserversByVnfId.json")
- // .withStatus(200)));
-
- MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlByIdVipr.xml");
- MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml");
- //MockGetGenericVnfById_404("testVnfId");
- MockGetGenericVnfByIdWithDepth("skask", 1, "AAI/AAI_genericVnfsByVnfId.json");
- MockAAIVfModule();
- MockDBUpdateVfModule();
- MockGetPserverByVnfId("skask", "AAI/AAI_pserverByVnfId.json", 200);
- MockSetInMaintFlagByVnfId("skask", "AAI/AAI_genericVnfsByVnfId.json", 200);
- MockGetGenericVnfsByVnfId("skask", "AAI/AAI_genericVnfsByVnfId.json", 200);
- MockGetDefaultCloudRegionByCloudRegionId("mdt1", "AAI/AAI_defaultCloudRegionByCloudRegionId.json", 200);
- MockPolicySkip();
- MockAppcError();
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- String updaetVnfRequest =
- FileUtil.readResourceFile("__files/InfrastructureFlows/VnfInPlaceUpdate_VID_request.json");
-
- Map<String, Object> variables = setupVariablesSunnyDayVID();
-
-
- TestAsyncResponse asyncResponse = invokeAsyncProcess("VnfInPlaceUpdate",
- "v1", businessKey, updaetVnfRequest, variables);
-
- WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 100000);
-
- String responseBody = response.getContent();
- System.out.println("Workflow (Synch) Response:\n" + responseBody);
-
- // TODO add appropriate assertions
-
- waitForProcessEnd(businessKey, 100000);
- checkVariable(businessKey, "VnfInPlaceUpdateSuccessIndicator", true);
-
- logEnd();
- }
-
- // Active Scenario
- private Map<String, Object> setupVariablesSunnyDayVID() {
- Map<String, Object> variables = new HashMap<String, Object>();
-
- variables.put("requestId", "testRequestId");
- variables.put("isDebugLogEnabled", "true");
- variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
- variables.put("vnfId", "skask");
-
- return variables;
-
- }
-
-}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/aai/AAIServiceInstanceTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/aai/AAIServiceInstanceTest.java
deleted file mode 100644
index b9f339921d..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/aai/AAIServiceInstanceTest.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2018 Huawei 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.infrastructure.aai;
-
-import org.junit.Test;
-
-
-public class AAIServiceInstanceTest {
-
- AAIServiceInstance test = new AAIServiceInstance("serviceInstanceName","serviceType","serviceRole","orchestrationStatus","modelInvariantUuid","modelVersionId","environmentContext","workloadContext");
-
- @Test
- public void getServiceInstanceNameTest() throws Exception {
- test.getServiceInstanceName();
- }
-
- @Test
- public void setServiceInstanceNameTest() throws Exception {
- test.setServiceInstanceName("serviceInstanceName");
- }
-
- @Test
- public void getServiceTypeTest() throws Exception {
- test.getServiceType();
- }
-
- @Test
- public void setServiceTypeTest() throws Exception {
- test.setServiceType("serviceType");
- }
-
-
- @Test
- public void getServiceRoleTest() throws Exception {
- test.getServiceRole();
- }
-
- @Test
- public void setServiceRoleTest() throws Exception {
- test.setServiceRole("serviceRole");
- }
-
- @Test
- public void getOrchestrationStatusTest() throws Exception {
- test.getOrchestrationStatus();
- }
-
- @Test
- public void setOrchestrationStatusTest() throws Exception {
- test.setOrchestrationStatus("status");
- }
-
- @Test
- public void getModelInvariantUuidTest() throws Exception {
- test.getModelInvariantUuid();
- }
-
- @Test
- public void setModelInvariantUuidTest() throws Exception {
- test.setModelInvariantUuid("uuid");
- }
-
- @Test
- public void getModelVersionIdTest() throws Exception {
- test.getModelVersionId();
- }
-
- @Test
- public void setModelVersionIdTest() throws Exception {
- test.setModelVersionId("versionId");
- }
-
- @Test
- public void getEnvironmentContextTest() throws Exception {
- test.getEnvironmentContext();
- }
-
- @Test
- public void setEnvironmentContextTest() throws Exception {
- test.setEnvironmentContext("context");
- }
-
- @Test
- public void getWorkloadContextTest() throws Exception {
- test.getWorkloadContext();
- }
-
- @Test
- public void setWorkloadContextTest() throws Exception {
- test.setWorkloadContext("context");
- }
-
-}
-
-
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java
deleted file mode 100644
index bffae8d892..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*-
- * ============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.infrastructure.pnf.delegate;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Optional;
-import org.onap.aai.domain.yang.Pnf;
-import org.openecomp.mso.bpmn.infrastructure.pnf.implementation.AaiConnection;
-
-public class AaiConnectionTestImpl implements AaiConnection {
-
- public static final String ID_WITH_ENTRY_AND_IP = "idWithEntryAndIp";
- public static final String ID_WITH_IP_V6 = "idWithIpV6";
- public static final String ID_WITHOUT_ENTRY = "IdWithoutEntry";
- public static final String ID_WITH_ENTRY_NO_IP = "idWithEntryNoIp";
- public static final String DEFAULT_IP = "1.2.3.4";
- public static final String DEFAULT_IP_V6 = "2001:db8::ff00:42:8329";
-
- private Map<String, Pnf> created = new HashMap<>();
-
- @Override
- public Optional<Pnf> getEntryFor(String correlationId) throws IOException {
- if (Objects.equals(correlationId, ID_WITH_ENTRY_AND_IP)) {
- Pnf pnf = new Pnf();
- pnf.setIpaddressV4Oam(DEFAULT_IP);
- return Optional.of(pnf);
- } else if (Objects.equals(correlationId, ID_WITH_IP_V6)) {
- Pnf pnf = new Pnf();
- pnf.setIpaddressV6Oam(DEFAULT_IP_V6);
- return Optional.of(pnf);
- } else if (Objects.equals(correlationId, ID_WITH_ENTRY_NO_IP)) {
- return Optional.of(new Pnf());
- } else {
- return Optional.empty();
- }
- }
-
- @Override
- public void createEntry(String correlationId, Pnf entry) throws IOException {
- created.put(correlationId, entry);
- }
-
- public Map<String, Pnf> getCreated() {
- return created;
- }
-
- public void reset() {
- created.clear();
- }
-}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/AaiConnectionThrowingException.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/AaiConnectionThrowingException.java
deleted file mode 100644
index 9a8dd5df24..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/AaiConnectionThrowingException.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*-
- * ============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.infrastructure.pnf.delegate;
-
-import java.io.IOException;
-import java.util.Optional;
-import org.onap.aai.domain.yang.Pnf;
-import org.openecomp.mso.bpmn.infrastructure.pnf.implementation.AaiConnection;
-
-public class AaiConnectionThrowingException implements AaiConnection {
-
- @Override
- public Optional<Pnf> getEntryFor(String correlationId) throws IOException {
- throw new IOException();
- }
-
- @Override
- public void createEntry(String correlationId, Pnf entry) throws IOException {
- throw new IOException();
- }
-}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java
deleted file mode 100644
index d27cf44342..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*-
- * ============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.infrastructure.pnf.delegate;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-import org.camunda.bpm.engine.delegate.DelegateExecution;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.junit4.SpringRunner;
-
-@RunWith(SpringRunner.class)
-@SpringBootTest(classes = {CancelDmaapSubscription.class, DmaapClientTestImpl.class})
-public class CancelDmaapSubscriptionTest {
-
- @Autowired
- public CancelDmaapSubscription delegate;
-
- @Autowired
- private DmaapClientTestImpl dmaapClientTest;
-
- @Test
- public void shouldCancelSubscription() throws Exception {
- // given
- DelegateExecution delegateExecution = mock(DelegateExecution.class);
- when(delegateExecution.getVariable(eq(ExecutionVariableNames.CORRELATION_ID))).thenReturn("testCorrelationId");
- when(delegateExecution.getProcessBusinessKey()).thenReturn("testBusinessKey");
- dmaapClientTest.registerForUpdate("testCorrelationId", () -> {});
- // when
- delegate.execute(delegateExecution);
- // then
- assertThat(dmaapClientTest.haveRegisteredConsumer()).isFalse();
- }
-} \ No newline at end of file
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegateTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegateTest.java
deleted file mode 100644
index 75a7450434..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegateTest.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*-
- * ============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.infrastructure.pnf.delegate;
-
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-import static org.openecomp.mso.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.ID_WITHOUT_ENTRY;
-import static org.openecomp.mso.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.ID_WITH_ENTRY_AND_IP;
-import static org.openecomp.mso.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.ID_WITH_ENTRY_NO_IP;
-import static org.openecomp.mso.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.ID_WITH_IP_V6;
-import static org.openecomp.mso.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.AAI_CONTAINS_INFO_ABOUT_IP;
-import static org.openecomp.mso.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.AAI_CONTAINS_INFO_ABOUT_PNF;
-import static org.openecomp.mso.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID;
-
-import org.camunda.bpm.engine.delegate.BpmnError;
-import org.camunda.bpm.engine.delegate.DelegateExecution;
-import org.junit.Test;
-import org.junit.experimental.runners.Enclosed;
-import org.junit.runner.RunWith;
-import org.openecomp.mso.bpmn.core.WorkflowException;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.junit4.SpringRunner;
-
-@RunWith(Enclosed.class)
-public class CheckAaiForCorrelationIdDelegateTest {
-
- @RunWith(SpringRunner.class)
- @SpringBootTest(classes = {CheckAaiForCorrelationIdDelegate.class, AaiConnectionTestImpl.class})
- public static class ConnectionOkTests {
-
- @Autowired
- private CheckAaiForCorrelationIdDelegate delegate;
-
- @Test
- public void shouldThrowExceptionWhenCorrelationIdIsNotSet() throws Exception {
- // given
- DelegateExecution execution = mock(DelegateExecution.class);
- when(execution.getVariable(CORRELATION_ID)).thenReturn(null);
- when(execution.getVariable("testProcessKey")).thenReturn("testProcessKeyValue");
- // when, then
- assertThatThrownBy(() -> delegate.execute(execution)).isInstanceOf(BpmnError.class);
- verify(execution).setVariable(eq("WorkflowException"), any(WorkflowException.class));
- }
-
- @Test
- public void shouldSetCorrectVariablesWhenAaiDoesNotContainInfoAboutPnf() throws Exception {
- // given
- DelegateExecution execution = mock(DelegateExecution.class);
- when(execution.getVariable(CORRELATION_ID)).thenReturn(ID_WITHOUT_ENTRY);
- // when
- delegate.execute(execution);
- // then
- verify(execution).setVariableLocal(AAI_CONTAINS_INFO_ABOUT_PNF, false);
- }
-
- @Test
- public void shouldSetCorrectVariablesWhenAaiContainsInfoAboutPnf() throws Exception {
- shouldSetCorrectVariablesWhenAaiContainsInfoAboutPnf(ID_WITH_ENTRY_AND_IP);
- }
-
- @Test
- public void shouldSetCorrectVariablesWhenAaiContainsInfoAboutPnfWithIpV6() throws Exception {
- shouldSetCorrectVariablesWhenAaiContainsInfoAboutPnf(ID_WITH_IP_V6);
- }
-
- private void shouldSetCorrectVariablesWhenAaiContainsInfoAboutPnf(String id) throws Exception {
- // given
- DelegateExecution execution = mock(DelegateExecution.class);
- when(execution.getVariable(CORRELATION_ID)).thenReturn(id);
- // when
- delegate.execute(execution);
- // then
- verify(execution).setVariableLocal(AAI_CONTAINS_INFO_ABOUT_PNF, true);
- verify(execution).setVariableLocal(AAI_CONTAINS_INFO_ABOUT_IP, true);
- }
-
- @Test
- public void shouldSetCorrectVariablesWhenAaiContainsInfoAboutPnfWithoutIp() throws Exception {
- // given
- DelegateExecution execution = mock(DelegateExecution.class);
- when(execution.getVariable(CORRELATION_ID)).thenReturn(ID_WITH_ENTRY_NO_IP);
- // when
- delegate.execute(execution);
- // then
- verify(execution).setVariableLocal(AAI_CONTAINS_INFO_ABOUT_PNF, true);
- verify(execution).setVariableLocal(AAI_CONTAINS_INFO_ABOUT_IP, false);
- }
- }
-
-
- @RunWith(SpringRunner.class)
- @SpringBootTest(classes = {CheckAaiForCorrelationIdDelegate.class, AaiConnectionThrowingException.class})
- public static class NoConnectionTests {
-
- @Autowired
- private CheckAaiForCorrelationIdDelegate delegate;
-
- @Test
- public void shouldThrowExceptionWhenIoExceptionOnConnectionToAai() throws Exception {
- // given
- DelegateExecution execution = mock(DelegateExecution.class);
- when(execution.getVariable(CORRELATION_ID)).thenReturn(ID_WITH_ENTRY_NO_IP);
- when(execution.getVariable("testProcessKey")).thenReturn("testProcessKey");
- // when, then
- assertThatThrownBy(() -> delegate.execute(execution)).isInstanceOf(BpmnError.class);
- verify(execution).setVariable(eq("WorkflowException"), any(WorkflowException.class));
- }
- }
-} \ No newline at end of file
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegateTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegateTest.java
deleted file mode 100644
index bc70a09880..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegateTest.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*-
- * ============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.infrastructure.pnf.delegate;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-import static org.openecomp.mso.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID;
-
-import org.camunda.bpm.engine.delegate.DelegateExecution;
-import org.junit.Test;
-import org.onap.aai.domain.yang.Pnf;
-
-public class CreateAaiEntryWithPnfIdDelegateTest {
-
- @Test
- public void shouldSetPnfIdAndPnfName() throws Exception {
- // given
- CreateAaiEntryWithPnfIdDelegate delegate = new CreateAaiEntryWithPnfIdDelegate();
- AaiConnectionTestImpl aaiConnection = new AaiConnectionTestImpl();
- delegate.setAaiConnection(aaiConnection);
- DelegateExecution execution = mock(DelegateExecution.class);
- when(execution.getVariable(eq(CORRELATION_ID))).thenReturn("testCorrelationId");
- // when
- delegate.execute(execution);
- // then
- Pnf createdEntry = aaiConnection.getCreated().get("testCorrelationId");
- assertThat(createdEntry.getPnfId()).isEqualTo("testCorrelationId");
- assertThat(createdEntry.getPnfName()).isEqualTo("testCorrelationId");
- assertThat(createdEntry.isInMaint()).isTrue();
- }
-} \ No newline at end of file
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java
deleted file mode 100644
index 8d35f9f8e0..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*-
- * ============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.infrastructure.pnf.delegate;
-
-import org.openecomp.mso.bpmn.infrastructure.pnf.dmaap.DmaapClient;
-import java.util.Objects;
-
-public class DmaapClientTestImpl implements DmaapClient {
-
- private String correlationId;
- private Runnable informConsumer;
-
- @Override
- public void registerForUpdate(String correlationId, Runnable informConsumer) {
- this.correlationId = correlationId;
- this.informConsumer = informConsumer;
- }
-
- @Override
- public Runnable unregister(String correlationId) {
- if (Objects.equals(this.correlationId, correlationId)) {
- this.correlationId = null;
- Runnable informConsumer = this.informConsumer;
- this.informConsumer = null;
- return informConsumer;
- }
- return null;
- }
-
- public String getCorrelationId() {
- return correlationId;
- }
-
- public Runnable getInformConsumer() {
- return informConsumer;
- }
-
- public boolean haveRegisteredConsumer() {
- return correlationId != null;
- }
-}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java
deleted file mode 100644
index 2bfae461be..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*-
- * ============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.infrastructure.pnf.delegate;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.inOrder;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verifyZeroInteractions;
-import static org.mockito.Mockito.when;
-
-import org.camunda.bpm.engine.ProcessEngineServices;
-import org.camunda.bpm.engine.RuntimeService;
-import org.camunda.bpm.engine.delegate.DelegateExecution;
-import org.camunda.bpm.engine.runtime.MessageCorrelationBuilder;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.InOrder;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.junit4.SpringRunner;
-
-@RunWith(SpringRunner.class)
-@SpringBootTest(classes = {InformDmaapClient.class, DmaapClientTestImpl.class})
-public class InformDmaapClientTest {
-
- @Autowired
- private InformDmaapClient informDmaapClient;
-
- @Autowired
- private DmaapClientTestImpl dmaapClientTest;
-
- private DelegateExecution delegateExecution;
-
- private MessageCorrelationBuilder messageCorrelationBuilder;
-
- @Test
- public void shouldSendListenerToDmaapClient() throws Exception {
- // given
- mockDelegateExecution();
- // when
- informDmaapClient.execute(delegateExecution);
- // then
- assertThat(dmaapClientTest.getCorrelationId()).isEqualTo("testCorrelationId");
- assertThat(dmaapClientTest.getInformConsumer()).isNotNull();
- verifyZeroInteractions(messageCorrelationBuilder);
- }
-
- @Test
- public void shouldSendListenerToDmaapClientAndSendMessageToCamunda() throws Exception {
- // given
- mockDelegateExecution();
- // when
- informDmaapClient.execute(delegateExecution);
- dmaapClientTest.getInformConsumer().run();
- // then
- assertThat(dmaapClientTest.getCorrelationId()).isEqualTo("testCorrelationId");
- InOrder inOrder = inOrder(messageCorrelationBuilder);
- inOrder.verify(messageCorrelationBuilder).processInstanceBusinessKey("testBusinessKey");
- inOrder.verify(messageCorrelationBuilder).correlateWithResult();
- }
-
- private void mockDelegateExecution() {
- delegateExecution = mock(DelegateExecution.class);
- when(delegateExecution.getVariable(eq(ExecutionVariableNames.CORRELATION_ID))).thenReturn("testCorrelationId");
- when(delegateExecution.getProcessBusinessKey()).thenReturn("testBusinessKey");
- ProcessEngineServices processEngineServices = mock(ProcessEngineServices.class);
- when(delegateExecution.getProcessEngineServices()).thenReturn(processEngineServices);
- RuntimeService runtimeService = mock(RuntimeService.class);
- when(processEngineServices.getRuntimeService()).thenReturn(runtimeService);
- messageCorrelationBuilder = mock(MessageCorrelationBuilder.class);
- when(runtimeService.createMessageCorrelation(any())).thenReturn(messageCorrelationBuilder);
- when(messageCorrelationBuilder.processInstanceBusinessKey(any())).thenReturn(messageCorrelationBuilder);
- }
-} \ No newline at end of file
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java
deleted file mode 100644
index 1799e7fcbc..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*-
- * ============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.infrastructure.pnf.delegate;
-
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-import static org.openecomp.mso.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID;
-import static org.openecomp.mso.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.TIMEOUT_FOR_NOTIFICATION;
-
-import org.camunda.bpm.engine.delegate.BpmnError;
-import org.camunda.bpm.engine.delegate.DelegateExecution;
-import org.junit.Before;
-import org.junit.Test;
-
-public class PnfCheckInputsTest {
-
- private PnfCheckInputs delegate;
-
- @Before
- public void setUp() throws Exception {
- delegate = new PnfCheckInputs();
- }
-
- private DelegateExecution mockDelegateExecution() {
- DelegateExecution delegateExecution = mock(DelegateExecution.class);
- when(delegateExecution.getVariable("testProcessKey")).thenReturn("testProcessKeyValue");
- return delegateExecution;
- }
-
- @Test
- public void shouldThrowException_whenPnfIdNotSet() throws Exception {
- // given
- DelegateExecution delegateExecution = mockDelegateExecution();
- // when, then
- assertThatThrownBy(() -> delegate.execute(delegateExecution)).isInstanceOf(BpmnError.class);
- }
-
- private DelegateExecution mockDelegateExecutionWithCorrelationId() {
- DelegateExecution delegateExecution = mockDelegateExecution();
- when(delegateExecution.getVariable(CORRELATION_ID)).thenReturn("testCorrelationId");
- return delegateExecution;
- }
-
- @Test
- public void shouldThrowException_whenTimeoutIsNotSetAndDefaultIsNotDefined() throws Exception {
- // given
- DelegateExecution delegateExecution = mockDelegateExecutionWithCorrelationId();
- // when, then
- assertThatThrownBy(() -> delegate.execute(delegateExecution)).isInstanceOf(BpmnError.class);
- }
-
- @Test
- public void shouldSetDefaultTimeout_whenTimeoutIsNotSet() throws Exception {
- // given
- String defaultTimeout = "T1D";
- delegate.setDefaultTimeout(defaultTimeout);
- DelegateExecution delegateExecution = mockDelegateExecutionWithCorrelationId();
- // when
- delegate.execute(delegateExecution);
- // then
- verify(delegateExecution).setVariable(eq(TIMEOUT_FOR_NOTIFICATION), eq(defaultTimeout));
- }
-} \ No newline at end of file
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/bpmn/CreateAndActivatePnfResourceTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/bpmn/CreateAndActivatePnfResourceTest.java
deleted file mode 100644
index ada5a902a7..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/bpmn/CreateAndActivatePnfResourceTest.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*-
- * ============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.infrastructure.pnf.delegate.bpmn;
-
-import static org.camunda.bpm.engine.test.assertions.ProcessEngineAssertions.assertThat;
-import static org.openecomp.mso.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.ID_WITHOUT_ENTRY;
-import static org.openecomp.mso.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.ID_WITH_ENTRY_AND_IP;
-import static org.openecomp.mso.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.ID_WITH_ENTRY_NO_IP;
-import static org.openecomp.mso.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.camunda.bpm.engine.RuntimeService;
-import org.camunda.bpm.engine.history.HistoricVariableInstance;
-import org.camunda.bpm.engine.runtime.ProcessInstance;
-import org.camunda.bpm.engine.test.Deployment;
-import org.camunda.bpm.engine.test.ProcessEngineRule;
-import org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.openecomp.mso.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringRunner;
-
-@RunWith(SpringRunner.class)
-@ContextConfiguration(locations = "/applicationContext_forPnfTesting.xml")
-public class CreateAndActivatePnfResourceTest {
-
- private static final String TIMEOUT_10_S = "PT10S";
- @Autowired
- private RuntimeService runtimeService;
-
- @Autowired
- @Rule
- public ProcessEngineRule processEngineRule;
-
- @Autowired
- private AaiConnectionTestImpl aaiConnection;
-
- @Test
- @Deployment(resources = {"process/CreateAndActivatePnfResource.bpmn"})
- public void shouldSaveCurrentIpToVariableIfItAlreadyExistsInAai() throws Exception {
- // given
- aaiConnection.reset();
- BpmnAwareTests.init(processEngineRule.getProcessEngine());
- Map<String, Object> variables = new HashMap<>();
- variables.put("timeoutForPnfEntryNotification", TIMEOUT_10_S);
- variables.put(CORRELATION_ID, ID_WITH_ENTRY_AND_IP);
- // when
- ProcessInstance instance = runtimeService
- .startProcessInstanceByKey("CreateAndActivatePnfResource", variables);
- // then
- assertThat(instance).isEnded().hasPassedInOrder(
- "CreateAndActivatePnf_StartEvent",
- "CheckAiiForCorrelationId",
- "DoesAaiContainInfoAboutPnf",
- "DoesAaiContainInfoAboutIp",
- "AaiEntryAlreadyUpToDate"
- );
- }
-
- @Test
- @Deployment(resources = {"process/CreateAndActivatePnfResource.bpmn"})
- public void shouldWaitForMessageFromDmaapAndUpdateAaiEntryWhenIpIsMissingInAaiEntry() throws Exception {
- // given
- aaiConnection.reset();
- BpmnAwareTests.init(processEngineRule.getProcessEngine());
- Map<String, Object> variables = new HashMap<>();
- variables.put("timeoutForPnfEntryNotification", TIMEOUT_10_S);
- variables.put(CORRELATION_ID, ID_WITH_ENTRY_NO_IP);
- // when
- ProcessInstance instance = runtimeService
- .startProcessInstanceByKey("CreateAndActivatePnfResource", "businessKey", variables);
- assertThat(instance).isWaitingAt("WaitForDmaapPnfReadyNotification").isWaitingFor("WorkflowMessage");
- runtimeService.createMessageCorrelation("WorkflowMessage")
- .processInstanceBusinessKey("businessKey")
- .correlateWithResult();
- // then
- assertThat(instance).isEnded().hasPassedInOrder(
- "CreateAndActivatePnf_StartEvent",
- "CheckAiiForCorrelationId",
- "DoesAaiContainInfoAboutPnf",
- "DoesAaiContainInfoAboutIp",
- "AaiEntryExists",
- "InformDmaapClient",
- "WaitForDmaapPnfReadyNotification",
- "AaiEntryUpdated"
- );
- }
-
- @Test
- @Deployment(resources = {"process/CreateAndActivatePnfResource.bpmn"})
- public void shouldCreateAaiEntryWaitForMessageFromDmaapAndUpdateAaiEntryWhenNoAaiEntry() throws Exception {
- // given
- aaiConnection.reset();
- BpmnAwareTests.init(processEngineRule.getProcessEngine());
- Map<String, Object> variables = new HashMap<>();
- variables.put("timeoutForPnfEntryNotification", TIMEOUT_10_S);
- variables.put(CORRELATION_ID, ID_WITHOUT_ENTRY);
- // when
- ProcessInstance instance = runtimeService
- .startProcessInstanceByKey("CreateAndActivatePnfResource", "businessKey", variables);
- assertThat(instance).isWaitingAt("WaitForDmaapPnfReadyNotification").isWaitingFor("WorkflowMessage");
- runtimeService.createMessageCorrelation("WorkflowMessage")
- .processInstanceBusinessKey("businessKey")
- .correlateWithResult();
- // then
- assertThat(instance).isEnded().hasPassedInOrder(
- "CreateAndActivatePnf_StartEvent",
- "CheckAiiForCorrelationId",
- "DoesAaiContainInfoAboutPnf",
- "CreateAndActivatePnf_CreateAaiEntry",
- "AaiEntryExists",
- "InformDmaapClient",
- "WaitForDmaapPnfReadyNotification",
- "AaiEntryUpdated"
- );
- assertThat(aaiConnection.getCreated()).containsOnlyKeys(ID_WITHOUT_ENTRY);
- }
-
- private List<HistoricVariableInstance> getVariables(ProcessInstance instance) {
- return processEngineRule.getHistoryService().createHistoricVariableInstanceQuery()
- .processInstanceId(instance.getProcessInstanceId()).taskIdIn().list();
- }
-}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/JsonUtilForCorrelationIdTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/JsonUtilForCorrelationIdTest.java
deleted file mode 100644
index 95de883dab..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/JsonUtilForCorrelationIdTest.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*-
- * ============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.infrastructure.pnf.dmaap;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-import java.util.List;
-import org.junit.Test;
-
-public class JsonUtilForCorrelationIdTest {
-
- private static final String JSON_EXAMPLE_WITH_CORRELATION_ID = "[\n"
- + " {\n"
- + " \"pnfRegistrationFields\" : {\n"
- + " \"correlationId\" : \"corrTest1\",\n"
- + " \"value\" : \"value1\"\n"
- + " }\n"
- + " },\n"
- + " {\n"
- + " \"pnfRegistrationFields\" : {\n"
- + " \"correlationId\" : \"corrTest2\",\n"
- + " \"value\" : \"value2\"\n"
- + " }\n"
- + " }\n"
- + "]";
-
- private static final String JSON_EXAMPLE_WITH_CORRELATION_ID2 = "{\"pnfRegistrationFields\":{\"correlationId\":\"corrTest3\"}}";
- private static final String JSON_EXAMPLE_WITH_CORRELATION_ID3 = "[\"\\{\\\"pnfRegistrationFields\\\":"
- + "{\\\"correlationId\\\":\\\"corrTest4\\\"}}\", \"\\{\\\"pnfRegistrationFields\\\":"
- + "{\\\"correlationId\\\":\\\"corrTest5\\\"}}\"]";
- private static final String JSON_EXAMPLE_WITH_CORRELATION_ID4 = "{\"header\":{\"key\":\"value\"}}";
-
- @Test
- public void parseJsonSuccessful() {
- List<String> expectedResult = JsonUtilForCorrelationId
- .parseJsonToGelAllCorrelationId(JSON_EXAMPLE_WITH_CORRELATION_ID);
- assertThat(expectedResult).containsExactly("corrTest1", "corrTest2");
-
- List<String> expectedResult2 = JsonUtilForCorrelationId
- .parseJsonToGelAllCorrelationId(JSON_EXAMPLE_WITH_CORRELATION_ID2);
- assertThat(expectedResult2).containsExactly("corrTest3");
- }
-
- @Test
- public void parseJsonWithEscapeCharacters_Successful() {
- List<String> expectedResult = JsonUtilForCorrelationId
- .parseJsonToGelAllCorrelationId(JSON_EXAMPLE_WITH_CORRELATION_ID3);
- assertThat(expectedResult).containsExactly("corrTest4", "corrTest5");
- }
-
- @Test
- public void parseJson_emptyListReturnedWhenNothingFound() {
- List<String> expectedResult = JsonUtilForCorrelationId
- .parseJsonToGelAllCorrelationId(JSON_EXAMPLE_WITH_CORRELATION_ID4);
- assertThat(expectedResult).isEmpty();
- }
-
-}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java
deleted file mode 100644
index c4d2570adb..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java
+++ /dev/null
@@ -1,208 +0,0 @@
-/*-
- * ============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.infrastructure.pnf.dmaap;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.verifyZeroInteractions;
-import static org.mockito.Mockito.when;
-
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.lang.reflect.Field;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ScheduledExecutorService;
-import org.apache.http.HttpEntity;
-import org.apache.http.HttpResponse;
-import org.apache.http.ProtocolVersion;
-import org.apache.http.client.HttpClient;
-import org.apache.http.client.methods.HttpGet;
-import org.apache.http.entity.StringEntity;
-import org.apache.http.message.BasicHttpResponse;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.ArgumentCaptor;
-import org.openecomp.mso.bpmn.core.PropertyConfiguration;
-import org.openecomp.mso.bpmn.infrastructure.pnf.dmaap.PnfEventReadyDmaapClient.DmaapTopicListenerThread;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PowerMockIgnore;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-
-@RunWith(PowerMockRunner.class)
-@PrepareForTest({PropertyConfiguration.class})
-@PowerMockIgnore("javax.net.ssl.*")
-public class PnfEventReadyDmaapClientTest {
-
- private static final String CORRELATION_ID = "corrTestId";
- private static final String CORRELATION_ID_NOT_FOUND_IN_MAP = "otherCorrId";
- private static final String JSON_EXAMPLE_WITH_CORRELATION_ID = "[\n"
- + " {\n"
- + " \"pnfRegistrationFields\" : {\n"
- + " \"correlationId\" : \"%s\",\n"
- + " \"value\" : \"value1\"\n"
- + " }\n"
- + " },\n"
- + " {\n"
- + " \"pnfRegistrationFields\" : {\n"
- + " \"correlationId\" : \"corr\",\n"
- + " \"value\" : \"value2\"\n"
- + " }\n"
- + " }\n"
- + "]";
- private static final String JSON_EXAMPLE_WITH_NO_CORRELATION_ID =
- "{\"pnfRegistrationFields\":{\"field\":\"value\"}}";
-
- private static final String HOST = "hostTest";
- private static final int PORT = 1234;
- private static final String PROTOCOL = "http";
- private static final String URI_PATH_PREFIX = "eventsForTesting";
- private static final String EVENT_TOPIC_TEST = "eventTopicTest";
- private static final String CONSUMER_ID = "consumerTestId";
- private static final String CONSUMER_GROUP = "consumerGroupTest";
-
- private PnfEventReadyDmaapClient testedObject;
- private DmaapTopicListenerThread testedObjectInnerClassThread;
- private HttpClient httpClientMock;
- private Runnable threadMockToNotifyCamundaFlow;
- private ScheduledExecutorService executorMock;
-
- @Before
- public void init() throws NoSuchFieldException, IllegalAccessException {
- PowerMockito.mockStatic(PropertyConfiguration.class);
- PropertyConfiguration propertyConfigurationMock = mock(PropertyConfiguration.class);
- PowerMockito.when(PropertyConfiguration.getInstance()).thenReturn(propertyConfigurationMock);
- when(propertyConfigurationMock.getProperties(PropertyConfiguration.MSO_BPMN_URN_PROPERTIES)).thenReturn(
- createProperties());
- testedObject = new PnfEventReadyDmaapClient();
- testedObject.setDmaapProtocol(PROTOCOL);
- testedObject.setDmaapUriPathPrefix(URI_PATH_PREFIX);
- testedObject.setDmaapTopicName(EVENT_TOPIC_TEST);
- testedObject.setConsumerId(CONSUMER_ID);
- testedObject.setConsumerGroup(CONSUMER_GROUP);
- testedObject.setDmaapClientDelayInSeconds(1);
- testedObject.init();
- testedObjectInnerClassThread = testedObject.new DmaapTopicListenerThread();
- httpClientMock = mock(HttpClient.class);
- threadMockToNotifyCamundaFlow = mock(Runnable.class);
- executorMock = mock(ScheduledExecutorService.class);
- setPrivateField();
- }
-
- /**
- * Test run method, where the are following conditions:
- * <p> - DmaapThreadListener is running, flag is set to true
- * <p> - map is filled with one entry with the key that we get from response
- * <p> run method should invoke thread from map to notify camunda process, remove element from the map (map is
- * empty) and shutdown the executor because of empty map
- */
- @Test
- public void correlationIdIsFoundInHttpResponse_notifyAboutPnfReady()
- throws IOException {
- when(httpClientMock.execute(any(HttpGet.class))).
- thenReturn(createResponse(String.format(JSON_EXAMPLE_WITH_CORRELATION_ID, CORRELATION_ID)));
- testedObjectInnerClassThread.run();
- ArgumentCaptor<HttpGet> captor1 = ArgumentCaptor.forClass(HttpGet.class);
- verify(httpClientMock).execute(captor1.capture());
- assertThat(captor1.getValue().getURI()).hasHost(HOST).hasPort(PORT).hasScheme(PROTOCOL)
- .hasPath(
- "/" + URI_PATH_PREFIX + "/" + EVENT_TOPIC_TEST + "/" + CONSUMER_GROUP + "/" + CONSUMER_ID + "");
- verify(threadMockToNotifyCamundaFlow).run();
- verify(executorMock).shutdownNow();
- }
-
- /**
- * Test run method, where the are following conditions:
- * <p> - DmaapThreadListener is running, flag is set to true
- * <p> - map is filled with one entry with the correlationId that does not match to correlationId
- * taken from http response. run method should not do anything with the map not run any thread to notify camunda
- * process
- */
- @Test
- public void correlationIdIsFoundInHttpResponse_NotFoundInMap()
- throws IOException {
- when(httpClientMock.execute(any(HttpGet.class))).
- thenReturn(createResponse(
- String.format(JSON_EXAMPLE_WITH_CORRELATION_ID, CORRELATION_ID_NOT_FOUND_IN_MAP)));
- testedObjectInnerClassThread.run();
- verifyZeroInteractions(threadMockToNotifyCamundaFlow, executorMock);
- }
-
- /**
- * Test run method, where the are following conditions:
- * <p> - DmaapThreadListener is running, flag is set to true
- * <p> - map is filled with one entry with the correlationId but no correlation id is taken from HttpResponse
- * run method should not do anything with the map and not run any thread to notify camunda process
- */
- @Test
- public void correlationIdIsNotFoundInHttpResponse() throws IOException {
- when(httpClientMock.execute(any(HttpGet.class))).
- thenReturn(createResponse(JSON_EXAMPLE_WITH_NO_CORRELATION_ID));
- testedObjectInnerClassThread.run();
- verifyZeroInteractions(threadMockToNotifyCamundaFlow, executorMock);
- }
-
- private void setPrivateField() throws NoSuchFieldException, IllegalAccessException {
- Field httpClientField = testedObject.getClass().getDeclaredField("httpClient");
- httpClientField.setAccessible(true);
- httpClientField.set(testedObject, httpClientMock);
- httpClientField.setAccessible(false);
-
- Field executorField = testedObject.getClass().getDeclaredField("executor");
- executorField.setAccessible(true);
- executorField.set(testedObject, executorMock);
- executorField.setAccessible(false);
-
- Field pnfCorrelationToThreadMapField = testedObject.getClass()
- .getDeclaredField("pnfCorrelationIdToThreadMap");
- pnfCorrelationToThreadMapField.setAccessible(true);
- Map<String, Runnable> pnfCorrelationToThreadMap = new ConcurrentHashMap<>();
- pnfCorrelationToThreadMap.put(CORRELATION_ID, threadMockToNotifyCamundaFlow);
- pnfCorrelationToThreadMapField.set(testedObject, pnfCorrelationToThreadMap);
-
- Field threadRunFlag = testedObject.getClass().getDeclaredField("dmaapThreadListenerIsRunning");
- threadRunFlag.setAccessible(true);
- threadRunFlag.set(testedObject, true);
- threadRunFlag.setAccessible(false);
- }
-
- private Map<String, String> createProperties() {
- Map<String, String> map = new HashMap<>();
- map.put("mso.dmaap.host", HOST);
- map.put("mso.dmaap.port", String.valueOf(PORT));
- return map;
- }
-
- private HttpResponse createResponse(String json) throws UnsupportedEncodingException {
- HttpEntity entity = new StringEntity(json);
- ProtocolVersion protocolVersion = new ProtocolVersion("", 1, 1);
- HttpResponse response = new BasicHttpResponse(protocolVersion, 1, "");
- response.setEntity(entity);
- response.setStatusCode(200);
- return response;
- }
-
-}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/workflow/service/WorkflowResourceApplicationTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/workflow/service/WorkflowResourceApplicationTest.java
deleted file mode 100644
index c667dbf4bb..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/workflow/service/WorkflowResourceApplicationTest.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2018 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.infrastructure.workflow.service;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.Set;
-
-import org.junit.Test;
-
-public class WorkflowResourceApplicationTest {
-
- @Test
- public void test() throws Exception {
- WorkflowResourceApplication workflowResourceApp = new WorkflowResourceApplication();
- Set<Class<?>> classes = workflowResourceApp.getClasses();
- assertEquals(0, classes.size());
- Set<Object> singleton = workflowResourceApp.getSingletons();
- assertEquals(3, singleton.size());
- }
-} \ No newline at end of file
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/HeaderUtilTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/HeaderUtilTest.java
deleted file mode 100644
index b861a79feb..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/HeaderUtilTest.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2018 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.infrastructure.workflow.serviceTask.client;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-
-public class HeaderUtilTest {
-
- @Test
- public void getAuthorizationTest() throws Exception {
- String authorization = HeaderUtil.getAuthorization(HeaderUtil.USER, HeaderUtil.PASS);
- assertEquals("Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ==", authorization);
- }
-
-} \ No newline at end of file
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilderTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilderTest.java
deleted file mode 100644
index 99a87def80..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilderTest.java
+++ /dev/null
@@ -1,358 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2018 Huawei 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.infrastructure.workflow.serviceTask.client.builder;
-
-import org.camunda.bpm.engine.ProcessEngineServices;
-import org.camunda.bpm.engine.delegate.DelegateExecution;
-import org.camunda.bpm.engine.runtime.Incident;
-import org.camunda.bpm.engine.variable.VariableMap;
-import org.camunda.bpm.engine.variable.value.TypedValue;
-import org.camunda.bpm.model.bpmn.BpmnModelInstance;
-import org.camunda.bpm.model.bpmn.instance.FlowElement;
-import org.junit.Test;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-public class AbstractBuilderTest {
-
- AbstractBuilder abstractBuilder = new AbstractBuilder() {
- @Override
- Object build(DelegateExecution execution, Object input) throws Exception {
- return null;
- }
- };
-
- DelegateExecution delegateExecution = new DelegateExecution() {
- @Override
- public String getProcessInstanceId() {
- return null;
- }
-
- @Override
- public String getProcessBusinessKey() {
- return null;
- }
-
- @Override
- public String getProcessDefinitionId() {
- return null;
- }
-
- @Override
- public String getParentId() {
- return null;
- }
-
- @Override
- public String getCurrentActivityId() {
- return null;
- }
-
- @Override
- public String getCurrentActivityName() {
- return null;
- }
-
- @Override
- public String getActivityInstanceId() {
- return null;
- }
-
- @Override
- public String getParentActivityInstanceId() {
- return null;
- }
-
- @Override
- public String getCurrentTransitionId() {
- return null;
- }
-
- @Override
- public DelegateExecution getProcessInstance() {
- return null;
- }
-
- @Override
- public DelegateExecution getSuperExecution() {
- return null;
- }
-
- @Override
- public boolean isCanceled() {
- return false;
- }
-
- @Override
- public String getTenantId() {
- return null;
- }
-
- @Override
- public void setVariable(String s, Object o, String s1) {
-
- }
-
- @Override
- public Incident createIncident(String s, String s1) {
- return null;
- }
-
- @Override
- public Incident createIncident(String s, String s1, String s2) {
- return null;
- }
-
- @Override
- public void resolveIncident(String s) {
-
- }
-
- @Override
- public String getId() {
- return null;
- }
-
- @Override
- public String getEventName() {
- return null;
- }
-
- @Override
- public String getBusinessKey() {
- return null;
- }
-
- @Override
- public BpmnModelInstance getBpmnModelInstance() {
- return null;
- }
-
- @Override
- public FlowElement getBpmnModelElementInstance() {
- return null;
- }
-
- @Override
- public ProcessEngineServices getProcessEngineServices() {
- return null;
- }
-
- @Override
- public String getVariableScopeKey() {
- return null;
- }
-
- @Override
- public Map<String, Object> getVariables() {
- return null;
- }
-
- @Override
- public VariableMap getVariablesTyped() {
- return null;
- }
-
- @Override
- public VariableMap getVariablesTyped(boolean b) {
- return null;
- }
-
- @Override
- public Map<String, Object> getVariablesLocal() {
- return null;
- }
-
- @Override
- public VariableMap getVariablesLocalTyped() {
- return null;
- }
-
- @Override
- public VariableMap getVariablesLocalTyped(boolean b) {
- return null;
- }
-
- @Override
- public Object getVariable(String s) {
- return null;
- }
-
- @Override
- public Object getVariableLocal(String s) {
- return null;
- }
-
- @Override
- public <T extends TypedValue> T getVariableTyped(String s) {
- return null;
- }
-
- @Override
- public <T extends TypedValue> T getVariableTyped(String s, boolean b) {
- return null;
- }
-
- @Override
- public <T extends TypedValue> T getVariableLocalTyped(String s) {
- return null;
- }
-
- @Override
- public <T extends TypedValue> T getVariableLocalTyped(String s, boolean b) {
- return null;
- }
-
- @Override
- public Set<String> getVariableNames() {
- return null;
- }
-
- @Override
- public Set<String> getVariableNamesLocal() {
- return null;
- }
-
- @Override
- public void setVariable(String s, Object o) {
-
- }
-
- @Override
- public void setVariableLocal(String s, Object o) {
-
- }
-
- @Override
- public void setVariables(Map<String, ?> map) {
-
- }
-
- @Override
- public void setVariablesLocal(Map<String, ?> map) {
-
- }
-
- @Override
- public boolean hasVariables() {
- return false;
- }
-
- @Override
- public boolean hasVariablesLocal() {
- return false;
- }
-
- @Override
- public boolean hasVariable(String s) {
- return false;
- }
-
- @Override
- public boolean hasVariableLocal(String s) {
- return false;
- }
-
- @Override
- public void removeVariable(String s) {
-
- }
-
- @Override
- public void removeVariableLocal(String s) {
-
- }
-
- @Override
- public void removeVariables(Collection<String> collection) {
-
- }
-
- @Override
- public void removeVariablesLocal(Collection<String> collection) {
-
- }
-
- @Override
- public void removeVariables() {
-
- }
-
- @Override
- public void removeVariablesLocal() {
-
- }
- };
-
-
- @Test
- public void buildTest() throws Exception {
- abstractBuilder.build(null, null);
- }
-
- @Test
- public void getRequestActoinTest() throws Exception {
- abstractBuilder.getRequestActoin(delegateExecution);
- }
-
- @Test
- public void getSvcActionTest() throws Exception {
- abstractBuilder.getSvcAction(delegateExecution);
- }
-
- @Test
- public void getRequestIdTest() throws Exception {
- abstractBuilder.getRequestId(delegateExecution);
- }
-
- @Test
- public void getOnapServiceModelInformationEntityTest() throws Exception {
- abstractBuilder.getOnapServiceModelInformationEntity(delegateExecution);
- }
-
- @Test
- public void getOnapNetworkModelInformationEntityTest() throws Exception {
- abstractBuilder.getOnapNetworkModelInformationEntity(delegateExecution);
- }
-
- @Test
- public void getParamEntitiesTest() throws Exception {
- abstractBuilder.getParamEntities(new HashMap<>());
- }
-
- @Test
- public void getRequestInformationEntityTest() throws Exception {
- abstractBuilder.getRequestInformationEntity(delegateExecution);
- }
-
- @Test
- public void getServiceInformationEntityTest() throws Exception {
- abstractBuilder.getServiceInformationEntity(delegateExecution);
- }
-
- @Test
- public void getServiceInstanceNameTest() throws Exception {
- abstractBuilder.getServiceInstanceName(delegateExecution);
- }
-
-} \ No newline at end of file
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
deleted file mode 100644
index e7b80f12ab..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/AbstractTestBase.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * ============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
deleted file mode 100644
index d9534f325f..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/CreateVcpeResCustServiceTest.java
+++ /dev/null
@@ -1,382 +0,0 @@
-/*
- * ============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 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.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;
-
-import java.io.IOException;
-import java.util.HashMap;
-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.BPMNUtil;
-import org.openecomp.mso.bpmn.mock.FileUtil;
-
-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/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
- @Ignore // 1802 merge
- @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 {
-
- System.out.println("starting: testCreateVcpeResCustService_Success\n");
- 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);
-
- 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.contains("request-id>testRequestId<"));
- assertTrue(completionReq.contains("action>CREATE<"));
- assertTrue(completionReq.contains("source>VID<"));
-
- assertEquals("1", BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix+"VnfsCreatedCount"));
- }
-
- @Test
- @Ignore // 1802 merge
- @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_NoParts() throws Exception {
-
- System.out.println("starting: testCreateVcpeResCustService_NoParts\n" );
- 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");
-
- // 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();
-
- String businessKey = UUID.randomUUID().toString();
- invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables);
-
- // for SI
- injectSDNCCallbacks(callbacks, "assign");
-
- 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.contains("request-id>testRequestId<"));
- assertTrue(completionReq.contains("action>CREATE<"));
- assertTrue(completionReq.contains("source>VID<"));
-
- assertEquals("0", BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix+"VnfsCreatedCount"));
- }
-
- @Test
- @Ignore // 1802 merge
- @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 {
-
- System.out.println("starting: testCreateVcpeResCustService_Fault_NoRollback\n");
- 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 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);
-
- 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
- @Ignore // 1802 merge
- @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"})
-
- public void testCreateVcpeResCustService_Fault_Rollback() throws Exception {
-
- System.out.println("starting: testCreateVcpeResCustService_Fault_Rollback\n");
- 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> setupVariables() {
- Map<String, Object> variables = new HashMap<>();
- variables.put("requestId", "testRequestId");
- variables.put("request-id", "testRequestId");
- variables.put("serviceInstanceId", DEC_INST);
- variables.put("allottedResourceId", ARID);
- return variables;
-
- }
-}
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
deleted file mode 100644
index d026b7a949..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DeleteVcpeResCustServiceTest.java
+++ /dev/null
@@ -1,297 +0,0 @@
-/*
- * ============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.contains("<request-id>testRequestId<"));
- assertTrue(completionReq.contains("<action>DELETE<"));
- assertTrue(completionReq.contains("<source>VID<"));
-
- 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.contains("<request-id>testRequestId<"));
- assertTrue(completionReq.contains("<action>DELETE<"));
- assertTrue(completionReq.contains("<source>VID<"));
-
- 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
deleted file mode 100644
index 0407e172e2..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceBRGRollbackTest.java
+++ /dev/null
@@ -1,345 +0,0 @@
-/*
- * ============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 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;
-import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB;
-import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter;
-
-import java.io.IOException;
-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.core.RollbackData;
-import org.openecomp.mso.bpmn.mock.FileUtil;
-
-
-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/VfModularity/SDNCTopologyDeactivateCallback.xml"));
- callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml"));
- callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml"));
- }
-
- @Test
- @Deployment(resources = {
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"})
- public void testDoCreateAllottedResourceBRGRollback_Success() 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");
-
- invokeSubProcess(PROCNAME, businessKey, variables);
-
- injectSDNCCallbacks(callbacks, "deactivate");
- 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_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);
-
- 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);
-
- variables.put("serviceInstanceId", DEC_INST);
- variables.put("parentServiceInstanceId", DEC_PARENT_INST);
-
- RollbackData rollbackData = new RollbackData();
-
- 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/"+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
deleted file mode 100644
index 0373266ce1..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceBRGTest.java
+++ /dev/null
@@ -1,296 +0,0 @@
-/*
- * ============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 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;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutAllottedResource;
-import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB;
-import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter;
-
-import java.io.IOException;
-import java.util.HashMap;
-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.mock.FileUtil;
-
-
-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/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"));
- }
-
- @Test
- @Deployment(resources = {
- "subprocess/GenericGetService.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/DoCreateAllottedResourceBRG.bpmn",
- "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"})
- 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");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariablesSuccess(variables, "testRequestId123");
-
- invokeSubProcess(PROCNAME, businessKey, variables);
-
- injectSDNCCallbacks(callbacks, "assign");
- injectSDNCCallbacks(callbacks, "create");
- injectSDNCCallbacks(callbacks, "activate");
- 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_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) {
- variables.put("isDebugLogEnabled", "true");
- variables.put("failExists", "true");
- variables.put("disableRollback", "true");
- variables.put("msoRequestId", requestId);
- variables.put("mso-request-id", "requestId");
- variables.put("sourceNetworkId", "snId");
- variables.put("sourceNetworkRole", "snRole");
- variables.put("allottedResourceRole", "txc");
- variables.put("allottedResourceType", "BRG");
- variables.put("allottedResourceId", ARID);
- variables.put("vni", "BRG");
- variables.put("vgmuxBearerIP", "bearerip");
- variables.put("brgWanMacAddress", "wanmac");
-
- variables.put("serviceInstanceId", DEC_INST);
- variables.put("parentServiceInstanceId", DEC_PARENT_INST);
-
- variables.put("serviceChainServiceInstanceId", "scsiId");
-
- String arModelInfo = "{ "+ "\"modelType\": \"allotted-resource\"," +
- "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," +
- "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," +
- "\"modelName\": \"vSAMP12\"," +
- "\"modelVersion\": \"1.0\"," +
- "\"modelCustomizationUuid\": \"MODEL-ID-1234\"," +
- "}";
- variables.put("allottedResourceModelInfo", arModelInfo);
- }
-
-}
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
deleted file mode 100644
index cdce56ee63..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceTXCRollbackTest.java
+++ /dev/null
@@ -1,345 +0,0 @@
-/*
- * ============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 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;
-import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB;
-import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter;
-
-import java.io.IOException;
-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.core.RollbackData;
-import org.openecomp.mso.bpmn.mock.FileUtil;
-
-
-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/VfModularity/SDNCTopologyDeactivateCallback.xml"));
- callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml"));
- callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml"));
- }
-
- @Test
- @Deployment(resources = {
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"})
- public void testDoCreateAllottedResourceTXCRollback_Success() 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");
-
- invokeSubProcess(PROCNAME, businessKey, variables);
-
- injectSDNCCallbacks(callbacks, "deactivate");
- 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_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);
-
- 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);
-
- variables.put("serviceInstanceId", DEC_INST);
- variables.put("parentServiceInstanceId", DEC_PARENT_INST);
-
- RollbackData rollbackData = new RollbackData();
-
- 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/"+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
deleted file mode 100644
index 9cf059c24c..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceTXCTest.java
+++ /dev/null
@@ -1,302 +0,0 @@
-/*
- * ============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 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;
-import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutAllottedResource;
-import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB;
-import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter;
-
-import java.io.IOException;
-import java.util.HashMap;
-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.mock.FileUtil;
-
-
-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/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"));
- }
-
- @Test
- @Deployment(resources = {
- "subprocess/GenericGetService.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/DoCreateAllottedResourceTXC.bpmn",
- "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"})
- 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<>();
- setVariablesSuccess(variables, "testRequestId123");
-
- invokeSubProcess(PROCNAME, businessKey, variables);
-
- injectSDNCCallbacks(callbacks, "assign");
- injectSDNCCallbacks(callbacks, "create");
- injectSDNCCallbacks(callbacks, "activate");
- 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"));
- 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);
-
- 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");
- variables.put("msoRequestId", requestId);
- variables.put("mso-request-id", "requestId");
- variables.put("sourceNetworkId", "snId");
- variables.put("sourceNetworkRole", "snRole");
- variables.put("allottedResourceRole", "brg");
- variables.put("allottedResourceType", "TXC");
- variables.put("allottedResourceId", ARID);
- variables.put("brgWanMacAddress", "wanmac");
-
- variables.put("serviceInstanceId", DEC_INST);
- variables.put("parentServiceInstanceId", DEC_PARENT_INST);
-
- variables.put("serviceChainServiceInstanceId", "scsiId");
-
- String arModelInfo = "{ "+ "\"modelType\": \"allotted-resource\"," +
- "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," +
- "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," +
- "\"modelName\": \"vSAMP12\"," +
- "\"modelVersion\": \"1.0\"," +
- "\"modelCustomizationUuid\": \"MODEL-ID-1234\"," +
- "}";
- variables.put("allottedResourceModelInfo", arModelInfo);
- }
-
-}
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
deleted file mode 100644
index 03972da789..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoDeleteAllottedResourceBRGTest.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * ============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 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;
-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.util.HashMap;
-import java.util.Map;
-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.mock.FileUtil;
-
-
-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/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
- @Deployment(resources = {
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/DoDeleteAllottedResourceBRG.bpmn"})
- public void testDoDeleteAllottedResourceBRG_Success() 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");
-
- invokeSubProcess(PROCNAME, businessKey, variables);
-
- injectSDNCCallbacks(callbacks, "deactivate");
- injectSDNCCallbacks(callbacks, "delete");
- injectSDNCCallbacks(callbacks, "unassign");
-
- waitForProcessEnd(businessKey, 10000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- 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);
-
- 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
deleted file mode 100644
index 2b0364c3c9..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoDeleteAllottedResourceTXCTest.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * ============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 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;
-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.util.HashMap;
-import java.util.Map;
-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.mock.FileUtil;
-
-
-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/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
- @Deployment(resources = {
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/DoDeleteAllottedResourceTXC.bpmn"})
- public void testDoDeleteAllottedResourceTXC_Success() 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");
-
- invokeSubProcess(PROCNAME, businessKey, variables);
-
- injectSDNCCallbacks(callbacks, "deactivate");
- injectSDNCCallbacks(callbacks, "delete");
- injectSDNCCallbacks(callbacks, "unassign");
-
- waitForProcessEnd(businessKey, 10000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- 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);
-
- variables.put("serviceInstanceId", DEC_INST);
- variables.put("parentServiceInstanceId", DEC_PARENT_INST);
- }
-
-}