summaryrefslogtreecommitdiffstats
path: root/catalog-be/src/test/java/org/openecomp
diff options
context:
space:
mode:
authorMichael Lando <michael.lando@intl.att.com>2018-10-04 13:02:56 +0300
committerMichael Lando <michael.lando@intl.att.com>2018-10-04 13:26:23 +0300
commit454cfef267e87a2e0fba46964106c6fe03c220fd (patch)
tree1d4616a51f266f129db181e14478778da8f62161 /catalog-be/src/test/java/org/openecomp
parent79e3627ae1ebff32a721116600e26233803d067e (diff)
fix csar creation
fix required not populated based on DB fix bad packaging of the normative types in csar fix import logic to correctly read boolean fields Change-Id: Idca39ddb070f5f816916a90f124c5c40dae415af Issue-ID: SDC-1447 Signed-off-by: Michael Lando <michael.lando@intl.att.com>
Diffstat (limited to 'catalog-be/src/test/java/org/openecomp')
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ImportUtilsTest.java25
1 files changed, 23 insertions, 2 deletions
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ImportUtilsTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ImportUtilsTest.java
index f5357e735f..b23b8abd1e 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ImportUtilsTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ImportUtilsTest.java
@@ -21,13 +21,17 @@
package org.openecomp.sdc.be.components.impl;
import fj.data.Either;
+import mockit.Mock;
import org.junit.Test;
+import org.mockito.Mockito;
import org.openecomp.sdc.be.components.impl.ImportUtils.ResultStatusEnum;
import org.openecomp.sdc.be.components.impl.ImportUtils.ToscaElementTypeEnum;
import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.SchemaDefinition;
import org.openecomp.sdc.be.model.HeatParameterDefinition;
+import org.openecomp.sdc.be.model.InputDefinition;
import org.openecomp.sdc.be.model.PropertyDefinition;
+import org.openecomp.sdc.be.model.operations.impl.AnnotationTypeOperations;
import org.openecomp.sdc.be.utils.TypeUtils;
import org.openecomp.sdc.common.api.ArtifactTypeEnum;
import org.yaml.snakeyaml.Yaml;
@@ -48,6 +52,8 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
public class ImportUtilsTest {
+
+
@Test
public void testStringTypeFindToscaElements() throws IOException {
Either<List<Object>, ResultStatusEnum> toscaElements = ImportUtils.findToscaElements((Map<String, Object>) loadJsonFromFile("normative-types-string-list-test.yml"), "stringTestTag", ToscaElementTypeEnum.STRING, new ArrayList<>());
@@ -295,6 +301,21 @@ public class ImportUtilsTest {
}
+ @Test
+ public void testGetInputsFromYml() throws IOException {
+
+ Map<String, Object> toscaJson = (Map<String, Object>) loadJsonFromFile("importToscaInputs.yml");
+
+ AnnotationTypeOperations annotationTypeOperations= Mockito.mock(AnnotationTypeOperations.class);
+ Mockito.when(annotationTypeOperations.getLatestType(Mockito.anyString())).thenReturn(null);
+
+ Either<Map<String, InputDefinition>, ResultStatusEnum> actualInputs = ImportUtils.getInputs(toscaJson,annotationTypeOperations);
+ assertTrue(actualInputs.isLeft());
+ Map<String, Map<String, Object>> expectedProperties = getElements(toscaJson, TypeUtils.ToscaTagNamesEnum.INPUTS);
+ compareProperties(expectedProperties, actualInputs.left().value());
+
+ }
+
private void compareAttributes(Map<String, Map<String, Object>> expected, Map<String, PropertyDefinition> actual) {
Map<String, Object> singleExpectedAttribute;
@@ -322,11 +343,11 @@ public class ImportUtilsTest {
}
- private void compareProperties(Map<String, Map<String, Object>> expected, Map<String, PropertyDefinition> actual) {
+ private void compareProperties(Map<String, Map<String, Object>> expected, Map<String, ? extends PropertyDefinition > actual) {
Map<String, Object> singleExpectedProperty;
PropertyDefinition actualProperty, expectedPropertyModel;
- // attributes of resource
+
for (Map.Entry<String, Map<String, Object>> expectedProperty : expected.entrySet()) {
singleExpectedProperty = expectedProperty.getValue();