summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-tosca-converter-lib
diff options
context:
space:
mode:
authorVitaly Emporopulo <Vitaliy.Emporopulo@amdocs.com>2017-10-23 11:22:15 +0000
committerGerrit Code Review <gerrit@onap.org>2017-10-23 11:22:15 +0000
commitb75aaccf629eecac3a68d3d30edec6312fd5ec38 (patch)
tree168a028a87efbd8464735d879db7a3cff28c3ce3 /openecomp-be/lib/openecomp-tosca-converter-lib
parent8e5fc51917be4fc78d55197ca43b2b11fa357856 (diff)
parent5f3a0ea3230fc09bb66a5b6fbd65868fe2a46e6c (diff)
Merge "Fixed resources not being released, code cleanup"
Diffstat (limited to 'openecomp-be/lib/openecomp-tosca-converter-lib')
-rw-r--r--openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/converter/impl/ToscaConverterImplTest.java21
1 files changed, 7 insertions, 14 deletions
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/converter/impl/ToscaConverterImplTest.java b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/converter/impl/ToscaConverterImplTest.java
index f29ca4a427..471e3891c7 100644
--- a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/converter/impl/ToscaConverterImplTest.java
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/converter/impl/ToscaConverterImplTest.java
@@ -41,22 +41,18 @@ public class ToscaConverterImplTest {
private static final String VIRTUAL_LINK = "virtualLink";
private static final String UNBOUNDED = "UNBOUNDED";
- private static String inputFilesPath;
- private static String outputFilesPath;
- private static Map<String, ServiceTemplate> expectedOutserviceTemplates;
-
@Test
public void testConvertMainSt() throws IOException {
- inputFilesPath = "/mock/toscaConverter/convertMainSt/in";
- outputFilesPath = "/mock/toscaConverter/convertMainSt/out";
+ String inputFilesPath = "/mock/toscaConverter/convertMainSt/in";
+ String outputFilesPath = "/mock/toscaConverter/convertMainSt/out";
FileContentHandler fileContentHandler =
createFileContentHandlerFromInput(inputFilesPath);
- expectedOutserviceTemplates = new HashMap<>();
+ Map<String, ServiceTemplate> expectedOutserviceTemplates = new HashMap<>();
loadServiceTemplates(outputFilesPath, new ToscaExtensionYamlUtil(),
- expectedOutserviceTemplates);
+ expectedOutserviceTemplates);
ToscaServiceModel toscaServiceModel = toscaConverter.convert(fileContentHandler);
ServiceTemplate mainSt = toscaServiceModel.getServiceTemplates().get(mainStName);
@@ -201,18 +197,15 @@ public class ToscaConverterImplTest {
private static void addServiceTemplateFiles(Map<String, ServiceTemplate> serviceTemplates,
File[] files,
- ToscaExtensionYamlUtil toscaExtensionYamlUtil)
- throws IOException {
+ ToscaExtensionYamlUtil toscaExtensionYamlUtil) throws IOException {
+
for (File file : files) {
+
try (InputStream yamlFile = new FileInputStream(file)) {
ServiceTemplate serviceTemplateFromYaml =
toscaExtensionYamlUtil.yamlToObject(yamlFile, ServiceTemplate.class);
createConcreteRequirementObjectsInServiceTemplate(serviceTemplateFromYaml, toscaExtensionYamlUtil);
serviceTemplates.put(file.getName(), serviceTemplateFromYaml);
- try {
- yamlFile.close();
- } catch (IOException ignore) {
- }
}
}
}