aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-be/src/test
diff options
context:
space:
mode:
authorshrikantawachar <shrikant.awachar@amdocs.com>2018-12-17 12:26:43 +0530
committershrikantawachar <shrikant.awachar@amdocs.com>2018-12-19 15:08:44 +0530
commitb6e7850484ba61df259e38fd6b59e94c2a7de5b6 (patch)
treeb235bafe42063bea899602c54d8f437c26227c77 /catalog-be/src/test
parente7cdba9c8a87f6dfd4823214ca64016e69b45a16 (diff)
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 <shrikant.awachar@amdocs.com>
Diffstat (limited to 'catalog-be/src/test')
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InterfaceOperationBusinessLogicTest.java23
1 files changed, 22 insertions, 1 deletions
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<Component, StorageOperationStatus> 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<Map<String, InterfaceDefinition>, 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<String, InterfaceDefinition> interfaceDefinitionMap = new HashMap<>();
+ interfaceDefinitionMap.put(interfaceDefinition.getUniqueId(), interfaceDefinition);
+ when(interfaceLifecycleOperation.getAllInterfaceLifecycleTypes()).thenReturn(Either.left(interfaceDefinitionMap));
+ Either<Map<String, InterfaceDefinition>, ResponseFormat> response = bl.getAllInterfaceLifecycleTypes();
+ Assert.assertEquals(response.left().value().size(),1);
+ }
} \ No newline at end of file