mirror of
https://github.com/itplr-kosit/validator.git
synced 2026-05-25 16:55:39 +00:00
#9 Formatierungsregeln
This commit is contained in:
parent
b369107267
commit
6030d484cc
18 changed files with 746 additions and 27 deletions
|
|
@ -19,13 +19,13 @@
|
|||
|
||||
package de.kosit.validationtool.api;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
/**
|
||||
* Zentrale Konfigration einer Prüf-Instanz.
|
||||
*
|
||||
|
|
@ -54,15 +54,15 @@ public class CheckConfiguration {
|
|||
* @return uri die durch entsprechende resolver aufgelöst werden kann
|
||||
*/
|
||||
public URI getScenarioRepository() {
|
||||
if (scenarioRepository == null) {
|
||||
scenarioRepository = createDefaultRepository();
|
||||
if (this.scenarioRepository == null) {
|
||||
this.scenarioRepository = createDefaultRepository();
|
||||
}
|
||||
return scenarioRepository;
|
||||
return this.scenarioRepository;
|
||||
}
|
||||
|
||||
private URI createDefaultRepository() {
|
||||
log.info("Creating default scenario repository (alongside scenario definition)");
|
||||
return scenarioDefinition.resolve(".");
|
||||
return this.scenarioDefinition.resolve(".");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,8 +19,6 @@
|
|||
|
||||
package de.kosit.validationtool.api;
|
||||
|
||||
import static org.apache.commons.lang3.StringUtils.isNotEmpty;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
|
@ -28,13 +26,11 @@ import java.io.File;
|
|||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.security.DigestInputStream;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
|
||||
import javax.xml.bind.DatatypeConverter;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
|
@ -42,6 +38,8 @@ import org.apache.commons.lang3.StringUtils;
|
|||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import static org.apache.commons.lang3.StringUtils.isNotEmpty;
|
||||
|
||||
/**
|
||||
* Service zum Einlesen des Test-Objekts in den Speicher. Beim Einlesen wird gleichzeitig eine Prüfsumme ermittelt und
|
||||
* mit dem Ergebnis mitgeführt.
|
||||
|
|
@ -227,8 +225,6 @@ public class InputFactory {
|
|||
byte[] hash = digest.digest();
|
||||
log.debug("Generated hashcode for {} is {}", name, DatatypeConverter.printHexBinary(hash));
|
||||
out.flush();
|
||||
log.info(new String(out.toByteArray(), Charset.forName("utf8")).substring(0,
|
||||
out.toByteArray().length < 100 ? out.toByteArray().length : 100));
|
||||
return new Input(out.toByteArray(), name, hash, digest.getAlgorithm());
|
||||
} catch (IOException e) {
|
||||
throw new IllegalArgumentException(MESSAGE_OPEN_STREAM_ERROR + name, e);
|
||||
|
|
|
|||
|
|
@ -21,10 +21,6 @@ package de.kosit.validationtool.impl;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import de.kosit.validationtool.model.scenarios.Scenarios;
|
||||
import org.w3c.dom.Document;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
|
@ -37,7 +33,6 @@ import de.kosit.validationtool.impl.tasks.CreateReportAction;
|
|||
import de.kosit.validationtool.impl.tasks.DocumentParseAction;
|
||||
import de.kosit.validationtool.impl.tasks.ScenarioSelectionAction;
|
||||
import de.kosit.validationtool.impl.tasks.SchemaValidationAction;
|
||||
import de.kosit.validationtool.impl.tasks.SchematronValidationAction;
|
||||
import de.kosit.validationtool.impl.tasks.ValidateReportInputAction;
|
||||
import de.kosit.validationtool.model.reportInput.CreateReportInput;
|
||||
import de.kosit.validationtool.model.reportInput.DocumentIdentificationType;
|
||||
|
|
@ -88,7 +83,6 @@ public class DefaultCheck implements Check {
|
|||
checkSteps.add(new DocumentParseAction());
|
||||
checkSteps.add(new ScenarioSelectionAction(repository));
|
||||
checkSteps.add(new SchemaValidationAction());
|
||||
checkSteps.add(new SchematronValidationAction(processor, configuration.getScenarioRepository()));
|
||||
checkSteps.add(new ValidateReportInputAction(conversionService, contentRepository.getReportInputSchema()));
|
||||
checkSteps.add(new CreateReportAction(processor, conversionService, repository, configuration.getScenarioRepository()));
|
||||
}
|
||||
|
|
@ -112,7 +106,6 @@ public class DefaultCheck implements Check {
|
|||
protected XdmNode runCheckInternal(CheckAction.Bag t) {
|
||||
long started = System.currentTimeMillis();
|
||||
log.info("Checking content of {}", t.getInput().getName());
|
||||
|
||||
for (final CheckAction action : checkSteps) {
|
||||
long start = System.currentTimeMillis();
|
||||
if (!action.isSkipped(t)) {
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ public abstract class BaseScenario {
|
|||
*/
|
||||
public Schema getSchema() {
|
||||
if (schema == null) {
|
||||
final List<String> schemaResources = getValidateWithXmlSchema().getResource().stream().map(r -> r.getLocation())
|
||||
final List<String> schemaResources = getValidateWithXmlSchema().getResource().stream().map(ResourceType::getLocation)
|
||||
.collect(Collectors.toList());
|
||||
schema = repository.createSchema(schemaResources);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ import lombok.Getter;
|
|||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* Ein Ergebnisobjekte, dass das eigentliche Ergebnis hält und optional auch verschiedene Fehlerobjekte.
|
||||
* Ein Ergebnisobjekt, dass das eigentliche Ergebnis hält und optional auch verschiedene Fehlerobjekte.
|
||||
*
|
||||
* @param <T> der Typ des Ergebnis-Objekts
|
||||
* @param <E> der Typ des Fehler-Objekts
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ public class DocumentParseAction implements CheckAction {
|
|||
|
||||
/**
|
||||
* Parsed und überprüft ein übergebenes Dokument darauf ob es well-formed ist. Dies stellt den ersten
|
||||
* Verarbeitungsschritt des Prüf-Tools dar. Diese Funktion verzichtet explizit auf das Validierung gegenüber ein Schema.
|
||||
* Verarbeitungsschritt des Prüf-Tools dar. Diese Funktion verzichtet explizit auf die Validierung gegenüber einem Schema.
|
||||
*
|
||||
* @param content ein Dokument
|
||||
* @return Ergebnis des Parsings inklusive etwaiger Fehler
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@ import de.kosit.validationtool.model.reportInput.ValidationResultsSchematron;
|
|||
import de.kosit.validationtool.model.scenarios.ScenarioType;
|
||||
|
||||
import net.sf.saxon.s9api.DOMDestination;
|
||||
import net.sf.saxon.s9api.Processor;
|
||||
import net.sf.saxon.s9api.SaxonApiException;
|
||||
import net.sf.saxon.s9api.XdmNode;
|
||||
import net.sf.saxon.s9api.XsltTransformer;
|
||||
|
|
@ -49,8 +48,6 @@ import net.sf.saxon.s9api.XsltTransformer;
|
|||
@RequiredArgsConstructor
|
||||
public class SchematronValidationAction implements CheckAction {
|
||||
|
||||
private final Processor processor;
|
||||
|
||||
private final URI repository;
|
||||
|
||||
private List<ValidationResultsSchematron> validate(XdmNode document, ScenarioType scenario) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue