mirror of
https://github.com/itplr-kosit/validator.git
synced 2026-05-25 16:55:39 +00:00
Resolve "Force formatting"
This commit is contained in:
parent
bc9acc3a0a
commit
69d6e55f14
45 changed files with 535 additions and 538 deletions
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -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}
|
||||
|
|
|
|||
|
|
@ -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}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -183,8 +183,6 @@ public class Grid {
|
|||
return this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
private static final Format DEFAULT_FORMAT = new Format();
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -55,7 +55,6 @@ public class Daemon {
|
|||
this.threadCount = threadCount;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Methode zum Starten des Servers
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
package de.kosit.validationtool.impl;
|
||||
|
||||
import lombok.SneakyThrows;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Properties;
|
||||
|
|
|
|||
|
|
@ -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()) {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
||||
|
|
|
|||
|
|
@ -103,7 +103,6 @@ public class SchemaValidationAction implements CheckAction {
|
|||
|
||||
private static class FileSerializedDocument implements SerializedDocument {
|
||||
|
||||
|
||||
private final Path file;
|
||||
|
||||
private final Processor processor;
|
||||
|
|
|
|||
|
|
@ -105,5 +105,4 @@ public class RelativeUriResolver implements URIResolver, UnparsedTextURIResolver
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue