summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core')
-rw-r--r--openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/AbstractToscaConverter.java20
-rw-r--r--openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/AbstractToscaSolConverter.java4
-rw-r--r--openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/ToscaConverterImpl.java10
-rw-r--r--openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/VnfTopologyTemplateConverter.java24
-rw-r--r--openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/services/ServiceTemplateReaderServiceImpl.java30
-rw-r--r--openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/impl/ToscaConverterImplTest.java10
6 files changed, 49 insertions, 49 deletions
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/AbstractToscaConverter.java b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/AbstractToscaConverter.java
index 43ae3c9f38..7168192526 100644
--- a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/AbstractToscaConverter.java
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/AbstractToscaConverter.java
@@ -23,11 +23,11 @@
package org.openecomp.core.impl;
import static org.openecomp.core.converter.datatypes.Constants.ONAP_INDEX;
-import static org.openecomp.core.converter.datatypes.Constants.definitionsDir;
-import static org.openecomp.core.converter.datatypes.Constants.globalStName;
-import static org.openecomp.core.converter.datatypes.Constants.globalSubstitution;
-import static org.openecomp.core.converter.datatypes.Constants.mainStName;
-import static org.openecomp.core.converter.datatypes.Constants.openecompHeatIndex;
+import static org.openecomp.core.converter.datatypes.Constants.DEFINITIONS_DIR;
+import static org.openecomp.core.converter.datatypes.Constants.GLOBAL_ST_NAME;
+import static org.openecomp.core.converter.datatypes.Constants.GLOBAL_SUBSTITUTION;
+import static org.openecomp.core.converter.datatypes.Constants.MAIN_ST_NAME;
+import static org.openecomp.core.converter.datatypes.Constants.OPENECOMP_HEAT_INDEX;
import static org.openecomp.core.impl.GlobalSubstitutionServiceTemplate.GLOBAL_SUBSTITUTION_SERVICE_FILE_NAME;
import static org.openecomp.core.impl.GlobalSubstitutionServiceTemplate.HEAT_INDEX_IMPORT_FILE;
import static org.openecomp.core.impl.GlobalSubstitutionServiceTemplate.ONAP_INDEX_IMPORT_FILE;
@@ -183,9 +183,9 @@ public abstract class AbstractToscaConverter implements ToscaConverter {
private void convertImports(ServiceTemplate serviceTemplate) {
List<Map<String, Import>> imports = new ArrayList<>();
- imports.add(createImportMap(openecompHeatIndex, HEAT_INDEX_IMPORT_FILE));
+ imports.add(createImportMap(OPENECOMP_HEAT_INDEX, HEAT_INDEX_IMPORT_FILE));
imports.add(createImportMap(ONAP_INDEX, ONAP_INDEX_IMPORT_FILE));
- imports.add(createImportMap(globalSubstitution, globalStName));
+ imports.add(createImportMap(GLOBAL_SUBSTITUTION, GLOBAL_ST_NAME));
serviceTemplate.setImports(imports);
}
@@ -264,7 +264,7 @@ public abstract class AbstractToscaConverter implements ToscaConverter {
}
protected boolean isMainServiceTemplate(String fileName) {
- return fileName.endsWith(mainStName);
+ return fileName.endsWith(MAIN_ST_NAME);
}
protected boolean isMetadataFile(String fileName) {
@@ -272,11 +272,11 @@ public abstract class AbstractToscaConverter implements ToscaConverter {
}
protected boolean isGlobalServiceTemplate(String fileName) {
- return fileName.endsWith(globalStName);
+ return fileName.endsWith(GLOBAL_ST_NAME);
}
protected boolean isDefinitions(String fileName) {
- return fileName.startsWith(definitionsDir);
+ return fileName.startsWith(DEFINITIONS_DIR);
}
private String getTemplateNameFromStName(String serviceTemplateName) {
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/AbstractToscaSolConverter.java b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/AbstractToscaSolConverter.java
index f94d2bf5dd..ee669244ce 100644
--- a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/AbstractToscaSolConverter.java
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/AbstractToscaSolConverter.java
@@ -22,7 +22,7 @@
package org.openecomp.core.impl;
-import static org.openecomp.core.converter.datatypes.Constants.globalStName;
+import static org.openecomp.core.converter.datatypes.Constants.GLOBAL_ST_NAME;
import static org.openecomp.sdc.tosca.csar.ToscaMetaEntry.ENTRY_DEFINITIONS;
import static org.openecomp.sdc.tosca.csar.ToscaMetadataFileInfo.TOSCA_META_PATH_FILE_NAME;
@@ -73,7 +73,7 @@ public abstract class AbstractToscaSolConverter extends AbstractToscaConverter {
for (Map.Entry<String, byte[]> fileEntry : csarFiles.entrySet()) {
if (!handledDefinitionFilesList.contains(fileEntry.getKey()) && !isMetadataFile(fileEntry.getKey())) {
if (isGlobalServiceTemplate(fileEntry.getKey())) {
- handleServiceTemplate(globalStName, fileEntry.getKey(), csarFiles, serviceTemplates);
+ handleServiceTemplate(GLOBAL_ST_NAME, fileEntry.getKey(), csarFiles, serviceTemplates);
} else {
artifacts.addFile(
getConcreteArtifactFileName(fileEntry.getKey()), fileEntry.getValue());
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 fcc6f0ab31..6f50205f44 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
@@ -25,8 +25,8 @@ import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
import java.util.HashMap;
import java.util.Map;
-import static org.openecomp.core.converter.datatypes.Constants.globalStName;
-import static org.openecomp.core.converter.datatypes.Constants.mainStName;
+import static org.openecomp.core.converter.datatypes.Constants.GLOBAL_ST_NAME;
+import static org.openecomp.core.converter.datatypes.Constants.MAIN_ST_NAME;
public class ToscaConverterImpl extends AbstractToscaConverter {
@@ -42,11 +42,11 @@ public class ToscaConverterImpl extends AbstractToscaConverter {
CsarFileTypes fileType = getFileType(fileEntry.getKey());
switch (fileType) {
case mainServiceTemplate:
- handleServiceTemplate(mainStName, fileEntry.getKey(), csarFiles, serviceTemplates);
+ handleServiceTemplate(MAIN_ST_NAME, fileEntry.getKey(), csarFiles, serviceTemplates);
break;
case globalServiceTemplate:
- handleServiceTemplate(globalStName, fileEntry.getKey(), csarFiles, serviceTemplates);
+ handleServiceTemplate(GLOBAL_ST_NAME, fileEntry.getKey(), csarFiles, serviceTemplates);
break;
case externalFile:
@@ -63,7 +63,7 @@ public class ToscaConverterImpl extends AbstractToscaConverter {
}
}
handleMetadataFile(csarFiles);
- updateToscaServiceModel(toscaServiceModel, serviceTemplates, artifacts, gsst, csarFiles, mainStName);
+ updateToscaServiceModel(toscaServiceModel, serviceTemplates, artifacts, gsst, csarFiles, MAIN_ST_NAME);
return toscaServiceModel;
}
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/VnfTopologyTemplateConverter.java b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/VnfTopologyTemplateConverter.java
index b676fb2fad..f902309c68 100644
--- a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/VnfTopologyTemplateConverter.java
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/VnfTopologyTemplateConverter.java
@@ -45,11 +45,11 @@ import java.util.Map;
import java.util.Objects;
import java.util.Optional;
-import static org.openecomp.core.converter.datatypes.Constants.capabilities;
-import static org.openecomp.core.converter.datatypes.Constants.inputs;
-import static org.openecomp.core.converter.datatypes.Constants.nodeType;
-import static org.openecomp.core.converter.datatypes.Constants.outputs;
-import static org.openecomp.core.converter.datatypes.Constants.requirements;
+import static org.openecomp.core.converter.datatypes.Constants.CAPABILITIES;
+import static org.openecomp.core.converter.datatypes.Constants.INPUTS;
+import static org.openecomp.core.converter.datatypes.Constants.NODE_TYPE;
+import static org.openecomp.core.converter.datatypes.Constants.OUTPUTS;
+import static org.openecomp.core.converter.datatypes.Constants.REQUIREMENTS;
public class VnfTopologyTemplateConverter {
@@ -63,12 +63,12 @@ public class VnfTopologyTemplateConverter {
private void convertInputs(ServiceTemplate serviceTemplate, ServiceTemplateReaderService readerService) {
Map<String, Object> inputs = readerService.getInputs();
- addInputsOrOutputsToServiceTemplate(serviceTemplate, inputs, Constants.inputs);
+ addInputsOrOutputsToServiceTemplate(serviceTemplate, inputs, Constants.INPUTS);
}
private void convertOutputs(ServiceTemplate serviceTemplate, ServiceTemplateReaderService readerService) {
Map<String, Object> outputs = readerService.getOutputs();
- addInputsOrOutputsToServiceTemplate(serviceTemplate, outputs, Constants.outputs);
+ addInputsOrOutputsToServiceTemplate(serviceTemplate, outputs, Constants.OUTPUTS);
}
private void addInputsOrOutputsToServiceTemplate(ServiceTemplate serviceTemplate, Map<String, Object> mapToConvert,
@@ -93,9 +93,9 @@ public class VnfTopologyTemplateConverter {
private void addToServiceTemplateAccordingToSection(ServiceTemplate serviceTemplate, String inputsOrOutputs,
String parameterId, ParameterDefinition parameterDefinition) {
- if (inputsOrOutputs.equals(inputs)) {
+ if (inputsOrOutputs.equals(INPUTS)) {
DataModelUtil.addInputParameterToTopologyTemplate(serviceTemplate, parameterId, parameterDefinition);
- } else if (inputsOrOutputs.equals(outputs)) {
+ } else if (inputsOrOutputs.equals(OUTPUTS)) {
DataModelUtil.addOutputParameterToTopologyTemplate(serviceTemplate, parameterId, parameterDefinition);
}
}
@@ -163,11 +163,11 @@ public class VnfTopologyTemplateConverter {
private SubstitutionMapping convertSubstitutionMappings(Map<String, Object> substitutionMappings) {
SubstitutionMapping substitutionMapping = new SubstitutionMapping();
- substitutionMapping.setNode_type((String) substitutionMappings.get(nodeType));
+ substitutionMapping.setNode_type((String) substitutionMappings.get(NODE_TYPE));
substitutionMapping.setCapabilities(
- convertSubstitutionMappingsSections(capabilities, substitutionMappings.get(capabilities)));
+ convertSubstitutionMappingsSections(CAPABILITIES, substitutionMappings.get(CAPABILITIES)));
substitutionMapping.setRequirements(
- convertSubstitutionMappingsSections(requirements, substitutionMappings.get(requirements)));
+ convertSubstitutionMappingsSections(REQUIREMENTS, substitutionMappings.get(REQUIREMENTS)));
return substitutionMapping;
}
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/services/ServiceTemplateReaderServiceImpl.java b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/services/ServiceTemplateReaderServiceImpl.java
index a74ec8eb7c..e39a5a6c2e 100644
--- a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/services/ServiceTemplateReaderServiceImpl.java
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/services/ServiceTemplateReaderServiceImpl.java
@@ -21,13 +21,13 @@
package org.openecomp.core.impl.services;
import static org.openecomp.core.converter.datatypes.Constants.POLICIES;
-import static org.openecomp.core.converter.datatypes.Constants.inputs;
-import static org.openecomp.core.converter.datatypes.Constants.metadata;
-import static org.openecomp.core.converter.datatypes.Constants.nodeTemplates;
-import static org.openecomp.core.converter.datatypes.Constants.nodeTypes;
-import static org.openecomp.core.converter.datatypes.Constants.outputs;
-import static org.openecomp.core.converter.datatypes.Constants.substitutionMappings;
-import static org.openecomp.core.converter.datatypes.Constants.topologyTemplate;
+import static org.openecomp.core.converter.datatypes.Constants.INPUTS;
+import static org.openecomp.core.converter.datatypes.Constants.METADATA;
+import static org.openecomp.core.converter.datatypes.Constants.NODE_TEMPLATES;
+import static org.openecomp.core.converter.datatypes.Constants.NODE_TYPES;
+import static org.openecomp.core.converter.datatypes.Constants.OUTPUTS;
+import static org.openecomp.core.converter.datatypes.Constants.SUBSTITUTION_MAPPINGS;
+import static org.openecomp.core.converter.datatypes.Constants.TOPOLOGY_TEMPLATE;
import static org.openecomp.sdc.be.utils.TypeUtils.ToscaTagNamesEnum.DATA_TYPES;
import static org.openecomp.sdc.be.utils.TypeUtils.ToscaTagNamesEnum.IMPORTS;
import static org.openecomp.sdc.be.utils.TypeUtils.ToscaTagNamesEnum.TOSCA_VERSION;
@@ -72,7 +72,7 @@ public class ServiceTemplateReaderServiceImpl implements ServiceTemplateReaderSe
@Override
public Object getMetadata() {
- return this.readServiceTemplate.get(metadata);
+ return this.readServiceTemplate.get(METADATA);
}
@Override
@@ -82,38 +82,38 @@ public class ServiceTemplateReaderServiceImpl implements ServiceTemplateReaderSe
@Override
public Map<String, Object> getNodeTypes() {
- return Objects.isNull(this.readServiceTemplate.get(nodeTypes)) ? new HashMap<>()
- : (Map<String, Object>) this.readServiceTemplate.get(nodeTypes);
+ return Objects.isNull(this.readServiceTemplate.get(NODE_TYPES)) ? new HashMap<>()
+ : (Map<String, Object>) this.readServiceTemplate.get(NODE_TYPES);
}
@Override
public Object getTopologyTemplate() {
- return this.readServiceTemplate.get(topologyTemplate);
+ return this.readServiceTemplate.get(TOPOLOGY_TEMPLATE);
}
@Override
public Map<String, Object> getNodeTemplates() {
return Objects.isNull(this.getTopologyTemplate()) ? new HashMap<>()
- : (Map<String, Object>) ((Map<String, Object>) this.getTopologyTemplate()).get(nodeTemplates);
+ : (Map<String, Object>) ((Map<String, Object>) this.getTopologyTemplate()).get(NODE_TEMPLATES);
}
@Override
public Map<String, Object> getInputs() {
return Objects.isNull(this.getTopologyTemplate()) ? new HashMap<>()
- : (Map<String, Object>) ((Map<String, Object>) this.getTopologyTemplate()).get(inputs);
+ : (Map<String, Object>) ((Map<String, Object>) this.getTopologyTemplate()).get(INPUTS);
}
@Override
public Map<String, Object> getOutputs() {
return Objects.isNull(this.getTopologyTemplate()) ? new HashMap<>()
- : (Map<String, Object>) ((Map<String, Object>) this.getTopologyTemplate()).get(outputs);
+ : (Map<String, Object>) ((Map<String, Object>) this.getTopologyTemplate()).get(OUTPUTS);
}
@Override
public Map<String, Object> getSubstitutionMappings() {
return Objects.isNull(this.getTopologyTemplate()) ? new HashMap<>()
: (Map<String, Object>) ((Map<String, Object>) this.getTopologyTemplate())
- .get(substitutionMappings);
+ .get(SUBSTITUTION_MAPPINGS);
}
@Override
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/impl/ToscaConverterImplTest.java b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/impl/ToscaConverterImplTest.java
index bcfc3d8eda..5d25635a0e 100644
--- a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/impl/ToscaConverterImplTest.java
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/impl/ToscaConverterImplTest.java
@@ -41,8 +41,8 @@ import java.util.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
-import static org.openecomp.core.converter.datatypes.Constants.globalStName;
-import static org.openecomp.core.converter.datatypes.Constants.mainStName;
+import static org.openecomp.core.converter.datatypes.Constants.GLOBAL_ST_NAME;
+import static org.openecomp.core.converter.datatypes.Constants.MAIN_ST_NAME;
public class ToscaConverterImplTest {
@@ -167,7 +167,7 @@ public class ToscaConverterImplTest {
private void validateConvertorOutput(String outputFilesPath, ToscaServiceModel toscaServiceModel)
throws IOException {
- ServiceTemplate mainSt = toscaServiceModel.getServiceTemplates().get(mainStName);
+ ServiceTemplate mainSt = toscaServiceModel.getServiceTemplates().get(MAIN_ST_NAME);
Map<String, ServiceTemplate> expectedOutserviceTemplates = new HashMap<>();
loadServiceTemplates(outputFilesPath, new ToscaExtensionYamlUtil(),
expectedOutserviceTemplates);
@@ -227,12 +227,12 @@ public class ToscaConverterImplTest {
YamlUtil yamlUtil = new YamlUtil();
if (Objects.nonNull(gloablSubstitutionServiceTemplate)) {
assertEquals("difference global substitution service template: ",
- yamlUtil.objectToYaml(expectedOutserviceTemplates.get(globalStName)),
+ yamlUtil.objectToYaml(expectedOutserviceTemplates.get(GLOBAL_ST_NAME)),
yamlUtil.objectToYaml(gloablSubstitutionServiceTemplate));
}
if (Objects.nonNull(mainServiceTemplate)) {
assertEquals("difference main service template: ",
- yamlUtil.objectToYaml(expectedOutserviceTemplates.get(mainStName)),
+ yamlUtil.objectToYaml(expectedOutserviceTemplates.get(MAIN_ST_NAME)),
yamlUtil.objectToYaml(mainServiceTemplate));
}
}