aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-tasks/src/test
diff options
context:
space:
mode:
authorPlummer, Brittany <brittany.plummer@att.com>2019-07-05 10:23:16 -0400
committerBenjamin, Max (mb388a) <mb388a@us.att.com>2019-07-05 10:23:22 -0400
commit0e2cda138f35ee6a7a8a54c29a6c4edf07d51745 (patch)
treebed0d4cdf6ad783a5a58a3f00f594d43e41902f7 /bpmn/so-bpmn-tasks/src/test
parent294a68f814de3820ae3d5fdcf976615ad233c11a (diff)
update bpmn to save extsystemerrorsource
Added ext error source to workflow exception Updated all lines that create this exception with source Added unit tests and updated existing ones Change-Id: Id9b3b1e6e24368224214a6370ea2d450ae667bfb Issue-ID: SO-2092 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/test')
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java9
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasksTest.java73
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java3
3 files changed, 79 insertions, 6 deletions
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java
index d0cee42178..8aea2d2650 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java
@@ -39,12 +39,14 @@ import org.onap.so.bpmn.BaseTaskTest;
import org.onap.so.client.exception.BadResponseException;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.exception.MapperException;
+import org.onap.so.utils.TargetEntity;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.eq;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertThat;
+import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
@@ -110,8 +112,9 @@ public class NetworkAdapterRestV1Test extends BaseTaskTest {
delegateExecution.setVariable("networkAdapterRequest", updateNetworkRequest);
delegateExecution.setVariable("NetworkAResponse_MESSAGE", updateNetworkResponse.toXmlString());
- doThrow(new BpmnError("MSOWorkflowException")).when(exceptionBuilder)
- .buildAndThrowWorkflowException(any(DelegateExecution.class), anyInt(), any(String.class));
+ doThrow(new BpmnError("MSOWorkflowException")).when(exceptionBuilder).buildAndThrowWorkflowException(
+ any(DelegateExecution.class), anyInt(), any(String.class), any(TargetEntity.class));
+
try {
networkAdapterRestV1Tasks.processCallback(delegateExecution);
} catch (BpmnError be) {
@@ -119,6 +122,6 @@ public class NetworkAdapterRestV1Test extends BaseTaskTest {
}
assertNull(delegateExecution.getVariable("updateNetworkResponse"));
verify(exceptionBuilder, times(1)).buildAndThrowWorkflowException(any(DelegateExecution.class), eq(7000),
- eq("test error message"));
+ eq("test error message"), eq(TargetEntity.OPENSTACK));
}
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasksTest.java
index 3ea8474b24..0ba9237aaf 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasksTest.java
@@ -43,6 +43,9 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.client.exception.BBObjectNotFoundException;
+import org.onap.so.client.exception.BadResponseException;
+import org.onap.so.utils.TargetEntities;
+import org.onap.so.utils.TargetEntity;
public class SDNCQueryTasksTest extends BaseTaskTest {
@InjectMocks
@@ -61,8 +64,8 @@ public class SDNCQueryTasksTest extends BaseTaskTest {
genericVnf = setGenericVnf();
vfModule = setVfModule();
- doThrow(new BpmnError("BPMN Error")).when(exceptionUtil)
- .buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
+ doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(
+ any(BuildingBlockExecution.class), eq(7000), any(Exception.class), any(TargetEntities.class));
when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID)))
.thenReturn(serviceInstance);
@@ -88,6 +91,28 @@ public class SDNCQueryTasksTest extends BaseTaskTest {
}
@Test
+ public void queryVfModuleBadResponseExceptionTest() throws Exception {
+ BadResponseException exception = new BadResponseException("Error received from SDNC");
+ doThrow(exception).when(sdncVfModuleResources).queryVfModule(vfModule);
+
+ expectedException.expect(BpmnError.class);
+ sdncQueryTasks.queryVfModule(execution);
+
+ verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, TargetEntity.SDNC);
+ }
+
+ @Test
+ public void queryVfModuleResponseExceptionNoResponseTest() throws Exception {
+ BadResponseException exception = new BadResponseException("Error did not receive a response from SDNC.");
+ doThrow(exception).when(sdncVfModuleResources).queryVfModule(vfModule);
+
+ expectedException.expect(BpmnError.class);
+ sdncQueryTasks.queryVfModule(execution);
+
+ verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, TargetEntity.SO);
+ }
+
+ @Test
public void queryVnfTest() throws Exception {
String sdncQueryResponse = "response";
@@ -101,6 +126,28 @@ public class SDNCQueryTasksTest extends BaseTaskTest {
}
@Test
+ public void queryVnfBadResponseExceptionTest() throws Exception {
+ BadResponseException exception = new BadResponseException("Error received from SDNC");
+ doThrow(exception).when(sdncVnfResources).queryVnf(genericVnf);
+
+ expectedException.expect(BpmnError.class);
+ sdncQueryTasks.queryVnf(execution);
+
+ verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, TargetEntity.SDNC);
+ }
+
+ @Test
+ public void queryVnfBadResponseExceptionNoResponseTest() throws Exception {
+ BadResponseException exception = new BadResponseException("Error did not receive a response from SDNC.");
+ doThrow(exception).when(sdncVnfResources).queryVnf(genericVnf);
+
+ expectedException.expect(BpmnError.class);
+ sdncQueryTasks.queryVnf(execution);
+
+ verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, TargetEntity.SO);
+ }
+
+ @Test
public void queryVfModuleForVolumeGroupTest() throws Exception {
String sdncQueryResponse = "response";
vfModule.setSelflink("vfModuleSelfLink");
@@ -115,6 +162,28 @@ public class SDNCQueryTasksTest extends BaseTaskTest {
}
@Test
+ public void queryVfModuleForVolumeGroupBadResponseExceptionTest() throws Exception {
+ BadResponseException exception = new BadResponseException("Error received from SDNC");
+ doThrow(exception).when(sdncVfModuleResources).queryVfModule(vfModule);
+
+ expectedException.expect(BpmnError.class);
+ sdncQueryTasks.queryVfModuleForVolumeGroup(execution);
+
+ verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, TargetEntity.SDNC);
+ }
+
+ @Test
+ public void queryVfModuleForVolumeGroupBadResponseExceptionNoResponseTest() throws Exception {
+ BadResponseException exception = new BadResponseException("Error did not receive a response from SDNC.");
+ doThrow(exception).when(sdncVfModuleResources).queryVfModule(vfModule);
+
+ expectedException.expect(BpmnError.class);
+ sdncQueryTasks.queryVfModuleForVolumeGroup(execution);
+
+ verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, TargetEntity.SO);
+ }
+
+ @Test
public void queryVfModuleForVolumeGroupNoSelfLinkExceptionTest() throws Exception {
expectedException.expect(BpmnError.class);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java
index 6a94b357e0..0fc33fe5ce 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java
@@ -21,6 +21,7 @@
package org.onap.so.bpmn.infrastructure.sdnc.tasks;
import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.doThrow;
import java.io.IOException;
@@ -48,6 +49,7 @@ import org.onap.so.client.exception.MapperException;
import org.onap.so.client.sdnc.SDNCClient;
import org.onap.so.client.sdnc.beans.SDNCRequest;
import org.onap.so.client.sdnc.endpoint.SDNCTopology;
+import org.onap.so.utils.TargetEntity;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
import com.fasterxml.jackson.core.JsonParseException;
@@ -66,7 +68,6 @@ public class SDNCRequestTasksTest extends SDNCRequestTasks {
@Mock
SDNCClient sdncClient;
-
@Spy
private ExceptionBuilder exceptionBuilder;