diff options
author | Francis Toth <francis.toth@yoppworks.com> | 2020-06-18 15:30:26 -0400 |
---|---|---|
committer | Francis Toth <francis.toth@yoppworks.com> | 2020-06-21 07:34:43 -0400 |
commit | 051fcebef77e7f8c4536ef717a78f05ab1a002ff (patch) | |
tree | 1c735113663946c6f12dde81ed1f468dd365b0d0 /asdctool/src/main | |
parent | 194c4a67301b88783ff7d2587feb66912de5ff94 (diff) |
Decouple TXT Report file writing and formatting logic (3/6)
This commit aims to move the printValidationTaskStatus function's logic from ReportManager (deprecated) to ReportFile.
Signed-off-by: Francis Toth <francis.toth@yoppworks.com>
Change-Id: Ic33a519f4c70276d404a83bf7de8a27f0007b285
Issue-ID: SDC-2499
Diffstat (limited to 'asdctool/src/main')
3 files changed, 15 insertions, 12 deletions
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/TopologyTemplateValidatorExecuter.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/TopologyTemplateValidatorExecuter.java index 967a6c68e5..497e589234 100644 --- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/TopologyTemplateValidatorExecuter.java +++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/executers/TopologyTemplateValidatorExecuter.java @@ -108,7 +108,7 @@ public class TopologyTemplateValidatorExecuter { } else if (successAllTasks && vertexNum == verticesSize) { successTasks.add(task.getTaskName()); } - ReportManager.printValidationTaskStatus(vertex, task.getTaskName(), result.getStatus(), outputFilePath); + reportFile.printValidationTaskStatus(vertex, task.getTaskName(), result.getStatus()); report.addSuccess(vertex.getUniqueId(), task.getTaskName(), result); } String componentScanStatus = successAllTasks ? "success" : "failed"; 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 936ec4b251..f1f084e2a8 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 @@ -65,6 +65,20 @@ public class ReportFile { validatorName + " Validation Started, on " + componentsNum + " components---------"); } + + public void printValidationTaskStatus( + GraphVertex vertexScanned, + String taskName, + boolean success + ) { + String successStatus = success ? "success" : "failed"; + writer.writeln(""); + writer.writeln("-----------------------Vertex: " + + vertexScanned.getUniqueId() + ", Task " + + taskName + " " + successStatus + + "-----------------------" + ); + } } /** 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 63e7ebe071..3149d049c1 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 @@ -59,17 +59,6 @@ public class ReportManager { } } - public static void printValidationTaskStatus(GraphVertex vertexScanned, String taskName, boolean success, - String outputFilePath) { - String successStatus = success ? "success" : "failed"; - String line = - "-----------------------Vertex: " + vertexScanned.getUniqueId() + ", Task " + taskName + " " + successStatus - + "-----------------------"; - StrBuilder sb = new StrBuilder(); - sb.appendln(line); - writeReportLineToFile(line, outputFilePath); - } - public static void writeReportLineToFile(String message, String outputFilePath) { try { Files.write(Paths.get(outputFilePath), new StrBuilder().appendNewLine().toString().getBytes(), |