summaryrefslogtreecommitdiffstats
path: root/catalog-be/src
diff options
context:
space:
mode:
authorSindhuri.A <arcot.sindhuri@huawei.com>2018-11-21 17:34:47 +0530
committerTal Gitelman <tal.gitelman@att.com>2018-11-29 11:13:10 +0000
commitd7b6bb274a1cc6f4e303045587b7c61e505e0fb7 (patch)
treee1d6b02411fa4ce0a9702ad121399962dd2c245e /catalog-be/src
parent82c84075c71e285d1009bbe7e183ad2f0358d335 (diff)
UT-InputsBusinessLogic
UT for InputsBusinessLogic class Issue-ID: SDC-1775 Change-Id: Ia95f73af0af5e8abef883250c3b649b53a0cb4e9 Signed-off-by: Sindhuri.A <arcot.sindhuri@huawei.com>
Diffstat (limited to 'catalog-be/src')
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogicTest.java29
1 files changed, 29 insertions, 0 deletions
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogicTest.java
index 34b017778e..934a35e98a 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogicTest.java
@@ -61,6 +61,9 @@ public class InputsBusinessLogicTest {
@Mock
private UserValidations userValidations;
+ @Mock
+ private ComponentInstanceBusinessLogic componentInstanceBusinessLogic;
+
@InjectMocks
private InputsBusinessLogic testInstance;
@@ -118,6 +121,32 @@ public class InputsBusinessLogicTest {
assertEquals("inputId", componentInstanceInputs.left().value().get(0).getInputId());
}
+ @Test
+ public void testGetInputs() {
+ String userId = "userId";
+ String componentId = "compId";
+ Component component = new Resource();
+ when(toscaOperationFacadeMock.getToscaElement(Mockito.any(String.class), Mockito.any(ComponentParametersView.class))).thenReturn(Either.left(component));
+ testInstance.getInputs(userId, componentId);
+ assertEquals(null, component.getInputs());
+ }
+
+ @Test
+ public void testGetCIPropertiesByInputId() {
+ Either<List<ComponentInstanceProperty>, ResponseFormat> result;
+ String userId = "userId";
+ String componentId = "compId";
+ Component component = new Resource();
+ List<InputDefinition> listDef = new ArrayList<>();
+ InputDefinition inputDef = new InputDefinition();
+ inputDef.setUniqueId(componentId);
+ listDef.add(inputDef);
+ component.setInputs(listDef);
+ when(toscaOperationFacadeMock.getToscaElement(Mockito.any(String.class), Mockito.any(ComponentParametersView.class))).thenReturn(Either.left(component));
+ result = testInstance.getComponentInstancePropertiesByInputId(userId, componentId, componentId, componentId);
+ assertTrue(result.isLeft());
+ }
+
private void getComponents_emptyInputs(Service service) {
when(toscaOperationFacadeMock.getToscaElement(eq(COMPONENT_ID), Mockito.any(ComponentParametersView.class))).thenReturn(Either.left(service));
Either<List<ComponentInstanceInput>, ResponseFormat> componentInstanceInputs = testInstance.getComponentInstanceInputs(USER_ID, COMPONENT_ID, COMPONENT_INSTANCE_ID);