Resolve "Force formatting"

This commit is contained in:
Andreas Penski 2020-09-03 06:02:42 +00:00
parent bc9acc3a0a
commit 69d6e55f14
45 changed files with 535 additions and 538 deletions

View file

@ -16,7 +16,7 @@ public enum AcceptRecommendation {
ACCEPTABLE,
/**
* Recommendation is to reject {@link Input} based on the evaluation of the overall validation.
* Recommendation is to reject {@link Input} based on the evaluation of the overall validation.
*/
REJECT
}

View file

@ -24,7 +24,6 @@ import java.util.stream.Collectors;
import org.w3c.dom.Document;
/**
* Main validator interface for checking incoming files.
*
@ -33,8 +32,8 @@ import org.w3c.dom.Document;
public interface Check {
/**
* Checks an incoming xml {@link Input Inputs}. The result-{@link Document} is readonly. To change the this document you
* need to copy the nodes into an new {@link Document}.
* Checks an incoming xml {@link Input Inputs}. The result-{@link Document} is readonly. To change the this document
* you need to copy the nodes into an new {@link Document}.
*
* @param input the resource / xml file to validate.
* @return a result-{@link Document} (readonly)
@ -75,5 +74,4 @@ public interface Check {
return input.stream().map(this::checkInput).collect(Collectors.toList());
}
}

View file

@ -54,8 +54,6 @@ public class CheckConfiguration implements Configuration {
*/
private URI scenarioRepository;
private Configuration delegate;
private Configuration getDelegate() {
@ -95,8 +93,6 @@ public class CheckConfiguration implements Configuration {
return getDelegate().getAuthor();
}
@Override
public ContentRepository getContentRepository() {
return getDelegate().getContentRepository();

View file

@ -62,8 +62,8 @@ public interface Configuration {
String getDate();
/**
* Add some additional parameters to the validator configuration. Parameter usage depends on actual implementation of
* {@link Check}
* Add some additional parameters to the validator configuration. Parameter usage depends on actual implementation
* of {@link Check}
*
* @return
*/

View file

@ -79,8 +79,8 @@ public class InputFactory {
}
/**
* Liest einen Prüfling von dem übergebenen Pfad. Es wird der Default-Prüfsummenalgorithmus zur Ermittlung der Prüfsumme
* genutzt.
* Liest einen Prüfling von dem übergebenen Pfad. Es wird der Default-Prüfsummenalgorithmus zur Ermittlung der
* Prüfsumme genutzt.
*
* @param path der Prüflings
* @return ein Prüf-Eingabe-Objekt
@ -114,8 +114,8 @@ public class InputFactory {
}
/**
* Liest einen Prüfling von der übergebenen URI. Es wird der Default-Prüfsummenalgorithmus zur Ermittlung der Prüfsumme
* genutzt.
* Liest einen Prüfling von der übergebenen URI. Es wird der Default-Prüfsummenalgorithmus zur Ermittlung der
* Prüfsumme genutzt.
*
* @param uri URI des Prüflings
* @return ein Prüf-Eingabe-Objekt
@ -141,8 +141,8 @@ public class InputFactory {
}
/**
* Liest einen Prüfling von der übergebenen URL. Es wird der Default-Prüfsummenalgorithmus zur Ermittlung der Prüfsumme
* genutzt.
* Liest einen Prüfling von der übergebenen URL. Es wird der Default-Prüfsummenalgorithmus zur Ermittlung der
* Prüfsumme genutzt.
*
* @param url URL des Prüflings
* @return ein Prüf-Eingabe-Objekt
@ -173,8 +173,9 @@ public class InputFactory {
}
/**
* Reads a test document from a {@link Source}. Note: computing the hashcode is only supported for {@link StreamSource}.
* You can not directly use other {@link Source Soures}. You need to supply the hashcode for identification then.
* Reads a test document from a {@link Source}. Note: computing the hashcode is only supported for
* {@link StreamSource}. You can not directly use other {@link Source Soures}. You need to supply the hashcode for
* identification then.
*
* @param source source
* @return an {@link Input}
@ -190,8 +191,8 @@ public class InputFactory {
/**
* Reads a test document from a {@link Source} using a specified digest algorithm.
*
* Note: computing the hashcode is only supported for {@link StreamSource}. You can not directly use other {@link Source
* Soures}. You need to supply the hashcode for identification then.
* Note: computing the hashcode is only supported for {@link StreamSource}. You can not directly use other
* {@link Source Soures}. You need to supply the hashcode for identification then.
*
* @param source source
* @param name the digest algorithm
@ -304,8 +305,8 @@ public class InputFactory {
}
/**
* Reads a saxon {@link XdmNode} with a given name. Hashcode identification is based on the name of the supplied input.
* Now real hashcode is computed.
* Reads a saxon {@link XdmNode} with a given name. Hashcode identification is based on the name of the supplied
* input. Now real hashcode is computed.
*
* @param node the node to read
* @param name the name of the {@link Input}

View file

@ -36,8 +36,8 @@ public interface ResolvingConfigurationStrategy {
/**
* Returns a preconfigured {@link Processor Saxon Processor} for various tasks within the Validator. The validator
* leverages the saxon s9api for internal processing e.g. xml reading and writing. So this is the main object to secure
* for reading, transforming and writing xml files.
* leverages the saxon s9api for internal processing e.g. xml reading and writing. So this is the main object to
* secure for reading, transforming and writing xml files.
*
* Note: you need exactly one instance for all validator related processing.
*
@ -50,8 +50,8 @@ public interface ResolvingConfigurationStrategy {
* dereferencing an absolute URI (after resolution) to return a {@link javax.xml.transform.Source}. It <b>can</b> be
* used for resolving relative URIs against a base URI or restrict access to certain URIs.
* <p>
* This URIResolver is used to dereference the URIs appearing in <code>xsl:import</code>, <code>xsl:include</code>, and
* <code>xsl:import-schema</code> declarations.
* This URIResolver is used to dereference the URIs appearing in <code>xsl:import</code>, <code>xsl:include</code>,
* and <code>xsl:import-schema</code> declarations.
* </p>
*
* @param scenarioRepository an optional repository, your implementation might not need this
@ -60,7 +60,8 @@ public interface ResolvingConfigurationStrategy {
URIResolver createResolver(URI scenarioRepository);
/**
* Creates a specific implementation for resolving objects referenced via XSLT's <code>unparsed-text()</code> function.
* Creates a specific implementation for resolving objects referenced via XSLT's <code>unparsed-text()</code>
* function.
*
* @param scenarioRepository an optional repository, your implementation might not need this
* @return a preconfigured {@link net.sf.saxon.lib.UnparsedTextURIResolver} or null for using saxons default
@ -68,8 +69,8 @@ public interface ResolvingConfigurationStrategy {
UnparsedTextURIResolver createUnparsedTextURIResolver(URI scenarioRepository);
/**
* Creates a preconfigured {@link Validator } instance for a given schema for xml file validation. The implementation
* takes care about security and reference resolving strategies.
* Creates a preconfigured {@link Validator } instance for a given schema for xml file validation. The
* implementation takes care about security and reference resolving strategies.
*
* @param schema the scheme to create a {@link Validator} for
* @return a preconfigured {@link Validator}

View file

@ -16,8 +16,8 @@ import net.sf.saxon.s9api.XdmNode;
public interface Result {
/**
* Zeigt an, ob die Verarbeitung durch den Validator erfolgreich durchlaufen wurde. Diese Funktion macht ausdrücklich
* keine Aussage über die zur Akzeptanz.
* Zeigt an, ob die Verarbeitung durch den Validator erfolgreich durchlaufen wurde. Diese Funktion macht
* ausdrücklich keine Aussage über die zur Akzeptanz.
*
* @return true, wenn die Verarbeitung komplett und erfolgreich durchlaufen wurde
* @see #getAcceptRecommendation()
@ -92,7 +92,8 @@ public interface Result {
boolean isWellformed();
/**
* Returns true, if schematron has been checked and the result does not contain any {@link FailedAssert FailedAsserts}.
* Returns true, if schematron has been checked and the result does not contain any {@link FailedAssert
* FailedAsserts}.
*
* @return true, if valid
*/

View file

@ -91,7 +91,6 @@ class CheckAssertionAction implements CheckAction {
return getMapped().entrySet().stream().filter(e -> matches(e.getKey(), name)).map(Map.Entry::getValue).findFirst().orElse(null);
}
private boolean check(XdmNode document, AssertionType assertion) {
try {
final XPathSelector selector = createSelector(assertion);

View file

@ -9,34 +9,52 @@ import org.apache.commons.cli.Option;
public class CommandLineOptions {
static final Option HELP = Option.builder("?").longOpt("help").argName("Help").desc("Displays this help").build();
static final Option SCENARIOS = Option.builder("s").required().longOpt("scenarios").hasArg().desc("Location of scenarios.xml e.g.")
.build();
static final Option REPOSITORY = Option.builder("r").longOpt("repository").hasArg().desc("Directory containing scenario content")
.build();
static final Option PRINT = Option.builder("p").longOpt("print").desc("Prints the check result to stdout").build();
static final Option OUTPUT = Option.builder("o").longOpt("output-directory")
.desc("Defines the out directory for results. Defaults to cwd").hasArg().build();
static final Option EXTRACT_HTML = Option.builder("h").longOpt("html")
.desc("Extract and save any html content within result as a separate file ").build();
static final Option DEBUG = Option.builder("d").longOpt("debug").desc("Prints some more debug information").build();
static final Option SERIALIZE_REPORT_INPUT = Option.builder("c").longOpt("serialize-report-input")
.desc("Serializes the report input to the cwd").build();
static final Option CHECK_ASSERTIONS = Option.builder("c").longOpt("check-assertions").hasArg()
.desc("Check the result using defined assertions").argName("assertions-file").build();
static final Option SERVER = Option.builder("D").longOpt("daemon").desc("Starts a daemon listing for validation requests").build();
static final Option HOST = Option.builder("H").longOpt("host").hasArg()
.desc("The hostname / IP address to bind the daemon. Default is localhost").build();
static final Option PORT = Option.builder("P").longOpt("port").hasArg().desc("The port to bind the daemon. Default is 8080").build();
static final Option WORKER_COUNT = Option.builder("T").longOpt("threads").hasArg()
.desc("Number of threads processing validation requests").build();
static final Option DISABLE_GUI = Option.builder("G").longOpt("disable-gui").desc("Disables the GUI of the daemon mode").build();
static final Option REPORT_POSTFIX = Option.builder(null).longOpt("report-postfix").hasArg()
.desc("Postfix of the generated report name").build();
static final Option REPORT_PREFIX = Option.builder(null).longOpt("report-prefix").hasArg().desc("Prefix of the generated report name")
.build();
static final Option DEBUG_LOG = Option.builder("X").longOpt("debug-logging").desc("Enables full debug log. Alias for -l debug").build();
static final Option LOG_LEVEL = Option.builder("l").longOpt("log-level").hasArg()
.desc("Enables a certain log level for debugging " + "purposes").build();
static final Option PRINT_MEM_STATS = Option.builder("m").longOpt("memory-stats").desc("Prints some memory stats").build();
private CommandLineOptions() {

View file

@ -200,7 +200,6 @@ public class Validator {
return check.isSuccessful(results) ? ReturnValue.SUCCESS : ReturnValue.createFailed(check.getNotAcceptableCount(results));
}
private static ConfigurationLoader getConfiguration(final CommandLine cmd) {
final URI scenarioLocation = determineDefinition(cmd);
final URI repositoryLocation = determineRepository(cmd);

View file

@ -183,8 +183,6 @@ public class Grid {
return this;
}
}
private static final Format DEFAULT_FORMAT = new Format();

View file

@ -177,6 +177,7 @@ public class ConfigurationLoader {
/**
* Sets actual {@link ResolvingMode}, when the validator needs to resolve stuff on startup.
*
* @param mode the resolving mode
* @return this
*/
@ -188,13 +189,14 @@ public class ConfigurationLoader {
return this;
}
public ConfigurationLoader setResolvingStrategy(final ResolvingConfigurationStrategy strategy){
public ConfigurationLoader setResolvingStrategy(final ResolvingConfigurationStrategy strategy) {
this.resolvingConfigurationStrategy = strategy;
return this;
}
/**
* Add a parameter to the configuration.
*
* @param name the name of the parameter
* @param value the parameter value object
* @return this

View file

@ -48,8 +48,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.
* Specifices a source for this report. This is either used to compile the report transformation or as documentation
* for a precompiled tranformation.
*
* @param source the source
* @return this
@ -60,8 +60,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.
* Specifices a source for this report. This is either used to compile the report transformation or as documentation
* for a precompiled tranformation.
*
* @param source the source
* @return this
@ -72,8 +72,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.
* Specifices a source for this report. This is either used to compile the report transformation or as documentation
* for a precompiled tranformation.
*
* @param source the source
* @return this

View file

@ -11,9 +11,10 @@ public final class Keys {
* The actual scenarios file location as used with {@link ConfigurationLoader}.
*/
public static final String SCENARIOS_FILE = "scenarios_file";
/**
* The actual scenarios configuration represented as serializable tree. This either loaded from file or build manually
* via {@link ConfigurationBuilder}
* The actual scenarios configuration represented as serializable tree. This either loaded from file or build
* manually via {@link ConfigurationBuilder}
*/
public static final String SCENARIO_DEFINITION = "scenario_definition";

View file

@ -70,8 +70,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.
* Specifices a source for this report. This is either used to compile the report transformation or as documentation
* for a precompiled tranformation.
*
* @param source the source
* @return this
@ -81,8 +81,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.
* Specifices a source for this report. This is either used to compile the report transformation or as documentation
* for a precompiled tranformation.
*
* @param source the source
* @return this
@ -93,8 +93,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.
* Specifices a source for this report. This is either used to compile the report transformation or as documentation
* for a precompiled tranformation.
*
* @param source the source
* @return this

View file

@ -157,8 +157,8 @@ public class ScenarioBuilder implements Builder<Scenario> {
/**
* Add description for this scenario. This is part of the
* {@link de.kosit.validationtool.model.reportInput.CreateReportInput} configuration and can be used while creating the
* report
* {@link de.kosit.validationtool.model.reportInput.CreateReportInput} configuration and can be used while creating
* the report
*
* @param description the description
* @return this

View file

@ -70,8 +70,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.
* Specifices a source for this schematron validation. This is either used to compile the schematron transformation
* or as documentation for a precompiled tranformation.
*
* @param source the source
* @return this
@ -81,8 +81,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.
* Specifices a source for this schematron validation. This is either used to compile the schematron transformation
* or as documentation for a precompiled tranformation.
*
* @param source the source
* @return this
@ -93,8 +93,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.
* Specifices a source for this schematron validation. This is either used to compile the schematron transformation
* or as documentation for a precompiled tranformation.
*
* @param source the source
* @return this

View file

@ -15,7 +15,6 @@ abstract class BaseHandler implements HttpHandler {
protected static final String APPLICATION_XML = "application/xml";
protected static void write(final HttpExchange exchange, final byte[] content, final String contentType) throws IOException {
write(exchange, content, contentType, HttpStatus.SC_OK);
}

View file

@ -37,8 +37,8 @@ class CheckHandler extends BaseHandler {
/**
* Methode, die eine gegebene Anforderung verarbeitet und eine entsprechende Antwort generiert
*
* @param httpExchange kapselt eine empfangene HTTP-Anforderung und eine Antwort, die in einem Exchange generiert werden
* soll.
* @param httpExchange kapselt eine empfangene HTTP-Anforderung und eine Antwort, die in einem Exchange generiert
* werden soll.
*/
@Override
public void handle(final HttpExchange httpExchange) throws IOException {

View file

@ -26,7 +26,7 @@ import de.kosit.validationtool.model.scenarios.Scenarios;
*/
@Slf4j
@RequiredArgsConstructor
class ConfigHandler extends BaseHandler {
class ConfigHandler extends BaseHandler {
private final Configuration configuration;

View file

@ -55,7 +55,6 @@ public class Daemon {
this.threadCount = threadCount;
}
/**
* Methode zum Starten des Servers
*

View file

@ -28,28 +28,27 @@ public class GuiHandler extends BaseHandler {
final String path = exchange.getRequestURI().toASCIIString();
if (path.equals("/")) {
write(exchange, IOUtils.toString(INDEX_HTML, Charset.defaultCharset()).getBytes(), "text/html");
} else{
} else {
final URL resource = GuiHandler.class.getClassLoader().getResource("gui" + path);
if (resource != null) {
write(exchange, IOUtils.toString(resource, Charset.defaultCharset()).getBytes(),
Mediatype.resolveBySuffix(resource.getPath()).getMimeType());
}else {
error(exchange,404,"not found");
} else {
error(exchange, 404, "not found");
}
}
}
@RequiredArgsConstructor
@Getter
protected enum Mediatype {
JS("application/javascript"),
MD("text/markdown"),
CSS("text/css");
JS("application/javascript"), MD("text/markdown"), CSS("text/css");
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);
return Arrays.stream(values()).filter(e -> path.toUpperCase().endsWith("." + e.name())).findFirst().orElse(Mediatype.MD);
}
}
}

View file

@ -81,6 +81,7 @@ public class ConversionService {
}
private static final int MAX_LOG_CONTENT = 50;
// context setup
private JAXBContext jaxbContext;
@ -233,9 +234,6 @@ public class ConversionService {
}
}
public <T> T readDocument(final Source source, final Class<T> type) {
try {
final Unmarshaller u = getJaxbContext().createUnmarshaller();

View file

@ -19,9 +19,9 @@ public class DateFactory {
@SneakyThrows
public static XMLGregorianCalendar createTimestamp() {
final GregorianCalendar cal = new GregorianCalendar();
cal.setTime(new Date());
return DatatypeFactory.newInstance().newXMLGregorianCalendar(cal);
final GregorianCalendar cal = new GregorianCalendar();
cal.setTime(new Date());
return DatatypeFactory.newInstance().newXMLGregorianCalendar(cal);
}
}

View file

@ -1,7 +1,5 @@
package de.kosit.validationtool.impl;
import lombok.SneakyThrows;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

View file

@ -74,8 +74,7 @@ public class ScenarioRepository {
*/
public Result<Scenario, String> selectScenario(final XdmNode document) {
final Result<Scenario, String> result;
final List<Scenario> collect = getScenarios().stream().filter(s -> match(document, s))
.collect(Collectors.toList());
final List<Scenario> collect = getScenarios().stream().filter(s -> match(document, s)).collect(Collectors.toList());
if (collect.size() == 1) {
result = new Result<>(collect.get(0));
} else if (collect.isEmpty()) {

View file

@ -125,9 +125,9 @@ public interface CheckAction {
void check(Bag results);
/**
* Ermittlung, ob ein Schritt u.U. ausgelassen werden kann. Die Funktion wird vor der eigentlichen Prüfaktion aufgerufen
* und kann somit eine Ausführung des Prüfschrittes verhindern. Entwickler können diese Funktion überschreiben, um den
* Prüfschritt bedingt auszuführen.
* Ermittlung, ob ein Schritt u.U. ausgelassen werden kann. Die Funktion wird vor der eigentlichen Prüfaktion
* aufgerufen und kann somit eine Ausführung des Prüfschrittes verhindern. Entwickler können diese Funktion
* überschreiben, um den Prüfschritt bedingt auszuführen.
*
* @param results die bisher gesammelten Information
* @return <code>true</code> wenn der Schritt ausgelassen werden soll

View file

@ -70,8 +70,9 @@ import net.sf.saxon.s9api.XsltTransformer;
public class CreateReportAction implements CheckAction {
/**
* Wrapper to fix some inconsistencies between sax and saxon. Saxon tries to set some properties which has no effect on
* {@link JAXBSource}'s XMLReader, but it throws exceptions on unknown properties. This just drops this exceptions.
* Wrapper to fix some inconsistencies between sax and saxon. Saxon tries to set some properties which has no effect
* on {@link JAXBSource}'s XMLReader, but it throws exceptions on unknown properties. This just drops this
* exceptions.
*/
private static class ReaderWrapper implements XMLReader {

View file

@ -103,7 +103,6 @@ public class SchemaValidationAction implements CheckAction {
private static class FileSerializedDocument implements SerializedDocument {
private final Path file;
private final Processor processor;

View file

@ -105,5 +105,4 @@ public class RelativeUriResolver implements URIResolver, UnparsedTextURIResolver
}
}
}

View file

@ -44,7 +44,6 @@ import de.kosit.validationtool.impl.tasks.CheckAction;
*/
public class ExtractHtmlActionTest {
private ExtractHtmlContentAction action;
private Path tmpDirectory;

View file

@ -38,7 +38,6 @@ import de.kosit.validationtool.impl.tasks.CheckAction;
*/
public class PrintReportActionTest {
private CommandLine commandLine;
private PrintReportAction action;

View file

@ -42,7 +42,6 @@ import de.kosit.validationtool.impl.tasks.CheckAction;
*/
public class SerializeReportActionTest {
private Path tmpDirectory;
private SerializeReportAction action;
@ -70,9 +69,9 @@ public class SerializeReportActionTest {
assertThat(this.tmpDirectory.toFile().listFiles()).hasSize(1);
}
//ERPT-83
// ERPT-83
@Test
public void testName(){
public void testName() {
final String name = "some.name.with.dots";
final CheckAction.Bag b = new CheckAction.Bag(InputFactory.read("ega".getBytes(), name + ".xml"));
assertThat(b.getName()).isEqualTo(name);

View file

@ -26,7 +26,4 @@ public class SimpleConfigTest {
assertThat(result).isNotNull();
}
}

View file

@ -1,9 +1,10 @@
package de.kosit.validationtool.daemon;
import io.restassured.http.ContentType;
import static io.restassured.RestAssured.given;
import org.junit.Test;
import static io.restassured.RestAssured.given;
import io.restassured.http.ContentType;
public class GuiHandlerIT extends BaseIT {

View file

@ -23,6 +23,7 @@ import net.sf.saxon.s9api.XPathExecutable;
public class ComputeAcceptanceActionTest {
private static final String DOESNOT_EXIST = "count(//doesnotExist) = 0";
private final ComputeAcceptanceAction action = new ComputeAcceptanceAction();
@Test
@ -103,7 +104,6 @@ public class ComputeAcceptanceActionTest {
assertThat(bag.getAcceptStatus()).isEqualTo(AcceptRecommendation.REJECT);
}
private static XPathExecutable createXpath(final String expression) {
return new ContentRepository(ResolvingMode.STRICT_RELATIVE.getStrategy(), null).createXPath(expression, new HashMap<>());
}

View file

@ -35,7 +35,6 @@ public class CreateReportActionTest {
private ContentRepository repository;
@Before
public void setup() {
this.repository = Simple.createContentRepository();

View file

@ -57,13 +57,13 @@ public class TestBagBuilder {
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.setName("invoice");
v.getResource().add(r);
t.setValidateWithXmlSchema(v);
final ScenarioType t = new ScenarioType();
final ValidateWithXmlSchema v = new ValidateWithXmlSchema();
final ResourceType r = new ResourceType();
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()));
return scenario;

View file

@ -49,7 +49,6 @@ import net.sf.saxon.s9api.XsltCompiler;
import net.sf.saxon.s9api.XsltExecutable;
import net.sf.saxon.s9api.XsltTransformer;
/**
* Testet verschiedene Saxon Security Einstellungen.
*
@ -77,7 +76,8 @@ public class SaxonSecurityTest {
transformer.setDestination(result);
transformer.transform();
// wenn der Punkt erreicht wird, sollte wenigstens, das Element evil nicht mit 'bösen' Inhalten gefüllt sein!
// wenn der Punkt erreicht wird, sollte wenigstens, das Element evil nicht mit 'bösen' Inhalten gefüllt
// sein!
if (StringUtils.isNotBlank(result.getXdmNode().getStringValue())) {
fail(String.format("Saxon configuration should prevent expansion within %s", resource));
}