summaryrefslogtreecommitdiffstats
path: root/catalog-model/src/test/java
diff options
context:
space:
mode:
authorKrupaNagabhushan <krupa.nagabhushan@est.tech>2021-07-14 14:21:47 +0100
committerMichael Morris <michael.morris@est.tech>2021-07-21 14:13:29 +0000
commit0514ec6635a08cdbaac5d664c3a4f13bcb0cbf51 (patch)
tree8ece729ff236e5011b705c3c79536eb482a44a7c /catalog-model/src/test/java
parenta3da4a7625f75f719a0ef1ffe1c2bef87828d2f3 (diff)
Consider component model when retrieving relationship types
Issue-ID: SDC-3640 Signed-off-by: MichaelMorris <michael.morris@est.tech> Change-Id: Ic06a9085b8aa2f44b8d33d7de12eadf691106131 Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech> Signed-off-by: KrupaNagabhushan <krupa.nagabhushan@est.tech>
Diffstat (limited to 'catalog-model/src/test/java')
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/RelationshipTypeOperationTest.java20
1 files changed, 14 insertions, 6 deletions
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/RelationshipTypeOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/RelationshipTypeOperationTest.java
index 1cc13364a5..6551a13981 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/RelationshipTypeOperationTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/RelationshipTypeOperationTest.java
@@ -32,6 +32,7 @@ import java.util.Map;
import java.util.Map.Entry;
import fj.data.Either;
+import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.junit.Before;
@@ -155,9 +156,9 @@ public class RelationshipTypeOperationTest extends ModelTestBase {
@Test
public void testGetAllRelationshipTypesNotFound() {
Mockito.doReturn(Either.right(JanusGraphOperationStatus.NOT_FOUND)).when(
- janusGraphGenericDao).getByCriteria(NodeTypeEnum.RelationshipType, null,
+ janusGraphGenericDao).getByCriteriaForModel(NodeTypeEnum.RelationshipType, null, null,
RelationshipTypeData.class);
- Either<Map<String, RelationshipTypeDefinition>, JanusGraphOperationStatus> either = relationshipTypeOperation.getAllRelationshipTypes();
+ Either<Map<String, RelationshipTypeDefinition>, JanusGraphOperationStatus> either = relationshipTypeOperation.getAllRelationshipTypes(null);
assertTrue(either.isLeft() && MapUtils.isEmpty(either.left().value()));
}
@@ -165,9 +166,9 @@ public class RelationshipTypeOperationTest extends ModelTestBase {
@Test
public void testGetAllRelationshipTypesNotConnnected() {
Mockito.doReturn(Either.right(JanusGraphOperationStatus.NOT_CONNECTED)).when(
- janusGraphGenericDao).getByCriteria(NodeTypeEnum.RelationshipType, null,
+ janusGraphGenericDao).getByCriteriaForModel(NodeTypeEnum.RelationshipType, null, null,
RelationshipTypeData.class);
- Either<Map<String, RelationshipTypeDefinition>, JanusGraphOperationStatus> either = relationshipTypeOperation.getAllRelationshipTypes();
+ Either<Map<String, RelationshipTypeDefinition>, JanusGraphOperationStatus> either = relationshipTypeOperation.getAllRelationshipTypes(null);
assertTrue(either.isRight() && JanusGraphOperationStatus.NOT_CONNECTED == either.right().value());
}
@@ -185,7 +186,7 @@ public class RelationshipTypeOperationTest extends ModelTestBase {
relationshipTypeDataList.add(relationshipTypeData1);
Mockito.doReturn(Either.left(relationshipTypeDataList))
- .when(janusGraphGenericDao).getByCriteria(NodeTypeEnum.RelationshipType, null,
+ .when(janusGraphGenericDao).getByCriteriaForModel(NodeTypeEnum.RelationshipType, null, null,
RelationshipTypeData.class);
Mockito.doReturn(Either.left(relationshipTypeData1)).when(janusGraphGenericDao)
@@ -203,11 +204,18 @@ public class RelationshipTypeOperationTest extends ModelTestBase {
.getDerivedFromChild("tosca.relationships.Root1", NodeTypeEnum.RelationshipType, RelationshipTypeData.class);
Either<Map<String, RelationshipTypeDefinition>, JanusGraphOperationStatus> either =
- relationshipTypeOperation.getAllRelationshipTypes();
+ relationshipTypeOperation.getAllRelationshipTypes(null);
assertTrue(either.isLeft());
RelationshipTypeDefinition relationshipTypeDefinition = either.left().value().get("tosca.relationships.Root1");
assertEquals("tosca.relationships.Parent", relationshipTypeDefinition.getDerivedFrom());
+
+ Mockito.doReturn(Either.right(JanusGraphOperationStatus.NOT_FOUND))
+ .when(janusGraphGenericDao).getByCriteriaForModel(NodeTypeEnum.RelationshipType, null, "modelA",
+ RelationshipTypeData.class);
+ either = relationshipTypeOperation.getAllRelationshipTypes("modelA");
+ assertTrue(either.isLeft());
+ assertTrue(MapUtils.isEmpty(either.left().value()));
}
public RelationshipTypeDefinition createRelationship(String relationshipTypeName) {