From 9a699253cf15450615b3df93ed38a492cbd33d3f Mon Sep 17 00:00:00 2001 From: shrikantawachar Date: Fri, 6 Apr 2018 11:07:00 +0530 Subject: Reducing onboarding backend maven build time Reducing onboarding backend maven build time Change-Id: I3fe5f8d6d9b21591018243d16809451c6b8c2d14 Issue-ID: SDC-1189 Signed-off-by: shrikantawachar --- .../services/impl/ToscaFileOutputServiceCsarImplTest.java | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'openecomp-be/lib/openecomp-tosca-lib/src/test/java/org') 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 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 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())); } } -- cgit 1.2.3-korg