mirror of
https://github.com/itplr-kosit/validator.git
synced 2026-05-25 16:55:39 +00:00
#14 load from jar einfacher
This commit is contained in:
parent
165ce94be9
commit
b4429bed89
5 changed files with 37 additions and 27 deletions
48
pom.xml
48
pom.xml
|
|
@ -2,12 +2,12 @@
|
||||||
<!-- License below -->
|
<!-- License below -->
|
||||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" 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>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<name>KoSIT XML Prüftool Implementierung</name>
|
<name>KoSIT XML Prüftool Implementierung</name>
|
||||||
|
|
||||||
<groupId>de.kosit</groupId>
|
<groupId>de.kosit</groupId>
|
||||||
<version>1.1.0-SNAPSHOT</version>
|
<version>1.1.0-SNAPSHOT</version>
|
||||||
|
|
||||||
<artifactId>validationtool</artifactId>
|
<artifactId>validationtool</artifactId>
|
||||||
<description>KoSIT XML Prüftool zur Prüfung von XML Dateien gegenüber definierten Szenarien.</description>
|
<description>KoSIT XML Prüftool zur Prüfung von XML Dateien gegenüber definierten Szenarien.</description>
|
||||||
<developers>
|
<developers>
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
<organizationUrl>http://www.xoev.de</organizationUrl>
|
<organizationUrl>http://www.xoev.de</organizationUrl>
|
||||||
</developer>
|
</developer>
|
||||||
<developer>
|
<developer>
|
||||||
|
|
||||||
<id>renzo.kottmann</id>
|
<id>renzo.kottmann</id>
|
||||||
<name>Renzo Kottmann</name>
|
<name>Renzo Kottmann</name>
|
||||||
<organization>KoSIT</organization>
|
<organization>KoSIT</organization>
|
||||||
|
|
@ -58,7 +58,7 @@
|
||||||
<url>file:${project.basedir}/libs</url>
|
<url>file:${project.basedir}/libs</url>
|
||||||
</repository>
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
|
|
@ -89,7 +89,7 @@
|
||||||
<version>${version.slf4j}</version>
|
<version>${version.slf4j}</version>
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.commons</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
<artifactId>commons-lang3</artifactId>
|
<artifactId>commons-lang3</artifactId>
|
||||||
|
|
@ -130,9 +130,9 @@
|
||||||
<artifactId>packaged-test-scenarios</artifactId>
|
<artifactId>packaged-test-scenarios</artifactId>
|
||||||
<version>1.0.0</version>
|
<version>1.0.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<resources>
|
<resources>
|
||||||
<resource>
|
<resource>
|
||||||
|
|
@ -143,7 +143,7 @@
|
||||||
<filtering>true</filtering>
|
<filtering>true</filtering>
|
||||||
</resource>
|
</resource>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
|
@ -175,7 +175,7 @@
|
||||||
<encoding>UTF-8</encoding>
|
<encoding>UTF-8</encoding>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-shade-plugin</artifactId>
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
|
|
@ -233,7 +233,7 @@
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-assembly-plugin</artifactId>
|
<artifactId>maven-assembly-plugin</artifactId>
|
||||||
|
|
@ -257,8 +257,8 @@
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<!-- Integrate the /src/main/generated folder -->
|
<!-- Integrate the /src/main/generated folder -->
|
||||||
<groupId>org.codehaus.mojo</groupId>
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
|
|
@ -275,7 +275,7 @@
|
||||||
<sources>
|
<sources>
|
||||||
<source>src/generated/java</source>
|
<source>src/generated/java</source>
|
||||||
</sources>
|
</sources>
|
||||||
|
|
||||||
</configuration>
|
</configuration>
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
|
|
@ -310,7 +310,7 @@
|
||||||
</plugins>
|
</plugins>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<!-- Integrate code coverage -->
|
<!-- Integrate code coverage -->
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.jacoco</groupId>
|
<groupId>org.jacoco</groupId>
|
||||||
|
|
@ -350,7 +350,7 @@
|
||||||
<argLine>-Dfile.encoding=UTF-8 ${jacocoArgumentsJUnit}</argLine>
|
<argLine>-Dfile.encoding=UTF-8 ${jacocoArgumentsJUnit}</argLine>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-source-plugin</artifactId>
|
<artifactId>maven-source-plugin</artifactId>
|
||||||
|
|
@ -364,7 +364,7 @@
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-release-plugin</artifactId>
|
<artifactId>maven-release-plugin</artifactId>
|
||||||
|
|
@ -373,7 +373,7 @@
|
||||||
<tagNameFormat>v@{project.version}</tagNameFormat>
|
<tagNameFormat>v@{project.version}</tagNameFormat>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.codehaus.mojo</groupId>
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
<artifactId>exec-maven-plugin</artifactId>
|
<artifactId>exec-maven-plugin</artifactId>
|
||||||
|
|
@ -401,9 +401,9 @@
|
||||||
<argument>-r</argument>
|
<argument>-r</argument>
|
||||||
<argument>${project.build.testOutputDirectory}/examples/repository</argument>
|
<argument>${project.build.testOutputDirectory}/examples/repository</argument>
|
||||||
<argument>-D</argument>
|
<argument>-D</argument>
|
||||||
|
|
||||||
</arguments>
|
</arguments>
|
||||||
|
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
|
|
@ -437,20 +437,20 @@
|
||||||
<goal>integration-test</goal>
|
<goal>integration-test</goal>
|
||||||
<goal>verify</goal>
|
<goal>verify</goal>
|
||||||
</goals>
|
</goals>
|
||||||
|
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
<scm>
|
<scm>
|
||||||
<connection>https://github.com/itplr-kosit/validationtool.git</connection>
|
<connection>https://github.com/itplr-kosit/validationtool.git</connection>
|
||||||
<developerConnection>scm:git:https://github.com/itplr-kosit/validationtool.git</developerConnection>
|
<developerConnection>scm:git:https://github.com/itplr-kosit/validationtool.git</developerConnection>
|
||||||
<tag>v1.0.0</tag>
|
<tag>v1.0.0</tag>
|
||||||
</scm>
|
</scm>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
<!--
|
<!--
|
||||||
~ Licensed to the Koordinierungsstelle für IT-Standards (KoSIT) under
|
~ Licensed to the Koordinierungsstelle für IT-Standards (KoSIT) under
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,8 @@ import lombok.RequiredArgsConstructor;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
import de.kosit.validationtool.impl.RelativeUriResolver;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Zentrale Konfigration einer Prüf-Instanz.
|
* Zentrale Konfigration einer Prüf-Instanz.
|
||||||
*
|
*
|
||||||
|
|
@ -62,7 +64,7 @@ public class CheckConfiguration {
|
||||||
|
|
||||||
private URI createDefaultRepository() {
|
private URI createDefaultRepository() {
|
||||||
log.info("Creating default scenario repository (alongside scenario definition)");
|
log.info("Creating default scenario repository (alongside scenario definition)");
|
||||||
return this.scenarioDefinition.resolve(".");
|
return RelativeUriResolver.resolve(URI.create("."), this.scenarioDefinition);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,14 @@ public class RelativeUriResolver implements URIResolver, UnparsedTextURIResolver
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static URI resolve(final URI href, final URI base) {
|
/**
|
||||||
|
* Resolves a relative uri including uris within a jar file.
|
||||||
|
*
|
||||||
|
* @param href the uri to resolve
|
||||||
|
* @param base the base uri
|
||||||
|
* @return the resolved uri
|
||||||
|
*/
|
||||||
|
public static URI resolve(final URI href, final URI base) {
|
||||||
final boolean jarURI = isJarURI(base);
|
final boolean jarURI = isJarURI(base);
|
||||||
final URI tmpBase = jarURI ? URI.create(base.toASCIIString().substring(4)) : base;
|
final URI tmpBase = jarURI ? URI.create(base.toASCIIString().substring(4)) : base;
|
||||||
final URI result = tmpBase.resolve(href);
|
final URI result = tmpBase.resolve(href);
|
||||||
|
|
|
||||||
|
|
@ -89,6 +89,7 @@ public class ScenarioRepository {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void checkVersion(final URI scenarioDefinition) {
|
private static void checkVersion(final URI scenarioDefinition) {
|
||||||
|
final DocumentParseAction p = new DocumentParseAction();
|
||||||
try {
|
try {
|
||||||
final Result<XdmNode, XMLSyntaxError> result = DocumentParseAction.parseDocument(InputFactory.read(scenarioDefinition.toURL()));
|
final Result<XdmNode, XMLSyntaxError> result = DocumentParseAction.parseDocument(InputFactory.read(scenarioDefinition.toURL()));
|
||||||
if (result.isValid() && !isSupportedDocument(result.getObject())) {
|
if (result.isValid() && !isSupportedDocument(result.getObject())) {
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ import net.sf.saxon.s9api.XdmNode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Testet die Document Parsing-Funktionalitäten.
|
* Testet die Document Parsing-Funktionalitäten.
|
||||||
*
|
*
|
||||||
* @author Andreas Penski
|
* @author Andreas Penski
|
||||||
*/
|
*/
|
||||||
public class DocumentParserTest {
|
public class DocumentParserTest {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue