summaryrefslogtreecommitdiffstats
path: root/catalog-model/src/test/java
diff options
context:
space:
mode:
authorMichaelMorris <michael.morris@est.tech>2021-07-30 13:06:11 +0100
committerAndr� Schmid <andre.schmid@est.tech>2021-08-12 09:47:01 +0000
commitdf1e300dad94d65a88d2012df9096961619d8272 (patch)
treed610a352cf85237c0ef969035a58db17a297cd86 /catalog-model/src/test/java
parent55c256b321652c5d94658a62f3ec3744cae18ff4 (diff)
Update base types based on model
Also made some changes where model was not being considered Signed-off-by: MichaelMorris <michael.morris@est.tech> Issue-ID: SDC-3666 Change-Id: I450c5261239cf4104c494abe6711cb61368a2b4a
Diffstat (limited to 'catalog-model/src/test/java')
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacadeTest.java9
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ElementOperationTest.java8
2 files changed, 8 insertions, 9 deletions
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacadeTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacadeTest.java
index a19e7c431f..b88eec2993 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacadeTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacadeTest.java
@@ -263,10 +263,9 @@ public class ToscaOperationFacadeTest {
Map<GraphPropertyEnum, Object> propertiesNotToMatch = new EnumMap<>(GraphPropertyEnum.class);
propertiesToMatch.put(GraphPropertyEnum.TOSCA_RESOURCE_NAME, "toscaResourceName");
propertiesToMatch.put(GraphPropertyEnum.IS_HIGHEST_VERSION, true);
- propertiesToMatch.put(GraphPropertyEnum.MODEL, null);
propertiesNotToMatch.put(GraphPropertyEnum.IS_DELETED, true);
- when(janusGraphDaoMock.getByCriteria(null, propertiesToMatch, propertiesNotToMatch, JsonParseFlagEnum.ParseAll))
+ when(janusGraphDaoMock.getByCriteria(null, propertiesToMatch, propertiesNotToMatch, JsonParseFlagEnum.ParseAll, null))
.thenReturn(Either.left(list));
when(topologyTemplateOperationMock.getToscaElement(ArgumentMatchers.eq(graphVertex), any(ComponentParametersView.class)))
.thenReturn(Either.left(toscaElement));
@@ -437,12 +436,12 @@ public class ToscaOperationFacadeTest {
public void testGetLatestByToscaResourceName() {
Either<Component, StorageOperationStatus> result;
String toscaResourceName = "name";
+ String model = "testModel";
ToscaElement toscaElement = getToscaElementForTest();
Map<GraphPropertyEnum, Object> propertiesToMatch = new EnumMap<>(GraphPropertyEnum.class);
propertiesToMatch.put(GraphPropertyEnum.TOSCA_RESOURCE_NAME, toscaResourceName);
propertiesToMatch.put(GraphPropertyEnum.IS_HIGHEST_VERSION, true);
- propertiesToMatch.put(GraphPropertyEnum.MODEL, null);
Map<GraphPropertyEnum, Object> propertiesNotToMatch = new EnumMap<>(GraphPropertyEnum.class);
propertiesNotToMatch.put(GraphPropertyEnum.IS_DELETED, true);
@@ -454,11 +453,11 @@ public class ToscaOperationFacadeTest {
graphVertex.setMetadataProperties(props);
graphVertexList.add(graphVertex);
- when(janusGraphDaoMock.getByCriteria(null, propertiesToMatch, propertiesNotToMatch, JsonParseFlagEnum.ParseMetadata))
+ when(janusGraphDaoMock.getByCriteria(null, propertiesToMatch, propertiesNotToMatch, JsonParseFlagEnum.ParseMetadata, model))
.thenReturn(Either.left(graphVertexList));
when(topologyTemplateOperationMock.getToscaElement(any(GraphVertex.class), any(ComponentParametersView.class)))
.thenReturn(Either.left(toscaElement));
- result = testInstance.getLatestByToscaResourceName(toscaResourceName);
+ result = testInstance.getLatestByToscaResourceName(toscaResourceName, model);
assertTrue(result.isLeft());
}
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ElementOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ElementOperationTest.java
index 230fbe1aba..d8b7e53860 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ElementOperationTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ElementOperationTest.java
@@ -490,7 +490,7 @@ public class ElementOperationTest extends ModelTestBase {
GraphVertex baseTypeVertex = mock(GraphVertex.class);
when(baseTypeVertex.getMetadataProperty(GraphPropertyEnum.VERSION)).thenReturn("1.0");
- when(healingJanusGraphDao.getByCriteria(any(), any(), any()))
+ when(healingJanusGraphDao.getByCriteria(eq(VertexTypeEnum.NODE_TYPE), any(), isNull(), eq(JsonParseFlagEnum.ParseAll), any()))
.thenReturn(Either.left(Collections.singletonList(baseTypeVertex)));
GraphVertex derivedTypeVertex = mock(GraphVertex.class);
@@ -508,7 +508,7 @@ public class ElementOperationTest extends ModelTestBase {
when(derivedTypeVertex.getMetadataProperty(GraphPropertyEnum.TOSCA_RESOURCE_NAME))
.thenReturn("org.parent.type");
- List<BaseType> baseTypes = elementOperation.getBaseTypes("serviceCategoryA");
+ List<BaseType> baseTypes = elementOperation.getBaseTypes("serviceCategoryA", null);
assertEquals(2, baseTypes.size());
assertEquals("org.base.type", baseTypes.get(0).getToscaResourceName());
@@ -539,13 +539,13 @@ public class ElementOperationTest extends ModelTestBase {
GraphVertex baseTypeVertex = mock(GraphVertex.class);
when(baseTypeVertex.getMetadataProperty(GraphPropertyEnum.VERSION)).thenReturn("1.0");
- when(healingJanusGraphDao.getByCriteria(any(), any(), any()))
+ when(healingJanusGraphDao.getByCriteria(eq(VertexTypeEnum.NODE_TYPE), any(), isNull(), eq(JsonParseFlagEnum.ParseAll), any()))
.thenReturn(Either.left(Collections.singletonList(baseTypeVertex)));
when(healingJanusGraphDao.getParentVertices(baseTypeVertex, EdgeLabelEnum.DERIVED_FROM,
JsonParseFlagEnum.ParseAll)).thenReturn(Either.right(JanusGraphOperationStatus.NOT_FOUND));
- List<BaseType> baseTypes = elementOperation.getBaseTypes("serviceCategoryA");
+ List<BaseType> baseTypes = elementOperation.getBaseTypes("serviceCategoryA", null);
assertEquals(1, baseTypes.size());
assertEquals("org.service.default", baseTypes.get(0).getToscaResourceName());