diff options
Diffstat (limited to 'openecomp-be/lib/openecomp-tosca-lib/src/test')
-rw-r--r-- | openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/services/impl/ToscaFileOutputServiceCsarImplTest.java | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/services/impl/ToscaFileOutputServiceCsarImplTest.java b/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/services/impl/ToscaFileOutputServiceCsarImplTest.java index 0910684f3a..445915f4f8 100644 --- a/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/services/impl/ToscaFileOutputServiceCsarImplTest.java +++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/services/impl/ToscaFileOutputServiceCsarImplTest.java @@ -111,13 +111,12 @@ public class ToscaFileOutputServiceCsarImplTest { new ToscaServiceModel(heatFiles, definitionsInput, ToscaUtil.getServiceTemplateFileName(mainServiceTemplate)), licenseArtifactsFiles); - String resultFileName = "resultFile.zip"; - File file = new File(resultFileName); + File file = File.createTempFile("resultFile", "zip"); try (FileOutputStream fos = new FileOutputStream(file)) { fos.write(csarFile); } - try (ZipFile zipFile = new ZipFile(resultFileName)) { + try (ZipFile zipFile = new ZipFile(file)) { Enumeration<? extends ZipEntry> entries = zipFile.entries(); @@ -126,10 +125,9 @@ public class ToscaFileOutputServiceCsarImplTest { count++; entries.nextElement(); } - Assert.assertEquals(7, count); } - Files.delete(Paths.get(file.getPath())); + Files.delete(Paths.get(file.getAbsolutePath())); } @Test @@ -152,13 +150,12 @@ public class ToscaFileOutputServiceCsarImplTest { null); - String resultFileName = "resultFile.zip"; - File file = new File(resultFileName); + File file = File.createTempFile("resultFile", "zip"); try (FileOutputStream fos = new FileOutputStream(file)) { fos.write(csarFile); } - try (ZipFile zipFile = new ZipFile(resultFileName)) { + try (ZipFile zipFile = new ZipFile(file)) { Enumeration<? extends ZipEntry> entries = zipFile.entries(); @@ -170,6 +167,6 @@ public class ToscaFileOutputServiceCsarImplTest { Assert.assertEquals(2, count); } - Files.delete(Paths.get(file.getPath())); + Files.delete(Paths.get(file.getAbsolutePath())); } } |