diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f4e5c6..f320d38 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 removed. - [INTERNAL] Bump [Saxon HE](https://www.saxonica.com/documentation11/documentation.xml) to 11.4 - [INTERNAL] Bump [jaxb-ri](https://github.com/eclipse-ee4j/jaxb-ri) to 2.3.7 +- (CORE) Various other dependency updates. See pom.xml - [INTERNAL] CLI parsing based on pico-cli, commons-cli is removed diff --git a/pom.xml b/pom.xml index 7c005ae..a0ac618 100644 --- a/pom.xml +++ b/pom.xml @@ -54,9 +54,14 @@ UTF-8 - 0.8.7 + 3.23.1 + 2.11.0 + 3.12.0 + 0.8.8 2.3.7 - 1.18.20 + 1.18.24 + 4.8.1 + 5.2.0 11.4 1.7.25 @@ -95,7 +100,7 @@ org.fusesource.jansi jansi - 1.18 + 2.4.0 true @@ -108,7 +113,7 @@ org.apache.commons commons-lang3 - 3.10 + ${version.commons-lang} org.glassfish.jaxb @@ -119,7 +124,7 @@ org.assertj assertj-core - 3.16.1 + ${version.assertj} test @@ -131,7 +136,7 @@ commons-io commons-io - 2.7 + ${version.commons-io} io.rest-assured @@ -142,7 +147,7 @@ org.mockito mockito-core - 3.3.3 + ${version.mockito} test @@ -170,7 +175,7 @@ org.codehaus.mojo build-helper-maven-plugin - 3.1.0 + 3.3.0 reserve-network-port @@ -190,7 +195,7 @@ org.apache.maven.plugins maven-enforcer-plugin - 3.0.0-M2 + 3.1.0 enforce-versions @@ -210,7 +215,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.8.1 + 3.10.1 1.8 1.8 @@ -221,7 +226,7 @@ org.apache.maven.plugins maven-shade-plugin - 3.2.1 + 3.4.1 jdk11+ @@ -294,7 +299,7 @@ org.apache.maven.plugins maven-assembly-plugin - 3.1.1 + 3.4.2 full_dist @@ -319,7 +324,7 @@ org.jvnet.jaxb2.maven2 maven-jaxb2-plugin - 0.14.0 + 0.15.1 @@ -412,7 +417,7 @@ org.apache.maven.plugins maven-surefire-plugin - 2.22.0 + 3.0.0-M7 -Dfile.encoding=UTF-8 ${jacocoSurefire} @@ -422,7 +427,7 @@ org.apache.maven.plugins maven-source-plugin - 3.1.0 + 3.2.1 attach-sources @@ -445,7 +450,7 @@ org.codehaus.mojo exec-maven-plugin - 1.6.0 + 3.1.0 run @@ -482,7 +487,7 @@ org.apache.maven.plugins maven-antrun-plugin - 1.8 + 3.1.0 @@ -503,7 +508,7 @@ org.apache.maven.plugins maven-failsafe-plugin - 2.22.1 + 3.0.0-M7 test-it @@ -522,7 +527,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.2.0 + 3.4.1 8 none diff --git a/src/main/java/de/kosit/validationtool/cmd/InternalCheck.java b/src/main/java/de/kosit/validationtool/cmd/InternalCheck.java index ea5e218..6c27a2e 100644 --- a/src/main/java/de/kosit/validationtool/cmd/InternalCheck.java +++ b/src/main/java/de/kosit/validationtool/cmd/InternalCheck.java @@ -61,9 +61,59 @@ class InternalCheck extends DefaultCheck { super(processor, configuration); } + private static String createStatusLine(final Map results) { + final long acceptable = results.entrySet().stream().filter(e -> e.getValue().isAcceptable()).count(); + final long rejected = results.entrySet().stream().filter(e -> !e.getValue().isAcceptable()).count(); + final long errors = results.entrySet().stream().filter(e -> !e.getValue().isProcessingSuccessful()).count(); + final Line line = new Line(); + line.add("Acceptable: ").add(acceptable, Code.GREEN); + line.add(" Rejected: ").add(rejected, Code.RED); + if (errors > 0) { + line.add(" Processing errors: ").add(errors, Code.RED); + } + return line.render(true, false); + } + + private static Grid createResultGrid(final Map results) { + final Grid grid = new Grid( + //@formatter:off + new ColumnDefinition("File", 60, 10, 1), + new ColumnDefinition("Schema", 7).justify(Justify.CENTER), + new ColumnDefinition("Schematron", 10).justify(Justify.CENTER), + new ColumnDefinition("Acceptance", 10, 5).justify(Justify.CENTER), + new ColumnDefinition("Error/Description", 60,20,3) + ); + //@formatter:on + results.entrySet().stream().sorted(Entry.comparingByKey()).forEach(e -> { + final Result value = e.getValue(); + + final Code textcolor = value.isAcceptable() ? Code.GREEN : Code.RED; + grid.addCell(e.getKey(), textcolor); + grid.addCell(value.isSchemaValid() ? "Y" : "N", textcolor); + grid.addCell(value.isSchematronValid() ? "Y" : "N", textcolor); + grid.addCell(value.getAcceptRecommendation(), textcolor); + grid.addCell(joinErrors(value)); + }); + return grid; + } + + private static String joinErrors(final Result value) { + final StringBuilder b = new StringBuilder(); + b.append(String.join(";", value.getProcessingErrors())); + if (value.getSchemaViolations() != null && !value.getSchemaViolations().isEmpty()) { + b.append(b.length() > 0 ? ";" : ""); + b.append(value.getSchemaViolations().stream().map(XmlError::getMessage).collect(Collectors.joining(";"))); + } + if (value.getSchematronResult() != null && !value.getSchematronResult().isEmpty()) { + b.append(b.length() > 0 ? ";" : ""); + b.append(value.getSchematronResult().stream().flatMap(e -> e.getMessages().stream()).collect(Collectors.joining(";"))); + } + return b.toString(); + } + /** * Prüft die Prüflinge und gibt Informationen über etwaige Assertions aus. - * + * * @param input die Prüflinge * @return false wenn es Assertion-Fehler gibt, sonst true */ @@ -114,54 +164,4 @@ class InternalCheck extends DefaultCheck { return (int) (this.failedAssertions + results.values().stream().filter(e -> !e.isAcceptable()).count()); } - private static String createStatusLine(final Map results) { - final long acceptable = results.entrySet().stream().filter(e -> e.getValue().isAcceptable()).count(); - final long rejected = results.entrySet().stream().filter(e -> !e.getValue().isAcceptable()).count(); - final long errors = results.entrySet().stream().filter(e -> !e.getValue().isProcessingSuccessful()).count(); - final Line line = new Line(); - line.add("Acceptable: ").add(acceptable, Code.GREEN); - line.add(" Rejected: ").add(rejected, Code.RED); - if (errors > 0) { - line.add(" Processing errors: ").add(errors, Code.RED); - } - return line.render(true, false); - } - - private static Grid createResultGrid(final Map results) { - final Grid grid = new Grid( - //@formatter:off - new ColumnDefinition("filename", 60, 10, 1), - new ColumnDefinition("Schema", 7).justify(Justify.CENTER), - new ColumnDefinition("Schematron", 10).justify(Justify.CENTER), - new ColumnDefinition("Acceptance", 10, 5).justify(Justify.CENTER), - new ColumnDefinition("Error/Description", 60,20,3) - ); - //@formatter:on - results.entrySet().stream().sorted(Entry.comparingByKey()).forEach(e -> { - final Result value = e.getValue(); - - final Code textcolor = value.isAcceptable() ? Code.GREEN : Code.RED; - grid.addCell(e.getKey(), textcolor); - grid.addCell(value.isSchemaValid() ? "Y" : "N", textcolor); - grid.addCell(value.isSchematronValid() ? "Y" : "N", textcolor); - grid.addCell(value.getAcceptRecommendation(), textcolor); - grid.addCell(joinErrors(value)); - }); - return grid; - } - - private static String joinErrors(final Result value) { - final StringBuilder b = new StringBuilder(); - b.append(String.join(";", value.getProcessingErrors())); - if (value.getSchemaViolations() != null && !value.getSchemaViolations().isEmpty()) { - b.append(b.length() > 0 ? ";" : ""); - b.append(value.getSchemaViolations().stream().map(XmlError::getMessage).collect(Collectors.joining(";"))); - } - if (value.getSchematronResult() != null && !value.getSchematronResult().isEmpty()) { - b.append(b.length() > 0 ? ";" : ""); - b.append(value.getSchematronResult().stream().flatMap(e -> e.getMessages().stream()).collect(Collectors.joining(";"))); - } - return b.toString(); - } - }