diff options
Diffstat (limited to 'openecomp-be/lib/openecomp-heat-lib/src')
2 files changed, 14 insertions, 11 deletions
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 fc01e2e8b0..6312e5a575 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 @@ -23,16 +23,18 @@ package org.openecomp.sdc.heat.datatypes.model; import org.junit.Test; import org.openecomp.sdc.tosca.services.YamlUtil; +import java.io.IOException; import java.io.InputStream; public class EnvironmentTest { @Test - public void testYamlToServiceTemplateObj() { + public void testYamlToServiceTemplateObj() throws IOException { YamlUtil yamlUtil = new YamlUtil(); - InputStream yamlFile = yamlUtil.loadYamlFileIs("/mock/model/envSettings.env"); - Environment envVars = yamlUtil.yamlToObject(yamlFile, Environment.class); - envVars.toString(); + try (InputStream yamlFile = yamlUtil.loadYamlFileIs("/mock/model/envSettings.env")) { + Environment envVars = yamlUtil.yamlToObject(yamlFile, Environment.class); + envVars.toString(); + } } @Test @@ -46,9 +48,8 @@ public class EnvironmentTest { if (heatResourceName.length() == lastIndexOfUnderscore) { System.out.println(heatResourceName); } else { - String heatResourceNameSuffix = heatResourceName.substring(lastIndexOfUnderscore + 1); + try { - 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 3715b0f999..dd8abdc0b9 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 @@ -26,6 +26,7 @@ import org.openecomp.sdc.logging.api.Logger; import org.openecomp.sdc.logging.api.LoggerFactory; import org.openecomp.sdc.tosca.services.YamlUtil; +import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.HashMap; @@ -37,12 +38,13 @@ public class HeatOrchestrationTemplateTest { private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName()); @Test - public void testYamlToServiceTemplateObj() { + public void testYamlToServiceTemplateObj() throws IOException { YamlUtil yamlUtil = new YamlUtil(); - InputStream yamlFile = yamlUtil.loadYamlFileIs("/mock/model/testHeat.yml"); - HeatOrchestrationTemplate heatOrchestrationTemplate = - yamlUtil.yamlToObject(yamlFile, HeatOrchestrationTemplate.class); - heatOrchestrationTemplate.toString(); + try (InputStream yamlFile = yamlUtil.loadYamlFileIs("/mock/model/testHeat.yml")) { + HeatOrchestrationTemplate heatOrchestrationTemplate = + yamlUtil.yamlToObject(yamlFile, HeatOrchestrationTemplate.class); + heatOrchestrationTemplate.toString(); + } } @Test |