diff options
Diffstat (limited to 'openecomp-be/lib/openecomp-heat-lib')
6 files changed, 22 insertions, 6 deletions
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/HeatBoolean.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/HeatBoolean.java index 249dcaf4a5..f0bb253a4b 100644 --- a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/HeatBoolean.java +++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/HeatBoolean.java @@ -24,6 +24,8 @@ import org.openecomp.sdc.common.errors.CoreException; import org.openecomp.sdc.common.errors.ErrorCategory; import org.openecomp.sdc.common.errors.ErrorCode; import org.openecomp.sdc.heat.services.ErrorCodes; +import org.openecomp.sdc.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; import java.util.HashSet; import java.util.Set; @@ -33,6 +35,8 @@ public class HeatBoolean { private static Set<Object> heatFalse; private static Set<Object> heatTrue; + private final static Logger log = (Logger) LoggerFactory.getLogger(HeatBoolean.class.getName()); + static { @@ -90,6 +94,7 @@ public class HeatBoolean { Boolean answer = eval(value); return true; } catch (CoreException ce) { + log.debug("",ce); return false; } } diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/manifest/FileData.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/manifest/FileData.java index dd487603e1..81bf2fa5a9 100644 --- a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/manifest/FileData.java +++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/manifest/FileData.java @@ -31,7 +31,7 @@ import java.util.function.Predicate; public class FileData { - public static Set<Type> heatFileTypes = + protected static final Set<Type> heatFileTypes = new HashSet<>(Arrays.asList(Type.HEAT, Type.HEAT_NET, Type.HEAT_VOL)); private Boolean isBase; private String file; diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/HeatTreeManager.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/HeatTreeManager.java index def773d712..372c09cffe 100644 --- a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/HeatTreeManager.java +++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/HeatTreeManager.java @@ -23,7 +23,6 @@ package org.openecomp.sdc.heat.services.tree; import org.openecomp.core.utilities.file.FileContentHandler; import org.openecomp.core.utilities.file.FileUtils; import org.openecomp.core.utilities.json.JsonUtil; -import org.openecomp.sdc.tosca.services.YamlUtil; import org.openecomp.core.validation.types.GlobalValidationContext; import org.openecomp.sdc.common.utils.SdcCommon; import org.openecomp.sdc.datatypes.error.ErrorMessage; @@ -34,6 +33,7 @@ import org.openecomp.sdc.heat.datatypes.structure.Artifact; import org.openecomp.sdc.heat.datatypes.structure.HeatStructureTree; import org.openecomp.sdc.logging.api.Logger; import org.openecomp.sdc.logging.api.LoggerFactory; +import org.openecomp.sdc.tosca.services.YamlUtil; import java.io.InputStream; import java.util.HashMap; @@ -101,10 +101,14 @@ public class HeatTreeManager { .values().stream().filter(heatStructureTree -> tree.getHeat().contains(heatStructureTree)) .forEach(heatStructureTree -> tree.getHeat().remove(heatStructureTree)); - heatContentMap.getFileList().stream().filter(fileName -> !manifestFiles.contains(fileName)) + heatContentMap.getFileList().stream().filter(fileName -> isNotInManifestFiles(fileName)) .forEach(fileName -> addTreeOther(fileName)); } + private boolean isNotInManifestFiles(String fileName) { + return !manifestFiles.contains(fileName); + } + private void addTreeOther(String fileName) { if (tree.getOther() == null) { tree.setOther(new HashSet<>()); @@ -132,7 +136,9 @@ public class HeatTreeManager { Set<String> artifactSet = HeatTreeManagerUtil.getArtifactFiles(filename, hot, globalContext); addHeatArtifactFiles(fileHeatStructureTree, artifactSet); - } catch (Exception ignore) { /* invalid yaml no need to process reference */ } + } catch (Exception ignore) { /* invalid yaml no need to process reference */ + logger.debug("",ignore); + } } diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/HeatTreeManagerUtil.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/HeatTreeManagerUtil.java index b8df50b87c..3802018c99 100644 --- a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/HeatTreeManagerUtil.java +++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/HeatTreeManagerUtil.java @@ -166,7 +166,7 @@ public class HeatTreeManagerUtil { Map<String, Object> resourceDefValueMap = resource.getProperties() == null ? null : (Map<String, Object>) resource.getProperties().get( PropertiesMapKeyTypes.RESOURCE_DEF.getKeyMap()); - if (MapUtils.isNotEmpty(resourceDefValueMap)) { + if (MapUtils.isNotEmpty(resourceDefValueMap) && resourceDefValueMap != null) { Object resourceDefType = resourceDefValueMap.get("type"); if (Objects.nonNull(resourceDefType)) { if (resourceDefType instanceof String) { diff --git a/openecomp-be/lib/openecomp-heat-lib/src/test/java/org/openecomp/sdc/heat/datatypes/model/EnvironmentTest.java b/openecomp-be/lib/openecomp-heat-lib/src/test/java/org/openecomp/sdc/heat/datatypes/model/EnvironmentTest.java index c99eda7309..fc01e2e8b0 100644 --- a/openecomp-be/lib/openecomp-heat-lib/src/test/java/org/openecomp/sdc/heat/datatypes/model/EnvironmentTest.java +++ b/openecomp-be/lib/openecomp-heat-lib/src/test/java/org/openecomp/sdc/heat/datatypes/model/EnvironmentTest.java @@ -48,7 +48,7 @@ public class EnvironmentTest { } else { String heatResourceNameSuffix = heatResourceName.substring(lastIndexOfUnderscore + 1); try { - Integer.parseInt(heatResourceNameSuffix); + int heatResourceNameSuffixInt = Integer.parseInt(heatResourceNameSuffix); System.out.println(heatResourceName.substring(0, lastIndexOfUnderscore)); } catch (NumberFormatException ignored) { System.out.println(heatResourceName); diff --git a/openecomp-be/lib/openecomp-heat-lib/src/test/java/org/openecomp/sdc/heat/datatypes/model/HeatOrchestrationTemplateTest.java b/openecomp-be/lib/openecomp-heat-lib/src/test/java/org/openecomp/sdc/heat/datatypes/model/HeatOrchestrationTemplateTest.java index ec5c7526e3..3715b0f999 100644 --- a/openecomp-be/lib/openecomp-heat-lib/src/test/java/org/openecomp/sdc/heat/datatypes/model/HeatOrchestrationTemplateTest.java +++ b/openecomp-be/lib/openecomp-heat-lib/src/test/java/org/openecomp/sdc/heat/datatypes/model/HeatOrchestrationTemplateTest.java @@ -22,6 +22,8 @@ package org.openecomp.sdc.heat.datatypes.model; import org.junit.Assert; import org.junit.Test; +import org.openecomp.sdc.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; import org.openecomp.sdc.tosca.services.YamlUtil; import java.io.InputStream; @@ -32,6 +34,8 @@ import java.util.Map; public class HeatOrchestrationTemplateTest { + private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName()); + @Test public void testYamlToServiceTemplateObj() { YamlUtil yamlUtil = new YamlUtil(); @@ -99,6 +103,7 @@ public class HeatOrchestrationTemplateTest { yamlUtil.yamlToObject(yml, HeatOrchestrationTemplate.class); Assert.assertNotNull(heatOrchestrationTemplate); } catch (Exception ignored) { + log.debug("",ignored); } } |