Fix default imports being amended 69/120369/2
authorMichaelMorris <michael.morris@est.tech>
Fri, 9 Apr 2021 11:26:22 +0000 (12:26 +0100)
committerChristophe Closset <christophe.closset@intl.att.com>
Mon, 12 Apr 2021 08:38:40 +0000 (08:38 +0000)
Signed-off-by: MichaelMorris <michael.morris@est.tech>
Issue-ID: SDC-3552
Change-Id: Ibb5cfbba2075820c798eae1726953871140ddce5

catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java
common-app-api/src/main/java/org/openecomp/sdc/be/config/Configuration.java

index 10d2130..d211a8b 100644 (file)
@@ -200,7 +200,7 @@ public class ToscaExportHandler {
     }
 
     public Either<ToscaRepresentation, ToscaError> exportComponentInterface(final Component component, final boolean isAssociatedComponent) {
-        final List<Map<String, Map<String, String>>> imports = getDefaultToscaImportConfig();
+        final List<Map<String, Map<String, String>>> imports = new ArrayList<>(getDefaultToscaImportConfig());
         if (CollectionUtils.isEmpty(imports)) {
             log.debug(FAILED_TO_GET_DEFAULT_IMPORTS_CONFIGURATION);
             return Either.right(ToscaError.GENERAL_ERROR);
@@ -220,7 +220,7 @@ public class ToscaExportHandler {
             toscaVersion = ((Resource) component).getToscaVersion();
         }
         ToscaTemplate toscaTemplate = new ToscaTemplate(toscaVersion != null ? toscaVersion : TOSCA_VERSION);
-        toscaTemplate.setImports(new ArrayList<>(imports));
+        toscaTemplate.setImports(imports);
         final Map<String, ToscaNodeType> nodeTypes = new HashMap<>();
         final Either<ToscaTemplate, ToscaError> toscaTemplateRes = convertInterfaceNodeType(new HashMap<>(), component, toscaTemplate, nodeTypes,
             isAssociatedComponent);
index e30f5f3..04ba19e 100644 (file)
@@ -165,6 +165,10 @@ public class Configuration extends BasicConfiguration {
     public Map<String, Set<String>> getExcludedGroupTypesMapping() {
         return safeGetCapsInsensitiveMap(excludedGroupTypesMapping);
     }
+    
+    public List<Map<String, Map<String, String>>> getDefaultImports(){
+        return Collections.unmodifiableList(defaultImports);
+    }
 
     @Override
     public String toString() {