summaryrefslogtreecommitdiffstats
path: root/adapters/mso-openstack-adapters/src/test
diff options
context:
space:
mode:
authorBoslet, Cory <cory.boslet@att.com>2019-04-26 21:25:55 -0400
committerBenjamin, Max (mb388a) <mb388a@us.att.com>2019-04-26 21:27:15 -0400
commitcd2687fbd989f2ca23fd82dcb7c70afb401bdd13 (patch)
tree2c67c7d47affaa7aaae2ac526cdc524b5dc8c68e /adapters/mso-openstack-adapters/src/test
parenta8bce119e8900a95f1f1b61b1caa375a19a2f1a1 (diff)
Do not need to retry on inventory exception
Do not need to retry on inventory exception due to vservers/linterfaces missing. Change-Id: I8e1e1d89ebd35e2b84a65e5e6db3e1db3f976982 Issue-ID: SO-1812 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'adapters/mso-openstack-adapters/src/test')
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateInventoryTaskTest.java20
1 files changed, 20 insertions, 0 deletions
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateInventoryTaskTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateInventoryTaskTest.java
index 03622db655..c358d3f34c 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateInventoryTaskTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateInventoryTaskTest.java
@@ -10,6 +10,10 @@ import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
+import org.onap.so.adapters.audit.AAIObjectAudit;
+import org.onap.so.adapters.audit.AAIObjectAuditList;
+import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
+import com.fasterxml.jackson.core.JsonProcessingException;
public class CreateInventoryTaskTest {
@@ -17,6 +21,9 @@ public class CreateInventoryTaskTest {
ExternalTask externalTask;
@Mock
+ CreateAAIInventory createAAIInventory;
+
+ @Mock
ExternalTaskService externalTaskService;
@InjectMocks
@@ -33,4 +40,17 @@ public class CreateInventoryTaskTest {
inventoryTask.executeExternalTask(externalTask, externalTaskService);
Mockito.verify(externalTaskService, times(1)).handleBpmnError(externalTask, "AAIInventoryFailure");
}
+
+ @Test
+ public void testExecuteExternalTask_InventoryException() throws InventoryException, JsonProcessingException {
+ AAIObjectAuditList object = new AAIObjectAuditList();
+ AAIObjectAudit e = new AAIObjectAudit();
+ e.setDoesObjectExist(true);
+ object.getAuditList().add(e);
+ GraphInventoryCommonObjectMapperProvider objectMapper = new GraphInventoryCommonObjectMapperProvider();
+ doReturn(objectMapper.getMapper().writeValueAsString(e)).when(externalTask).getVariable("auditInventoryResult");
+ Mockito.doThrow(InventoryException.class).when(createAAIInventory).createInventory(Mockito.any());
+ inventoryTask.executeExternalTask(externalTask, externalTaskService);
+ Mockito.verify(externalTaskService, times(1)).handleBpmnError(externalTask, "AAIInventoryFailure");
+ }
}