diff options
author | Francis Toth <francis.toth@yoppworks.com> | 2020-06-18 15:46:31 -0400 |
---|---|---|
committer | Ofir Sonsino <ofir.sonsino@intl.att.com> | 2020-06-23 11:28:53 +0000 |
commit | 8c6ad373281722ce410a1108c67de5f1adf350ea (patch) | |
tree | 27bf3bccc1b868b3317806d0e864c4f6a19efb1c /asdctool/src/main | |
parent | 2879d63dbeecdd485394f9f35df0578040b8cf2c (diff) |
Decouple TXT Report file writing and formatting logic (5/6)
This commit aims to move the reportEndOfToolRun function from ReportManager (deprecated) to ReportFile.
Signed-off-by: Francis Toth <francis.toth@yoppworks.com>
Change-Id: I17731864c34ed9a70b1b1e91b89bad835dc72449
Issue-ID: SDC-2499
Diffstat (limited to 'asdctool/src/main')
3 files changed, 16 insertions, 13 deletions
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/report/ReportFile.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/report/ReportFile.java index b22edb6cee..b483964a6e 100644 --- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/report/ReportFile.java +++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/report/ReportFile.java @@ -95,6 +95,21 @@ public class ReportFile { writer.writeln(""); writer.write(sb.toString()); } + + public void reportEndOfToolRun(Report report) { + StrBuilder sb = new StrBuilder(); + sb.appendln("-----------------------------------Validator Tool Summary-----------------------------------"); + report.forEachFailure((taskName, failedVertices) -> { + sb.append("Task: ") + .append(taskName) + .appendNewLine() + .append("FailedVertices: ") + .append(String.valueOf(failedVertices)) + .appendNewLine(); + }); + writer.writeln(""); + writer.write(sb.toString()); + } } /** diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/utils/ReportManager.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/utils/ReportManager.java index a733eec38b..9b09e67c39 100644 --- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/utils/ReportManager.java +++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/utils/ReportManager.java @@ -68,16 +68,4 @@ public class ReportManager { log.info("write to file failed - {}", e.getClass().getSimpleName(), e); } } - - public static void reportEndOfToolRun(Report report, String outputFilePath) { - StrBuilder sb = new StrBuilder(); - sb.appendln("-----------------------------------Validator Tool Summary-----------------------------------"); - report.forEachFailure((taskName, failedVertices) -> { - sb.append("Task: " + taskName); - sb.appendNewLine(); - sb.append("FailedVertices: " + failedVertices); - sb.appendNewLine(); - }); - writeReportLineToFile(sb.toString(), outputFilePath); - } } diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/ValidationTool.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/ValidationTool.java index d84f0a5d69..3bffa0b5e2 100644 --- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/ValidationTool.java +++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/main/ValidationTool.java @@ -59,7 +59,7 @@ public class ValidationTool { log.info("Start Validation Tool"); Report report = Report.make(); boolean result = validationToolBL.validateAll(report, textFile, txtReportFilePath); - ReportManager.reportEndOfToolRun(report, txtReportFilePath); + textFile.reportEndOfToolRun(report); csvFile.printAllResults(report); if (result) { log.info("Validation finished successfully"); |