25-FixTypos

This commit is contained in:
Adrian-Devries 2025-04-24 12:54:11 +02:00
parent 7d99b83e07
commit 2466f9cf5d
50 changed files with 136 additions and 136 deletions

View file

@ -29,7 +29,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
* Zentrale Konfigration einer Prüf-Instanz. * Zentrale Konfiguration einer Prüf-Instanz.
* *
* @author Andreas Penski * @author Andreas Penski
* @deprecated since 1.3.0 use {@link Configuration} instead. Will be removed in 2.0 * @deprecated since 1.3.0 use {@link Configuration} instead. Will be removed in 2.0
@ -42,7 +42,7 @@ import java.util.Map;
public class CheckConfiguration implements Configuration { public class CheckConfiguration implements Configuration {
/** /**
* URL, die auf die scenerio.xml Datei zeigt. * URL, die auf die scenario.xml Datei zeigt.
*/ */
private final URI scenarioDefinition; private final URI scenarioDefinition;

View file

@ -35,7 +35,7 @@ import java.util.Map;
* {@link Check}</li> * {@link Check}</li>
* </ol> * </ol>
* <p> * <p>
* Both methods can be used via convinience methods. See below. * Both methods can be used via convenience methods. See below.
* *
* @author Andreas Penski * @author Andreas Penski
*/ */

View file

@ -44,7 +44,7 @@ public interface Input {
/** /**
* The digest algorithm used for computing the {@link #getHashCode()} * The digest algorithm used for computing the {@link #getHashCode()}
* *
* @return the name of the digest algorith * @return the name of the digest algorithm
*/ */
String getDigestAlgorithm(); String getDigestAlgorithm();

View file

@ -50,10 +50,10 @@ import static org.apache.commons.lang3.StringUtils.isNotEmpty;
@Slf4j @Slf4j
public class InputFactory { public class InputFactory {
static final String DEFAULT_ALGORITH = "SHA-256"; static final String DEFAULT_ALGORITHM = "SHA-256";
/** /**
* Pseudo hashcode algorithm name, which indicates, thate the hashcode of the {@link Input} is actually the name. * Pseudo hashcode algorithm name, which indicates that the hashcode of the {@link Input} is actually the name.
*/ */
static final String PSEUDO_NAME_ALGORITHM = "NAME"; static final String PSEUDO_NAME_ALGORITHM = "NAME";
@ -66,7 +66,7 @@ public class InputFactory {
} }
InputFactory(final String specifiedAlgorithm) { InputFactory(final String specifiedAlgorithm) {
this.algorithm = isNotEmpty(specifiedAlgorithm) ? specifiedAlgorithm : DEFAULT_ALGORITH; this.algorithm = isNotEmpty(specifiedAlgorithm) ? specifiedAlgorithm : DEFAULT_ALGORITHM;
// check validity // check validity
StreamHelper.createDigest(this.algorithm); StreamHelper.createDigest(this.algorithm);
} }
@ -79,11 +79,11 @@ public class InputFactory {
* @return ein Prüf-Eingabe-Objekt * @return ein Prüf-Eingabe-Objekt
*/ */
public static Input read(final Path path) { public static Input read(final Path path) {
return read(path, DEFAULT_ALGORITH); return read(path, DEFAULT_ALGORITHM);
} }
/** /**
* Liest einen Prüfling von der übergebenen URL. Es wird ein definierter Algorithmis zur Ermittlung der Prüfsumme * Liest einen Prüfling von der übergebenen URL. Es wird ein definierter Algorithmus zur Ermittlung der Prüfsumme
* genutzt. * genutzt.
* *
* @param path der Prüflings * @param path der Prüflings
@ -103,7 +103,7 @@ public class InputFactory {
* @return ein Prüf-Eingabe-Objekt * @return ein Prüf-Eingabe-Objekt
*/ */
public static Input read(final File file) { public static Input read(final File file) {
return read(file, DEFAULT_ALGORITH); return read(file, DEFAULT_ALGORITHM);
} }
/** /**
@ -114,11 +114,11 @@ public class InputFactory {
* @return ein Prüf-Eingabe-Objekt * @return ein Prüf-Eingabe-Objekt
*/ */
public static Input read(final URI uri) { public static Input read(final URI uri) {
return read(uri, DEFAULT_ALGORITH); return read(uri, DEFAULT_ALGORITHM);
} }
/** /**
* Liest einen Prüfling von der übergebenen URL. Es wird ein definierter Algorithmis zur Ermittlung der Prüfsumme * Liest einen Prüfling von der übergebenen URL. Es wird ein definierter Algorithmus zur Ermittlung der Prüfsumme
* genutzt. * genutzt.
* *
* @param uri URI des Prüflings * @param uri URI des Prüflings
@ -141,7 +141,7 @@ public class InputFactory {
* @return ein Prüf-Eingabe-Objekt * @return ein Prüf-Eingabe-Objekt
*/ */
public static Input read(final URL url) { public static Input read(final URL url) {
return read(url, DEFAULT_ALGORITH); return read(url, DEFAULT_ALGORITHM);
} }
/** /**
@ -175,7 +175,7 @@ public class InputFactory {
*/ */
public static Input read(final Source source) { public static Input read(final Source source) {
if (source instanceof StreamSource) { if (source instanceof StreamSource) {
return read(source, source.getSystemId(), DEFAULT_ALGORITH); return read(source, source.getSystemId(), DEFAULT_ALGORITHM);
} }
final String name = UUID.randomUUID().toString(); final String name = UUID.randomUUID().toString();
return read(source, name, PSEUDO_NAME_ALGORITHM, name.getBytes()); return read(source, name, PSEUDO_NAME_ALGORITHM, name.getBytes());
@ -219,7 +219,7 @@ public class InputFactory {
} }
/** /**
* Liest einen Prüfling von der übergebenen URL. Es wird ein definierter Algorithmis zur Ermittlung der Prüfsumme * Liest einen Prüfling von der übergebenen URL. Es wird ein definierter Algorithmus zur Ermittlung der Prüfsumme
* genutzt. * genutzt.
* *
* @param file der Prüflings * @param file der Prüflings
@ -237,7 +237,7 @@ public class InputFactory {
} }
/** /**
* Liest einen Prüfling von der übergebenen byte-Sequenz. Es wird ein definierter Algorithmis zur Ermittlung der * Liest einen Prüfling von der übergebenen byte-Sequenz. Es wird ein definierter Algorithmus zur Ermittlung der
* Prüfsumme genutzt. * Prüfsumme genutzt.
* *
* @param input URL des Prüflings * @param input URL des Prüflings
@ -245,11 +245,11 @@ public class InputFactory {
*/ */
public static Input read(final byte[] input, final String name) { public static Input read(final byte[] input, final String name) {
checkNull(input); checkNull(input);
return read(input, name, DEFAULT_ALGORITH); return read(input, name, DEFAULT_ALGORITHM);
} }
/** /**
* Liest einen Prüfling von der übergebenen byte-Sequenz. Es wird ein definierter Algorithmis zur Ermittlung der * Liest einen Prüfling von der übergebenen byte-Sequenz. Es wird ein definierter Algorithmus zur Ermittlung der
* Prüfsumme genutzt. * Prüfsumme genutzt.
* *
* @param input URL des Prüflings * @param input URL des Prüflings
@ -282,7 +282,7 @@ public class InputFactory {
* @return einen Prüfling in eingelesener Form * @return einen Prüfling in eingelesener Form
*/ */
public static Input read(final InputStream inputStream, final String name) { public static Input read(final InputStream inputStream, final String name) {
return read(inputStream, name, DEFAULT_ALGORITH); return read(inputStream, name, DEFAULT_ALGORITHM);
} }
/** /**

View file

@ -31,8 +31,8 @@ import java.net.URI;
* The KoSIT Validator provides out of the box implementations with various security levels based on openjdk SAX stack. * The KoSIT Validator provides out of the box implementations with various security levels based on openjdk SAX stack.
* <p> * <p>
* If you decide to implement a custom strategy, please be aware of XML security within your stack. The validator * If you decide to implement a custom strategy, please be aware of XML security within your stack. The validator
* components beyond this strategy asume secured implementation of the interfaces provided by this strategy. There is no * components beyond this strategy assume secured implementation of the interfaces provided by this strategy. There is
* effort to mitigate or prevent xml related security issues such as XXE, loading external sources etc. Your would be * no effort to mitigate or prevent xml related security issues such as XXE, loading external sources etc. Your would be
* responsible for this! * responsible for this!
* *
* @see de.kosit.validationtool.impl.ResolvingMode * @see de.kosit.validationtool.impl.ResolvingMode

View file

@ -104,7 +104,7 @@ public interface Result {
* *
* @return true wenn well-formed * @return true wenn well-formed
*/ */
boolean isWellformed(); boolean isWellFormed();
/** /**
* Returns true, if schematron has been checked and the result does not contain any {@link FailedAssert * Returns true, if schematron has been checked and the result does not contain any {@link FailedAssert

View file

@ -17,7 +17,7 @@
package de.kosit.validationtool.api; package de.kosit.validationtool.api;
/** /**
* Fehlerobjekt für die Bereitstellung von Fehlern aus der internen Verarbeitung, bspw. Schema-Validation-Fehler. * Fehlerobjekt für die Bereitstellung von Fehlern aus der internen Verarbeitung, z.B. Schema-Validation-Fehler.
* *
* @author Andreas Penski * @author Andreas Penski
*/ */
@ -42,7 +42,7 @@ public interface XmlError {
/** /**
* Gibt optional eine Zeilennummer an, aus der der Fehler resultiert. * Gibt optional eine Zeilennummer an, aus der der Fehler resultiert.
* *
* @return die Zeitelnnummer * @return die Zeilennummer
*/ */
Integer getRowNumber(); Integer getRowNumber();

View file

@ -52,7 +52,7 @@ public class CommandLineApplication {
final ReturnValue resultStatus = mainProgram(args); final ReturnValue resultStatus = mainProgram(args);
if (!resultStatus.equals(ReturnValue.DAEMON_MODE)) { if (!resultStatus.equals(ReturnValue.DAEMON_MODE)) {
if (!resultStatus.equals(ReturnValue.HELP_REQUEST) && resultStatus.getCode() >= 0) { if (!resultStatus.equals(ReturnValue.HELP_REQUEST) && resultStatus.getCode() >= 0) {
sayGoodby(resultStatus); sayGoodbye(resultStatus);
} }
System.exit(resultStatus.getCode()); System.exit(resultStatus.getCode());
} else { } else {
@ -60,7 +60,7 @@ public class CommandLineApplication {
} }
} }
private static void sayGoodby(final ReturnValue resultStatus) { private static void sayGoodbye(final ReturnValue resultStatus) {
Printer.writeOut("\n##############################"); Printer.writeOut("\n##############################");
if (resultStatus.equals(ReturnValue.SUCCESS)) { if (resultStatus.equals(ReturnValue.SUCCESS)) {
Printer.writeOut("# " + new Line(Code.GREEN).add("Validation successful!").render(false, false) + " #"); Printer.writeOut("# " + new Line(Code.GREEN).add("Validation successful!").render(false, false) + " #");

View file

@ -84,11 +84,11 @@ class InternalCheck extends DefaultCheck {
results.entrySet().stream().sorted(Entry.comparingByKey()).forEach(e -> { results.entrySet().stream().sorted(Entry.comparingByKey()).forEach(e -> {
final Result value = e.getValue(); final Result value = e.getValue();
final Code textcolor = value.isAcceptable() ? Code.GREEN : Code.RED; final Code textColor = value.isAcceptable() ? Code.GREEN : Code.RED;
grid.addCell(e.getKey(), textcolor); grid.addCell(e.getKey(), textColor);
grid.addCell(value.isSchemaValid() ? "Y" : "N", textcolor); grid.addCell(value.isSchemaValid() ? "Y" : "N", textColor);
grid.addCell(value.isSchematronValid() ? "Y" : "N", textcolor); grid.addCell(value.isSchematronValid() ? "Y" : "N", textColor);
grid.addCell(value.getAcceptRecommendation(), textcolor); grid.addCell(value.getAcceptRecommendation(), textColor);
grid.addCell(joinErrors(value)); grid.addCell(joinErrors(value));
}); });
return grid; return grid;

View file

@ -45,15 +45,15 @@ class TypeConverter {
private static <T extends Definition> T convert(final Class<T> type, final String value) { private static <T extends Definition> T convert(final Class<T> type, final String value) {
final T def; final T def;
final String[] splitted = defaultIfBlank(value, "").split("="); final String[] items = defaultIfBlank(value, "").split("=");
if (splitted.length == 1) { if (items.length == 1) {
def = createNewInstance(type); def = createNewInstance(type);
def.setName(getDefaultName(type)); def.setName(getDefaultName(type));
def.setPath(Paths.get(splitted[0].trim())); def.setPath(Paths.get(items[0].trim()));
} else if (splitted.length == 2) { } else if (items.length == 2) {
def = createNewInstance(type); def = createNewInstance(type);
def.setName(splitted[0].trim()); def.setName(items[0].trim());
def.setPath(Paths.get(splitted[1].trim())); def.setPath(Paths.get(items[1].trim()));
} else { } else {
throw new IllegalArgumentException("Not a valid repository specification " + value); throw new IllegalArgumentException("Not a valid repository specification " + value);
} }

View file

@ -56,7 +56,7 @@ import static org.apache.commons.lang3.StringUtils.EMPTY;
import static org.apache.commons.lang3.StringUtils.isNotEmpty; import static org.apache.commons.lang3.StringUtils.isNotEmpty;
/** /**
* Actual evaluation and processing of CommandLineOptions argumtens. * Actual evaluation and processing of CommandLineOptions arguments.
* *
* @author Andreas Penski * @author Andreas Penski
*/ */
@ -184,7 +184,7 @@ public class Validator {
checkUnused(mappedScenarios, mappedRepos); checkUnused(mappedScenarios, mappedRepos);
return mappedScenarios.entrySet().stream().map(e -> { return mappedScenarios.entrySet().stream().map(e -> {
assertFileExistance(e.getValue(), "scenario"); assertFileExistence(e.getValue(), "scenario");
final URI scenarioLocation = e.getValue().toUri(); final URI scenarioLocation = e.getValue().toUri();
final URI repositoryLocation = findRepository(e.getKey(), mappedRepos); final URI repositoryLocation = findRepository(e.getKey(), mappedRepos);
@ -321,7 +321,7 @@ public class Validator {
} }
@SuppressWarnings("SameParameterValue") @SuppressWarnings("SameParameterValue")
private static void assertFileExistance(final Path f, final String type) { private static void assertFileExistence(final Path f, final String type) {
if (!Files.isRegularFile(f)) { if (!Files.isRegularFile(f)) {
throw new IllegalArgumentException( throw new IllegalArgumentException(
String.format("Not a valid path for %s definition specified: '%s'", type, f.toAbsolutePath())); String.format("Not a valid path for %s definition specified: '%s'", type, f.toAbsolutePath()));

View file

@ -151,7 +151,7 @@ public class ConfigurationBuilder {
/** /**
* Adds a description to this configuration. * Adds a description to this configuration.
* *
* @param description the descriptioin * @param description the description
* @return this * @return this
*/ */
public ConfigurationBuilder description(final String description) { public ConfigurationBuilder description(final String description) {
@ -262,7 +262,7 @@ public class ConfigurationBuilder {
} }
/** /**
* Builds the actual {@link Configuration} by validating all builder inputs and constructing neccessary objects. * Builds the actual {@link Configuration} by validating all builder inputs and constructing necessary objects.
* *
* @return a valid configuration * @return a valid configuration
* @throws IllegalStateException when the configuration is not valid/complete * @throws IllegalStateException when the configuration is not valid/complete

View file

@ -69,7 +69,7 @@ public class ConfigurationLoader {
protected final Map<String, Object> parameters = new HashMap<>(); protected final Map<String, Object> parameters = new HashMap<>();
/** /**
* URL, die auf die scenerio.xml Datei zeigt. * URL, die auf die scenario.xml Datei zeigt.
*/ */
@Getter(AccessLevel.PACKAGE) @Getter(AccessLevel.PACKAGE)
private final URI scenarioDefinition; private final URI scenarioDefinition;
@ -115,8 +115,8 @@ public class ConfigurationLoader {
} }
private static Scenario createFallback(final Scenarios scenarios, final ContentRepository repository) { private static Scenario createFallback(final Scenarios scenarios, final ContentRepository repository) {
final ResourceType noscenarioResource = scenarios.getNoScenarioReport().getResource(); final ResourceType noScenarioResource = scenarios.getNoScenarioReport().getResource();
return new FallbackBuilder().source(noscenarioResource.getLocation()).name(noscenarioResource.getName()).build(repository) return new FallbackBuilder().source(noScenarioResource.getLocation()).name(noScenarioResource.getName()).build(repository)
.getObject(); .getObject();
} }
@ -140,7 +140,7 @@ public class ConfigurationLoader {
s.setUriResolver(repository.getResolver()); s.setUriResolver(repository.getResolver());
s.setUnparsedTextURIResolver(repository.getUnparsedTextURIResolver()); s.setUnparsedTextURIResolver(repository.getUnparsedTextURIResolver());
if (def.getAcceptMatch() != null) { if (def.getAcceptMatch() != null) {
s.setAcceptExecutable(repository.createAccepptExecutable(def)); s.setAcceptExecutable(repository.createAcceptExecutable(def));
} }
return s; return s;
} }

View file

@ -66,8 +66,8 @@ public class FallbackBuilder implements Builder<Scenario> {
} }
/** /**
* Specifices a source for this report. This is either used to compile the report transformation or as documentation * Specifies a source for this report. This is either used to compile the report transformation or as documentation
* for a precompiled tranformation. * for a precompiled transformation.
* *
* @param source the source * @param source the source
* @return this * @return this
@ -78,8 +78,8 @@ public class FallbackBuilder implements Builder<Scenario> {
} }
/** /**
* Specifices a source for this report. This is either used to compile the report transformation or as documentation * Specifies a source for this report. This is either used to compile the report transformation or as documentation
* for a precompiled tranformation. * for a precompiled transformation.
* *
* @param source the source * @param source the source
* @return this * @return this
@ -91,8 +91,8 @@ public class FallbackBuilder implements Builder<Scenario> {
} }
/** /**
* Specifices a source for this report. This is either used to compile the report transformation or as documentation * Specifies a source for this report. This is either used to compile the report transformation or as documentation
* for a precompiled tranformation. * for a precompiled transformation.
* *
* @param source the source * @param source the source
* @return this * @return this

View file

@ -83,8 +83,8 @@ public class ReportBuilder implements Builder<Pair<CreateReportType, Transformat
} }
/** /**
* Specifices a source for this report. This is either used to compile the report transformation or as documentation * Specifies a source for this report. This is either used to compile the report transformation or as documentation
* for a precompiled tranformation. * for a precompiled transformation.
* *
* @param source the source * @param source the source
* @return this * @return this
@ -94,8 +94,8 @@ public class ReportBuilder implements Builder<Pair<CreateReportType, Transformat
} }
/** /**
* Specifices a source for this report. This is either used to compile the report transformation or as documentation * Specifies a source for this report. This is either used to compile the report transformation or as documentation
* for a precompiled tranformation. * for a precompiled transformation.
* *
* @param source the source * @param source the source
* @return this * @return this
@ -106,8 +106,8 @@ public class ReportBuilder implements Builder<Pair<CreateReportType, Transformat
} }
/** /**
* Specifices a source for this report. This is either used to compile the report transformation or as documentation * Specifies a source for this report. This is either used to compile the report transformation or as documentation
* for a precompiled tranformation. * for a precompiled transformation.
* *
* @param source the source * @param source the source
* @return this * @return this

View file

@ -138,7 +138,7 @@ public class ScenarioBuilder implements Builder<Scenario> {
/** /**
* Add a xpath expression to compute acceptance for the scenario. You can leverage declared namespaces. * Add a xpath expression to compute acceptance for the scenario. You can leverage declared namespaces.
* *
* @param acceptXpath the xpath expresison * @param acceptXpath the xpath expression
* @return this * @return this
*/ */
public ScenarioBuilder acceptWith(final String acceptXpath) { public ScenarioBuilder acceptWith(final String acceptXpath) {

View file

@ -70,7 +70,7 @@ public class SchemaBuilder implements Builder<Pair<ValidateWithXmlSchema, Schema
final ValidateWithXmlSchema o = new ValidateWithXmlSchema(); final ValidateWithXmlSchema o = new ValidateWithXmlSchema();
final ResourceType r = new ResourceType(); final ResourceType r = new ResourceType();
r.setName(isNotEmpty(this.name) ? this.name : DEFAULT_NAME); r.setName(isNotEmpty(this.name) ? this.name : DEFAULT_NAME);
r.setLocation(this.schemaLocation != null ? this.schemaLocation.toASCIIString() : "manuelly configured"); r.setLocation(this.schemaLocation != null ? this.schemaLocation.toASCIIString() : "manually configured");
o.getResource().add(r); o.getResource().add(r);
return o; return o;
} }

View file

@ -83,8 +83,8 @@ public class SchematronBuilder implements Builder<Pair<ValidateWithSchematron, T
} }
/** /**
* Specifices a source for this schematron validation. This is either used to compile the schematron transformation * Specifies a source for this schematron validation. This is either used to compile the schematron transformation
* or as documentation for a precompiled tranformation. * or as documentation for a precompiled transformation.
* *
* @param source the source * @param source the source
* @return this * @return this
@ -94,8 +94,8 @@ public class SchematronBuilder implements Builder<Pair<ValidateWithSchematron, T
} }
/** /**
* Specifices a source for this schematron validation. This is either used to compile the schematron transformation * Specifies a source for this schematron validation. This is either used to compile the schematron transformation
* or as documentation for a precompiled tranformation. * or as documentation for a precompiled transformation.
* *
* @param source the source * @param source the source
* @return this * @return this
@ -106,8 +106,8 @@ public class SchematronBuilder implements Builder<Pair<ValidateWithSchematron, T
} }
/** /**
* Specifices a source for this schematron validation. This is either used to compile the schematron transformation * Specifies a source for this schematron validation. This is either used to compile the schematron transformation
* or as documentation for a precompiled tranformation. * or as documentation for a precompiled transformation.
* *
* @param source the source * @param source the source
* @return this * @return this

View file

@ -45,7 +45,7 @@ class CheckHandler extends BaseHandler {
private static final AtomicLong counter = new AtomicLong(0); private static final AtomicLong counter = new AtomicLong(0);
private final Check implemenation; private final Check implementation;
private final Processor processor; private final Processor processor;
@ -59,13 +59,13 @@ class CheckHandler extends BaseHandler {
try { try {
log.debug("Incoming request"); log.debug("Incoming request");
final String requestMethod = httpExchange.getRequestMethod(); final String requestMethod = httpExchange.getRequestMethod();
// check neccessary, since gui can be disabled // check necessary, since gui can be disabled
if (requestMethod.equals("POST")) { if (requestMethod.equals("POST")) {
final BufferedInputStream buffered = StreamHelper.wrapPeekable(httpExchange.getRequestBody()); final BufferedInputStream buffered = StreamHelper.wrapPeekable(httpExchange.getRequestBody());
if (!isMultipartFormData(httpExchange) && isContentAvailable(httpExchange, buffered)) { if (!isMultipartFormData(httpExchange) && isContentAvailable(httpExchange, buffered)) {
final SourceInput serverInput = (SourceInput) InputFactory.read(buffered, final SourceInput serverInput = (SourceInput) InputFactory.read(buffered,
resolveInputName(httpExchange.getRequestURI())); resolveInputName(httpExchange.getRequestURI()));
final Result result = this.implemenation.checkInput(serverInput); final Result result = this.implementation.checkInput(serverInput);
write(httpExchange, serialize(result), APPLICATION_XML, resolveStatus(result)); write(httpExchange, serialize(result), APPLICATION_XML, resolveStatus(result));
} else { } else {
error(httpExchange, HttpStatus.SC_BAD_REQUEST, "No content supplied"); error(httpExchange, HttpStatus.SC_BAD_REQUEST, "No content supplied");

View file

@ -92,7 +92,7 @@ public class Daemon {
log.info("Server {} started", server.getAddress()); log.info("Server {} started", server.getAddress());
writeOut("Daemon started. Visit http://{0}", this.bindAddress + ":" + this.port); writeOut("Daemon started. Visit http://{0}", this.bindAddress + ":" + this.port);
} catch (final IOException e) { } catch (final IOException e) {
log.error("Error starting HttpServer for Valdidator: {}", e.getMessage(), e); log.error("Error starting HttpServer for Validator: {}", e.getMessage(), e);
} }
} }

View file

@ -46,7 +46,7 @@ public class GuiHandler extends BaseHandler {
final URL resource = GuiHandler.class.getClassLoader().getResource("ui" + path); final URL resource = GuiHandler.class.getClassLoader().getResource("ui" + path);
if (resource != null) { if (resource != null) {
write(exchange, IOUtils.toString(resource, Charset.defaultCharset()).getBytes(), write(exchange, IOUtils.toString(resource, Charset.defaultCharset()).getBytes(),
Mediatype.resolveBySuffix(resource.getPath()).getMimeType()); MediaType.resolveBySuffix(resource.getPath()).getMimeType());
} else { } else {
error(exchange, 404, "not found"); error(exchange, 404, "not found");
} }
@ -55,14 +55,14 @@ public class GuiHandler extends BaseHandler {
@RequiredArgsConstructor @RequiredArgsConstructor
@Getter @Getter
protected enum Mediatype { protected enum MediaType {
JS("application/javascript"), MD("text/markdown"), CSS("text/css"), SVG("image/svg+xml"), HTML("text/html"), PNG("image/png"); JS("application/javascript"), MD("text/markdown"), CSS("text/css"), SVG("image/svg+xml"), HTML("text/html"), PNG("image/png");
private final String mimeType; private final String mimeType;
static Mediatype resolveBySuffix(final String path) { static MediaType resolveBySuffix(final String path) {
return Arrays.stream(values()).filter(e -> path.toUpperCase().endsWith("." + e.name())).findFirst().orElse(Mediatype.MD); return Arrays.stream(values()).filter(e -> path.toUpperCase().endsWith("." + e.name())).findFirst().orElse(MediaType.MD);
} }
} }
} }

View file

@ -102,7 +102,7 @@ public class CollectingErrorEventHandler implements ValidationEventHandler, Erro
} }
/** /**
* Zeigt an, ob es Validierungs-Ereignisse gab. * Zeigt an, ob es Validierungsereignisse gab.
* *
* @return true, wenn mindestens ein Validierungsereignis aufgetreten ist * @return true, wenn mindestens ein Validierungsereignis aufgetreten ist
*/ */

View file

@ -55,7 +55,7 @@ import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
* Repository für verschiedene XML Artefakte zur Vearbeitung der Prüfszenarien. * Repository für verschiedene XML Artefakte zur Verarbeitung der Prüfszenarien.
* *
* @author Andreas Penski * @author Andreas Penski
*/ */
@ -163,7 +163,7 @@ public class ContentRepository {
} }
/** /**
* Erzeugt ein Schema auf Basis der übegebenen URIs * Erzeugt ein Schema auf Basis der übergebenen URIs
* *
* @param uris die uris in String-Repräsentation * @param uris die uris in String-Repräsentation
* @return das Schema * @return das Schema
@ -243,7 +243,7 @@ public class ContentRepository {
return createXPath(s.getMatch(), namespaces); return createXPath(s.getMatch(), namespaces);
} }
public XPathExecutable createAccepptExecutable(final ScenarioType s) { public XPathExecutable createAcceptExecutable(final ScenarioType s) {
final Map<String, String> namespaces = s.getNamespace().stream() final Map<String, String> namespaces = s.getNamespace().stream()
.collect(Collectors.toMap(NamespaceType::getPrefix, ns -> StringTrimAdapter.trim(ns.getValue()))); .collect(Collectors.toMap(NamespaceType::getPrefix, ns -> StringTrimAdapter.trim(ns.getValue())));
return createXPath(s.getAcceptMatch(), namespaces); return createXPath(s.getAcceptMatch(), namespaces);

View file

@ -122,7 +122,7 @@ public class ConversionService {
} }
/** /**
* Initialisiert den conversion service mit den angegegebenen Packages. * Initialisiert den conversion service mit den angegebenen Packages.
* *
* @param context packages für den JAXB Kontext * @param context packages für den JAXB Kontext
*/ */
@ -134,7 +134,7 @@ public class ConversionService {
} }
/** /**
* Initialsiert den conversion service mit dem angegebenen Kontextpfad * Initialisiert den conversion service mit dem angegebenen Kontextpfad
* *
* @param contextPath der Kontextpfad * @param contextPath der Kontextpfad
*/ */

View file

@ -50,8 +50,8 @@ import java.util.stream.Collectors;
import static de.kosit.validationtool.impl.DateFactory.createTimestamp; import static de.kosit.validationtool.impl.DateFactory.createTimestamp;
/** /**
* The reference implementation for the validation process. After initialisation, instances are threadsafe and should be * The reference implementation for the validation process. After initialisation, instances are thread safe and should
* reused since initializing saxon runtime objects is a rather heavyweight process. * be reused since initializing saxon runtime objects is a rather heavyweight process.
* *
* @author Andreas Penski * @author Andreas Penski
*/ */
@ -129,7 +129,7 @@ public class DefaultCheck implements Check {
private Result createResult(final Bag t) { private Result createResult(final Bag t) {
final DefaultResult result = new DefaultResult(t.getReport(), t.getAcceptStatus(), new HtmlExtractor(this.processor)); final DefaultResult result = new DefaultResult(t.getReport(), t.getAcceptStatus(), new HtmlExtractor(this.processor));
result.setWellformed(t.getParserResult().isValid()); result.setWellFormed(t.getParserResult().isValid());
result.setReportInput(t.getReportInput()); result.setReportInput(t.getReportInput());
if (t.getSchemaValidationResult() != null) { if (t.getSchemaValidationResult() != null) {
result.setSchemaViolations(convertErrors(t.getSchemaValidationResult().getErrors())); result.setSchemaViolations(convertErrors(t.getSchemaValidationResult().getErrors()));

View file

@ -70,7 +70,7 @@ public class DefaultResult implements Result {
@Getter @Getter
@Setter @Setter
private boolean wellformed; private boolean wellFormed;
public DefaultResult(final XdmNode report, final AcceptRecommendation recommendation, final HtmlExtractor htmlExtractor) { public DefaultResult(final XdmNode report, final AcceptRecommendation recommendation, final HtmlExtractor htmlExtractor) {
this.report = report; this.report = report;
@ -109,7 +109,7 @@ public class DefaultResult implements Result {
} }
/** /**
* Extrahiert evtl. im Report vorhandene HTML-Fragmente als String. * Extrahiert eventuell im Report vorhandene HTML-Fragmente als String.
* *
* @return Liste mit HTML Strings. * @return Liste mit HTML Strings.
*/ */
@ -118,7 +118,7 @@ public class DefaultResult implements Result {
} }
/** /**
* Extrahiert evtl. im Report vorhandene HTML-Fragmente. * Extrahiert eventuell im Report vorhandene HTML-Fragmente.
* *
* @return Liste mit HTML Nodes. * @return Liste mit HTML Nodes.
*/ */
@ -127,7 +127,7 @@ public class DefaultResult implements Result {
} }
/** /**
* Extrahiert evtl. im Report vorhandene HTML-Fragmente als {@link Element}. * Extrahiert eventuell im Report vorhandene HTML-Fragmente als {@link Element}.
* *
* @return Liste mit HTML Elementen. * @return Liste mit HTML Elementen.
*/ */

View file

@ -21,7 +21,7 @@ import java.io.InputStream;
import java.util.Properties; import java.util.Properties;
/** /**
* Hält statische Informatione über diesen Validator. * Hält statische Informationen über diesen Validator.
* *
* @author Andreas Penski * @author Andreas Penski
*/ */

View file

@ -97,7 +97,7 @@ public class HtmlExtractor {
} }
/** /**
* Extrahiert evtl. vorhandene HTML-Knoten als String. * Extrahiert eventuell vorhandene HTML-Knoten als String.
* *
* @param node der root knoten * @param node der root knoten
* @return HTML-Fragment als String * @return HTML-Fragment als String

View file

@ -31,7 +31,7 @@ import java.net.URL;
* An {@link Input} carries an {@link URL} which can be used for all 'locatable' inputs such as {@link File}, * An {@link Input} carries an {@link URL} which can be used for all 'locatable' inputs such as {@link File},
* {@link java.nio.file.Path} and any other {@link URL}. * {@link java.nio.file.Path} and any other {@link URL}.
* <p> * <p>
* This stream is NOT read into memory. So this implementation has good in memory efficieny. The validation process MAY * This stream is NOT read into memory. So this implementation has good in memory efficiency. The validation process MAY
* read the stream more than once. Make sure, that the {@link URL} points to fast I/O devices * read the stream more than once. Make sure, that the {@link URL} points to fast I/O devices
* *
* @author Andreas Penski * @author Andreas Penski

View file

@ -42,7 +42,7 @@ public class XdmNodeInput implements Input {
@Override @Override
public Source getSource() { public Source getSource() {
// usually not neccessary to be called. // usually not necessary to be called.
return this.node.getUnderlyingNode(); return this.node.getUnderlyingNode();
} }
} }

View file

@ -34,7 +34,7 @@ import java.util.Collections;
/** /**
* Interface, welches von allen Prüfschritten implementiert wird. Der Parameter vom Typ {@link Bag} dient dabei sowohl * Interface, welches von allen Prüfschritten implementiert wird. Der Parameter vom Typ {@link Bag} dient dabei sowohl
* als Quellce für Eingabe Parameter als auch für die Aufnahme von Ergebnisse, die an weitere Schritte weitergeleitet * als Quelle für Eingabeparameter als auch für die Aufnahme von Ergebnissen, die an weitere Schritte weitergeleitet
* werden sollen. * werden sollen.
* *
* @author Andreas Penski * @author Andreas Penski
@ -82,7 +82,7 @@ public interface CheckAction {
} }
/** /**
* Signalisiert einen vorzeitigen Stop der Vearbeitung. * Signalisiert einen vorzeitigen Stop der Verarbeitung.
*/ */
public void stopProcessing(final String error) { public void stopProcessing(final String error) {
stopProcessing(Collections.singleton(error)); stopProcessing(Collections.singleton(error));
@ -112,7 +112,7 @@ public interface CheckAction {
} }
/** /**
* Ausfürhung des Prüfschrittes und Erweiterung der gesammelten Informationen. * Ausführung des Prüfschrittes und Erweiterung der gesammelten Informationen.
* *
* @param results die Informationssammlung * @param results die Informationssammlung
*/ */

View file

@ -41,7 +41,7 @@ public class ComputeAcceptanceAction implements CheckAction {
// xml wurde aus irgendwelchen Gründen nicht korrekt verarbeitet, dann lassen wir es als undefined // xml wurde aus irgendwelchen Gründen nicht korrekt verarbeitet, dann lassen wir es als undefined
return; return;
} }
if (preCondtionsMatch(results)) { if (preConditionsMatch(results)) {
final Optional<XPathSelector> acceptMatch = results.getScenarioSelectionResult().getObject().getAcceptSelector(); final Optional<XPathSelector> acceptMatch = results.getScenarioSelectionResult().getObject().getAcceptSelector();
if (results.getSchemaValidationResult().isValid() && acceptMatch.isPresent()) { if (results.getSchemaValidationResult().isValid() && acceptMatch.isPresent()) {
evaluateAcceptanceMatch(results, acceptMatch.get()); evaluateAcceptanceMatch(results, acceptMatch.get());
@ -81,7 +81,7 @@ public class ComputeAcceptanceAction implements CheckAction {
} }
} }
private static boolean preCondtionsMatch(final Bag results) { private static boolean preConditionsMatch(final Bag results) {
return results.getReport() != null && results.getSchemaValidationResult() != null && results.getScenarioSelectionResult() != null; return results.getReport() != null && results.getSchemaValidationResult() != null && results.getScenarioSelectionResult() != null;
} }

View file

@ -150,7 +150,7 @@ public class CreateReportAction implements CheckAction {
@Override @Override
public void setFeature(final String name, final boolean value) throws SAXNotRecognizedException { public void setFeature(final String name, final boolean value) throws SAXNotRecognizedException {
// this inverts the logic from JaxbSource pseude parser // this inverts the logic from JaxbSource pseudo parser
if (name.equals(SAX_FEATURES_NAMESPACES) && !value) { if (name.equals(SAX_FEATURES_NAMESPACES) && !value) {
throw new SAXNotRecognizedException(name); throw new SAXNotRecognizedException(name);
} }

View file

@ -60,7 +60,7 @@ public class DocumentParseAction implements CheckAction {
try { try {
if (content instanceof XdmNodeInput && hasCompatibleConfiguration((XdmNodeInput) content)) { if (content instanceof XdmNodeInput && hasCompatibleConfiguration((XdmNodeInput) content)) {
// parsing not neccessary // parsing not necessary
result = new Result<>(((XdmNodeInput) content).getNode()); result = new Result<>(((XdmNodeInput) content).getNode());
} else { } else {
final DocumentBuilder builder = this.processor.newDocumentBuilder(); final DocumentBuilder builder = this.processor.newDocumentBuilder();

View file

@ -48,14 +48,14 @@ import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
/** /**
* Schema valiation of the {@link Input} with the schema of the supplied scenario. This implementation is based on JDK * Schema validation of the {@link Input} with the schema of the supplied scenario. This implementation is based on JDK
* functionality and therefore needs a {@link Source} to do the actual validation. Since we base the validator on Saxon * functionality and therefore needs a {@link Source} to do the actual validation. Since we base the validator on Saxon
* HE functionality, we have no support for schema in Saxon (e.g. the in memory version of the document is not * HE functionality, we have no support for schema in Saxon (e.g. the in memory version of the document is not
* schema-aware) and need to re-read the actual source. * schema-aware) and need to re-read the actual source.
* <p> * <p>
* Since the actual {@link Input} implementation may not be read twice, we must serialize the previously read document. * Since the actual {@link Input} implementation may not be read twice, we must serialize the previously read document.
* This implementation tries to do the validation in an efficient manner. If possible the source is read a second time * This implementation tries to do the validation in an efficient manner. If possible the source is read a second time
* to validate. If not, the source is serialized to the heap upon re-read/validaiton up to a configurable file size. The * to validate. If not, the source is serialized to the heap upon re-read/validation up to a configurable file size. The
* document is serialized to a temporary file otherwise. * document is serialized to a temporary file otherwise.
* *
* @author Andreas Penski * @author Andreas Penski
@ -180,7 +180,7 @@ public class SchemaValidationAction implements CheckAction {
} }
@SuppressWarnings("squid:S2095") // intentionally return open stream/autoclosable here @SuppressWarnings("squid:S2095") // intentionally return open stream/autocloseable here
private SerializedDocument serialize(final Input input, final XdmNode object) throws IOException, SaxonApiException { private SerializedDocument serialize(final Input input, final XdmNode object) throws IOException, SaxonApiException {
final SerializedDocument doc; final SerializedDocument doc;
if (input instanceof AbstractInput && ((AbstractInput) input).getLength() < getInMemoryLimit()) { if (input instanceof AbstractInput && ((AbstractInput) input).getLength() < getInMemoryLimit()) {

View file

@ -101,14 +101,14 @@ public class SchematronValidationAction implements CheckAction {
@Override @Override
public boolean isSkipped(final Bag results) { public boolean isSkipped(final Bag results) {
return hasNoSchematrons(results.getScenarioSelectionResult().getObject()) || isSchemaInvalid(results); return hasNoSchematron(results.getScenarioSelectionResult().getObject()) || isSchemaInvalid(results);
} }
private static boolean isSchemaInvalid(final Bag results) { private static boolean isSchemaInvalid(final Bag results) {
return results.getSchemaValidationResult() == null || results.getSchemaValidationResult().isInvalid(); return results.getSchemaValidationResult() == null || results.getSchemaValidationResult().isInvalid();
} }
private static boolean hasNoSchematrons(final Scenario object) { private static boolean hasNoSchematron(final Scenario object) {
return object.getSchematronValidations().isEmpty(); return object.getSchematronValidations().isEmpty();
} }
} }

View file

@ -49,7 +49,7 @@ public class ValidateReportInputAction implements CheckAction {
} }
/** /**
* Validatiert das gegebene JAXB-Objekt gegen das konfigurierte Schema * Validiert das gegebene JAXB-Objekt gegen das konfigurierte Schema
* *
* @param object das JAXB-Objekt * @param object das JAXB-Objekt
* @param <T> der Typ des Objekts * @param <T> der Typ des Objekts

View file

@ -69,7 +69,7 @@ public class ProcessorProvider {
} }
} }
protected static final String DISSALLOW_DOCTYPE_DECL_FEATURE = "http://apache.org/xml/features/disallow-doctype-decl"; protected static final String DISALLOW_DTD_FEATURE = "http://apache.org/xml/features/disallow-doctype-decl";
protected static final String LOAD_EXTERNAL_DTD_FEATURE = "http://apache.org/xml/features/nonvalidating/load-external-dtd"; protected static final String LOAD_EXTERNAL_DTD_FEATURE = "http://apache.org/xml/features/nonvalidating/load-external-dtd";
@ -105,11 +105,11 @@ public class ProcessorProvider {
processor.setConfigurationProperty(Feature.XINCLUDE, false); processor.setConfigurationProperty(Feature.XINCLUDE, false);
processor.setConfigurationProperty(Feature.ALLOW_EXTERNAL_FUNCTIONS, false); processor.setConfigurationProperty(Feature.ALLOW_EXTERNAL_FUNCTIONS, false);
// Konfiguration des zu verwendenden Parsers, wenn Saxon selbst einen erzeugen muss, bspw. beim XSL parsen // Konfiguration des zu verwendenden Parsers, wenn Saxon selbst einen erzeugen muss
processor.getUnderlyingConfiguration().setConfigurationProperty(FeatureKeys.XML_PARSER_FEATURE + encode(FEATURE_SECURE_PROCESSING), processor.getUnderlyingConfiguration().setConfigurationProperty(FeatureKeys.XML_PARSER_FEATURE + encode(FEATURE_SECURE_PROCESSING),
true); // NOSONAR true); // NOSONAR
processor.getUnderlyingConfiguration() processor.getUnderlyingConfiguration().setConfigurationProperty(FeatureKeys.XML_PARSER_FEATURE + encode(DISALLOW_DTD_FEATURE),
.setConfigurationProperty(FeatureKeys.XML_PARSER_FEATURE + encode(DISSALLOW_DOCTYPE_DECL_FEATURE), true); // NOSONAR true); // NOSONAR
processor.getUnderlyingConfiguration().setConfigurationProperty(FeatureKeys.XML_PARSER_FEATURE + encode(LOAD_EXTERNAL_DTD_FEATURE), processor.getUnderlyingConfiguration().setConfigurationProperty(FeatureKeys.XML_PARSER_FEATURE + encode(LOAD_EXTERNAL_DTD_FEATURE),
false); // NOSONAR false); // NOSONAR
processor.getUnderlyingConfiguration() processor.getUnderlyingConfiguration()

View file

@ -58,8 +58,8 @@ public class InputFactoryTest {
@Test @Test
public void testDefaultDigestAlgorithm() { public void testDefaultDigestAlgorithm() {
assertThat(new InputFactory().getAlgorithm()).isEqualTo(InputFactory.DEFAULT_ALGORITH); assertThat(new InputFactory().getAlgorithm()).isEqualTo(InputFactory.DEFAULT_ALGORITHM);
assertThat(new InputFactory("").getAlgorithm()).isEqualTo(InputFactory.DEFAULT_ALGORITH); assertThat(new InputFactory("").getAlgorithm()).isEqualTo(InputFactory.DEFAULT_ALGORITHM);
} }
@Test @Test
@ -156,7 +156,7 @@ public class InputFactoryTest {
} }
@Test @Test
public void testUnexistingInput() { public void testNotExistingInput() {
assertThrows(IllegalArgumentException.class, () -> InputFactory.read(Simple.NOT_EXISTING)); assertThrows(IllegalArgumentException.class, () -> InputFactory.read(Simple.NOT_EXISTING));
} }

View file

@ -178,7 +178,7 @@ public class CommandlineApplicationTest {
CommandLineApplication.mainProgram(args); CommandLineApplication.mainProgram(args);
assertThat(CommandLine.getErrorOutput()).contains(RESULT_OUTPUT); assertThat(CommandLine.getErrorOutput()).contains(RESULT_OUTPUT);
assertThat(CommandLine.getOutputLines()).haveAtLeastOne(new Condition<>( assertThat(CommandLine.getOutputLines()).haveAtLeastOne(new Condition<>(
s -> StringUtils.contains(s, "<?xml version=\"1.0\" " + "encoding=\"UTF-8\"?>"), "Must " + "contain xml preambel")); s -> StringUtils.contains(s, "<?xml version=\"1.0\" " + "encoding=\"UTF-8\"?>"), "Must " + "contain xml preamble"));
} }
@Test @Test

View file

@ -64,7 +64,7 @@ public class DefaultNamingStrategyTest {
} }
@Test @Test
public void testUnknownExtenson() { public void testUnknownExtension() {
final DefaultNamingStrategy strategy = new DefaultNamingStrategy(); final DefaultNamingStrategy strategy = new DefaultNamingStrategy();
assertThat(strategy.createName("test.ext")).isEqualTo("test.ext-report.xml"); assertThat(strategy.createName("test.ext")).isEqualTo("test.ext-report.xml");
strategy.setPrefix("prefix"); strategy.setPrefix("prefix");

View file

@ -35,7 +35,7 @@ import java.util.stream.Stream;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
/** /**
* Testet die HTML-Extrkation des Kommondazeilenprogramms. * Testet die HTML-Extraktion des Kommandozeilenprogramms.
* *
* @author Andreas Penski * @author Andreas Penski
*/ */

View file

@ -84,7 +84,7 @@ public class ConversionServiceTest {
@Test @Test
public void testUnmarshalIllFormed() { public void testUnmarshalIllFormed() {
assertThrows(ConversionService.ConversionException.class, assertThrows(ConversionService.ConversionException.class,
() -> this.service.readXml(Invalid.SCENARIOS_ILLFORMED, Scenarios.class, this.repository.createSchema(SCHEMA))); () -> this.service.readXml(Invalid.SCENARIOS_ILL_FORMED, Scenarios.class, this.repository.createSchema(SCHEMA)));
} }
@Test @Test

View file

@ -144,7 +144,7 @@ public class DefaultCheckTest {
public void testGarbage() { public void testGarbage() {
final Result result = this.validCheck.checkInput(read(GARBAGE)); final Result result = this.validCheck.checkInput(read(GARBAGE));
assertThat(result).isNotNull(); assertThat(result).isNotNull();
assertThat(result.isWellformed()).isFalse(); assertThat(result.isWellFormed()).isFalse();
assertThat(result.isSchemaValid()).isFalse(); assertThat(result.isSchemaValid()).isFalse();
assertThat(result.isProcessingSuccessful()).isFalse(); assertThat(result.isProcessingSuccessful()).isFalse();
} }
@ -153,7 +153,7 @@ public class DefaultCheckTest {
public void testNoScenario() { public void testNoScenario() {
final Result result = this.validCheck.checkInput(read(UNKNOWN)); final Result result = this.validCheck.checkInput(read(UNKNOWN));
assertThat(result).isNotNull(); assertThat(result).isNotNull();
assertThat(result.isWellformed()).isTrue(); assertThat(result.isWellFormed()).isTrue();
assertThat(result.isProcessingSuccessful()).isTrue(); assertThat(result.isProcessingSuccessful()).isTrue();
assertThat(result.isSchemaValid()).isFalse(); assertThat(result.isSchemaValid()).isFalse();
assertThat(result.getAcceptRecommendation()).isEqualTo(AcceptRecommendation.REJECT); assertThat(result.getAcceptRecommendation()).isEqualTo(AcceptRecommendation.REJECT);
@ -162,9 +162,9 @@ public class DefaultCheckTest {
@Test @Test
public void testNotWellFormed() { public void testNotWellFormed() {
final Result result = this.validCheck.checkInput(read(NOT_WELLFORMED)); final Result result = this.validCheck.checkInput(read(NOT_WELL_FORMED));
assertThat(result).isNotNull(); assertThat(result).isNotNull();
assertThat(result.isWellformed()).isFalse(); assertThat(result.isWellFormed()).isFalse();
assertThat(result.isSchemaValid()).isFalse(); assertThat(result.isSchemaValid()).isFalse();
assertThat(result.isProcessingSuccessful()).isFalse(); assertThat(result.isProcessingSuccessful()).isFalse();
assertThat(result.getAcceptRecommendation()).isEqualTo(AcceptRecommendation.REJECT); assertThat(result.getAcceptRecommendation()).isEqualTo(AcceptRecommendation.REJECT);
@ -176,7 +176,7 @@ public class DefaultCheckTest {
public void testRejectAcceptMatch() { public void testRejectAcceptMatch() {
final Result result = this.validCheck.checkInput(read(REJECTED)); final Result result = this.validCheck.checkInput(read(REJECTED));
assertThat(result).isNotNull(); assertThat(result).isNotNull();
assertThat(result.isWellformed()).isTrue(); assertThat(result.isWellFormed()).isTrue();
assertThat(result.isSchemaValid()).isTrue(); assertThat(result.isSchemaValid()).isTrue();
assertThat(result.isProcessingSuccessful()).isTrue(); assertThat(result.isProcessingSuccessful()).isTrue();
assertThat(result.getAcceptRecommendation()).isEqualTo(AcceptRecommendation.REJECT); assertThat(result.getAcceptRecommendation()).isEqualTo(AcceptRecommendation.REJECT);
@ -189,13 +189,13 @@ public class DefaultCheckTest {
public void testSchematronFailed() { public void testSchematronFailed() {
final Result result = this.validCheck.checkInput(read(SCHEMATRON_INVALID)); final Result result = this.validCheck.checkInput(read(SCHEMATRON_INVALID));
assertThat(result).isNotNull(); assertThat(result).isNotNull();
assertThat(result.isWellformed()).isTrue(); assertThat(result.isWellFormed()).isTrue();
assertThat(result.isSchemaValid()).isTrue(); assertThat(result.isSchemaValid()).isTrue();
assertThat(result.getFailedAsserts()).isNotEmpty(); assertThat(result.getFailedAsserts()).isNotEmpty();
assertThat(result.isSchematronValid()).isFalse(); assertThat(result.isSchematronValid()).isFalse();
assertThat(result.getSchematronResult().get(0).findFailedAssert("content-1")).isPresent(); assertThat(result.getSchematronResult().get(0).findFailedAssert("content-1")).isPresent();
assertThat(result.isProcessingSuccessful()).isTrue(); assertThat(result.isProcessingSuccessful()).isTrue();
// acceptMatch overules schematron!!! // acceptMatch overrules schematron!!!
assertThat(result.getAcceptRecommendation()).isEqualTo(AcceptRecommendation.ACCEPTABLE); assertThat(result.getAcceptRecommendation()).isEqualTo(AcceptRecommendation.ACCEPTABLE);
assertThat(result.isAcceptable()).isTrue(); assertThat(result.isAcceptable()).isTrue();
assertThat(result.getReport()).isNotNull(); assertThat(result.getReport()).isNotNull();
@ -207,7 +207,7 @@ public class DefaultCheckTest {
public void testSchematronFailedWithoutAcceptMatch() { public void testSchematronFailedWithoutAcceptMatch() {
final Result result = this.validCheck.checkInput(read(FOO_SCHEMATRON_INVALID)); final Result result = this.validCheck.checkInput(read(FOO_SCHEMATRON_INVALID));
assertThat(result).isNotNull(); assertThat(result).isNotNull();
assertThat(result.isWellformed()).isTrue(); assertThat(result.isWellFormed()).isTrue();
assertThat(result.isSchemaValid()).isTrue(); assertThat(result.isSchemaValid()).isTrue();
result.getFailedAsserts(); result.getFailedAsserts();
assertThat(result.isSchematronValid()).isFalse(); assertThat(result.isSchematronValid()).isFalse();

View file

@ -70,7 +70,7 @@ public class Helper {
public static final URI SCHEMATRON_INVALID = ROOT.resolve("input/simple-schematron-invalid.xml"); public static final URI SCHEMATRON_INVALID = ROOT.resolve("input/simple-schematron-invalid.xml");
public static final URI NOT_WELLFORMED = ROOT.resolve("input/simple-not-wellformed.xml"); public static final URI NOT_WELL_FORMED = ROOT.resolve("input/simple-not-wellformed.xml");
public static final URI UNKNOWN = ROOT.resolve("input/unknown.xml"); public static final URI UNKNOWN = ROOT.resolve("input/unknown.xml");
@ -95,11 +95,11 @@ public class Helper {
public static class Invalid { public static class Invalid {
public static final URI ROOT = EXAMPLES_DIR.resolve("invaid/"); public static final URI ROOT = EXAMPLES_DIR.resolve("invalid/");
public static final URI SCENARIOS = ROOT.resolve("scenarios.xml"); public static final URI SCENARIOS = ROOT.resolve("scenarios.xml");
public static final URI SCENARIOS_ILLFORMED = ROOT.resolve("scenarios-illformed.xml"); public static final URI SCENARIOS_ILL_FORMED = ROOT.resolve("scenarios-illformed.xml");
} }

View file

@ -37,7 +37,7 @@ import static org.assertj.core.api.Assertions.assertThat;
*/ */
public class ComputeAcceptanceActionTest { public class ComputeAcceptanceActionTest {
private static final String DOESNOT_EXIST = "count(//doesnotExist) = 0"; private static final String DOES_NOT_EXIST = "count(//doesnotExist) = 0";
private final ComputeAcceptanceAction action = new ComputeAcceptanceAction(); private final ComputeAcceptanceAction action = new ComputeAcceptanceAction();
@ -66,7 +66,7 @@ public class ComputeAcceptanceActionTest {
@Test @Test
public void testValidAcceptMatch() { public void testValidAcceptMatch() {
final Bag bag = createBag(true, true); final Bag bag = createBag(true, true);
bag.getScenarioSelectionResult().getObject().setAcceptExecutable(createXpath(DOESNOT_EXIST)); bag.getScenarioSelectionResult().getObject().setAcceptExecutable(createXpath(DOES_NOT_EXIST));
this.action.check(bag); this.action.check(bag);
assertThat(bag.getAcceptStatus()).isEqualTo(AcceptRecommendation.ACCEPTABLE); assertThat(bag.getAcceptStatus()).isEqualTo(AcceptRecommendation.ACCEPTABLE);
} }
@ -82,7 +82,7 @@ public class ComputeAcceptanceActionTest {
@Test @Test
public void testAcceptMatchOverridesSchematronErrors() { public void testAcceptMatchOverridesSchematronErrors() {
final Bag bag = createBag(true, false); final Bag bag = createBag(true, false);
bag.getScenarioSelectionResult().getObject().setAcceptExecutable(createXpath(DOESNOT_EXIST)); bag.getScenarioSelectionResult().getObject().setAcceptExecutable(createXpath(DOES_NOT_EXIST));
this.action.check(bag); this.action.check(bag);
assertThat(bag.getAcceptStatus()).isEqualTo(AcceptRecommendation.ACCEPTABLE); assertThat(bag.getAcceptStatus()).isEqualTo(AcceptRecommendation.ACCEPTABLE);
} }
@ -90,7 +90,7 @@ public class ComputeAcceptanceActionTest {
@Test @Test
public void testValidAcceptMatchOnSchemaFailed() { public void testValidAcceptMatchOnSchemaFailed() {
final Bag bag = createBag(false, true); final Bag bag = createBag(false, true);
bag.getScenarioSelectionResult().getObject().setAcceptExecutable(createXpath(DOESNOT_EXIST)); bag.getScenarioSelectionResult().getObject().setAcceptExecutable(createXpath(DOES_NOT_EXIST));
this.action.check(bag); this.action.check(bag);
assertThat(bag.getAcceptStatus()).isEqualTo(AcceptRecommendation.REJECT); assertThat(bag.getAcceptStatus()).isEqualTo(AcceptRecommendation.REJECT);
} }

View file

@ -52,8 +52,8 @@ public class DocumentParseActionTest {
} }
@Test @Test
public void testIllformed() { public void testIllFormed() {
final Result<XdmNode, XMLSyntaxError> result = this.action.parseDocument(read(Simple.NOT_WELLFORMED)); final Result<XdmNode, XMLSyntaxError> result = this.action.parseDocument(read(Simple.NOT_WELL_FORMED));
assertThat(result).isNotNull(); assertThat(result).isNotNull();
assertThat(result.getErrors()).isNotEmpty(); assertThat(result.getErrors()).isNotEmpty();
assertThat(result.getObject()).isNull(); assertThat(result.getObject()).isNull();

View file

@ -89,7 +89,7 @@ public class SchemaValidatorActionTest {
public void testNoRepeatableRead() throws Exception { public void testNoRepeatableRead() throws Exception {
try ( final InputStream inputStream = Simple.SIMPLE_VALID.toURL().openStream() ) { try ( final InputStream inputStream = Simple.SIMPLE_VALID.toURL().openStream() ) {
final Bag bag = createBag(InputFactory.read(new StreamSource(inputStream))); final Bag bag = createBag(InputFactory.read(new StreamSource(inputStream)));
// don't read the real inputstream here! // don't read the real input stream here!
bag.setParserResult(Helper.parseDocument(InputFactory.read(Simple.SIMPLE_VALID.toURL()))); bag.setParserResult(Helper.parseDocument(InputFactory.read(Simple.SIMPLE_VALID.toURL())));
this.service.check(bag); this.service.check(bag);
assertThat(bag.getSchemaValidationResult()).isNotNull(); assertThat(bag.getSchemaValidationResult()).isNotNull();

View file

@ -68,18 +68,18 @@ public class TestBagBuilder {
return bag; return bag;
} }
private static Scenario createScenario(final URI schemafile) { private static Scenario createScenario(final URI schemaFile) {
try { try {
final ScenarioType t = new ScenarioType(); final ScenarioType t = new ScenarioType();
final ValidateWithXmlSchema v = new ValidateWithXmlSchema(); final ValidateWithXmlSchema v = new ValidateWithXmlSchema();
final ResourceType r = new ResourceType(); final ResourceType r = new ResourceType();
r.setLocation(schemafile.getRawPath()); r.setLocation(schemaFile.getRawPath());
r.setName("invoice"); r.setName("invoice");
v.getResource().add(r); v.getResource().add(r);
t.setValidateWithXmlSchema(v); t.setValidateWithXmlSchema(v);
final Scenario scenario = new Scenario(t); final Scenario scenario = new Scenario(t);
scenario.setSchema(createSchema(schemafile.toURL())); scenario.setSchema(createSchema(schemaFile.toURL()));
final ResolvingConfigurationStrategy strategy = ResolvingMode.STRICT_RELATIVE.getStrategy(); final ResolvingConfigurationStrategy strategy = ResolvingMode.STRICT_RELATIVE.getStrategy();
scenario.setFactory(strategy); scenario.setFactory(strategy);
return scenario; return scenario;