diff --git a/dist/assembly-full.xml b/dist/assembly-full.xml deleted file mode 100644 index 221a6d3..0000000 --- a/dist/assembly-full.xml +++ /dev/null @@ -1,56 +0,0 @@ - - full - - dir - zip - - false - - - ${project.parent.basedir} - / - - LICENSE* - NOTICE* - - - - - - - / - false - runtime - ${artifact.artifactId}-${artifact.baseVersion}-${artifact.classifier}.${artifact.extension} - - ${project.groupId}:validationtool:jar:*:standalone - ${project.groupId}:validationtool:jar:*:full - ${project.groupId}:validationtool:jar:*:sources - - - - / - false - runtime - ${artifact.artifactId}-${artifact.baseVersion}.${artifact.extension} - - ${project.groupId}:validationtool - - - - /libs - false - runtime - ${artifact.artifactId}-${artifact.baseVersion}.${artifact.extension} - - ${project.groupId}:validationtool - - - - - \ No newline at end of file diff --git a/dist/assembly-standalone.xml b/dist/assembly-standalone.xml deleted file mode 100644 index 9b625cf..0000000 --- a/dist/assembly-standalone.xml +++ /dev/null @@ -1,36 +0,0 @@ - - standalone - - dir - zip - - false - - - ${project.parent.basedir} - / - - LICENSE* - NOTICE* - - - - - - - / - false - runtime - ${artifact.artifactId}-${artifact.baseVersion}-${artifact.classifier}.${artifact.extension} - - ${project.groupId}:validationtool:jar:*:standalone - ${project.groupId}:validationtool:jar:*:sources - - - - \ No newline at end of file diff --git a/dist/pom.xml b/dist/pom.xml deleted file mode 100644 index 24e5ef0..0000000 --- a/dist/pom.xml +++ /dev/null @@ -1,135 +0,0 @@ - - - - - 4.0.0 - - de.kosit - validationtool-base - 1.0.2-SNAPSHOT - ../ - - validationtool-dist - pom - KoSIT XML Prüftool Distribution - KoSIT XML Prüftool zur Prüfung von XML Dateien gegenüber definierten Szenarien. - - - - UTF-8 - - - - - de.kosit - validationtool - ${project.version} - - - de.kosit - validationtool - ${project.version} - standalone - - - de.kosit - validationtool - ${project.version} - sources - - - de.kosit - validationtool - ${project.version} - full - - - - - - - - maven-assembly-plugin - 3.1.0 - - - standalone - package - - single - - - - assembly-standalone.xml - - true - true - target/ - target/assembly/standalone - - - - full - package - - single - - - - assembly-full.xml - - true - true - target/ - target/assembly/full - - - - - - - - \ No newline at end of file diff --git a/pom.xml b/pom.xml index 905da62..088df0b 100644 --- a/pom.xml +++ b/pom.xml @@ -18,9 +18,7 @@ ~ under the License. --> - + 4.0.0 3.0 @@ -29,7 +27,7 @@ KoSIT XML Prüftool Implementierung de.kosit - 1.0.2-SNAPSHOT + 1.0.3-SNAPSHOT validationtool KoSIT XML Prüftool zur Prüfung von XML Dateien gegenüber definierten Szenarien. @@ -191,6 +189,38 @@ + + standalone_dist + package + + single + + + + src/assembly/assembly-standalone.xml + + true + true + target/ + target/assembly/standalone + + + + full_dist + package + + single + + + + src/assembly/assembly-full.xml + + true + true + target/ + target/assembly/full + + @@ -298,14 +328,7 @@ - - org.apache.maven.plugins - maven-release-plugin - 2.5.3 - - v@{project.version} - - + org.apache.maven.plugins maven-release-plugin @@ -319,6 +342,8 @@ https://github.com/itplr-kosit/validationtool.git + scm:git:https://github.com/itplr-kosit/validationtool.git + v1.0.0 \ No newline at end of file diff --git a/src/assembly/assembly-full.xml b/src/assembly/assembly-full.xml new file mode 100644 index 0000000..353f67f --- /dev/null +++ b/src/assembly/assembly-full.xml @@ -0,0 +1,56 @@ + + + + full + + dir + zip + + false + + + ${project.basedir} + / + + LICENSE* + NOTICE* + + + + ${project.build.directory} + / + + validationtool-*.jar + + + + + + + /libs + false + runtime + ${artifact.artifactId}-${artifact.baseVersion}.${artifact.extension} + + + + \ No newline at end of file diff --git a/src/assembly/assembly-standalone.xml b/src/assembly/assembly-standalone.xml new file mode 100644 index 0000000..55eeb08 --- /dev/null +++ b/src/assembly/assembly-standalone.xml @@ -0,0 +1,46 @@ + + + + standalone + + dir + zip + + false + + + ${project.basedir} + / + + LICENSE* + NOTICE* + + + + ${project.build.directory} + / + + validationtool-*standalone.jar + + + + \ No newline at end of file diff --git a/src/main/java/de/kosit/validationtool/cmd/CommandLineApplication.java b/src/main/java/de/kosit/validationtool/cmd/CommandLineApplication.java index c232ef6..972c8a8 100644 --- a/src/main/java/de/kosit/validationtool/cmd/CommandLineApplication.java +++ b/src/main/java/de/kosit/validationtool/cmd/CommandLineApplication.java @@ -28,7 +28,6 @@ import java.nio.file.Paths; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; -import java.util.List; import java.util.stream.Collectors; import org.apache.commons.cli.CommandLine; @@ -162,9 +161,12 @@ public class CommandLineApplication { final Collection targets = determineTestTargets(cmd); start = System.currentTimeMillis(); - final List input = targets.stream().map(InputFactory::read).collect(Collectors.toList()); - boolean result = check.checkInput(input); - log.info("Processing {} object(s) completed in {}ms", input.size(), System.currentTimeMillis() - start); + for (Path p : targets) { + final Input input = InputFactory.read(p); + check.checkInput(input); + } + boolean result = check.printAndEvaluate(); + log.info("Processing {} object(s) completed in {}ms", targets.size(), System.currentTimeMillis() - start); return result ? 0 : 1; } catch (Exception e) { diff --git a/src/main/java/de/kosit/validationtool/cmd/InternalCheck.java b/src/main/java/de/kosit/validationtool/cmd/InternalCheck.java index 471f7c7..06a45f4 100644 --- a/src/main/java/de/kosit/validationtool/cmd/InternalCheck.java +++ b/src/main/java/de/kosit/validationtool/cmd/InternalCheck.java @@ -19,16 +19,12 @@ package de.kosit.validationtool.cmd; +import lombok.extern.slf4j.Slf4j; + import de.kosit.validationtool.api.CheckConfiguration; import de.kosit.validationtool.api.Input; import de.kosit.validationtool.impl.DefaultCheck; -import de.kosit.validationtool.impl.model.Result; import de.kosit.validationtool.impl.tasks.CheckAction; -import lombok.extern.slf4j.Slf4j; - -import java.util.ArrayList; -import java.util.List; -import java.util.stream.Collectors; /** * Simple Erweiterung der Klasse {@link DefaultCheck} um das Ergebnis der Assertion-Prüfung auszwerten und auszugeben. @@ -39,12 +35,16 @@ import java.util.stream.Collectors; @Slf4j class InternalCheck extends DefaultCheck { + private int checkAssertions = 0; + + private int failedAssertions = 0; + /** * Erzeugt eine neue Instanz mit der angegebenen Konfiguration. * * @param configuration die Konfiguration */ - public InternalCheck(CheckConfiguration configuration) { + InternalCheck(CheckConfiguration configuration) { super(configuration); } @@ -54,24 +54,16 @@ class InternalCheck extends DefaultCheck { * @param input die Prüflinge * @return false wenn es Assertion-Fehler gibt, sonst true */ - public boolean checkInput(List input) { - List results = new ArrayList<>(); - input.forEach(i -> { - CheckAction.Bag bag = new CheckAction.Bag(i, createReport()); - runCheckInternal(bag); - results.add(bag); - }); - - return printAndEvaluate(results); - + void checkInput(Input input) { + CheckAction.Bag bag = new CheckAction.Bag(input, createReport()); + runCheckInternal(bag); + if (bag.getAssertionResult() != null) { + checkAssertions += bag.getAssertionResult().getObject(); + failedAssertions += bag.getAssertionResult().getErrors().size(); + } } - private boolean printAndEvaluate(List results) { - final List> asserts = results.stream().filter(r -> r.getAssertionResult() != null) - .map(CheckAction.Bag::getAssertionResult).collect(Collectors.toList()); - int checkAssertions = asserts.stream().mapToInt(e -> e.getObject()).sum(); - int failedAssertions = asserts.stream().mapToInt(e -> e.getErrors().size()).sum(); - + public boolean printAndEvaluate() { if (failedAssertions > 0) { log.error("Assertion check failed.\n\nAssertions run: {}, Assertions failed: {}\n", checkAssertions, failedAssertions); } else if (checkAssertions > 0) { diff --git a/src/test/java/de/kosit/validationtool/impl/VersioningTest.java b/src/test/java/de/kosit/validationtool/impl/VersioningTest.java index 8e53959..7aa765a 100644 --- a/src/test/java/de/kosit/validationtool/impl/VersioningTest.java +++ b/src/test/java/de/kosit/validationtool/impl/VersioningTest.java @@ -34,7 +34,7 @@ import de.kosit.validationtool.model.scenarios.Scenarios; /** * Testet die Versionierung von Scenario-Dateien aka Konfigurationsdaten. - * + * * @author Andreas Penski */ public class VersioningTest { @@ -45,7 +45,7 @@ public class VersioningTest { private static final URL NEW_FEATURE = VersioningTest.class.getResource("/examples/versioning/scenarios-newfeature.xml"); - private static final URL NEW_VERSION = VersioningTest.class.getResource("/examples/versioning/scenarios-newVersion.xml"); + private static final URL NEW_VERSION = VersioningTest.class.getResource("/examples/versioning/scenarios-newversion.xml"); @Rule public ExpectedException exception = ExpectedException.none();