Fix 'Wrong Inputs creation on (Add Service)'
[sdc.git] / catalog-be / src / main / java / org / openecomp / sdc / be / tosca / ToscaExportHandler.java
index 9591e6b..25d0287 100644 (file)
@@ -800,11 +800,11 @@ public class ToscaExportHandler {
         if (CollectionUtils.isNotEmpty(component.getProperties())) {
             List<PropertyDefinition> properties = component.getProperties();
             Map<String, ToscaProperty> convertedProperties = properties.stream()
-                .map(propertyDefinition -> resolvePropertyValueFromInput(propertyDefinition, component.getInputs())).collect(Collectors
-                    .toMap(PropertyDataDefinition::getName,
-                        property -> propertyConvertor.convertProperty(dataTypes, property, PropertyConvertor.PropertyType.PROPERTY)));
+                .map(propertyDefinition -> resolvePropertyValueFromInput(propertyDefinition, component.getInputs()))
+                .collect(Collectors.toMap(PropertyDataDefinition::getName,
+                    property -> propertyConvertor.convertProperty(dataTypes, property, PropertyConvertor.PropertyType.PROPERTY)));
             // merge component properties and inputs properties
-            mergedProperties.putAll(convertedProperties);
+            convertedProperties.forEach((k, v) -> mergedProperties.putIfAbsent(k, v));
         }
         if (MapUtils.isNotEmpty(mergedProperties)) {
             toscaNodeType.setProperties(mergedProperties);
@@ -938,7 +938,7 @@ public class ToscaExportHandler {
             nodeTemplate.setType(componentInstance.getToscaComponentName());
             nodeTemplate.setDirectives(componentInstance.getDirectives());
             NodeFilter nodeFilter = convertToNodeTemplateNodeFilterComponent(componentInstance.getNodeFilter());
-            if(nodeFilter != null && nodeFilter.hasData()){
+            if (nodeFilter != null && nodeFilter.hasData()) {
                 nodeTemplate.setNode_filter(nodeFilter);
             }
             final Either<Component, Boolean> originComponentRes = capabilityRequirementConverter
@@ -1767,7 +1767,7 @@ public class ToscaExportHandler {
     }
 
     private Map<String, ToscaProperty> convertInputsToProperties(Map<String, DataTypeDefinition> dataTypes, List<InputDefinition> componentInputs,
-                                                             String componentUniqueId) {
+                                                                 String componentUniqueId) {
         if (CollectionUtils.isEmpty(componentInputs)) {
             return new HashMap<>();
         }
@@ -1788,6 +1788,10 @@ public class ToscaExportHandler {
             .ofNullable(interfacesOperationsConverter.getInterfacesMap(proxyComponent, null, proxyComponentInterfaces, dataTypes, false, false));
     }
 
+    private Configuration getConfiguration() {
+        return ConfigurationManager.getConfigurationManager().getConfiguration();
+    }
+
     private static class CustomRepresenter extends Representer {
 
         CustomRepresenter() {
@@ -1943,8 +1947,4 @@ public class ToscaExportHandler {
         }
     }
 
-    private Configuration getConfiguration() {
-        return ConfigurationManager.getConfigurationManager().getConfiguration();
-    }
-
 }