aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be')
-rw-r--r--openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/src/main/java/org/openecomp/core/converter/datatypes/Constants.java1
-rw-r--r--openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/services/ServiceTemplateReaderServiceImpl.java3
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/impl/ToscaAnalyzerServiceImpl.java5
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/impl/ToscaValidationServiceImpl.java14
4 files changed, 12 insertions, 11 deletions
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/src/main/java/org/openecomp/core/converter/datatypes/Constants.java b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/src/main/java/org/openecomp/core/converter/datatypes/Constants.java
index 18e6a49aa5..c9f5548681 100644
--- a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/src/main/java/org/openecomp/core/converter/datatypes/Constants.java
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/src/main/java/org/openecomp/core/converter/datatypes/Constants.java
@@ -26,7 +26,6 @@ public class Constants {
public static final String metadataFile = "TOSCA-Metadata/TOSCA.meta";
- public static final String definitionVersion = "tosca_definitions_version";
private static final String DEFAULT_NAMESPACE = "tosca_default_namespace";
private static final String TEMPLATE_NAME = "template_name";
public static final String topologyTemplate = "topology_template";
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 f41caff349..9b1c0126c7 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
@@ -28,6 +28,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
+import org.openecomp.sdc.be.utils.TypeUtils.ToscaTagNamesEnum;
import static org.openecomp.core.converter.datatypes.Constants.*;
@@ -69,7 +70,7 @@ public class ServiceTemplateReaderServiceImpl implements ServiceTemplateReaderSe
@Override
public Object getToscaVersion() {
- return this.readServiceTemplate.get(definitionVersion);
+ return this.readServiceTemplate.get(ToscaTagNamesEnum.TOSCA_VERSION.getElementName());
}
@Override
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/impl/ToscaAnalyzerServiceImpl.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/impl/ToscaAnalyzerServiceImpl.java
index 1bc547aed7..3ce9badea0 100644
--- a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/impl/ToscaAnalyzerServiceImpl.java
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/impl/ToscaAnalyzerServiceImpl.java
@@ -56,6 +56,7 @@ import org.onap.sdc.tosca.services.YamlUtil;
import org.openecomp.core.utilities.CommonMethods;
import org.openecomp.core.utilities.file.FileContentHandler;
import org.openecomp.core.utilities.file.FileUtils;
+import org.openecomp.sdc.be.utils.TypeUtils.ToscaTagNamesEnum;
import org.openecomp.sdc.common.errors.CoreException;
import org.openecomp.sdc.common.errors.SdcRuntimeException;
import org.openecomp.sdc.common.zip.ZipUtils;
@@ -192,8 +193,8 @@ public class ToscaAnalyzerServiceImpl implements ToscaAnalyzerService {
}
private boolean isToscaYamlFile(byte[] fileContent) {
- Map fileMap = new YamlUtil().yamlToObject(new String(fileContent), Map.class);
- return fileMap.containsKey("tosca_definitions_version");
+ final Map fileMap = new YamlUtil().yamlToObject(new String(fileContent), Map.class);
+ return fileMap.containsKey(ToscaTagNamesEnum.TOSCA_VERSION.getElementName());
}
private void updateMinMaxOccurencesForNodeTypeRequirement(Map.Entry<String, RequirementAssignment> entry,
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/impl/ToscaValidationServiceImpl.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/impl/ToscaValidationServiceImpl.java
index 0394073e57..9f3dd0790f 100644
--- a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/impl/ToscaValidationServiceImpl.java
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/impl/ToscaValidationServiceImpl.java
@@ -26,6 +26,7 @@ import org.openecomp.core.utilities.file.FileUtils;
import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum;
import org.openecomp.core.validation.ErrorMessageCode;
import org.openecomp.core.validation.errors.ErrorMessagesFormatBuilder;
+import org.openecomp.sdc.be.utils.TypeUtils.ToscaTagNamesEnum;
import org.openecomp.sdc.datatypes.error.ErrorLevel;
import org.openecomp.sdc.datatypes.error.ErrorMessage;
import org.openecomp.sdc.logging.api.Logger;
@@ -55,7 +56,6 @@ public class ToscaValidationServiceImpl implements ToscaValidationService {
private static final String SDCPARSER_JTOSCA_VALIDATIONISSUE_CONFIG =
"SDCParser_jtosca-validation-issue-configuration.yaml";
private static final String SDCPARSER_ERROR_CONFIG = "SDCParser_error-configuration.yaml";
- private static final String TOSCA_DEFINITION_VERSION = "tosca_definitions_version";
static {
// Override default SDC Parser configuration
@@ -119,17 +119,17 @@ public class ToscaValidationServiceImpl implements ToscaValidationService {
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
}
- private boolean isToscaYaml(String filePath) {
+ private boolean isToscaYaml(final String filePath) {
boolean retValue = false;
- try (InputStream input = new BufferedInputStream(new FileInputStream(new File(filePath)));) {
- Yaml yaml = new Yaml();
- LinkedHashMap<String,Object> data = (LinkedHashMap) yaml.load(input);
- if(data.get(TOSCA_DEFINITION_VERSION) != null) {
+ try (final InputStream input = new BufferedInputStream(new FileInputStream(new File(filePath)));) {
+ final Yaml yaml = new Yaml();
+ final LinkedHashMap<String,Object> data = (LinkedHashMap) yaml.load(input);
+ if(data.get(ToscaTagNamesEnum.TOSCA_VERSION.getElementName()) != null) {
retValue = true;
}
}
- catch(Exception e){
+ catch(final Exception e){
LOGGER.info("Ignore the exception as the input file may not be a Tosca Yaml; let the " +
"default value return", e);
}