diff options
author | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2019-04-30 10:07:45 -0400 |
---|---|---|
committer | Steve Smokowski <ss835w@att.com> | 2019-05-03 16:20:12 +0000 |
commit | a16bf8f9315060822c16ec92a0532b8375c1a399 (patch) | |
tree | ccb13c95c1b6c63f0495566e8bd347ad7402a84b /adapters/mso-openstack-adapters/src/test/java | |
parent | d26574fe0e44f43bfbf507adbf91a28c1b53c63a (diff) | |
parent | 54b6e6ac185b55d89248cd3c55b1d7766ecaf294 (diff) |
Merge remote-tracking branch 'origin/dublin'
merged dublin into master branch
Change-Id: Ifb78d405611b65764fd4f01558b0e703551ed663
Issue-ID: SO-1830
Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Signed-off-by: Smokowski, Steve (ss835w) <ss835w@us.att.com>
Diffstat (limited to 'adapters/mso-openstack-adapters/src/test/java')
-rw-r--r-- | adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateInventoryTaskTest.java | 20 |
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..8513f30d4b 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.client.graphinventory.GraphInventoryCommonObjectMapperProvider; +import org.onap.so.objects.audit.AAIObjectAudit; +import org.onap.so.objects.audit.AAIObjectAuditList; +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"); + } } |