mirror of
https://github.com/itplr-kosit/validator.git
synced 2026-05-25 16:55:39 +00:00
feat: upgrade dependencies to use Java 17 and jakarta
This commit is contained in:
parent
5184f86c5e
commit
6059834dcc
16 changed files with 90 additions and 71 deletions
59
pom.xml
59
pom.xml
|
|
@ -21,7 +21,7 @@
|
|||
<name>KoSIT XML Prüftool Implementierung</name>
|
||||
|
||||
<groupId>de.kosit</groupId>
|
||||
<version>1.5.0</version>
|
||||
<version>1.5.1</version>
|
||||
|
||||
<artifactId>validationtool</artifactId>
|
||||
<description>KoSIT XML Validator against XSD and Schematron based on defined scenarios.</description>
|
||||
|
|
@ -58,19 +58,19 @@
|
|||
<version.commons-io>2.11.0</version.commons-io>
|
||||
<version.commons-lang>3.12.0</version.commons-lang>
|
||||
<version.jacoco>0.8.8</version.jacoco>
|
||||
<version.jaxb>2.3.7</version.jaxb>
|
||||
<version.jaxb>3.0.1</version.jaxb>
|
||||
<version.lombok>1.18.24</version.lombok>
|
||||
<version.mockito>4.9.0</version.mockito>
|
||||
<version.owasp-dependency-check>7.2.0</version.owasp-dependency-check>
|
||||
<version.rest-assured>5.2.0</version.rest-assured>
|
||||
<version.saxon-he>11.4</version.saxon-he>
|
||||
<version.saxon-he>12.5</version.saxon-he>
|
||||
<version.slf4j>1.7.36</version.slf4j>
|
||||
</properties>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>project.local</id>
|
||||
<name>project</name>
|
||||
<url>file:${project.basedir}/libs</url>
|
||||
<id>central</id>
|
||||
<name>Maven Central</name>
|
||||
<url>https://repo.maven.apache.org/maven2</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
|
|
@ -122,6 +122,11 @@
|
|||
<version>${version.jaxb}</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>jakarta.xml.bind</groupId>
|
||||
<artifactId>jakarta.xml.bind-api</artifactId>
|
||||
<version>${version.jaxb}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.assertj</groupId>
|
||||
<artifactId>assertj-core</artifactId>
|
||||
|
|
@ -218,12 +223,19 @@
|
|||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.10.1</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<source>17</source>
|
||||
<target>17</target>
|
||||
<encoding>UTF-8</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<configuration>
|
||||
<encoding>UTF-8</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
|
|
@ -270,8 +282,6 @@
|
|||
<exclude>org.glassfish.jaxb:jaxb-runtime</exclude>
|
||||
<exclude>com.sun.istack:istack-commons-runtime</exclude>
|
||||
<exclude>com.sun.xml.fastinfoset:FastInfoset</exclude>
|
||||
<exclude>jakarta.activation:jakarta.activation-api</exclude>
|
||||
<exclude>jakarta.xml.bind:jakarta.xml.bind-api</exclude>
|
||||
<exclude>org.jvnet.staxex:stax-ex</exclude>
|
||||
<exclude>org.glassfish.jaxb:txw2</exclude>
|
||||
</excludes>
|
||||
|
|
@ -323,9 +333,9 @@
|
|||
|
||||
<!-- Generate model classes -->
|
||||
<plugin>
|
||||
<groupId>org.jvnet.jaxb2.maven2</groupId>
|
||||
<artifactId>maven-jaxb2-plugin</artifactId>
|
||||
<version>0.15.1</version>
|
||||
<groupId>org.jvnet.jaxb</groupId>
|
||||
<artifactId>jaxb-maven-plugin</artifactId>
|
||||
<version>4.0.8</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
|
|
@ -343,18 +353,27 @@
|
|||
</args>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.jvnet.jaxb2_commons</groupId>
|
||||
<artifactId>jaxb2-basics</artifactId>
|
||||
<version>0.11.1</version>
|
||||
<groupId>org.jvnet.jaxb</groupId>
|
||||
<artifactId>jaxb-plugins</artifactId>
|
||||
<version>3.0.0</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</configuration>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.sun.xml.bind</groupId>
|
||||
<artifactId>jaxb-impl</artifactId>
|
||||
<version>4.0.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jaxb</groupId>
|
||||
<artifactId>jaxb-runtime</artifactId>
|
||||
<version>4.0.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>jakarta.xml.bind</groupId>
|
||||
<artifactId>jakarta.xml.bind-api</artifactId>
|
||||
<version>${version.jaxb}</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
|
|
@ -471,7 +490,7 @@
|
|||
<argument>${jacocoFailsafe}</argument>
|
||||
<argument>-Xmx128m</argument>
|
||||
<argument>-classpath</argument>
|
||||
<classpath />
|
||||
<classpath/>
|
||||
<argument>de.kosit.validationtool.cmd.CommandLineApplication</argument>
|
||||
<argument>-s</argument>
|
||||
<argument>${project.build.testOutputDirectory}/examples/simple/scenarios.xml</argument>
|
||||
|
|
@ -492,7 +511,7 @@
|
|||
<configuration>
|
||||
<target>
|
||||
<!-- schlafen um den Start des Daemon abzuwarten -->
|
||||
<sleep seconds="10" />
|
||||
<sleep seconds="10"/>
|
||||
<echo>${jacoco.tcp.port}</echo>
|
||||
</target>
|
||||
</configuration>
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ public interface ResolvingConfigurationStrategy {
|
|||
* function.
|
||||
*
|
||||
* @param scenarioRepository an optional repository, your implementation might not need this
|
||||
* @return a preconfigured {@link net.sf.saxon.lib.UnparsedTextURIResolver} or null for using saxons default
|
||||
* @return a preconfigured {@link UnparsedTextURIResolver} or null for using saxons default
|
||||
*/
|
||||
UnparsedTextURIResolver createUnparsedTextURIResolver(URI scenarioRepository);
|
||||
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ public class Validator {
|
|||
final Processor processor = ProcessorProvider.getProcessor();
|
||||
final List<Configuration> config = getConfiguration(cmd);
|
||||
final InternalCheck check = new InternalCheck(processor, config.toArray(new Configuration[0]));
|
||||
final CommandLineOptions.CliOptions cliOptions = defaultIfNull(cmd.getCliOptions(), new CliOptions());
|
||||
final CliOptions cliOptions = defaultIfNull(cmd.getCliOptions(), new CliOptions());
|
||||
final Path outputDirectory = determineOutputDirectory(cliOptions);
|
||||
if (cliOptions.isExtractHtml()) {
|
||||
check.getCheckSteps().add(new ExtractHtmlContentAction(processor, outputDirectory));
|
||||
|
|
@ -235,7 +235,7 @@ public class Validator {
|
|||
|
||||
}
|
||||
|
||||
private static NamingStrategy determineNamingStrategy(final CommandLineOptions.CliOptions cmd) {
|
||||
private static NamingStrategy determineNamingStrategy(final CliOptions cmd) {
|
||||
final DefaultNamingStrategy namingStrategy = new DefaultNamingStrategy();
|
||||
if (isNotEmpty(cmd.getReportPrefix())) {
|
||||
namingStrategy.setPrefix(cmd.getReportPrefix());
|
||||
|
|
@ -256,7 +256,7 @@ public class Validator {
|
|||
return a;
|
||||
}
|
||||
|
||||
private static Path determineOutputDirectory(final CommandLineOptions.CliOptions cmd) {
|
||||
private static Path determineOutputDirectory(final CliOptions cmd) {
|
||||
final Path dir;
|
||||
if (cmd.getOutputPath() != null) {
|
||||
dir = cmd.getOutputPath();
|
||||
|
|
@ -269,7 +269,7 @@ public class Validator {
|
|||
return dir;
|
||||
}
|
||||
|
||||
private static Collection<Input> determineTestTargets(final CommandLineOptions.CliOptions cmd) throws IOException {
|
||||
private static Collection<Input> determineTestTargets(final CliOptions cmd) throws IOException {
|
||||
final Collection<Input> targets = new ArrayList<>();
|
||||
if (cmd.getFiles() != null && !cmd.getFiles().isEmpty()) {
|
||||
cmd.getFiles().forEach(e -> targets.addAll(determineTestTarget(e)));
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ class XPathBuilder implements Builder<XPathExecutable> {
|
|||
final Iterable<String> iterable = () -> iterator;
|
||||
StreamSupport.stream(iterable.spliterator(), false).filter(e -> !ArrayUtils.contains(IGNORED_PREFIXES, e))
|
||||
.filter(StringUtils::isNotBlank).forEach(e -> ns.put(e, this.executable.getUnderlyingExpression().getInternalExpression()
|
||||
.getRetainedStaticContext().getURIForPrefix(e, false)));
|
||||
.getRetainedStaticContext().getURIForPrefix(e, false).toString()));
|
||||
getNamespaces().putAll(ns);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,8 +20,9 @@ import java.util.ArrayList;
|
|||
import java.util.Collection;
|
||||
import java.util.StringJoiner;
|
||||
|
||||
import javax.xml.bind.ValidationEvent;
|
||||
import javax.xml.bind.ValidationEventHandler;
|
||||
import jakarta.xml.bind.ValidationEvent;
|
||||
import jakarta.xml.bind.ValidationEventHandler;
|
||||
|
||||
import javax.xml.transform.ErrorListener;
|
||||
import javax.xml.transform.SourceLocator;
|
||||
import javax.xml.transform.TransformerException;
|
||||
|
|
|
|||
|
|
@ -33,7 +33,11 @@ import javax.xml.transform.URIResolver;
|
|||
import javax.xml.transform.stream.StreamSource;
|
||||
import javax.xml.validation.Schema;
|
||||
import javax.xml.validation.SchemaFactory;
|
||||
|
||||
import net.sf.saxon.lib.UnparsedTextURIResolver;
|
||||
import net.sf.saxon.s9api.Processor;
|
||||
import net.sf.saxon.s9api.SaxonApiException;
|
||||
import net.sf.saxon.s9api.XsltCompiler;
|
||||
import net.sf.saxon.s9api.XsltExecutable;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
|
|
@ -50,13 +54,8 @@ import de.kosit.validationtool.model.scenarios.ResourceType;
|
|||
import de.kosit.validationtool.model.scenarios.ScenarioType;
|
||||
import de.kosit.validationtool.model.scenarios.ValidateWithSchematron;
|
||||
|
||||
import net.sf.saxon.lib.UnparsedTextURIResolver;
|
||||
import net.sf.saxon.s9api.Processor;
|
||||
import net.sf.saxon.s9api.SaxonApiException;
|
||||
import net.sf.saxon.s9api.XPathCompiler;
|
||||
import net.sf.saxon.s9api.XPathExecutable;
|
||||
import net.sf.saxon.s9api.XsltCompiler;
|
||||
import net.sf.saxon.s9api.XsltExecutable;
|
||||
|
||||
/**
|
||||
* Repository für verschiedene XML Artefakte zur Vearbeitung der Prüfszenarien.
|
||||
|
|
|
|||
|
|
@ -24,14 +24,14 @@ import java.util.Arrays;
|
|||
import java.util.Collection;
|
||||
import java.util.StringJoiner;
|
||||
|
||||
import javax.xml.bind.JAXBContext;
|
||||
import javax.xml.bind.JAXBElement;
|
||||
import javax.xml.bind.JAXBException;
|
||||
import javax.xml.bind.JAXBIntrospector;
|
||||
import javax.xml.bind.Marshaller;
|
||||
import javax.xml.bind.Unmarshaller;
|
||||
import javax.xml.bind.ValidationEventHandler;
|
||||
import javax.xml.bind.annotation.XmlRegistry;
|
||||
import jakarta.xml.bind.JAXBContext;
|
||||
import jakarta.xml.bind.JAXBElement;
|
||||
import jakarta.xml.bind.JAXBException;
|
||||
import jakarta.xml.bind.JAXBIntrospector;
|
||||
import jakarta.xml.bind.Marshaller;
|
||||
import jakarta.xml.bind.Unmarshaller;
|
||||
import jakarta.xml.bind.ValidationEventHandler;
|
||||
import jakarta.xml.bind.annotation.XmlRegistry;
|
||||
import javax.xml.namespace.QName;
|
||||
import javax.xml.stream.XMLInputFactory;
|
||||
import javax.xml.stream.XMLOutputFactory;
|
||||
|
|
|
|||
|
|
@ -112,11 +112,11 @@ public class DefaultCheck implements Check {
|
|||
|
||||
@Override
|
||||
public Result checkInput(final Input input) {
|
||||
final CheckAction.Bag t = new CheckAction.Bag(input, createReport());
|
||||
final Bag t = new Bag(input, createReport());
|
||||
return runCheckInternal(t);
|
||||
}
|
||||
|
||||
protected Result runCheckInternal(final CheckAction.Bag t) {
|
||||
protected Result runCheckInternal(final Bag t) {
|
||||
final long started = System.currentTimeMillis();
|
||||
log.info("Checking content of {}", t.getInput().getName());
|
||||
for (final CheckAction action : this.checkSteps) {
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ import static org.apache.commons.lang3.StringUtils.defaultIfBlank;
|
|||
import java.io.IOException;
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
import javax.xml.bind.util.JAXBSource;
|
||||
import jakarta.xml.bind.util.JAXBSource;
|
||||
import javax.xml.transform.Source;
|
||||
import javax.xml.transform.dom.DOMSource;
|
||||
import javax.xml.transform.stream.StreamSource;
|
||||
|
|
@ -42,7 +42,7 @@ import net.sf.saxon.om.TreeInfo;
|
|||
* This class is known to work with:
|
||||
* <ul>
|
||||
* <li>{@link StreamSource} - both {@link java.io.InputStream} based and {@link java.io.Reader} based</li>
|
||||
* <li>{@link javax.xml.transform.dom.DOMSource}</li>
|
||||
* <li>{@link DOMSource}</li>
|
||||
* <li>{@link javax.xml.bind.util.JAXBSource}</li>
|
||||
* <li>{@link TreeInfo}</li>
|
||||
* </ul>
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ public class StreamHelper {
|
|||
private final LazyReadInput reference;
|
||||
|
||||
public CountInputStream(final LazyReadInput input, final InputStream stream) {
|
||||
super(new org.apache.commons.io.input.CountingInputStream(stream));
|
||||
super(new CountingInputStream(stream));
|
||||
this.reference = input;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,9 +20,9 @@ import java.io.IOException;
|
|||
import java.util.Collection;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.xml.bind.JAXBException;
|
||||
import javax.xml.bind.Marshaller;
|
||||
import javax.xml.bind.util.JAXBSource;
|
||||
import jakarta.xml.bind.JAXBException;
|
||||
import jakarta.xml.bind.Marshaller;
|
||||
import jakarta.xml.bind.util.JAXBSource;
|
||||
|
||||
import org.xml.sax.ContentHandler;
|
||||
import org.xml.sax.DTDHandler;
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ public class SchematronValidationAction implements CheckAction {
|
|||
// resolving nur relative zum Repository
|
||||
transformer.setURIResolver(scenario.getUriResolver());
|
||||
final CollectingErrorEventHandler e = new CollectingErrorEventHandler();
|
||||
transformer.setMessageListener(e);
|
||||
transformer.setErrorListener(e);
|
||||
|
||||
final XdmDestination result = new XdmDestination();
|
||||
transformer.setDestination(result);
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
package de.kosit.validationtool.impl.xml;
|
||||
|
||||
import javax.xml.bind.annotation.adapters.XmlAdapter;
|
||||
import jakarta.xml.bind.annotation.adapters.XmlAdapter;
|
||||
|
||||
public class StringTrimAdapter extends XmlAdapter<String, String> {
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,5 @@
|
|||
project_version=${project.version}
|
||||
framework_version=1.0.2
|
||||
engine_name=KoSIT Validator
|
||||
build_timestamp=${build.timestamp}
|
||||
build_number=${build.number}
|
||||
build_revision=${build.revision}
|
||||
build_branch=${build.branch}
|
||||
|
||||
|
|
|
|||
|
|
@ -65,6 +65,8 @@ public class CreateReportActionTest {
|
|||
bag.setReport(null);
|
||||
this.action.check(bag);
|
||||
assertThat(bag.getReport()).isNotNull();
|
||||
final String reportString = serialize(bag.getReport());
|
||||
System.out.println(reportString);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -77,7 +79,7 @@ public class CreateReportActionTest {
|
|||
this.action.check(bag);
|
||||
assertThat(bag.getReport()).isNotNull();
|
||||
final String reportString = serialize(bag.getReport());
|
||||
assertThat(reportString).contains("SAXParseException");
|
||||
assertThat(reportString).contains("IOException");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ public class SchemaValidatorActionTest {
|
|||
|
||||
@Test
|
||||
public void testSimple() throws MalformedURLException {
|
||||
final CheckAction.Bag bag = createBag(InputFactory.read(Simple.SIMPLE_VALID.toURL()));
|
||||
final Bag bag = createBag(InputFactory.read(Simple.SIMPLE_VALID.toURL()));
|
||||
this.service.check(bag);
|
||||
assertThat(bag.getSchemaValidationResult().isValid()).isTrue();
|
||||
assertThat(bag.getSchemaValidationResult()).isNotNull();
|
||||
|
|
@ -77,7 +77,7 @@ public class SchemaValidatorActionTest {
|
|||
@Test
|
||||
public void testValidationFailure() throws MalformedURLException {
|
||||
final Input input = InputFactory.read(Simple.SCHEMA_INVALID.toURL());
|
||||
final CheckAction.Bag bag = createBag(input);
|
||||
final Bag bag = createBag(input);
|
||||
this.service.check(bag);
|
||||
assertThat(bag.getSchemaValidationResult().isValid()).isFalse();
|
||||
bag.getSchemaValidationResult().getErrors().forEach(e -> {
|
||||
|
|
@ -153,7 +153,7 @@ public class SchemaValidatorActionTest {
|
|||
|
||||
@Test
|
||||
public void testProcessingError() throws IOException, SAXException {
|
||||
final CheckAction.Bag bag = createBag(InputFactory.read(Simple.SIMPLE_VALID.toURL()));
|
||||
final Bag bag = createBag(InputFactory.read(Simple.SIMPLE_VALID.toURL()));
|
||||
final Scenario scenario = bag.getScenarioSelectionResult().getObject();
|
||||
final Schema schema = mock(Schema.class);
|
||||
final Validator validator = mock(Validator.class);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue