mirror of
https://github.com/itplr-kosit/validator.git
synced 2026-05-25 16:55:39 +00:00
25-FixTypos
This commit is contained in:
parent
7d99b83e07
commit
2466f9cf5d
50 changed files with 136 additions and 136 deletions
|
|
@ -29,7 +29,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Zentrale Konfigration einer Prüf-Instanz.
|
||||
* Zentrale Konfiguration einer Prüf-Instanz.
|
||||
*
|
||||
* @author Andreas Penski
|
||||
* @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 {
|
||||
|
||||
/**
|
||||
* URL, die auf die scenerio.xml Datei zeigt.
|
||||
* URL, die auf die scenario.xml Datei zeigt.
|
||||
*/
|
||||
private final URI scenarioDefinition;
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ import java.util.Map;
|
|||
* {@link Check}</li>
|
||||
* </ol>
|
||||
* <p>
|
||||
* Both methods can be used via convinience methods. See below.
|
||||
* Both methods can be used via convenience methods. See below.
|
||||
*
|
||||
* @author Andreas Penski
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ public interface Input {
|
|||
/**
|
||||
* 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();
|
||||
|
||||
|
|
|
|||
|
|
@ -50,10 +50,10 @@ import static org.apache.commons.lang3.StringUtils.isNotEmpty;
|
|||
@Slf4j
|
||||
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";
|
||||
|
||||
|
|
@ -66,7 +66,7 @@ public class InputFactory {
|
|||
}
|
||||
|
||||
InputFactory(final String specifiedAlgorithm) {
|
||||
this.algorithm = isNotEmpty(specifiedAlgorithm) ? specifiedAlgorithm : DEFAULT_ALGORITH;
|
||||
this.algorithm = isNotEmpty(specifiedAlgorithm) ? specifiedAlgorithm : DEFAULT_ALGORITHM;
|
||||
// check validity
|
||||
StreamHelper.createDigest(this.algorithm);
|
||||
}
|
||||
|
|
@ -79,11 +79,11 @@ public class InputFactory {
|
|||
* @return ein Prüf-Eingabe-Objekt
|
||||
*/
|
||||
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.
|
||||
*
|
||||
* @param path der Prüflings
|
||||
|
|
@ -103,7 +103,7 @@ public class InputFactory {
|
|||
* @return ein Prüf-Eingabe-Objekt
|
||||
*/
|
||||
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
|
||||
*/
|
||||
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.
|
||||
*
|
||||
* @param uri URI des Prüflings
|
||||
|
|
@ -141,7 +141,7 @@ public class InputFactory {
|
|||
* @return ein Prüf-Eingabe-Objekt
|
||||
*/
|
||||
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) {
|
||||
if (source instanceof StreamSource) {
|
||||
return read(source, source.getSystemId(), DEFAULT_ALGORITH);
|
||||
return read(source, source.getSystemId(), DEFAULT_ALGORITHM);
|
||||
}
|
||||
final String name = UUID.randomUUID().toString();
|
||||
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.
|
||||
*
|
||||
* @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.
|
||||
*
|
||||
* @param input URL des Prüflings
|
||||
|
|
@ -245,11 +245,11 @@ public class InputFactory {
|
|||
*/
|
||||
public static Input read(final byte[] input, final String name) {
|
||||
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.
|
||||
*
|
||||
* @param input URL des Prüflings
|
||||
|
|
@ -282,7 +282,7 @@ public class InputFactory {
|
|||
* @return einen Prüfling in eingelesener Form
|
||||
*/
|
||||
public static Input read(final InputStream inputStream, final String name) {
|
||||
return read(inputStream, name, DEFAULT_ALGORITH);
|
||||
return read(inputStream, name, DEFAULT_ALGORITHM);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
* <p>
|
||||
* 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
|
||||
* effort to mitigate or prevent xml related security issues such as XXE, loading external sources etc. Your would be
|
||||
* components beyond this strategy assume secured implementation of the interfaces provided by this strategy. There is
|
||||
* no effort to mitigate or prevent xml related security issues such as XXE, loading external sources etc. Your would be
|
||||
* responsible for this!
|
||||
*
|
||||
* @see de.kosit.validationtool.impl.ResolvingMode
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ public interface Result {
|
|||
*
|
||||
* @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
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
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
|
||||
*/
|
||||
|
|
@ -42,7 +42,7 @@ public interface XmlError {
|
|||
/**
|
||||
* Gibt optional eine Zeilennummer an, aus der der Fehler resultiert.
|
||||
*
|
||||
* @return die Zeitelnnummer
|
||||
* @return die Zeilennummer
|
||||
*/
|
||||
Integer getRowNumber();
|
||||
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ public class CommandLineApplication {
|
|||
final ReturnValue resultStatus = mainProgram(args);
|
||||
if (!resultStatus.equals(ReturnValue.DAEMON_MODE)) {
|
||||
if (!resultStatus.equals(ReturnValue.HELP_REQUEST) && resultStatus.getCode() >= 0) {
|
||||
sayGoodby(resultStatus);
|
||||
sayGoodbye(resultStatus);
|
||||
}
|
||||
System.exit(resultStatus.getCode());
|
||||
} 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##############################");
|
||||
if (resultStatus.equals(ReturnValue.SUCCESS)) {
|
||||
Printer.writeOut("# " + new Line(Code.GREEN).add("Validation successful!").render(false, false) + " #");
|
||||
|
|
|
|||
|
|
@ -84,11 +84,11 @@ class InternalCheck extends DefaultCheck {
|
|||
results.entrySet().stream().sorted(Entry.comparingByKey()).forEach(e -> {
|
||||
final Result value = e.getValue();
|
||||
|
||||
final Code textcolor = value.isAcceptable() ? Code.GREEN : Code.RED;
|
||||
grid.addCell(e.getKey(), textcolor);
|
||||
grid.addCell(value.isSchemaValid() ? "Y" : "N", textcolor);
|
||||
grid.addCell(value.isSchematronValid() ? "Y" : "N", textcolor);
|
||||
grid.addCell(value.getAcceptRecommendation(), textcolor);
|
||||
final Code textColor = value.isAcceptable() ? Code.GREEN : Code.RED;
|
||||
grid.addCell(e.getKey(), textColor);
|
||||
grid.addCell(value.isSchemaValid() ? "Y" : "N", textColor);
|
||||
grid.addCell(value.isSchematronValid() ? "Y" : "N", textColor);
|
||||
grid.addCell(value.getAcceptRecommendation(), textColor);
|
||||
grid.addCell(joinErrors(value));
|
||||
});
|
||||
return grid;
|
||||
|
|
|
|||
|
|
@ -45,15 +45,15 @@ class TypeConverter {
|
|||
|
||||
private static <T extends Definition> T convert(final Class<T> type, final String value) {
|
||||
final T def;
|
||||
final String[] splitted = defaultIfBlank(value, "").split("=");
|
||||
if (splitted.length == 1) {
|
||||
final String[] items = defaultIfBlank(value, "").split("=");
|
||||
if (items.length == 1) {
|
||||
def = createNewInstance(type);
|
||||
def.setName(getDefaultName(type));
|
||||
def.setPath(Paths.get(splitted[0].trim()));
|
||||
} else if (splitted.length == 2) {
|
||||
def.setPath(Paths.get(items[0].trim()));
|
||||
} else if (items.length == 2) {
|
||||
def = createNewInstance(type);
|
||||
def.setName(splitted[0].trim());
|
||||
def.setPath(Paths.get(splitted[1].trim()));
|
||||
def.setName(items[0].trim());
|
||||
def.setPath(Paths.get(items[1].trim()));
|
||||
} else {
|
||||
throw new IllegalArgumentException("Not a valid repository specification " + value);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ import static org.apache.commons.lang3.StringUtils.EMPTY;
|
|||
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
|
||||
*/
|
||||
|
|
@ -184,7 +184,7 @@ public class Validator {
|
|||
checkUnused(mappedScenarios, mappedRepos);
|
||||
|
||||
return mappedScenarios.entrySet().stream().map(e -> {
|
||||
assertFileExistance(e.getValue(), "scenario");
|
||||
assertFileExistence(e.getValue(), "scenario");
|
||||
final URI scenarioLocation = e.getValue().toUri();
|
||||
final URI repositoryLocation = findRepository(e.getKey(), mappedRepos);
|
||||
|
||||
|
|
@ -321,7 +321,7 @@ public class Validator {
|
|||
}
|
||||
|
||||
@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)) {
|
||||
throw new IllegalArgumentException(
|
||||
String.format("Not a valid path for %s definition specified: '%s'", type, f.toAbsolutePath()));
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ public class ConfigurationBuilder {
|
|||
/**
|
||||
* Adds a description to this configuration.
|
||||
*
|
||||
* @param description the descriptioin
|
||||
* @param description the description
|
||||
* @return this
|
||||
*/
|
||||
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
|
||||
* @throws IllegalStateException when the configuration is not valid/complete
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ public class ConfigurationLoader {
|
|||
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)
|
||||
private final URI scenarioDefinition;
|
||||
|
|
@ -115,8 +115,8 @@ public class ConfigurationLoader {
|
|||
}
|
||||
|
||||
private static Scenario createFallback(final Scenarios scenarios, final ContentRepository repository) {
|
||||
final ResourceType noscenarioResource = scenarios.getNoScenarioReport().getResource();
|
||||
return new FallbackBuilder().source(noscenarioResource.getLocation()).name(noscenarioResource.getName()).build(repository)
|
||||
final ResourceType noScenarioResource = scenarios.getNoScenarioReport().getResource();
|
||||
return new FallbackBuilder().source(noScenarioResource.getLocation()).name(noScenarioResource.getName()).build(repository)
|
||||
.getObject();
|
||||
|
||||
}
|
||||
|
|
@ -140,7 +140,7 @@ public class ConfigurationLoader {
|
|||
s.setUriResolver(repository.getResolver());
|
||||
s.setUnparsedTextURIResolver(repository.getUnparsedTextURIResolver());
|
||||
if (def.getAcceptMatch() != null) {
|
||||
s.setAcceptExecutable(repository.createAccepptExecutable(def));
|
||||
s.setAcceptExecutable(repository.createAcceptExecutable(def));
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
* for a precompiled tranformation.
|
||||
* Specifies a source for this report. This is either used to compile the report transformation or as documentation
|
||||
* for a precompiled transformation.
|
||||
*
|
||||
* @param source the source
|
||||
* @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
|
||||
* for a precompiled tranformation.
|
||||
* Specifies a source for this report. This is either used to compile the report transformation or as documentation
|
||||
* for a precompiled transformation.
|
||||
*
|
||||
* @param source the source
|
||||
* @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
|
||||
* for a precompiled tranformation.
|
||||
* Specifies a source for this report. This is either used to compile the report transformation or as documentation
|
||||
* for a precompiled transformation.
|
||||
*
|
||||
* @param source the source
|
||||
* @return this
|
||||
|
|
|
|||
|
|
@ -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
|
||||
* for a precompiled tranformation.
|
||||
* Specifies a source for this report. This is either used to compile the report transformation or as documentation
|
||||
* for a precompiled transformation.
|
||||
*
|
||||
* @param source the source
|
||||
* @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
|
||||
* for a precompiled tranformation.
|
||||
* Specifies a source for this report. This is either used to compile the report transformation or as documentation
|
||||
* for a precompiled transformation.
|
||||
*
|
||||
* @param source the source
|
||||
* @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
|
||||
* for a precompiled tranformation.
|
||||
* Specifies a source for this report. This is either used to compile the report transformation or as documentation
|
||||
* for a precompiled transformation.
|
||||
*
|
||||
* @param source the source
|
||||
* @return this
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
*
|
||||
* @param acceptXpath the xpath expresison
|
||||
* @param acceptXpath the xpath expression
|
||||
* @return this
|
||||
*/
|
||||
public ScenarioBuilder acceptWith(final String acceptXpath) {
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ public class SchemaBuilder implements Builder<Pair<ValidateWithXmlSchema, Schema
|
|||
final ValidateWithXmlSchema o = new ValidateWithXmlSchema();
|
||||
final ResourceType r = new ResourceType();
|
||||
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);
|
||||
return o;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
* or as documentation for a precompiled tranformation.
|
||||
* Specifies a source for this schematron validation. This is either used to compile the schematron transformation
|
||||
* or as documentation for a precompiled transformation.
|
||||
*
|
||||
* @param source the source
|
||||
* @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
|
||||
* or as documentation for a precompiled tranformation.
|
||||
* Specifies a source for this schematron validation. This is either used to compile the schematron transformation
|
||||
* or as documentation for a precompiled transformation.
|
||||
*
|
||||
* @param source the source
|
||||
* @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
|
||||
* or as documentation for a precompiled tranformation.
|
||||
* Specifies a source for this schematron validation. This is either used to compile the schematron transformation
|
||||
* or as documentation for a precompiled transformation.
|
||||
*
|
||||
* @param source the source
|
||||
* @return this
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ class CheckHandler extends BaseHandler {
|
|||
|
||||
private static final AtomicLong counter = new AtomicLong(0);
|
||||
|
||||
private final Check implemenation;
|
||||
private final Check implementation;
|
||||
|
||||
private final Processor processor;
|
||||
|
||||
|
|
@ -59,13 +59,13 @@ class CheckHandler extends BaseHandler {
|
|||
try {
|
||||
log.debug("Incoming request");
|
||||
final String requestMethod = httpExchange.getRequestMethod();
|
||||
// check neccessary, since gui can be disabled
|
||||
// check necessary, since gui can be disabled
|
||||
if (requestMethod.equals("POST")) {
|
||||
final BufferedInputStream buffered = StreamHelper.wrapPeekable(httpExchange.getRequestBody());
|
||||
if (!isMultipartFormData(httpExchange) && isContentAvailable(httpExchange, buffered)) {
|
||||
final SourceInput serverInput = (SourceInput) InputFactory.read(buffered,
|
||||
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));
|
||||
} else {
|
||||
error(httpExchange, HttpStatus.SC_BAD_REQUEST, "No content supplied");
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ public class Daemon {
|
|||
log.info("Server {} started", server.getAddress());
|
||||
writeOut("Daemon started. Visit http://{0}", this.bindAddress + ":" + this.port);
|
||||
} catch (final IOException e) {
|
||||
log.error("Error starting HttpServer for Valdidator: {}", e.getMessage(), e);
|
||||
log.error("Error starting HttpServer for Validator: {}", e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ public class GuiHandler extends BaseHandler {
|
|||
final URL resource = GuiHandler.class.getClassLoader().getResource("ui" + path);
|
||||
if (resource != null) {
|
||||
write(exchange, IOUtils.toString(resource, Charset.defaultCharset()).getBytes(),
|
||||
Mediatype.resolveBySuffix(resource.getPath()).getMimeType());
|
||||
MediaType.resolveBySuffix(resource.getPath()).getMimeType());
|
||||
} else {
|
||||
error(exchange, 404, "not found");
|
||||
}
|
||||
|
|
@ -55,14 +55,14 @@ public class GuiHandler extends BaseHandler {
|
|||
|
||||
@RequiredArgsConstructor
|
||||
@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");
|
||||
|
||||
private final String mimeType;
|
||||
|
||||
static Mediatype resolveBySuffix(final String path) {
|
||||
return Arrays.stream(values()).filter(e -> path.toUpperCase().endsWith("." + e.name())).findFirst().orElse(Mediatype.MD);
|
||||
static MediaType resolveBySuffix(final String path) {
|
||||
return Arrays.stream(values()).filter(e -> path.toUpperCase().endsWith("." + e.name())).findFirst().orElse(MediaType.MD);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ import java.util.Map;
|
|||
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
|
||||
*/
|
||||
|
|
@ -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
|
||||
* @return das Schema
|
||||
|
|
@ -243,7 +243,7 @@ public class ContentRepository {
|
|||
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()
|
||||
.collect(Collectors.toMap(NamespaceType::getPrefix, ns -> StringTrimAdapter.trim(ns.getValue())));
|
||||
return createXPath(s.getAcceptMatch(), namespaces);
|
||||
|
|
|
|||
|
|
@ -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
|
||||
*/
|
||||
|
|
@ -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
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -50,8 +50,8 @@ import java.util.stream.Collectors;
|
|||
import static de.kosit.validationtool.impl.DateFactory.createTimestamp;
|
||||
|
||||
/**
|
||||
* The reference implementation for the validation process. After initialisation, instances are threadsafe and should be
|
||||
* reused since initializing saxon runtime objects is a rather heavyweight process.
|
||||
* The reference implementation for the validation process. After initialisation, instances are thread safe and should
|
||||
* be reused since initializing saxon runtime objects is a rather heavyweight process.
|
||||
*
|
||||
* @author Andreas Penski
|
||||
*/
|
||||
|
|
@ -129,7 +129,7 @@ public class DefaultCheck implements Check {
|
|||
|
||||
private Result createResult(final Bag t) {
|
||||
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());
|
||||
if (t.getSchemaValidationResult() != null) {
|
||||
result.setSchemaViolations(convertErrors(t.getSchemaValidationResult().getErrors()));
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ public class DefaultResult implements Result {
|
|||
|
||||
@Getter
|
||||
@Setter
|
||||
private boolean wellformed;
|
||||
private boolean wellFormed;
|
||||
|
||||
public DefaultResult(final XdmNode report, final AcceptRecommendation recommendation, final HtmlExtractor htmlExtractor) {
|
||||
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.
|
||||
*/
|
||||
|
|
@ -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.
|
||||
*/
|
||||
|
|
@ -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.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ import java.io.InputStream;
|
|||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* Hält statische Informatione über diesen Validator.
|
||||
* Hält statische Informationen über diesen Validator.
|
||||
*
|
||||
* @author Andreas Penski
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -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
|
||||
* @return HTML-Fragment als String
|
||||
|
|
|
|||
|
|
@ -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},
|
||||
* {@link java.nio.file.Path} and any other {@link URL}.
|
||||
* <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
|
||||
*
|
||||
* @author Andreas Penski
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ public class XdmNodeInput implements Input {
|
|||
|
||||
@Override
|
||||
public Source getSource() {
|
||||
// usually not neccessary to be called.
|
||||
// usually not necessary to be called.
|
||||
return this.node.getUnderlyingNode();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
* 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.
|
||||
*
|
||||
* @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) {
|
||||
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
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ public class ComputeAcceptanceAction implements CheckAction {
|
|||
// xml wurde aus irgendwelchen Gründen nicht korrekt verarbeitet, dann lassen wir es als undefined
|
||||
return;
|
||||
}
|
||||
if (preCondtionsMatch(results)) {
|
||||
if (preConditionsMatch(results)) {
|
||||
final Optional<XPathSelector> acceptMatch = results.getScenarioSelectionResult().getObject().getAcceptSelector();
|
||||
if (results.getSchemaValidationResult().isValid() && acceptMatch.isPresent()) {
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ public class CreateReportAction implements CheckAction {
|
|||
|
||||
@Override
|
||||
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) {
|
||||
throw new SAXNotRecognizedException(name);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ public class DocumentParseAction implements CheckAction {
|
|||
|
||||
try {
|
||||
if (content instanceof XdmNodeInput && hasCompatibleConfiguration((XdmNodeInput) content)) {
|
||||
// parsing not neccessary
|
||||
// parsing not necessary
|
||||
result = new Result<>(((XdmNodeInput) content).getNode());
|
||||
} else {
|
||||
final DocumentBuilder builder = this.processor.newDocumentBuilder();
|
||||
|
|
|
|||
|
|
@ -48,14 +48,14 @@ import java.nio.file.Files;
|
|||
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
|
||||
* 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.
|
||||
* <p>
|
||||
* 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
|
||||
* 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.
|
||||
*
|
||||
* @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 {
|
||||
final SerializedDocument doc;
|
||||
if (input instanceof AbstractInput && ((AbstractInput) input).getLength() < getInMemoryLimit()) {
|
||||
|
|
|
|||
|
|
@ -101,14 +101,14 @@ public class SchematronValidationAction implements CheckAction {
|
|||
|
||||
@Override
|
||||
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) {
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 <T> der Typ des Objekts
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
||||
|
|
@ -105,11 +105,11 @@ public class ProcessorProvider {
|
|||
processor.setConfigurationProperty(Feature.XINCLUDE, 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),
|
||||
true); // NOSONAR
|
||||
processor.getUnderlyingConfiguration()
|
||||
.setConfigurationProperty(FeatureKeys.XML_PARSER_FEATURE + encode(DISSALLOW_DOCTYPE_DECL_FEATURE), true); // NOSONAR
|
||||
processor.getUnderlyingConfiguration().setConfigurationProperty(FeatureKeys.XML_PARSER_FEATURE + encode(DISALLOW_DTD_FEATURE),
|
||||
true); // NOSONAR
|
||||
processor.getUnderlyingConfiguration().setConfigurationProperty(FeatureKeys.XML_PARSER_FEATURE + encode(LOAD_EXTERNAL_DTD_FEATURE),
|
||||
false); // NOSONAR
|
||||
processor.getUnderlyingConfiguration()
|
||||
|
|
|
|||
|
|
@ -58,8 +58,8 @@ public class InputFactoryTest {
|
|||
|
||||
@Test
|
||||
public void testDefaultDigestAlgorithm() {
|
||||
assertThat(new InputFactory().getAlgorithm()).isEqualTo(InputFactory.DEFAULT_ALGORITH);
|
||||
assertThat(new InputFactory("").getAlgorithm()).isEqualTo(InputFactory.DEFAULT_ALGORITH);
|
||||
assertThat(new InputFactory().getAlgorithm()).isEqualTo(InputFactory.DEFAULT_ALGORITHM);
|
||||
assertThat(new InputFactory("").getAlgorithm()).isEqualTo(InputFactory.DEFAULT_ALGORITHM);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -156,7 +156,7 @@ public class InputFactoryTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testUnexistingInput() {
|
||||
public void testNotExistingInput() {
|
||||
assertThrows(IllegalArgumentException.class, () -> InputFactory.read(Simple.NOT_EXISTING));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@ public class CommandlineApplicationTest {
|
|||
CommandLineApplication.mainProgram(args);
|
||||
assertThat(CommandLine.getErrorOutput()).contains(RESULT_OUTPUT);
|
||||
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
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ public class DefaultNamingStrategyTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testUnknownExtenson() {
|
||||
public void testUnknownExtension() {
|
||||
final DefaultNamingStrategy strategy = new DefaultNamingStrategy();
|
||||
assertThat(strategy.createName("test.ext")).isEqualTo("test.ext-report.xml");
|
||||
strategy.setPrefix("prefix");
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ import java.util.stream.Stream;
|
|||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Testet die HTML-Extrkation des Kommondazeilenprogramms.
|
||||
* Testet die HTML-Extraktion des Kommandozeilenprogramms.
|
||||
*
|
||||
* @author Andreas Penski
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ public class ConversionServiceTest {
|
|||
@Test
|
||||
public void testUnmarshalIllFormed() {
|
||||
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
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ public class DefaultCheckTest {
|
|||
public void testGarbage() {
|
||||
final Result result = this.validCheck.checkInput(read(GARBAGE));
|
||||
assertThat(result).isNotNull();
|
||||
assertThat(result.isWellformed()).isFalse();
|
||||
assertThat(result.isWellFormed()).isFalse();
|
||||
assertThat(result.isSchemaValid()).isFalse();
|
||||
assertThat(result.isProcessingSuccessful()).isFalse();
|
||||
}
|
||||
|
|
@ -153,7 +153,7 @@ public class DefaultCheckTest {
|
|||
public void testNoScenario() {
|
||||
final Result result = this.validCheck.checkInput(read(UNKNOWN));
|
||||
assertThat(result).isNotNull();
|
||||
assertThat(result.isWellformed()).isTrue();
|
||||
assertThat(result.isWellFormed()).isTrue();
|
||||
assertThat(result.isProcessingSuccessful()).isTrue();
|
||||
assertThat(result.isSchemaValid()).isFalse();
|
||||
assertThat(result.getAcceptRecommendation()).isEqualTo(AcceptRecommendation.REJECT);
|
||||
|
|
@ -162,9 +162,9 @@ public class DefaultCheckTest {
|
|||
|
||||
@Test
|
||||
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.isWellformed()).isFalse();
|
||||
assertThat(result.isWellFormed()).isFalse();
|
||||
assertThat(result.isSchemaValid()).isFalse();
|
||||
assertThat(result.isProcessingSuccessful()).isFalse();
|
||||
assertThat(result.getAcceptRecommendation()).isEqualTo(AcceptRecommendation.REJECT);
|
||||
|
|
@ -176,7 +176,7 @@ public class DefaultCheckTest {
|
|||
public void testRejectAcceptMatch() {
|
||||
final Result result = this.validCheck.checkInput(read(REJECTED));
|
||||
assertThat(result).isNotNull();
|
||||
assertThat(result.isWellformed()).isTrue();
|
||||
assertThat(result.isWellFormed()).isTrue();
|
||||
assertThat(result.isSchemaValid()).isTrue();
|
||||
assertThat(result.isProcessingSuccessful()).isTrue();
|
||||
assertThat(result.getAcceptRecommendation()).isEqualTo(AcceptRecommendation.REJECT);
|
||||
|
|
@ -189,13 +189,13 @@ public class DefaultCheckTest {
|
|||
public void testSchematronFailed() {
|
||||
final Result result = this.validCheck.checkInput(read(SCHEMATRON_INVALID));
|
||||
assertThat(result).isNotNull();
|
||||
assertThat(result.isWellformed()).isTrue();
|
||||
assertThat(result.isWellFormed()).isTrue();
|
||||
assertThat(result.isSchemaValid()).isTrue();
|
||||
assertThat(result.getFailedAsserts()).isNotEmpty();
|
||||
assertThat(result.isSchematronValid()).isFalse();
|
||||
assertThat(result.getSchematronResult().get(0).findFailedAssert("content-1")).isPresent();
|
||||
assertThat(result.isProcessingSuccessful()).isTrue();
|
||||
// acceptMatch overules schematron!!!
|
||||
// acceptMatch overrules schematron!!!
|
||||
assertThat(result.getAcceptRecommendation()).isEqualTo(AcceptRecommendation.ACCEPTABLE);
|
||||
assertThat(result.isAcceptable()).isTrue();
|
||||
assertThat(result.getReport()).isNotNull();
|
||||
|
|
@ -207,7 +207,7 @@ public class DefaultCheckTest {
|
|||
public void testSchematronFailedWithoutAcceptMatch() {
|
||||
final Result result = this.validCheck.checkInput(read(FOO_SCHEMATRON_INVALID));
|
||||
assertThat(result).isNotNull();
|
||||
assertThat(result.isWellformed()).isTrue();
|
||||
assertThat(result.isWellFormed()).isTrue();
|
||||
assertThat(result.isSchemaValid()).isTrue();
|
||||
result.getFailedAsserts();
|
||||
assertThat(result.isSchematronValid()).isFalse();
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ public class Helper {
|
|||
|
||||
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");
|
||||
|
||||
|
|
@ -95,11 +95,11 @@ public class Helper {
|
|||
|
||||
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_ILLFORMED = ROOT.resolve("scenarios-illformed.xml");
|
||||
public static final URI SCENARIOS_ILL_FORMED = ROOT.resolve("scenarios-illformed.xml");
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||
*/
|
||||
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();
|
||||
|
||||
|
|
@ -66,7 +66,7 @@ public class ComputeAcceptanceActionTest {
|
|||
@Test
|
||||
public void testValidAcceptMatch() {
|
||||
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);
|
||||
assertThat(bag.getAcceptStatus()).isEqualTo(AcceptRecommendation.ACCEPTABLE);
|
||||
}
|
||||
|
|
@ -82,7 +82,7 @@ public class ComputeAcceptanceActionTest {
|
|||
@Test
|
||||
public void testAcceptMatchOverridesSchematronErrors() {
|
||||
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);
|
||||
assertThat(bag.getAcceptStatus()).isEqualTo(AcceptRecommendation.ACCEPTABLE);
|
||||
}
|
||||
|
|
@ -90,7 +90,7 @@ public class ComputeAcceptanceActionTest {
|
|||
@Test
|
||||
public void testValidAcceptMatchOnSchemaFailed() {
|
||||
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);
|
||||
assertThat(bag.getAcceptStatus()).isEqualTo(AcceptRecommendation.REJECT);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,8 +52,8 @@ public class DocumentParseActionTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testIllformed() {
|
||||
final Result<XdmNode, XMLSyntaxError> result = this.action.parseDocument(read(Simple.NOT_WELLFORMED));
|
||||
public void testIllFormed() {
|
||||
final Result<XdmNode, XMLSyntaxError> result = this.action.parseDocument(read(Simple.NOT_WELL_FORMED));
|
||||
assertThat(result).isNotNull();
|
||||
assertThat(result.getErrors()).isNotEmpty();
|
||||
assertThat(result.getObject()).isNull();
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ public class SchemaValidatorActionTest {
|
|||
public void testNoRepeatableRead() throws Exception {
|
||||
try ( final InputStream inputStream = Simple.SIMPLE_VALID.toURL().openStream() ) {
|
||||
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())));
|
||||
this.service.check(bag);
|
||||
assertThat(bag.getSchemaValidationResult()).isNotNull();
|
||||
|
|
|
|||
|
|
@ -68,18 +68,18 @@ public class TestBagBuilder {
|
|||
return bag;
|
||||
}
|
||||
|
||||
private static Scenario createScenario(final URI schemafile) {
|
||||
private static Scenario createScenario(final URI schemaFile) {
|
||||
|
||||
try {
|
||||
final ScenarioType t = new ScenarioType();
|
||||
final ValidateWithXmlSchema v = new ValidateWithXmlSchema();
|
||||
final ResourceType r = new ResourceType();
|
||||
r.setLocation(schemafile.getRawPath());
|
||||
r.setLocation(schemaFile.getRawPath());
|
||||
r.setName("invoice");
|
||||
v.getResource().add(r);
|
||||
t.setValidateWithXmlSchema(v);
|
||||
final Scenario scenario = new Scenario(t);
|
||||
scenario.setSchema(createSchema(schemafile.toURL()));
|
||||
scenario.setSchema(createSchema(schemaFile.toURL()));
|
||||
final ResolvingConfigurationStrategy strategy = ResolvingMode.STRICT_RELATIVE.getStrategy();
|
||||
scenario.setFactory(strategy);
|
||||
return scenario;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue