aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoDeleteAllottedResourceBRGTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoDeleteAllottedResourceBRGTest.java')
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoDeleteAllottedResourceBRGTest.java106
1 files changed, 84 insertions, 22 deletions
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoDeleteAllottedResourceBRGTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoDeleteAllottedResourceBRGTest.java
index 46f5da46b3..03972da789 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoDeleteAllottedResourceBRGTest.java
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoDeleteAllottedResourceBRGTest.java
@@ -1,4 +1,4 @@
-/*-
+/*
* ============LICENSE_START=======================================================
* ONAP - SO
* ================================================================================
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,13 +17,10 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
-/*
- * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property.
- */
package org.openecomp.mso.bpmn.vcpe;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteAllottedResource;
import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetAllottedResource;
import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchAllottedResource;
@@ -38,20 +35,22 @@ import java.util.UUID;
import org.camunda.bpm.engine.test.Deployment;
import org.junit.Assert;
+import org.junit.Ignore;
import org.junit.Test;
import org.openecomp.mso.bpmn.common.BPMNUtil;
-import org.openecomp.mso.bpmn.common.WorkflowTest;
import org.openecomp.mso.bpmn.mock.FileUtil;
-public class DoDeleteAllottedResourceBRGTest extends WorkflowTest {
+public class DoDeleteAllottedResourceBRGTest extends AbstractTestBase {
+ private static final String PROCNAME = "DoDeleteAllottedResourceBRG";
private final CallbackSet callbacks = new CallbackSet();
public DoDeleteAllottedResourceBRGTest() throws IOException {
- callbacks.put("deactivate", FileUtil.readResourceFile("__files/VCPE/VfModularity/SDNCTopologyDeactivateCallback.xml"));
- callbacks.put("delete", FileUtil.readResourceFile("__files/VCPE/VfModularity/SDNCTopologyDeleteCallback.xml"));
- callbacks.put("unassign", FileUtil.readResourceFile("__files/VCPE/VfModularity/SDNCTopologyUnassignCallback.xml"));
+ callbacks.put("deactivate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml"));
+ callbacks.put("deactivateNF", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallbackNotFound.xml"));
+ callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml"));
+ callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml"));
}
@Test
@@ -59,12 +58,12 @@ public class DoDeleteAllottedResourceBRGTest extends WorkflowTest {
"subprocess/SDNCAdapterV1.bpmn",
"subprocess/FalloutHandler.bpmn",
"subprocess/DoDeleteAllottedResourceBRG.bpmn"})
- public void testDoDeleteAllottedResourceBRG_success() throws Exception {
+ public void testDoDeleteAllottedResourceBRG_Success() throws Exception {
- MockQueryAllottedResourceById("arId-1", "GenericFlows/getARUrlById.xml");
- MockGetAllottedResource("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "arId-1", "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml");
- MockPatchAllottedResource("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "arId-1");
- MockDeleteAllottedResource("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "arId-1", "1490627351232");
+ MockQueryAllottedResourceById(ARID, "GenericFlows/getARUrlById.xml");
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml");
+ MockPatchAllottedResource(CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
mockSDNCAdapter(200);
mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
@@ -72,7 +71,7 @@ public class DoDeleteAllottedResourceBRGTest extends WorkflowTest {
Map<String, Object> variables = new HashMap<>();
setVariablesSuccess(variables, "testRequestId1");
- invokeSubProcess("DoDeleteAllottedResourceBRG", businessKey, variables);
+ invokeSubProcess(PROCNAME, businessKey, variables);
injectSDNCCallbacks(callbacks, "deactivate");
injectSDNCCallbacks(callbacks, "delete");
@@ -81,20 +80,83 @@ public class DoDeleteAllottedResourceBRGTest extends WorkflowTest {
waitForProcessEnd(businessKey, 10000);
Assert.assertTrue(isProcessEnded(businessKey));
- String workflowException = BPMNUtil.getVariable(processEngineRule, "DoDeleteAllottedResourceBRG", "WorkflowException");
+ String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
System.out.println("workflowException:\n" + workflowException);
assertEquals(null, workflowException);
}
+
+ @Test
+ @Deployment(resources = {
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/FalloutHandler.bpmn",
+ "subprocess/DoDeleteAllottedResourceBRG.bpmn"})
+ public void testDoDeleteAllottedResourceBRG_ARNotInSDNC() throws Exception {
+
+ MockQueryAllottedResourceById(ARID, "GenericFlows/getARUrlById.xml");
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml");
+ MockPatchAllottedResource(CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+ mockSDNCAdapter(200);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables, "testRequestId1");
+
+ variables.put("failNotFound", "false");
+
+ invokeSubProcess(PROCNAME, businessKey, variables);
+
+ injectSDNCCallbacks(callbacks, "deactivateNF");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+ System.out.println("workflowException:\n" + workflowException);
+ assertEquals(null, workflowException);
+ }
+
+ // TODO - exception is not caught
+ @Test
+ @Ignore
+ @Deployment(resources = {
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/FalloutHandler.bpmn",
+ "subprocess/DoDeleteAllottedResourceBRG.bpmn"})
+ public void testDoDeleteAllottedResourceBRG_SubProcessError() throws Exception {
+
+ MockQueryAllottedResourceById(ARID, "GenericFlows/getARUrlById.xml");
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml");
+ MockPatchAllottedResource(CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ mockSDNCAdapter(500);
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables, "testRequestId1");
+
+ invokeSubProcess(PROCNAME, businessKey, variables);
+
+ waitForProcessEnd(businessKey, 10000);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX);
+ System.out.println("workflowException:\n" + workflowException);
+ assertNotNull(workflowException);
+ }
private void setVariablesSuccess(Map<String, Object> variables, String requestId) {
variables.put("isDebugLogEnabled", "true");
variables.put("failNotFound", "true");
variables.put("msoRequestId", requestId);
variables.put("mso-request-id", "requestId");
- variables.put("allottedResourceId", "arId-1");
+ variables.put("allottedResourceId", ARID);
- variables.put("serviceInstanceId", "MIS%252F1604%252F0026%252FSW_INTERNET");
- variables.put("parentServiceInstanceId","MIS%252F1604%252F0026%252FSW_INTERNET");
+ variables.put("serviceInstanceId", DEC_INST);
+ variables.put("parentServiceInstanceId", DEC_PARENT_INST);
}
}