aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core
diff options
context:
space:
mode:
authorojasdubey <ojas.dubey@amdocs.com>2019-07-08 13:07:18 +0530
committerAvi Gaffa <avi.gaffa@amdocs.com>2019-07-08 12:00:38 +0000
commitda8b24151295d923cc632dfa2d296b3c67f6cce2 (patch)
tree28e104919c9506d38229cb437bf31cb50d86f46f /openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core
parent3b72874a95ce734f555334fb0fba987a069664d0 (diff)
Move import handling to service template
Moving the handling of all import formats parsing to ServiceTemplate class to make it generic and reusable Change-Id: I80595c3654a625275549a3bb3afe8ba7c9455aff Issue-ID: SDC-2421 Signed-off-by: ojasdubey <ojas.dubey@amdocs.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core')
-rw-r--r--openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/AbstractToscaConverter.java12
-rw-r--r--openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/converter/impl/ToscaConvertorDefinitionsTest.java4
2 files changed, 8 insertions, 8 deletions
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/AbstractToscaConverter.java b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/AbstractToscaConverter.java
index 859d3da9dc..0b0c6e42f9 100644
--- a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/AbstractToscaConverter.java
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/AbstractToscaConverter.java
@@ -46,6 +46,7 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
@@ -180,12 +181,11 @@ public abstract class AbstractToscaConverter implements ToscaConverter {
}
private void convertImports(ServiceTemplate serviceTemplate) {
- serviceTemplate.setImports(new ArrayList<>());
- serviceTemplate.getImports()
- .add(createImportMap(openecompHeatIndex, HEAT_INDEX_IMPORT_FILE));
- serviceTemplate.getImports().add(createImportMap(ONAP_INDEX, ONAP_INDEX_IMPORT_FILE));
- serviceTemplate.getImports().add(createImportMap(globalSubstitution, globalStName));
-
+ List<Map<String, Import>> imports = new ArrayList<>();
+ imports.add(createImportMap(openecompHeatIndex, HEAT_INDEX_IMPORT_FILE));
+ imports.add(createImportMap(ONAP_INDEX, ONAP_INDEX_IMPORT_FILE));
+ imports.add(createImportMap(globalSubstitution, globalStName));
+ serviceTemplate.setImports(imports);
}
private Map<String, Import> createImportMap(String key, String fileName) {
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/converter/impl/ToscaConvertorDefinitionsTest.java b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/converter/impl/ToscaConvertorDefinitionsTest.java
index d5a99106bc..2c3ff0ae5d 100644
--- a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/converter/impl/ToscaConvertorDefinitionsTest.java
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/converter/impl/ToscaConvertorDefinitionsTest.java
@@ -44,8 +44,8 @@ public class ToscaConvertorDefinitionsTest {
assertNotNull(serviceTemplate.getImports());
assertFalse(serviceTemplate.getImports().isEmpty());
assertEquals(1 ,serviceTemplate.getImports().size());
- assertTrue(serviceTemplate.getImports().get(0).containsKey(HEAT_INDEX));
- assertTrue(serviceTemplate.getImports().get(0).containsKey(ONAP_INDEX));
+ assertTrue(((Map) serviceTemplate.getImports().get(0)).containsKey(HEAT_INDEX));
+ assertTrue(((Map) serviceTemplate.getImports().get(0)).containsKey(ONAP_INDEX));
assertEquals(DEFININTION_VERSION, serviceTemplate.getTosca_definitions_version());