summaryrefslogtreecommitdiffstats
path: root/catalog-be/src/test
diff options
context:
space:
mode:
authorMichaelMorris <michael.morris@est.tech>2022-08-19 09:36:41 +0100
committerVasyl Razinkov <vasyl.razinkov@est.tech>2022-09-02 10:22:01 +0000
commit97b5fa431d5924d90e97adedf76f3ce5648cd938 (patch)
tree40b200066f88dff83ae7773d30d2b37b42594d0d /catalog-be/src/test
parent7e84536e49b49cd1721b324d1ccaa17ca96456a7 (diff)
Support updated data types in service import
Signed-off-by: MichaelMorris <michael.morris@est.tech> Issue-ID: SDC-4140 Change-Id: Ib66d47a0f566b648722ce86cfc4e208880551a29
Diffstat (limited to 'catalog-be/src/test')
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ServiceImportBusinessLogicTest.java19
-rw-r--r--catalog-be/src/test/resources/csars/service-Ser09080002-csar.csarbin65020 -> 64137 bytes
2 files changed, 17 insertions, 2 deletions
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ServiceImportBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ServiceImportBusinessLogicTest.java
index 07593a0cd7..3f8f9c382c 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ServiceImportBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ServiceImportBusinessLogicTest.java
@@ -218,7 +218,21 @@ class ServiceImportBusinessLogicTest extends ServiceImportBussinessLogicBaseTest
when(toscaOperationFacade.updateInputsToComponent(anyList(), eq(newService.getUniqueId()))).thenReturn(Either.left(new ArrayList<>()));
when(applicationDataTypeCache.get(any(), contains("tosca.datatypes.test_"))).thenReturn(Either.right(JanusGraphOperationStatus.NOT_FOUND));
- when(applicationDataTypeCache.get(any(), matches("^((?!tosca.datatypes.test_).)*$"))).thenReturn(Either.left(new DataTypeDefinition()));
+ DataTypeDefinition typeToBeUpdated = new DataTypeDefinition();
+ List<PropertyDefinition> properties = new ArrayList<>();
+ PropertyDefinition nameProperty = new PropertyDefinition();
+ nameProperty.setName("name");
+ nameProperty.setType("string");
+ properties.add(nameProperty);
+ PropertyDefinition versionProperty = new PropertyDefinition();
+ versionProperty.setName("version");
+ versionProperty.setType("string");
+ properties.add(versionProperty);
+ typeToBeUpdated.setProperties(properties);
+ when(applicationDataTypeCache.get(any(), eq("onap.datatypes.ToscaConceptIdentifier.datatype"))).thenReturn(Either.left(typeToBeUpdated));
+ when(applicationDataTypeCache.get(any(), matches("^((?!(tosca.datatypes.test_|onap.datatypes.ToscaConceptIdentifier)).)*$"))).thenReturn(Either.left(new DataTypeDefinition()));
+
+
when(toscaOperationFacade.getLatestByToscaResourceName(contains("org.openecomp.resource"), isNull())).thenReturn(Either.left(null));
when(toscaOperationFacade.getLatestByToscaResourceName(contains("tosca.nodes."), isNull())).thenReturn(Either.left(null));
@@ -240,9 +254,10 @@ class ServiceImportBusinessLogicTest extends ServiceImportBussinessLogicBaseTest
ArgumentCaptor<String> yaml = ArgumentCaptor.forClass(String.class);
verify(dataTypeBusinessLogic).createDataTypeFromYaml(yaml.capture(), isNull(), anyBoolean());
Map<String, Object> yamlMap = new Yaml().load(yaml.getValue());
- assertEquals(2, yamlMap.size());
+ assertEquals(3, yamlMap.size());
assertNotNull(yamlMap.get("tosca.datatypes.test_a"));
assertNotNull(yamlMap.get("tosca.datatypes.test_b"));
+ assertNotNull(yamlMap.get("onap.datatypes.ToscaConceptIdentifier"));
}
@Test
diff --git a/catalog-be/src/test/resources/csars/service-Ser09080002-csar.csar b/catalog-be/src/test/resources/csars/service-Ser09080002-csar.csar
index a65850469d..00a6981272 100644
--- a/catalog-be/src/test/resources/csars/service-Ser09080002-csar.csar
+++ b/catalog-be/src/test/resources/csars/service-Ser09080002-csar.csar
Binary files differ