diff options
author | 2021-05-11 18:05:30 +0100 | |
---|---|---|
committer | 2021-05-15 06:21:37 +0000 | |
commit | 1073da9c4dacfc87982eecf1667eb0177540acf6 (patch) | |
tree | 1b2c3edc5f5d3826247e2dfd69919c097233f405 /catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java | |
parent | 2152a9a43767cdd486fd8c93894f66a05083f53c (diff) |
Improve test coverage
Change-Id: I2b02d85d9d395d9092d43bd54e21179aff29df91
Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech>
Issue-ID: SDC-3584
Diffstat (limited to 'catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java')
-rw-r--r-- | catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java | 29 |
1 files changed, 7 insertions, 22 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java index 45180008ab..b374e62a54 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java @@ -712,13 +712,7 @@ public class ToscaExportHandler { interfacesOperationsConverter.addInterfaceDefinitionElement(component, toscaNodeType, dataTypes, isAssociatedComponent); addInputsToProperties(dataTypes, inputDef, mergedProperties); final Map<String, ToscaAttribute> toscaAttributeMap; - try { - toscaAttributeMap = convertToToscaAttributes(component.getAttributes(), dataTypes); - } catch (final ToscaConversionException e) { - log.error(EcompLoggerErrorCode.SCHEMA_ERROR, ToscaExportHandler.class.getName(), - COULD_NOT_PARSE_COMPONENT_ATTRIBUTES_COMPONENT_UNIQUE_ID, component.getName(), component.getUniqueId(), e); - return Either.right(ToscaError.GENERAL_ERROR); - } + toscaAttributeMap = convertToToscaAttributes(component.getAttributes(), dataTypes); if (!toscaAttributeMap.isEmpty()) { toscaNodeType.setAttributes(toscaAttributeMap); } @@ -763,7 +757,7 @@ public class ToscaExportHandler { } private Map<String, ToscaAttribute> convertToToscaAttributes(final List<AttributeDefinition> attributeList, - final Map<String, DataTypeDefinition> dataTypes) throws ToscaConversionException { + final Map<String, DataTypeDefinition> dataTypes) { if (CollectionUtils.isEmpty(attributeList)) { return Collections.emptyMap(); } @@ -981,9 +975,7 @@ public class ToscaExportHandler { List<ComponentInstanceInput> instanceInputsList = componentInstancesInputs.get(instanceUniqueId); if (instanceInputsList != null) { instanceInputsList.forEach(input -> { - - Supplier<String> supplier = () -> input.getValue() != null && !Objects.isNull(input.getValue()) - ? input.getValue() : input.getDefaultValue(); + Supplier<String> supplier = () -> input.getValue() != null && !Objects.isNull(input.getValue()) ? input.getValue() : input.getDefaultValue(); propertyConvertor.convertAndAddValue(dataTypes, props, input, supplier); }); } @@ -1010,9 +1002,7 @@ public class ToscaExportHandler { // Filters out Attributes with empty default values .filter(attributeDefinition -> StringUtils.isNotEmpty(attributeDefinition.getDefaultValue())) // Converts and adds each value to attribute map - .forEach(attributeDefinition -> { - attributeConverter.convertAndAddValue(attribs, attributeDefinition); - }); + .forEach(attributeDefinition -> attributeConverter.convertAndAddValue(attribs, attributeDefinition)); } } @@ -1037,9 +1027,7 @@ public class ToscaExportHandler { // Filters out Attributes with empty default values .filter(attrib -> StringUtils.isNotEmpty(attrib.getDefaultValue())) // Converts and adds each value to attribute map - .forEach(attributeDefinition -> { - attributeConverter.convertAndAddValue(attribs, attributeDefinition); - }); + .forEach(attributeDefinition -> attributeConverter.convertAndAddValue(attribs, attributeDefinition)); } } @@ -1237,13 +1225,11 @@ public class ToscaExportHandler { Component originComponent, Map<String, Component> componentCache) { - final List<Map<String, ToscaTemplateRequirement>> toscaRequirements; final List<RequirementCapabilityRelDef> requirementDefinitionList = filterRequirements(componentInstance, relations); if (isNotEmpty(requirementDefinitionList)) { try { - toscaRequirements = buildRequirements(component, componentInstance, - requirementDefinitionList, originComponent, componentCache); + final List<Map<String, ToscaTemplateRequirement>> toscaRequirements = buildRequirements(component, componentInstance, requirementDefinitionList, originComponent, componentCache); if (!toscaRequirements.isEmpty()) { nodeTypeTemplate.setRequirements(toscaRequirements); } @@ -1267,8 +1253,7 @@ public class ToscaExportHandler { final List<Map<String, ToscaTemplateRequirement>> toscaRequirements = new ArrayList<>(); for (RequirementCapabilityRelDef relationshipDefinition : filteredRelations) { final Map<String, ToscaTemplateRequirement> toscaTemplateRequirementMap = - buildRequirement(componentInstance, originComponent, component.getComponentInstances(), - relationshipDefinition, componentCache); + buildRequirement(componentInstance, originComponent, component.getComponentInstances(), relationshipDefinition, componentCache); toscaRequirements.add(toscaTemplateRequirementMap); } |