summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAravindhan123 <aravindhan.r@amdocs.com>2017-12-12 14:55:31 +0530
committerVitaly Emporopulo <Vitaliy.Emporopulo@amdocs.com>2018-01-04 14:59:41 +0000
commit7b9c6ebc95a237b2657d0619d72f64466c80b2eb (patch)
treece45e376554c860d01d56dc454f560f1a0de2fb8
parenta0897881ae1dce8bd78d1a8ea67b6e053f8ca6ae (diff)
Fix Sonar Issues
Handles translator-core ToscaConverterImpl violations. Change-Id: I751ffdde851e23a977c6c05fc1fe5551f247a670 Issue-ID: SDC-343 Signed-off-by: Aravindhan123 <Aravindhan.r@amdocs.com>
-rw-r--r--openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/ToscaConverterImpl.java30
1 files changed, 15 insertions, 15 deletions
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 9b3a300934..a5421c0be8 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
@@ -67,6 +67,7 @@ import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -77,9 +78,7 @@ import java.util.regex.Pattern;
public class ToscaConverterImpl implements ToscaConverter {
- public ToscaConverterImpl() {
-
- }
+ private static final String ORIGINAL = ".original";
@Override
public ToscaServiceModel convert(FileContentHandler fileContentHandler)
@@ -108,6 +107,9 @@ public class ToscaConverterImpl implements ToscaConverter {
case definitionsFile:
handleDefintionTemplate(fileEntry.getKey(), csarFiles, gsst);
break;
+
+ default:
+ break;
}
}
handleMetadataFile(csarFiles);
@@ -118,7 +120,7 @@ public class ToscaConverterImpl implements ToscaConverter {
private void handleMetadataFile(Map<String, byte[]> csarFiles) {
byte[] bytes = csarFiles.remove(metadataFile);
if (bytes != null) {
- csarFiles.put(metadataFile + ".original", bytes);
+ csarFiles.put(metadataFile + ORIGINAL, bytes);
}
}
@@ -159,8 +161,8 @@ public class ToscaConverterImpl implements ToscaConverter {
addGlobalServiceTemplates(globalServiceTemplates, serviceTemplates);
toscaServiceModel.setEntryDefinitionServiceTemplate(mainStName);
toscaServiceModel.setServiceTemplates(serviceTemplates);
- externalFilesHandler.addFile(metadataFile + ".original",
- csarFiles.get(metadataFile + ".original"));
+ externalFilesHandler.addFile(metadataFile + ORIGINAL,
+ csarFiles.get(metadataFile + ORIGINAL));
toscaServiceModel.setArtifactFiles(externalFilesHandler);
if(MapUtils.isNotEmpty(globalSubstitutionServiceTemplate.getNode_types())) {
@@ -277,7 +279,7 @@ public class ToscaConverterImpl implements ToscaConverter {
}
private void convertNodeTypes(ServiceTemplate serviceTemplate, ServiceTemplateReaderService readerService) {
- Map<String, Object> nodeTypes = (Map<String, Object>) readerService.getNodeTypes();
+ Map<String, Object> nodeTypes = readerService.getNodeTypes();
if (MapUtils.isEmpty(nodeTypes)) {
return;
}
@@ -339,14 +341,12 @@ public class ToscaConverterImpl implements ToscaConverter {
String inputsOrOutputs,
String parameterId,
ParameterDefinition parameterDefinition) {
- switch (inputsOrOutputs) {
- case inputs:
- DataModelUtil
- .addInputParameterToTopologyTemplate(serviceTemplate, parameterId, parameterDefinition);
- break;
- case outputs:
- DataModelUtil
- .addOutputParameterToTopologyTemplate(serviceTemplate, parameterId, parameterDefinition);
+ if (inputsOrOutputs.equals(inputs)) {
+ DataModelUtil
+ .addInputParameterToTopologyTemplate(serviceTemplate, parameterId, parameterDefinition);
+ } else if (inputsOrOutputs.equals(outputs)) {
+ DataModelUtil
+ .addOutputParameterToTopologyTemplate(serviceTemplate, parameterId, parameterDefinition);
}
}