mirror of
https://github.com/itplr-kosit/validator.git
synced 2026-05-26 01:05:38 +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
|
|
@ -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