Merge remote-tracking branch 'origin/master' into mit_s9

This commit is contained in:
Andreas Penski (init) 2019-02-08 10:29:05 +01:00
commit 1e6e8f7eb0
9 changed files with 162 additions and 268 deletions

View file

@ -1,56 +0,0 @@
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
<id>full</id>
<formats>
<format>dir</format>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>${project.parent.basedir}</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>LICENSE*</include>
<include>NOTICE*</include>
</includes>
</fileSet>
<!-- <fileSet>
<directory>${project.build.directory}/xrechnung</directory>
<outputDirectory>/</outputDirectory>
</fileSet> -->
</fileSets>
<dependencySets>
<dependencySet>
<outputDirectory>/</outputDirectory>
<useProjectArtifact>false</useProjectArtifact>
<scope>runtime</scope>
<outputFileNameMapping>${artifact.artifactId}-${artifact.baseVersion}-${artifact.classifier}.${artifact.extension}</outputFileNameMapping>
<includes>
<include>${project.groupId}:validationtool:jar:*:standalone</include>
<include>${project.groupId}:validationtool:jar:*:full</include>
<include>${project.groupId}:validationtool:jar:*:sources</include>
</includes>
</dependencySet>
<dependencySet>
<outputDirectory>/</outputDirectory>
<useProjectArtifact>false</useProjectArtifact>
<scope>runtime</scope>
<outputFileNameMapping>${artifact.artifactId}-${artifact.baseVersion}.${artifact.extension}</outputFileNameMapping>
<includes>
<include>${project.groupId}:validationtool</include>
</includes>
</dependencySet>
<dependencySet>
<outputDirectory>/libs</outputDirectory>
<useProjectArtifact>false</useProjectArtifact>
<scope>runtime</scope>
<outputFileNameMapping>${artifact.artifactId}-${artifact.baseVersion}.${artifact.extension}</outputFileNameMapping>
<excludes>
<exclude>${project.groupId}:validationtool</exclude>
</excludes>
</dependencySet>
</dependencySets>
</assembly>

View file

@ -1,36 +0,0 @@
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
<id>standalone</id>
<formats>
<format>dir</format>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>${project.parent.basedir}</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>LICENSE*</include>
<include>NOTICE*</include>
</includes>
</fileSet>
<!-- <fileSet>
<directory>${project.build.directory}/xrechnung</directory>
<outputDirectory>/</outputDirectory>
</fileSet> -->
</fileSets>
<dependencySets>
<dependencySet>
<outputDirectory>/</outputDirectory>
<useProjectArtifact>false</useProjectArtifact>
<scope>runtime</scope>
<outputFileNameMapping>${artifact.artifactId}-${artifact.baseVersion}-${artifact.classifier}.${artifact.extension}</outputFileNameMapping>
<includes>
<include>${project.groupId}:validationtool:jar:*:standalone</include>
<include>${project.groupId}:validationtool:jar:*:sources</include>
</includes>
</dependencySet>
</dependencySets>
</assembly>

135
dist/pom.xml vendored
View file

@ -1,135 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Licensed to the Koordinierungsstelle für IT-Standards (KoSIT) under
~ one or more contributor license agreements. See the NOTICE file
~ distributed with this work for additional information
~ regarding copyright ownership. KoSIT licenses this file
~ to you under the Apache License, Version 2.0 (the
~ "License"); you may not use this file except in compliance
~ with the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing,
~ software distributed under the License is distributed on an
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~ KIND, either express or implied. See the License for the
~ specific language governing permissions and limitations
~ under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>de.kosit</groupId>
<artifactId>validationtool-base</artifactId>
<version>1.0.2-SNAPSHOT</version>
<relativePath>../</relativePath>
</parent>
<artifactId>validationtool-dist</artifactId>
<packaging>pom</packaging>
<name>KoSIT XML Prüftool Distribution</name>
<description>KoSIT XML Prüftool zur Prüfung von XML Dateien gegenüber definierten Szenarien.</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>de.kosit</groupId>
<artifactId>validationtool</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>de.kosit</groupId>
<artifactId>validationtool</artifactId>
<version>${project.version}</version>
<classifier>standalone</classifier>
</dependency>
<dependency>
<groupId>de.kosit</groupId>
<artifactId>validationtool</artifactId>
<version>${project.version}</version>
<classifier>sources</classifier>
</dependency>
<dependency>
<groupId>de.kosit</groupId>
<artifactId>validationtool</artifactId>
<version>${project.version}</version>
<classifier>full</classifier>
</dependency>
</dependencies>
<build>
<plugins>
<!-- <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.9</version>
<executions>
<execution>
<id>unpack</id>
<phase>package</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/xrechnung</outputDirectory>
<artifactItems>
<artifactItem>
<groupId>${project.groupId}</groupId>
<artifactId>xrechnung</artifactId>
<version>${project.version}</version>
<type>zip</type>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin> -->
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>standalone</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>assembly-standalone.xml</descriptor>
</descriptors>
<attach>true</attach>
<appendAssemblyId>true</appendAssemblyId>
<outputDirectory>target/</outputDirectory>
<workDirectory>target/assembly/standalone</workDirectory>
</configuration>
</execution>
<execution>
<id>full</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>assembly-full.xml</descriptor>
</descriptors>
<attach>true</attach>
<appendAssemblyId>true</appendAssemblyId>
<outputDirectory>target/</outputDirectory>
<workDirectory>target/assembly/full</workDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

49
pom.xml
View file

@ -18,9 +18,7 @@
~ under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<prerequisites>
<maven>3.0</maven>
@ -29,7 +27,7 @@
<name>KoSIT XML Prüftool Implementierung</name>
<groupId>de.kosit</groupId>
<version>1.0.2-SNAPSHOT</version>
<version>1.0.3-SNAPSHOT</version>
<artifactId>validationtool</artifactId>
<description>KoSIT XML Prüftool zur Prüfung von XML Dateien gegenüber definierten Szenarien.</description>
@ -191,6 +189,38 @@
</descriptors>
</configuration>
</execution>
<execution>
<id>standalone_dist</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/assembly/assembly-standalone.xml</descriptor>
</descriptors>
<attach>true</attach>
<appendAssemblyId>true</appendAssemblyId>
<outputDirectory>target/</outputDirectory>
<workDirectory>target/assembly/standalone</workDirectory>
</configuration>
</execution>
<execution>
<id>full_dist</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/assembly/assembly-full.xml</descriptor>
</descriptors>
<attach>true</attach>
<appendAssemblyId>true</appendAssemblyId>
<outputDirectory>target/</outputDirectory>
<workDirectory>target/assembly/full</workDirectory>
</configuration>
</execution>
</executions>
</plugin>
@ -298,14 +328,7 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
<configuration>
<tagNameFormat>v@{project.version}</tagNameFormat>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
@ -319,6 +342,8 @@
</build>
<scm>
<connection>https://github.com/itplr-kosit/validationtool.git</connection>
<developerConnection>scm:git:https://github.com/itplr-kosit/validationtool.git</developerConnection>
<tag>v1.0.0</tag>
</scm>
</project>

View file

@ -0,0 +1,56 @@
<!--
~ Licensed to the Koordinierungsstelle für IT-Standards (KoSIT) under
~ one or more contributor license agreements. See the NOTICE file
~ distributed with this work for additional information
~ regarding copyright ownership. KoSIT licenses this file
~ to you under the Apache License, Version 2.0 (the
~ "License"); you may not use this file except in compliance
~ with the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing,
~ software distributed under the License is distributed on an
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~ KIND, either express or implied. See the License for the
~ specific language governing permissions and limitations
~ under the License.
-->
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
<id>full</id>
<formats>
<format>dir</format>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>${project.basedir}</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>LICENSE*</include>
<include>NOTICE*</include>
</includes>
</fileSet>
<fileSet>
<directory>${project.build.directory}</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>validationtool-*.jar</include>
</includes>
</fileSet>
</fileSets>
<dependencySets>
<dependencySet>
<outputDirectory>/libs</outputDirectory>
<useProjectArtifact>false</useProjectArtifact>
<scope>runtime</scope>
<outputFileNameMapping>${artifact.artifactId}-${artifact.baseVersion}.${artifact.extension}</outputFileNameMapping>
</dependencySet>
</dependencySets>
</assembly>

View file

@ -0,0 +1,46 @@
<!--
~ Licensed to the Koordinierungsstelle für IT-Standards (KoSIT) under
~ one or more contributor license agreements. See the NOTICE file
~ distributed with this work for additional information
~ regarding copyright ownership. KoSIT licenses this file
~ to you under the Apache License, Version 2.0 (the
~ "License"); you may not use this file except in compliance
~ with the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing,
~ software distributed under the License is distributed on an
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~ KIND, either express or implied. See the License for the
~ specific language governing permissions and limitations
~ under the License.
-->
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
<id>standalone</id>
<formats>
<format>dir</format>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>${project.basedir}</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>LICENSE*</include>
<include>NOTICE*</include>
</includes>
</fileSet>
<fileSet>
<directory>${project.build.directory}</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>validationtool-*standalone.jar</include>
</includes>
</fileSet>
</fileSets>
</assembly>

View file

@ -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<Path> targets = determineTestTargets(cmd);
start = System.currentTimeMillis();
final List<Input> 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) {

View file

@ -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> input) {
List<CheckAction.Bag> 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<CheckAction.Bag> results) {
final List<Result<Integer, String>> 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) {

View file

@ -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();