From b6e7850484ba61df259e38fd6b59e94c2a7de5b6 Mon Sep 17 00:00:00 2001 From: shrikantawachar Date: Mon, 17 Dec 2018 12:26:43 +0530 Subject: API for get all interface lifecycle types API for get all interface lifecycle types Change-Id: I64471c98ff9626ac53562a075a34f506c2e263ab Issue-ID: SDC-1999 Signed-off-by: shrikantawachar --- .../impl/InterfaceOperationBusinessLogicTest.java | 23 +++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'catalog-be/src/test/java/org') diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InterfaceOperationBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InterfaceOperationBusinessLogicTest.java index 4227e5d5cc..f2d8b57dbf 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InterfaceOperationBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InterfaceOperationBusinessLogicTest.java @@ -70,6 +70,7 @@ import org.openecomp.sdc.be.model.operations.api.IElementOperation; import org.openecomp.sdc.be.model.operations.api.IPropertyOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.GraphLockOperation; +import org.openecomp.sdc.be.model.operations.impl.InterfaceLifecycleOperation; import org.openecomp.sdc.be.user.Role; import org.openecomp.sdc.be.user.UserBusinessLogic; import org.openecomp.sdc.common.api.ConfigurationSource; @@ -106,6 +107,7 @@ public class InterfaceOperationBusinessLogicTest { private final ArtifactCassandraDao artifactCassandraDao = Mockito.mock(ArtifactCassandraDao.class); private final InterfaceOperation interfaceOperation = Mockito.mock(InterfaceOperation.class); private final InterfaceOperationValidation operationValidator = Mockito.mock(InterfaceOperationValidation.class); + private InterfaceLifecycleOperation interfaceLifecycleOperation = Mockito.mock(InterfaceLifecycleOperation.class); private final GraphLockOperation graphLockOperation = Mockito.mock(GraphLockOperation.class); private User user = null; @@ -192,6 +194,7 @@ public class InterfaceOperationBusinessLogicTest { bl.setUserValidations(userValidations); bl.setInterfaceOperation(interfaceOperation); bl.setInterfaceOperationValidation(operationValidator); + bl.setInterfaceLifecycleOperation(interfaceLifecycleOperation); Resource resourceCsar = createResourceObjectCsar(true); setCanWorkOnResource(resourceCsar); Either oldResourceRes = Either.left(resourceCsar); @@ -423,6 +426,24 @@ public class InterfaceOperationBusinessLogicTest { return resource; } + @Test + public void testGetAllInterfaceLifecycleTypes_TypesNotFound() { + when(interfaceLifecycleOperation.getAllInterfaceLifecycleTypes()).thenReturn(Either.right(StorageOperationStatus.NOT_FOUND)); + Either, ResponseFormat> response = bl.getAllInterfaceLifecycleTypes(); + Assert.assertTrue(response.isRight()); + } - + @Test + public void testGetAllInterfaceLifecycleTypes_Success() { + final String UNIQUE_ID = "UNIQUE_ID"; + final String TYPE = "UNIQUE_ID"; + InterfaceDefinition interfaceDefinition = new InterfaceDefinition(); + interfaceDefinition.setUniqueId(UNIQUE_ID); + interfaceDefinition.setType(TYPE); + Map interfaceDefinitionMap = new HashMap<>(); + interfaceDefinitionMap.put(interfaceDefinition.getUniqueId(), interfaceDefinition); + when(interfaceLifecycleOperation.getAllInterfaceLifecycleTypes()).thenReturn(Either.left(interfaceDefinitionMap)); + Either, ResponseFormat> response = bl.getAllInterfaceLifecycleTypes(); + Assert.assertEquals(response.left().value().size(),1); + } } \ No newline at end of file -- cgit 1.2.3-korg