summaryrefslogtreecommitdiffstats
path: root/openecomp-be
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be')
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java6
-rw-r--r--openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/ToscaConverterImpl.java67
2 files changed, 37 insertions, 36 deletions
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java
index 0a3428579d..1891cddfd5 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java
@@ -329,7 +329,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
validateQuestionnaire(vspDetails.getId(), vspDetails.getVersion(), vspDetails
.getOnboardingMethod()));
- if (vspDetails.getOnboardingMethod().equals("Manual")) {
+ if ("Manual".equals(vspDetails.getOnboardingMethod())) {
Collection<ErrorCode> deploymentFlavourValidationErrList =
deploymentFlavorValidation(vspDetails.getId(), vspDetails.getVersion());
if (validationResponse.getVspErrors() != null) {
@@ -527,7 +527,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
if (vspDetails.getSubCategory() == null) {
errors.add(createMissingMandatoryFieldError("sub category"));
}
- if (vspDetails.getOnboardingMethod().equals("Manual")) {
+ if ("Manual".equals(vspDetails.getOnboardingMethod())) {
//Manual Onboarding specific validations
Collection<DeploymentFlavorEntity> deploymentFlavorEntities = vendorSoftwareProductDao
.listDeploymentFlavors(vspDetails.getId(), vspDetails.getVersion());
@@ -729,7 +729,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
mdcDataDebugMessage.debugEntryMessage("VSP id", vspDetails.getId());
VspDetails retrieved = vspInfoDao.get(vspDetails);
- if (!retrieved.getOnboardingMethod().equals(vspDetails.getOnboardingMethod())) {
+ if (!Objects.equals(retrieved.getOnboardingMethod(), vspDetails.getOnboardingMethod())) {
final ErrorCode onboardingMethodUpdateErrorCode = OnboardingMethodErrorBuilder
.getOnboardingUpdateError();
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/ToscaConverterImpl.java b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/ToscaConverterImpl.java
index 69fa33aae7..348739e780 100644
--- a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/ToscaConverterImpl.java
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/ToscaConverterImpl.java
@@ -36,7 +36,7 @@ public class ToscaConverterImpl implements ToscaConverter {
@Override
public ToscaServiceModel convert(FileContentHandler fileContentHandler)
- throws IOException {
+ throws IOException {
Map<String, byte[]> csarFiles = new HashMap<>(fileContentHandler.getFiles());
ToscaServiceModel toscaServiceModel = new ToscaServiceModel();
Map<String, ServiceTemplate> serviceTemplates = new HashMap<>();
@@ -88,9 +88,9 @@ public class ToscaConverterImpl implements ToscaConverter {
}
} catch (YAMLException ye) {
throw new CoreException(new ErrorCode.ErrorCodeBuilder()
- .withMessage("Invalid YAML content in file " + key + ". reason - "
- + ye.getMessage())
- .withCategory(ErrorCategory.APPLICATION).build());
+ .withMessage("Invalid YAML content in file " + key + ". reason - "
+ + ye.getMessage())
+ .withCategory(ErrorCategory.APPLICATION).build());
}
}
@@ -100,7 +100,7 @@ public class ToscaConverterImpl implements ToscaConverter {
GlobalSubstitutionServiceTemplate globalSubstitutionServiceTemplate,
Map<String, byte[]> csarFiles) {
Collection<ServiceTemplate> globalServiceTemplates =
- GlobalTypesGenerator.getGlobalTypesServiceTemplate().values();
+ GlobalTypesGenerator.getGlobalTypesServiceTemplate().values();
addGlobalServiceTemplates(globalServiceTemplates, serviceTemplates);
toscaServiceModel.setEntryDefinitionServiceTemplate(mainStName);
toscaServiceModel.setServiceTemplates(serviceTemplates);
@@ -125,10 +125,10 @@ public class ToscaConverterImpl implements ToscaConverter {
String fileName, Map<String, byte[]> csarFiles,
Map<String, ServiceTemplate> serviceTemplates) {
Optional<ServiceTemplate> serviceTemplate =
- getServiceTemplateFromCsar(fileName, csarFiles);
+ getServiceTemplateFromCsar(fileName, csarFiles);
serviceTemplate.ifPresent(
- serviceTemplate1 -> addServiceTemplate(serviceTemplateName, serviceTemplate1,
- serviceTemplates));
+ serviceTemplate1 -> addServiceTemplate(serviceTemplateName, serviceTemplate1,
+ serviceTemplates));
}
private void addServiceTemplate(String serviceTemplateName,
@@ -160,7 +160,7 @@ public class ToscaConverterImpl implements ToscaConverter {
ServiceTemplate serviceTemplate = new ServiceTemplate();
try {
ServiceTemplateReaderService readerService =
- new ServiceTemplateReaderServiceImpl(fileContent);
+ new ServiceTemplateReaderServiceImpl(fileContent);
convertMetadata(serviceTemplateName, serviceTemplate, readerService);
convertToscaVersion(serviceTemplate, readerService);
convertImports(serviceTemplate);
@@ -169,9 +169,9 @@ public class ToscaConverterImpl implements ToscaConverter {
} catch (YAMLException ye) {
throw new CoreException(new ErrorCode.ErrorCodeBuilder()
- .withMessage("Invalid YAML content in file" + serviceTemplateName + ". reason - "
- + ye.getMessage())
- .withCategory(ErrorCategory.APPLICATION).build());
+ .withMessage("Invalid YAML content in file" + serviceTemplateName + ". reason - "
+ + ye.getMessage())
+ .withCategory(ErrorCategory.APPLICATION).build());
}
@@ -187,7 +187,7 @@ public class ToscaConverterImpl implements ToscaConverter {
private void convertImports(ServiceTemplate serviceTemplate) {
serviceTemplate.setImports(new ArrayList<>());
serviceTemplate.getImports()
- .add(createImportMap(openecompHeatIndex, "openecomp-heat/_index.yml"));
+ .add(createImportMap(openecompHeatIndex, "openecomp-heat/_index.yml"));
serviceTemplate.getImports().add(createImportMap(globalSubstitution, globalStName));
}
@@ -210,7 +210,7 @@ public class ToscaConverterImpl implements ToscaConverter {
if (MapUtils.isNotEmpty(metadataToConvert)) {
for (Map.Entry<String, Object> metadataEntry : metadataToConvert.entrySet()) {
if (Objects.isNull(metadataEntry.getValue()) ||
- !(metadataEntry.getValue() instanceof String)) {
+ !(metadataEntry.getValue() instanceof String)) {
continue;
}
finalMetadata.put(metadataEntry.getKey(), (String) metadataEntry.getValue());
@@ -229,9 +229,9 @@ public class ToscaConverterImpl implements ToscaConverter {
for (Map.Entry<String, Object> nodeTypeEntry : nodeTypes.entrySet()) {
DataModelUtil
- .addNodeType(serviceTemplate, nodeTypeEntry.getKey(),
- (NodeType) createObjectFromClass(nodeTypeEntry.getKey(), nodeTypeEntry.getValue(),
- NodeType.class));
+ .addNodeType(serviceTemplate, nodeTypeEntry.getKey(),
+ (NodeType) createObjectFromClass(nodeTypeEntry.getKey(), nodeTypeEntry.getValue(),
+ NodeType.class));
}
}
@@ -265,10 +265,10 @@ public class ToscaConverterImpl implements ToscaConverter {
for (Map.Entry<String, Object> entry : mapToConvert.entrySet()) {
ParameterDefinition parameterDefinition =
- (ParameterDefinition) createObjectFromClass(
- entry.getKey(), entry.getValue(), ParameterDefinition.class);
+ (ParameterDefinition) createObjectFromClass(
+ entry.getKey(), entry.getValue(), ParameterDefinition.class);
addToServiceTemplateAccordingToSection(
- serviceTemplate, inputsOrOutputs, entry.getKey(), parameterDefinition);
+ serviceTemplate, inputsOrOutputs, entry.getKey(), parameterDefinition);
}
}
@@ -279,11 +279,11 @@ public class ToscaConverterImpl implements ToscaConverter {
switch (inputsOrOutputs) {
case inputs:
DataModelUtil
- .addInputParameterToTopologyTemplate(serviceTemplate, parameterId, parameterDefinition);
+ .addInputParameterToTopologyTemplate(serviceTemplate, parameterId, parameterDefinition);
break;
case outputs:
DataModelUtil
- .addOutputParameterToTopologyTemplate(serviceTemplate, parameterId, parameterDefinition);
+ .addOutputParameterToTopologyTemplate(serviceTemplate, parameterId, parameterDefinition);
}
}
@@ -315,15 +315,15 @@ public class ToscaConverterImpl implements ToscaConverter {
substitutionMapping.setNode_type((String) substitutionMappings.get(nodeType));
substitutionMapping.setCapabilities(
- convertSubstitutionMappingsSections((Map<String, Object>) substitutionMappings.get(capabilities)));
+ convertSubstitutionMappingsSections((Map<String, Object>) substitutionMappings.get(capabilities)));
substitutionMapping.setRequirements(
- convertSubstitutionMappingsSections((Map<String, Object>) substitutionMappings.get(requirements)));
+ convertSubstitutionMappingsSections((Map<String, Object>) substitutionMappings.get(requirements)));
return substitutionMapping;
}
private Map<String, List<String>> convertSubstitutionMappingsSections(
- Map<String, Object> sectionToConvert) {
+ Map<String, Object> sectionToConvert) {
Map<String, List<String>> convertedSection = new HashMap<>();
if (MapUtils.isEmpty(sectionToConvert)) {
return null;
@@ -345,7 +345,7 @@ public class ToscaConverterImpl implements ToscaConverter {
return CsarFileTypes.globalServiceTemplate;
} else if (isDefinitions(fileName)) {
return CsarFileTypes.definitionsFile;
- } else if (isMetadataFile(metadataFile)) {
+ } else if (isMetadataFile(fileName)) {
return CsarFileTypes.toscaMetadata;
}
return CsarFileTypes.externalFile;
@@ -373,14 +373,14 @@ public class ToscaConverterImpl implements ToscaConverter {
nodeTemplate.setDescription((String) nodeTemplateAsMap.get("description"));
nodeTemplate.setDirectives((List<String>) nodeTemplateAsMap.get("directives"));
nodeTemplate.setInterfaces(
- (Map<String, InterfaceDefinition>) nodeTemplateAsMap.get("interfaces"));
+ (Map<String, InterfaceDefinition>) nodeTemplateAsMap.get("interfaces"));
nodeTemplate.setNode_filter((NodeFilter) nodeTemplateAsMap.get("node_filter"));
nodeTemplate.setProperties((Map<String, Object>) nodeTemplateAsMap.get("properties"));
nodeTemplate.setRequirements(
- (List<Map<String, RequirementAssignment>>) nodeTemplateAsMap.get("requirements"));
+ (List<Map<String, RequirementAssignment>>) nodeTemplateAsMap.get("requirements"));
nodeTemplate.setType((String) nodeTemplateAsMap.get("type"));
nodeTemplate.setCapabilities(
- convertCapabilities((Map<String, Object>) nodeTemplateAsMap.get("capabilities")));
+ convertCapabilities((Map<String, Object>) nodeTemplateAsMap.get("capabilities")));
return nodeTemplate;
}
@@ -393,8 +393,8 @@ public class ToscaConverterImpl implements ToscaConverter {
for (Map.Entry<String, Object> capabilityAssignmentEntry : capabilities.entrySet()) {
Map<String, CapabilityAssignment> tempMap = new HashMap<>();
tempMap.put(capabilityAssignmentEntry.getKey(),
- (CapabilityAssignment) createObjectFromClass
- (capabilityAssignmentEntry.getKey(), capabilityAssignmentEntry.getValue(), CapabilityAssignment.class));
+ (CapabilityAssignment) createObjectFromClass
+ (capabilityAssignmentEntry.getKey(), capabilityAssignmentEntry.getValue(), CapabilityAssignment.class));
convertedCapabilities.add(tempMap);
}
return convertedCapabilities;
@@ -408,8 +408,9 @@ public class ToscaConverterImpl implements ToscaConverter {
} catch (Exception e) {
//todo - return error to user?
throw new CoreException(new ErrorCode.ErrorCodeBuilder()
- .withCategory(ErrorCategory.APPLICATION)
- .withMessage("Can't create Node Type from " + nodeTypeId).build());
+ .withCategory(ErrorCategory.APPLICATION)
+ .withMessage("Can't create " + classToCreate.getSimpleName() + " from " +
+ nodeTypeId).build());
}
}