From e82432429b960c9de5be12360bded3e89c45ead3 Mon Sep 17 00:00:00 2001 From: Pavel Aharoni Date: Wed, 17 May 2017 15:10:58 +0300 Subject: [SDC-20] fix toString loop and validation Change-Id: I24f5cdc52bf1c054fed1557ecf877d87c1fa6a34 Signed-off-by: Pavel Aharoni --- .../java/org/openecomp/test/CsarToscaTester.java | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'sdc-distribution-ci/src/main/java') diff --git a/sdc-distribution-ci/src/main/java/org/openecomp/test/CsarToscaTester.java b/sdc-distribution-ci/src/main/java/org/openecomp/test/CsarToscaTester.java index 068ef24..b07de08 100644 --- a/sdc-distribution-ci/src/main/java/org/openecomp/test/CsarToscaTester.java +++ b/sdc-distribution-ci/src/main/java/org/openecomp/test/CsarToscaTester.java @@ -27,7 +27,8 @@ public class CsarToscaTester { Date now = new Date(); SimpleDateFormat dateFormat = new SimpleDateFormat("d-MM-y-HH_mm_ss"); String time = dateFormat.format(now); - File dir = new File(args[1].toString() + "/csar-reports-" + time); + String csarsDir = args[1].toString() + "/csar-reports-" + time; + File dir = new File(csarsDir); dir.mkdir(); @@ -35,7 +36,10 @@ public class CsarToscaTester { if (file.isFile()) { System.out.println("File " + file.getAbsolutePath()); ExceptionCollector.clear(); - + String name = file.getName(); + String currentCsarDir = csarsDir+"/"+name+"-"+time; + dir = new File(currentCsarDir); + dir.mkdir(); ISdcCsarHelper csarHelper = factory.getSdcCsarHelper(file.getAbsolutePath()); List vflist = csarHelper.getServiceVfList(); List inputs = csarHelper.getServiceInputs(); @@ -44,18 +48,19 @@ public class CsarToscaTester { List warningsReport = ExceptionCollector.getWarningsReport(); //System.out.println("WARNINGS during CSAR parsing are: " + (warningsReport != null ? warningsReport.toString() : "none")); + if (!exceptionReport.isEmpty()) { try { - fw = new FileWriter(new File(dir + "/" + exceptionReport.size() / 2 + "-critical-" + file.getName() + ".txt")); + fw = new FileWriter(new File(currentCsarDir + "/" + exceptionReport.size() / 2 + "-critical-" + name +"-"+time + ".txt")); for (String exception : exceptionReport) { fw.write(exception); fw.write("\r\n"); } fw.close(); - fw = new FileWriter(new File(dir + "/" + warningsReport.size() / 2 + "-warning-" + file.getName() + ".txt")); + fw = new FileWriter(new File(currentCsarDir + "/" + warningsReport.size() / 2 + "-warning-" + name +"-"+time + ".txt")); for (String warning : warningsReport) { fw.write(warning); fw.write("\r\n"); @@ -63,6 +68,14 @@ public class CsarToscaTester { fw.close(); + //TODO + fw = new FileWriter(new File(currentCsarDir + "/" + exceptionReport.size() / 2 + "-critical-" + name +"-"+time + ".txt")); + for (String critical : exceptionReport) { + fw.write(critical); + fw.write("\r\n"); + } + fw.close(); + } catch (IOException ex) { ex.printStackTrace(); } -- cgit 1.2.3-korg