mirror of
https://github.com/itplr-kosit/validator.git
synced 2026-05-25 16:55:39 +00:00
Merge remote-tracking branch 'origin/release/1.5.x' into release/1.6.x
This commit is contained in:
commit
4e0a1e1fc5
38 changed files with 635 additions and 670 deletions
|
|
@ -1,22 +1,5 @@
|
|||
<!--
|
||||
~ Copyright 2017-2022 Koordinierungsstelle für IT-Standards (KoSIT)
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<assembly xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://maven.apache.org/ASSEMBLY/2.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
|
||||
xmlns="http://maven.apache.org/ASSEMBLY/2.0.0" xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
|
||||
<id>full</id>
|
||||
<formats>
|
||||
<format>zip</format>
|
||||
|
|
@ -35,7 +18,7 @@
|
|||
<directory>${project.build.directory}</directory>
|
||||
<outputDirectory/>
|
||||
<includes>
|
||||
<include>validationtool-*.jar</include>
|
||||
<include>validator-*.jar</include>
|
||||
</includes>
|
||||
</fileSet>
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ import org.fusesource.jansi.AnsiRenderer.Code;
|
|||
|
||||
import de.kosit.validationtool.cmd.report.Line;
|
||||
import de.kosit.validationtool.impl.Printer;
|
||||
|
||||
import picocli.CommandLine;
|
||||
import picocli.CommandLine.ParseResult;
|
||||
|
||||
|
|
@ -79,11 +78,11 @@ public class CommandLineApplication {
|
|||
final CommandLine commandLine = new CommandLine(new CommandLineOptions());
|
||||
try {
|
||||
commandLine.setExecutionExceptionHandler(CommandLineApplication::logExecutionException);
|
||||
commandLine.execute(args);
|
||||
if (commandLine.isUsageHelpRequested()) {
|
||||
final int cmdlineRetVal = commandLine.execute(args);
|
||||
if (commandLine.isUsageHelpRequested() || cmdlineRetVal == CommandLine.ExitCode.USAGE) {
|
||||
resultStatus = ReturnValue.HELP_REQUEST;
|
||||
} else {
|
||||
resultStatus = ObjectUtils.defaultIfNull(commandLine.getExecutionResult(), ReturnValue.PARSING_ERROR);
|
||||
resultStatus = ObjectUtils.getIfNull(commandLine.getExecutionResult(), ReturnValue.PARSING_ERROR);
|
||||
if (resultStatus.isError()) {
|
||||
commandLine.usage(System.out);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,12 +20,10 @@ import java.nio.file.Path;
|
|||
import java.util.List;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
import de.kosit.validationtool.cmd.CommandLineApplication.Level;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import de.kosit.validationtool.cmd.CommandLineApplication.Level;
|
||||
|
||||
import picocli.CommandLine.ArgGroup;
|
||||
import picocli.CommandLine.Command;
|
||||
import picocli.CommandLine.Help.Visibility;
|
||||
|
|
@ -38,10 +36,12 @@ import picocli.CommandLine.Parameters;
|
|||
* @author Andreas Penski
|
||||
*/
|
||||
@Command(description = "Structural and semantic validation of xml files", name = "KoSIT Validator", mixinStandardHelpOptions = false,
|
||||
separator = " ")
|
||||
separator = " ", synopsisHeading = CommandLineOptions.SYNOSIS_HEADING)
|
||||
@Getter
|
||||
public class CommandLineOptions implements Callable<ReturnValue> {
|
||||
|
||||
static final String SYNOSIS_HEADING = "Usage: ";
|
||||
|
||||
/**
|
||||
* @author Andreas Penski
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
package de.kosit.validationtool.cmd;
|
||||
|
||||
import static org.apache.commons.lang3.ObjectUtils.defaultIfNull;
|
||||
import static org.apache.commons.lang3.ObjectUtils.getIfNull;
|
||||
import static org.apache.commons.lang3.StringUtils.EMPTY;
|
||||
import static org.apache.commons.lang3.StringUtils.isNotEmpty;
|
||||
|
||||
|
|
@ -37,14 +37,11 @@ import java.util.stream.Stream;
|
|||
|
||||
import org.fusesource.jansi.AnsiRenderer.Code;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import de.kosit.validationtool.api.Configuration;
|
||||
import de.kosit.validationtool.api.Input;
|
||||
import de.kosit.validationtool.api.InputFactory;
|
||||
import de.kosit.validationtool.api.Result;
|
||||
import de.kosit.validationtool.cmd.CommandLineOptions.CliOptions;
|
||||
import de.kosit.validationtool.cmd.CommandLineOptions.Definition;
|
||||
import de.kosit.validationtool.cmd.CommandLineOptions.RepositoryDefinition;
|
||||
import de.kosit.validationtool.cmd.CommandLineOptions.ScenarioDefinition;
|
||||
import de.kosit.validationtool.cmd.assertions.Assertions;
|
||||
|
|
@ -55,7 +52,7 @@ import de.kosit.validationtool.impl.EngineInformation;
|
|||
import de.kosit.validationtool.impl.Printer;
|
||||
import de.kosit.validationtool.impl.ScenarioRepository;
|
||||
import de.kosit.validationtool.impl.xml.ProcessorProvider;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.sf.saxon.s9api.Processor;
|
||||
|
||||
/**
|
||||
|
|
@ -132,7 +129,7 @@ public class Validator {
|
|||
final Processor processor = ProcessorProvider.getProcessor();
|
||||
final List<Configuration> config = getConfiguration(cmd);
|
||||
final InternalCheck check = new InternalCheck(processor, config.toArray(new Configuration[0]));
|
||||
final CommandLineOptions.CliOptions cliOptions = defaultIfNull(cmd.getCliOptions(), new CliOptions());
|
||||
final CommandLineOptions.CliOptions cliOptions = getIfNull(cmd.getCliOptions(), new CliOptions());
|
||||
final Path outputDirectory = determineOutputDirectory(cliOptions);
|
||||
if (cliOptions.isExtractHtml()) {
|
||||
check.getCheckSteps().add(new ExtractHtmlContentAction(processor, outputDirectory));
|
||||
|
|
@ -180,17 +177,19 @@ public class Validator {
|
|||
* @return a list of configurations of the scenarios and repositories passed in cmd
|
||||
*/
|
||||
private static List<Configuration> getConfiguration(final CommandLineOptions cmd) {
|
||||
final List<ScenarioDefinition> scenarios = defaultIfNull(cmd.getScenarios(), Collections.emptyList());
|
||||
final List<ScenarioDefinition> scenarios = getIfNull(cmd.getScenarios(), Collections.emptyList());
|
||||
// Map from scenario name to scenario path
|
||||
final Map<String, Path> mappedScenarios = scenarios.stream()
|
||||
.collect(Collectors.toMap(ScenarioDefinition::getName, ScenarioDefinition::getPath));
|
||||
final List<RepositoryDefinition> repos = defaultIfNull(cmd.getRepositories(), Collections.emptyList());
|
||||
final Map<String, Path> mappedRepos = repos.stream().collect(Collectors.toMap(Definition::getName, Definition::getPath));
|
||||
final List<RepositoryDefinition> repos = getIfNull(cmd.getRepositories(), Collections.emptyList());
|
||||
final Map<String, Path> mappedRepos = repos.stream()
|
||||
.collect(Collectors.toMap(RepositoryDefinition::getName, RepositoryDefinition::getPath));
|
||||
checkUnused(mappedScenarios, mappedRepos);
|
||||
|
||||
return mappedScenarios.entrySet().stream().map(e -> {
|
||||
assertFileExistance(e.getValue(), "scenario");
|
||||
final URI scenarioLocation = e.getValue().toUri();
|
||||
final URI repositoryLocation = findRepository(e.getKey(), mappedRepos);
|
||||
final URI repositoryLocation = findRepository(scenarioLocation, e.getKey(), mappedRepos);
|
||||
|
||||
reportLoading(scenarioLocation, repositoryLocation);
|
||||
final Configuration configuration = Configuration.load(scenarioLocation, repositoryLocation)
|
||||
|
|
@ -208,9 +207,14 @@ public class Validator {
|
|||
unused.forEach(e -> Printer.writeErr("Warning: repository definition \"{0}\" is not used", e.getKey()));
|
||||
}
|
||||
|
||||
private static URI findRepository(final String key, final Map<String, Path> repositories) {
|
||||
private static URI findRepository(final URI scenarioLocation, final String key, final Map<String, Path> repositories) {
|
||||
final Path path = repositories.getOrDefault(key, repositories.get(ScenarioRepository.DEFAULT_ID));
|
||||
if (path == null) {
|
||||
// If it is an unnamed scenario, use the CWD instead
|
||||
if (key.startsWith(ScenarioRepository.DEFAULT)) {
|
||||
// Assume directory of scenario location instead
|
||||
return Paths.get(scenarioLocation).getParent().toUri();
|
||||
}
|
||||
throw new IllegalArgumentException(String.format("No repository location for scenario definition '%s' specified", key));
|
||||
}
|
||||
return determineRepository(path);
|
||||
|
|
|
|||
|
|
@ -38,7 +38,11 @@ public class Printer {
|
|||
* @param params the params.
|
||||
*/
|
||||
public static void writeOut(final String message, final Object... params) {
|
||||
System.out.println(new MessageFormat(message, Locale.ENGLISH).format(params));
|
||||
try {
|
||||
System.out.println(new MessageFormat(message, Locale.ENGLISH).format(params));
|
||||
} catch (final RuntimeException ex) {
|
||||
System.err.println("[Format error!] <" + message + "> with params <" + params + ">");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -48,7 +52,11 @@ public class Printer {
|
|||
* @param params the params.
|
||||
*/
|
||||
public static void writeErr(final String message, final Object... params) {
|
||||
System.err.println(new MessageFormat(message, Locale.ENGLISH).format(params));
|
||||
try {
|
||||
System.err.println(new MessageFormat(message, Locale.ENGLISH).format(params));
|
||||
} catch (final RuntimeException ex) {
|
||||
System.err.println("[Format error!] <" + message + "> with params <" + params + ">");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -16,22 +16,20 @@
|
|||
|
||||
package de.kosit.validationtool.impl;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.xml.transform.URIResolver;
|
||||
import javax.xml.validation.Schema;
|
||||
|
||||
import de.kosit.validationtool.api.ResolvingConfigurationStrategy;
|
||||
import de.kosit.validationtool.model.scenarios.ResourceType;
|
||||
import de.kosit.validationtool.model.scenarios.ScenarioType;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import de.kosit.validationtool.api.ResolvingConfigurationStrategy;
|
||||
import de.kosit.validationtool.model.scenarios.ResourceType;
|
||||
import de.kosit.validationtool.model.scenarios.ScenarioType;
|
||||
|
||||
import net.sf.saxon.lib.UnparsedTextURIResolver;
|
||||
import net.sf.saxon.s9api.XPathExecutable;
|
||||
import net.sf.saxon.s9api.XPathSelector;
|
||||
|
|
@ -80,7 +78,11 @@ public class Scenario {
|
|||
private Transformation reportTransformation;
|
||||
|
||||
public List<Transformation> getSchematronValidations() {
|
||||
return this.schematronValidations == null ? Collections.emptyList() : this.schematronValidations;
|
||||
// Must return a mutable list
|
||||
if (this.schematronValidations == null) {
|
||||
this.schematronValidations = new ArrayList<>();
|
||||
}
|
||||
return this.schematronValidations;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
|
|
@ -95,9 +97,9 @@ public class Scenario {
|
|||
}
|
||||
|
||||
/**
|
||||
* Liefert einen neuen XPath-Selector zur Evaluierung der {@link de.kosit.validationtool.api.AcceptRecommendation}.
|
||||
* Returns a new XPath selector for evaluating the {@link de.kosit.validationtool.api.AcceptRecommendation}.
|
||||
*
|
||||
* @return neuer Selector
|
||||
* @return new selector
|
||||
*/
|
||||
public Optional<XPathSelector> getAcceptSelector() {
|
||||
final XPathSelector selector = this.acceptExecutable != null ? this.acceptExecutable.load() : null;
|
||||
|
|
|
|||
|
|
@ -32,9 +32,8 @@ import org.junit.After;
|
|||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import de.kosit.validationtool.impl.Helper.Simple;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* Testet die Parameter des Kommandozeilen-Tools.
|
||||
|
|
@ -74,7 +73,7 @@ public class CommandlineApplicationTest {
|
|||
|
||||
@Test
|
||||
public void testHelp() {
|
||||
final String[] args = new String[] { "-?" };
|
||||
final String[] args = { "-?" };
|
||||
CommandLineApplication.mainProgram(args);
|
||||
assertThat(CommandLine.getErrorOutput()).isEmpty();
|
||||
checkForHelp(CommandLine.getOutputLines());
|
||||
|
|
@ -82,12 +81,20 @@ public class CommandlineApplicationTest {
|
|||
|
||||
private static void checkForHelp(final List<String> outputLines) {
|
||||
assertThat(outputLines.size()).isPositive();
|
||||
assertThat(outputLines.stream().filter(l -> l.startsWith("Usage: KoSIT Validator"))).hasSize(1);
|
||||
assertThat(outputLines.stream().filter(l -> l.startsWith(CommandLineOptions.SYNOSIS_HEADING))).hasSize(1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNoArguments() {
|
||||
final String[] args = {};
|
||||
CommandLineApplication.mainProgram(args);
|
||||
assertThat(CommandLine.getErrorOutput()).isNotEmpty();
|
||||
checkForHelp(CommandLine.getErrorLines());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRequiredScenarioFile() {
|
||||
final String[] args = new String[] { "arguments", "egal welche", "argumente drin sind" };
|
||||
final String[] args = { "arguments", "egal welche", "argumente drin sind" };
|
||||
CommandLineApplication.mainProgram(args);
|
||||
assertThat(CommandLine.getErrorOutput()).isNotEmpty();
|
||||
assertThat(CommandLine.getErrorOutput()).contains("Missing required option: '--scenarios");
|
||||
|
|
@ -95,7 +102,7 @@ public class CommandlineApplicationTest {
|
|||
|
||||
@Test
|
||||
public void testNotExistingScenarioFile() {
|
||||
final String[] args = new String[] { "-s", Paths.get(Simple.NOT_EXISTING).toString(), Paths.get(Simple.NOT_EXISTING).toString() };
|
||||
final String[] args = { "-s", Paths.get(Simple.NOT_EXISTING).toString(), Paths.get(Simple.NOT_EXISTING).toString() };
|
||||
CommandLineApplication.mainProgram(args);
|
||||
assertThat(CommandLine.getErrorOutput()).isNotEmpty();
|
||||
assertThat(CommandLine.getErrorOutput()).contains("Not a valid path for scenario definition specified");
|
||||
|
|
@ -103,7 +110,7 @@ public class CommandlineApplicationTest {
|
|||
|
||||
@Test
|
||||
public void testIncorrectRepository() {
|
||||
final String[] args = new String[] { "-s", Paths.get(Simple.SCENARIOS).toString(), "-r", Paths.get(Simple.NOT_EXISTING).toString(),
|
||||
final String[] args = { "-s", Paths.get(Simple.SCENARIOS).toString(), "-r", Paths.get(Simple.NOT_EXISTING).toString(),
|
||||
Paths.get(Simple.SIMPLE_VALID).toString() };
|
||||
CommandLineApplication.mainProgram(args);
|
||||
assertThat(CommandLine.getErrorOutput()).isNotEmpty();
|
||||
|
|
@ -112,8 +119,8 @@ public class CommandlineApplicationTest {
|
|||
|
||||
@Test
|
||||
public void testNotExistingTestTarget() {
|
||||
final String[] args = new String[] { "-s", Paths.get(Simple.SCENARIOS).toString(), "-r",
|
||||
Paths.get(Simple.REPOSITORY_URI).toString(), Paths.get(Simple.NOT_EXISTING).toString() };
|
||||
final String[] args = { "-s", Paths.get(Simple.SCENARIOS).toString(), "-r", Paths.get(Simple.REPOSITORY_URI).toString(),
|
||||
Paths.get(Simple.NOT_EXISTING).toString() };
|
||||
CommandLineApplication.mainProgram(args);
|
||||
assertThat(CommandLine.getErrorOutput()).isNotEmpty();
|
||||
assertThat(CommandLine.getErrorOutput()).contains("No test targets found");
|
||||
|
|
@ -121,17 +128,24 @@ public class CommandlineApplicationTest {
|
|||
|
||||
@Test
|
||||
public void testValidMinimalConfiguration() {
|
||||
final String[] args = new String[] { "-s", Paths.get(Simple.SCENARIOS).toString(), "-r",
|
||||
Paths.get(Simple.REPOSITORY_URI).toString(), Paths.get(Simple.SIMPLE_VALID).toString() };
|
||||
final String[] args = { "-s", Paths.get(Simple.SCENARIOS).toString(), "-r", Paths.get(Simple.REPOSITORY_URI).toString(),
|
||||
Paths.get(Simple.SIMPLE_VALID).toString() };
|
||||
CommandLineApplication.mainProgram(args);
|
||||
assertThat(CommandLine.getErrorOutput()).contains(RESULT_OUTPUT);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testValidMinimalConfigurationWithoutRepositoryPath() {
|
||||
final String[] args = { "-s", Paths.get(Simple.SCENARIOS_WITH_RELATIVE_PATHS).toString(),
|
||||
Paths.get(Simple.SIMPLE_VALID).toString() };
|
||||
CommandLineApplication.mainProgram(args);
|
||||
assertThat(CommandLine.getErrorOutput()).contains(RESULT_OUTPUT);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testValidNamingConfiguration() {
|
||||
final String[] args = new String[] { "-s", Paths.get(Simple.SCENARIOS).toString(), "-r",
|
||||
Paths.get(Simple.REPOSITORY_URI).toString(), Paths.get(Simple.SIMPLE_VALID).toString(), "--report-prefix", "somePrefix",
|
||||
"--report-postfix", "somePostfix" };
|
||||
final String[] args = { "-s", Paths.get(Simple.SCENARIOS).toString(), "-r", Paths.get(Simple.REPOSITORY_URI).toString(),
|
||||
Paths.get(Simple.SIMPLE_VALID).toString(), "--report-prefix", "somePrefix", "--report-postfix", "somePostfix" };
|
||||
CommandLineApplication.mainProgram(args);
|
||||
assertThat(CommandLine.getErrorOutput()).contains(RESULT_OUTPUT);
|
||||
assertThat(CommandLine.getErrorOutput()).contains("somePrefix-simple-somePostfix");
|
||||
|
|
@ -139,7 +153,7 @@ public class CommandlineApplicationTest {
|
|||
|
||||
@Test
|
||||
public void testValidMultipleInput() {
|
||||
final String[] args = new String[] { "-s", Paths.get(Simple.SCENARIOS).toString(), "-o", this.output.toString(), "-r",
|
||||
final String[] args = { "-s", Paths.get(Simple.SCENARIOS).toString(), "-o", this.output.toString(), "-r",
|
||||
Paths.get(Simple.REPOSITORY_URI).toString(), Paths.get(Simple.SIMPLE_VALID).toString(), Paths.get(Simple.FOO).toString() };
|
||||
CommandLineApplication.mainProgram(args);
|
||||
assertThat(CommandLine.getErrorOutput()).contains("Processing 2 object(s) completed");
|
||||
|
|
@ -147,7 +161,7 @@ public class CommandlineApplicationTest {
|
|||
|
||||
@Test
|
||||
public void testValidDirectoryInput() {
|
||||
final String[] args = new String[] { "-s", Paths.get(Simple.SCENARIOS).toString(), "-o", this.output.toString(), "-r",
|
||||
final String[] args = { "-s", Paths.get(Simple.SCENARIOS).toString(), "-o", this.output.toString(), "-r",
|
||||
Paths.get(Simple.REPOSITORY_URI).toString(), Paths.get(Simple.EXAMPLES).toString() };
|
||||
CommandLineApplication.mainProgram(args);
|
||||
assertThat(CommandLine.getErrorOutput()).contains("Processing 8 object(s) completed");
|
||||
|
|
@ -156,7 +170,7 @@ public class CommandlineApplicationTest {
|
|||
@Test
|
||||
public void testValidOutputConfiguration() throws IOException {
|
||||
|
||||
final String[] args = new String[] { "-s", Paths.get(Simple.SCENARIOS).toString(), "-o", this.output.toString(), "-r",
|
||||
final String[] args = { "-s", Paths.get(Simple.SCENARIOS).toString(), "-o", this.output.toString(), "-r",
|
||||
Paths.get(Simple.REPOSITORY_URI).toString(), Paths.get(Simple.SIMPLE_VALID).toString() };
|
||||
CommandLineApplication.mainProgram(args);
|
||||
assertThat(CommandLine.getErrorOutput()).contains(RESULT_OUTPUT);
|
||||
|
|
@ -167,8 +181,7 @@ public class CommandlineApplicationTest {
|
|||
@Test
|
||||
public void testNoInput() {
|
||||
// assertThat(output).doesNotExist();
|
||||
final String[] args = new String[] { "-s", Paths.get(Simple.SCENARIOS).toString(), "-r",
|
||||
Paths.get(Simple.REPOSITORY_URI).toString(), };
|
||||
final String[] args = { "-s", Paths.get(Simple.SCENARIOS).toString(), "-r", Paths.get(Simple.REPOSITORY_URI).toString(), };
|
||||
CommandLineApplication.mainProgram(args);
|
||||
checkForHelp(CommandLine.getOutputLines());
|
||||
}
|
||||
|
|
@ -176,8 +189,8 @@ public class CommandlineApplicationTest {
|
|||
@Test
|
||||
public void testPrint() {
|
||||
|
||||
final String[] args = new String[] { "-s", Paths.get(Simple.SCENARIOS).toString(), "-p", "-r",
|
||||
Paths.get(Simple.REPOSITORY_URI).toString(), "-o", this.output.toString(), Paths.get(Simple.SIMPLE_VALID).toString() };
|
||||
final String[] args = { "-s", Paths.get(Simple.SCENARIOS).toString(), "-p", "-r", Paths.get(Simple.REPOSITORY_URI).toString(), "-o",
|
||||
this.output.toString(), Paths.get(Simple.SIMPLE_VALID).toString() };
|
||||
CommandLineApplication.mainProgram(args);
|
||||
assertThat(CommandLine.getErrorOutput()).contains(RESULT_OUTPUT);
|
||||
assertThat(CommandLine.getOutputLines()).haveAtLeastOne(new Condition<>(
|
||||
|
|
@ -186,9 +199,8 @@ public class CommandlineApplicationTest {
|
|||
|
||||
@Test
|
||||
public void testHtmlExtraktion() throws IOException {
|
||||
final String[] args = new String[] { "-s", Paths.get(Simple.SCENARIOS).toString(), "-h", "-o",
|
||||
this.output.toAbsolutePath().toString(), "-r", Paths.get(Simple.REPOSITORY_URI).toString(),
|
||||
Paths.get(Simple.SIMPLE_VALID).toString() };
|
||||
final String[] args = { "-s", Paths.get(Simple.SCENARIOS).toString(), "-h", "-o", this.output.toAbsolutePath().toString(), "-r",
|
||||
Paths.get(Simple.REPOSITORY_URI).toString(), Paths.get(Simple.SIMPLE_VALID).toString() };
|
||||
CommandLineApplication.mainProgram(args);
|
||||
assertThat(CommandLine.getErrorOutput()).contains(RESULT_OUTPUT);
|
||||
assertThat(Files.list(this.output).filter(f -> f.toString().endsWith(".html")).count()).isPositive();
|
||||
|
|
@ -196,9 +208,9 @@ public class CommandlineApplicationTest {
|
|||
|
||||
@Test
|
||||
public void testAssertionsExtraktion() {
|
||||
final String[] args = new String[] { "-d", "-s", Paths.get(Simple.SCENARIOS).toString(), "-r",
|
||||
Paths.get(Simple.REPOSITORY_URI).toString(), "-o", this.output.toString(), "-c", Paths.get(ASSERTIONS).toString(),
|
||||
Paths.get(Simple.REPOSITORY_URI).toString(), Paths.get(Simple.SIMPLE_VALID).toString() };
|
||||
final String[] args = { "-d", "-s", Paths.get(Simple.SCENARIOS).toString(), "-r", Paths.get(Simple.REPOSITORY_URI).toString(), "-o",
|
||||
this.output.toString(), "-c", Paths.get(ASSERTIONS).toString(), Paths.get(Simple.REPOSITORY_URI).toString(),
|
||||
Paths.get(Simple.SIMPLE_VALID).toString() };
|
||||
CommandLineApplication.mainProgram(args);
|
||||
assertThat(CommandLine.getErrorOutput()).contains(RESULT_OUTPUT);
|
||||
assertThat(CommandLine.getErrorOutput()).contains("Can not find assertions for ");
|
||||
|
|
@ -206,16 +218,16 @@ public class CommandlineApplicationTest {
|
|||
|
||||
@Test
|
||||
public void testDebugFlag() {
|
||||
final String[] args = new String[] { "-s", Paths.get(Simple.SCENARIOS).toString(), "-r", "unknown", "-o", this.output.toString(),
|
||||
"-d", Paths.get(ASSERTIONS).toString() };
|
||||
final String[] args = { "-s", Paths.get(Simple.SCENARIOS).toString(), "-r", "unknown", "-o", this.output.toString(), "-d",
|
||||
Paths.get(ASSERTIONS).toString() };
|
||||
CommandLineApplication.mainProgram(args);
|
||||
assertThat(CommandLine.getErrorOutput()).contains("at de.kosit.validationtool");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPrintMemoryStats() {
|
||||
final String[] args = new String[] { "-m", "-s", Paths.get(Simple.SCENARIOS).toString(), "-r",
|
||||
Paths.get(Simple.REPOSITORY_URI).toString(), Paths.get(Simple.SIMPLE_VALID).toString() };
|
||||
final String[] args = { "-m", "-s", Paths.get(Simple.SCENARIOS).toString(), "-r", Paths.get(Simple.REPOSITORY_URI).toString(),
|
||||
Paths.get(Simple.SIMPLE_VALID).toString() };
|
||||
CommandLineApplication.mainProgram(args);
|
||||
assertThat(CommandLine.getErrorOutput()).contains(RESULT_OUTPUT);
|
||||
assertThat(CommandLine.getErrorOutput()).contains("total");
|
||||
|
|
@ -223,8 +235,7 @@ public class CommandlineApplicationTest {
|
|||
|
||||
@Test
|
||||
public void testReadFromPipe() throws IOException {
|
||||
final String[] args = new String[] { "-s", Paths.get(Simple.SCENARIOS).toString(), "-r",
|
||||
Paths.get(Simple.REPOSITORY_URI).toString() };
|
||||
final String[] args = { "-s", Paths.get(Simple.SCENARIOS).toString(), "-r", Paths.get(Simple.REPOSITORY_URI).toString() };
|
||||
CommandLine.setStandardInput(Files.newInputStream(Paths.get(Simple.SIMPLE_VALID)));
|
||||
CommandLineApplication.mainProgram(args);
|
||||
assertThat(CommandLine.getErrorOutput()).contains(RESULT_OUTPUT);
|
||||
|
|
@ -232,31 +243,30 @@ public class CommandlineApplicationTest {
|
|||
|
||||
@Test
|
||||
public void testAndre() throws IOException {
|
||||
final String[] args = new String[] { "-s", Paths.get(Simple.SCENARIOS).toString(), "-r",
|
||||
Paths.get(Simple.REPOSITORY_URI).toString(), Paths.get(Simple.SIMPLE_VALID).toString(), "--report-prefix", "andre1" };
|
||||
final String[] args = { "-s", Paths.get(Simple.SCENARIOS).toString(), "-r", Paths.get(Simple.REPOSITORY_URI).toString(),
|
||||
Paths.get(Simple.SIMPLE_VALID).toString(), "--report-prefix", "andre1" };
|
||||
CommandLineApplication.mainProgram(args);
|
||||
assertThat(CommandLine.getErrorOutput()).contains(RESULT_OUTPUT);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUnexpectedDaemonFlag() {
|
||||
final String[] args = new String[] { "-D", "-s", Paths.get(Simple.SCENARIOS).toString(), "-r",
|
||||
Paths.get(Simple.REPOSITORY_URI).toString(), Paths.get(Simple.SIMPLE_VALID).toString() };
|
||||
final String[] args = { "-D", "-s", Paths.get(Simple.SCENARIOS).toString(), "-r", Paths.get(Simple.REPOSITORY_URI).toString(),
|
||||
Paths.get(Simple.SIMPLE_VALID).toString() };
|
||||
CommandLineApplication.mainProgram(args);
|
||||
assertThat(CommandLine.getErrorOutput()).contains("Will ignore cli mode options");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParsingError() {
|
||||
final String[] args = new String[] { "-s", "-r", Paths.get(Simple.REPOSITORY_URI).toString(),
|
||||
Paths.get(Simple.SIMPLE_VALID).toString() };
|
||||
final String[] args = { "-s", "-r", Paths.get(Simple.REPOSITORY_URI).toString(), Paths.get(Simple.SIMPLE_VALID).toString() };
|
||||
CommandLineApplication.mainProgram(args);
|
||||
assertThat(CommandLine.getErrorOutput()).contains("Expected parameter for option");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void loadMultipleScenarios() {
|
||||
final String[] args = new String[] { "-s", "s1=" + Paths.get(Simple.SCENARIOS).toString(), "-s",
|
||||
final String[] args = { "-s", "s1=" + Paths.get(Simple.SCENARIOS).toString(), "-s",
|
||||
"s2=" + Paths.get(Simple.OTHER_SCENARIOS).toString(), "-r", "s1=" + Paths.get(Simple.REPOSITORY_URI).toString(), "-r",
|
||||
"s2=" + Paths.get(Simple.REPOSITORY_URI).toString(), Paths.get(Simple.SIMPLE_VALID).toString() };
|
||||
CommandLineApplication.mainProgram(args);
|
||||
|
|
@ -265,7 +275,7 @@ public class CommandlineApplicationTest {
|
|||
|
||||
@Test
|
||||
public void loadMultipleScenariosSingleRepository() {
|
||||
final String[] args = new String[] { "-s", "s1=" + Paths.get(Simple.SCENARIOS).toString(), "-s",
|
||||
final String[] args = { "-s", "s1=" + Paths.get(Simple.SCENARIOS).toString(), "-s",
|
||||
"s2=" + Paths.get(Simple.OTHER_SCENARIOS).toString(), "-r", Paths.get(Simple.REPOSITORY_URI).toString(),
|
||||
Paths.get(Simple.SIMPLE_VALID).toString() };
|
||||
CommandLineApplication.mainProgram(args);
|
||||
|
|
@ -274,7 +284,7 @@ public class CommandlineApplicationTest {
|
|||
|
||||
@Test
|
||||
public void loadMultipleScenariosMissingRepository() {
|
||||
final String[] args = new String[] { "-s", "s1=" + Paths.get(Simple.SCENARIOS).toString(), "-s",
|
||||
final String[] args = { "-s", "s1=" + Paths.get(Simple.SCENARIOS).toString(), "-s",
|
||||
"s2=" + Paths.get(Simple.OTHER_SCENARIOS).toString(), "-r", "s1=" + Paths.get(Simple.REPOSITORY_URI).toString(), "-r",
|
||||
"typo=" + Paths.get(Simple.REPOSITORY_URI).toString(), Paths.get(Simple.SIMPLE_VALID).toString() };
|
||||
CommandLineApplication.mainProgram(args);
|
||||
|
|
@ -283,16 +293,16 @@ public class CommandlineApplicationTest {
|
|||
|
||||
@Test
|
||||
public void loadMultipleOrderedScenarios() {
|
||||
final String[] args = new String[] { "-s", Paths.get(Simple.SCENARIOS).toString(), "-s",
|
||||
Paths.get(Simple.OTHER_SCENARIOS).toString(), "-r", Paths.get(Simple.REPOSITORY_URI).toString(), "-r",
|
||||
Paths.get(Simple.REPOSITORY_URI).toString(), Paths.get(Simple.SIMPLE_VALID).toString() };
|
||||
final String[] args = { "-s", Paths.get(Simple.SCENARIOS).toString(), "-s", Paths.get(Simple.OTHER_SCENARIOS).toString(), "-r",
|
||||
Paths.get(Simple.REPOSITORY_URI).toString(), "-r", Paths.get(Simple.REPOSITORY_URI).toString(),
|
||||
Paths.get(Simple.SIMPLE_VALID).toString() };
|
||||
CommandLineApplication.mainProgram(args);
|
||||
assertThat(CommandLine.getOutput()).contains("Processing of 1 objects completed");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkUnusedRepository() {
|
||||
final String[] args = new String[] { "-s", "s1=" + Paths.get(Simple.SCENARIOS).toString(), "-r",
|
||||
final String[] args = { "-s", "s1=" + Paths.get(Simple.SCENARIOS).toString(), "-r",
|
||||
"s1=" + Paths.get(Simple.REPOSITORY_URI).toString(), "-r", "unused=" + Paths.get(Simple.REPOSITORY_URI).toString(),
|
||||
Paths.get(Simple.SIMPLE_VALID).toString() };
|
||||
CommandLineApplication.mainProgram(args);
|
||||
|
|
@ -302,7 +312,7 @@ public class CommandlineApplicationTest {
|
|||
|
||||
@Test
|
||||
public void checkDuplicationScenarioDefinition() {
|
||||
final String[] args = new String[] { "-s", "s1=" + Paths.get(Simple.SCENARIOS).toString(), "-r",
|
||||
final String[] args = { "-s", "s1=" + Paths.get(Simple.SCENARIOS).toString(), "-r",
|
||||
"s1=" + Paths.get(Simple.REPOSITORY_URI).toString(), "-r", "unused=" + Paths.get(Simple.REPOSITORY_URI).toString(),
|
||||
Paths.get(Simple.SIMPLE_VALID).toString() };
|
||||
CommandLineApplication.mainProgram(args);
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@ import de.kosit.validationtool.impl.Scenario;
|
|||
import de.kosit.validationtool.impl.model.Result;
|
||||
import de.kosit.validationtool.model.scenarios.NamespaceType;
|
||||
import de.kosit.validationtool.model.scenarios.ScenarioType;
|
||||
|
||||
import net.sf.saxon.s9api.XPathExecutable;
|
||||
|
||||
/**
|
||||
|
|
@ -140,6 +139,25 @@ public class ScenarioBuilderTest {
|
|||
assertThat(configuration.getNamespace()).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConfigureWithSchematron() {
|
||||
final ContentRepository repository = Simple.createContentRepository();
|
||||
final XPathExecutable match = repository.createXPath("//*", null);
|
||||
final XPathExecutable accept = repository.createXPath("//*", null);
|
||||
final ScenarioBuilder builder = createScenario();
|
||||
builder.getNamespaces().clear();
|
||||
|
||||
builder.match(match);
|
||||
builder.acceptWith(accept);
|
||||
final Result<Scenario, String> result = builder.build(repository);
|
||||
assertThat(result.isValid()).isTrue();
|
||||
final ScenarioType configuration = result.getObject().getConfiguration();
|
||||
assertThat(configuration.getMatch()).isNotEmpty();
|
||||
assertThat(configuration.getAcceptMatch()).isNotEmpty();
|
||||
assertThat(configuration.getNamespace()).isEmpty();
|
||||
assertThat(configuration.getValidateWithSchematron()).isNotEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBasicAttributes() {
|
||||
final ContentRepository repository = Simple.createContentRepository();
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import static de.kosit.validationtool.config.ConfigurationBuilder.fallback;
|
|||
import static de.kosit.validationtool.config.ConfigurationBuilder.report;
|
||||
import static de.kosit.validationtool.config.ConfigurationBuilder.scenario;
|
||||
import static de.kosit.validationtool.config.ConfigurationBuilder.schema;
|
||||
import static de.kosit.validationtool.config.ConfigurationBuilder.schematron;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Date;
|
||||
|
|
@ -46,6 +47,7 @@ public class TestConfigurationFactory {
|
|||
|
||||
public static ScenarioBuilder createScenario() {
|
||||
return scenario("simple").validate(schema("Sample Schema").schemaLocation(URI.create("simple.xsd")))
|
||||
.validate(schematron("Sample Schematron").source(Simple.SCHEMATRON))
|
||||
.with(report("Report für eRechnung").source("report.xsl")).acceptWith("count(//test:rejected) = 0")
|
||||
.declareNamespace("cri", "http://www.xoev.de/de/validator/framework/1/createreportinput")
|
||||
.declareNamespace("rpt", "http://validator.kosit.de/test-report")
|
||||
|
|
|
|||
|
|
@ -0,0 +1,51 @@
|
|||
package de.kosit.validationtool.docs;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
import javax.xml.transform.URIResolver;
|
||||
import javax.xml.validation.Schema;
|
||||
import javax.xml.validation.SchemaFactory;
|
||||
import javax.xml.validation.Validator;
|
||||
|
||||
import de.kosit.validationtool.api.Configuration;
|
||||
import de.kosit.validationtool.api.ResolvingConfigurationStrategy;
|
||||
import de.kosit.validationtool.impl.ResolvingMode;
|
||||
import de.kosit.validationtool.impl.xml.ProcessorProvider;
|
||||
import net.sf.saxon.lib.UnparsedTextURIResolver;
|
||||
|
||||
public class MiscDocExampleCodes {
|
||||
|
||||
void m1() {
|
||||
final Configuration config = Configuration.load(URI.create("myscenarios.xml")).setResolvingMode(ResolvingMode.STRICT_LOCAL)
|
||||
.build(ProcessorProvider.getProcessor());
|
||||
}
|
||||
|
||||
private static final class MyCustomResolvingConfigurationStrategy implements ResolvingConfigurationStrategy {
|
||||
|
||||
public SchemaFactory createSchemaFactory() {
|
||||
// TODO
|
||||
return null;
|
||||
}
|
||||
|
||||
public URIResolver createResolver(final URI scenarioRepository) {
|
||||
// TODO
|
||||
return null;
|
||||
}
|
||||
|
||||
public UnparsedTextURIResolver createUnparsedTextURIResolver(final URI scenarioRepository) {
|
||||
// TODO
|
||||
return null;
|
||||
}
|
||||
|
||||
public Validator createValidator(final Schema schema) {
|
||||
// TODO
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
void m2() {
|
||||
final Configuration config = Configuration.load(URI.create("myscenarios.xml"))
|
||||
.setResolvingStrategy(new MyCustomResolvingConfigurationStrategy()).build(ProcessorProvider.getProcessor());
|
||||
}
|
||||
|
||||
}
|
||||
31
src/test/java/de/kosit/validationtool/docs/MyValidator.java
Normal file
31
src/test/java/de/kosit/validationtool/docs/MyValidator.java
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
package de.kosit.validationtool.docs;
|
||||
|
||||
import static de.kosit.validationtool.config.ConfigurationBuilder.fallback;
|
||||
import static de.kosit.validationtool.config.ConfigurationBuilder.report;
|
||||
import static de.kosit.validationtool.config.ConfigurationBuilder.scenario;
|
||||
import static de.kosit.validationtool.config.ConfigurationBuilder.schema;
|
||||
import static de.kosit.validationtool.config.ConfigurationBuilder.schematron;
|
||||
|
||||
import java.net.URI;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
import de.kosit.validationtool.api.Check;
|
||||
import de.kosit.validationtool.api.Configuration;
|
||||
import de.kosit.validationtool.impl.DefaultCheck;
|
||||
import de.kosit.validationtool.impl.xml.ProcessorProvider;
|
||||
|
||||
/**
|
||||
* Example code that is used in the docs/api.md file
|
||||
*/
|
||||
public class MyValidator {
|
||||
|
||||
public static void main(final String[] args) {
|
||||
final Configuration config = Configuration.create().name("myconfiguration")
|
||||
.with(scenario("firstScenario").match("//myNode").validate(schema("Sample Schema").schemaLocation(URI.create("simple.xsd")))
|
||||
.validate(schematron("my rules").source("myRules.xsl")).with(report("my report").source("report.xsl")))
|
||||
.with(fallback().name("default-report").source("fallback.xsl")).useRepository(Paths.get("/opt/myrepository"))
|
||||
.build(ProcessorProvider.getProcessor());
|
||||
final Check validator = new DefaultCheck(config);
|
||||
// .. run your checks
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
package de.kosit.validationtool.docs;
|
||||
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
|
||||
import de.kosit.validationtool.api.Check;
|
||||
import de.kosit.validationtool.api.Configuration;
|
||||
import de.kosit.validationtool.api.Input;
|
||||
import de.kosit.validationtool.api.InputFactory;
|
||||
import de.kosit.validationtool.api.Result;
|
||||
import de.kosit.validationtool.impl.DefaultCheck;
|
||||
import de.kosit.validationtool.impl.xml.ProcessorProvider;
|
||||
|
||||
/**
|
||||
* Example code that is used in the docs/api.md file
|
||||
*/
|
||||
public class StandardExample {
|
||||
|
||||
public void run(final Path testDocument) throws URISyntaxException {
|
||||
// Load scenarios.xml from classpath
|
||||
final URL scenarios = this.getClass().getClassLoader().getResource("examples/simple/scenarios-with-relative-paths.xml");
|
||||
// Load the rest of the specific Validator configuration from classpath
|
||||
final Configuration config = Configuration.load(scenarios.toURI()).build(ProcessorProvider.getProcessor());
|
||||
// Use the default validation procedure
|
||||
final Check validator = new DefaultCheck(config);
|
||||
// Validate a single document
|
||||
final Input document = InputFactory.read(testDocument);
|
||||
// Get Result including information about the whole validation
|
||||
final Result report = validator.checkInput(document);
|
||||
System.out.println("Is processing succesful=" + report.isProcessingSuccessful());
|
||||
// Get report document if processing was successful
|
||||
Document result = null;
|
||||
if (report.isProcessingSuccessful()) {
|
||||
result = report.getReportDocument();
|
||||
}
|
||||
// continue processing results...
|
||||
}
|
||||
|
||||
public static void main(final String[] args) throws Exception {
|
||||
// Use e.g. "src/test/resources/examples/simple/input/foo.xml"
|
||||
if (args.length == 0) {
|
||||
throw new IllegalStateException("Provide a test document filename on the commandline");
|
||||
}
|
||||
// Path of document for validation
|
||||
final Path testDoc = Paths.get(args[0]);
|
||||
final StandardExample example = new StandardExample();
|
||||
// run example validation
|
||||
example.run(testDoc);
|
||||
}
|
||||
}
|
||||
|
|
@ -32,7 +32,6 @@ import de.kosit.validationtool.impl.model.Result;
|
|||
import de.kosit.validationtool.impl.tasks.DocumentParseAction;
|
||||
import de.kosit.validationtool.impl.xml.ProcessorProvider;
|
||||
import de.kosit.validationtool.model.reportInput.XMLSyntaxError;
|
||||
|
||||
import net.sf.saxon.s9api.Processor;
|
||||
import net.sf.saxon.s9api.SaxonApiException;
|
||||
import net.sf.saxon.s9api.Serializer;
|
||||
|
|
@ -52,16 +51,18 @@ public class Helper {
|
|||
|
||||
public static final URI EXAMPLES = ROOT.resolve("input/");
|
||||
|
||||
public static final URI SIMPLE_VALID = Simple.ROOT.resolve("input/simple.xml");
|
||||
public static final URI SIMPLE_VALID = ROOT.resolve("input/simple.xml");
|
||||
|
||||
public static final URI FOO = Simple.ROOT.resolve("input/foo.xml");
|
||||
public static final URI FOO = ROOT.resolve("input/foo.xml");
|
||||
|
||||
public static final URI FOO_SCHEMATRON_INVALID = EXAMPLES.resolve("foo-schematron-invalid.xml");
|
||||
|
||||
public static final URI REJECTED = Simple.ROOT.resolve("input/withManualReject.xml");
|
||||
public static final URI REJECTED = ROOT.resolve("input/withManualReject.xml");
|
||||
|
||||
public static final URI SCENARIOS = ROOT.resolve("scenarios.xml");
|
||||
|
||||
public static final URI SCENARIOS_WITH_RELATIVE_PATHS = ROOT.resolve("scenarios-with-relative-paths.xml");
|
||||
|
||||
public static final URI OTHER_SCENARIOS = ROOT.resolve("otherScenarios.xml");
|
||||
|
||||
public static final URI ERROR_SCENARIOS = ROOT.resolve("scenarios-with-errors.xml");
|
||||
|
|
@ -84,6 +85,8 @@ public class Helper {
|
|||
|
||||
public static final URI SCHEMA = REPOSITORY_URI.resolve("simple.xsd");
|
||||
|
||||
public static final URI SCHEMATRON = REPOSITORY_URI.resolve("simple-schematron-error.xsl");
|
||||
|
||||
public static final ContentRepository createContentRepository() {
|
||||
final ResolvingConfigurationStrategy strategy = ResolvingMode.STRICT_RELATIVE.getStrategy();
|
||||
return new ContentRepository(Helper.getTestProcessor(), strategy, Simple.REPOSITORY_URI);
|
||||
|
|
|
|||
|
|
@ -18,9 +18,8 @@
|
|||
<schema xmlns:context="http://www.springframework.org/schema/context" xmlns="http://www.w3.org/2001/XMLSchema"
|
||||
targetNamespace="http://www.example.org/main"
|
||||
elementFormDefault="qualified">
|
||||
|
||||
<import namespace="http://www.springframework.org/schema/context"
|
||||
schemaLocation="http://www.springframework.org/schema/context/spring-context.xsd" />
|
||||
schemaLocation="https://www.springframework.org/schema/context/spring-context.xsd" />
|
||||
|
||||
<complexType name="MainType">
|
||||
<sequence>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,95 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
~ Copyright 2017-2022 Koordinierungsstelle für IT-Standards (KoSIT)
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<scenarios xmlns="http://www.xoev.de/de/validator/framework/1/scenarios" frameworkVersion="1.1.2">
|
||||
<name>HTML-TestSuite</name>
|
||||
<author>QA</author>
|
||||
<date>2025-08-19</date>
|
||||
<description>
|
||||
<p>Szenario für Tests</p>
|
||||
</description>
|
||||
|
||||
<scenario>
|
||||
<name>Simple</name>
|
||||
<description>
|
||||
<p>Nur Schemaprüfung.</p>
|
||||
</description>
|
||||
<namespace prefix="cri">http://www.xoev.de/de/validator/framework/1/createreportinput
|
||||
</namespace>
|
||||
<namespace prefix="test">
|
||||
http://validator.kosit.de/test-sample</namespace>
|
||||
<namespace prefix="rpt">http://validator.kosit.de/test-report</namespace>
|
||||
<match>/test:simple</match>
|
||||
|
||||
<validateWithXmlSchema>
|
||||
<resource>
|
||||
<name>Sample Schema</name>
|
||||
<location>repository/simple.xsd</location>
|
||||
</resource>
|
||||
</validateWithXmlSchema>
|
||||
<validateWithSchematron>
|
||||
<resource>
|
||||
<name>Sample Schematron</name>
|
||||
<location>repository/simple.xsl</location>
|
||||
</resource>
|
||||
</validateWithSchematron>
|
||||
<createReport>
|
||||
<resource>
|
||||
<name>Report für eRechnung</name>
|
||||
<location>repository/report.xsl</location>
|
||||
</resource>
|
||||
</createReport>
|
||||
<acceptMatch>count(//test:rejected) = 0</acceptMatch>
|
||||
</scenario>
|
||||
|
||||
<scenario>
|
||||
<name>NoAcceptMatch</name>
|
||||
<description>
|
||||
<p>Nur Schemaprüfung. Keine AcceptMatch deklaration</p>
|
||||
<p>Testen, ob auch alte Konfiguration funktionioeren</p>
|
||||
</description>
|
||||
<namespace prefix="test">http://validator.kosit.de/test-sample</namespace>
|
||||
<match>/test:foo</match>
|
||||
<validateWithXmlSchema>
|
||||
<resource>
|
||||
<name>Sample Schema</name>
|
||||
<location>repository/simple.xsd</location>
|
||||
</resource>
|
||||
</validateWithXmlSchema>
|
||||
<validateWithSchematron>
|
||||
<resource>
|
||||
<name>Sample Schematron</name>
|
||||
<location>repository/simple.xsl</location>
|
||||
</resource>
|
||||
</validateWithSchematron>
|
||||
<createReport>
|
||||
<resource>
|
||||
<name>Report für eRechnung</name>
|
||||
<location>repository/report.xsl</location>
|
||||
</resource>
|
||||
</createReport>
|
||||
</scenario>
|
||||
|
||||
|
||||
<noScenarioReport>
|
||||
<resource>
|
||||
<name>default</name>
|
||||
<location>repository/report.xsl</location>
|
||||
</resource>
|
||||
</noScenarioReport>
|
||||
|
||||
</scenarios>
|
||||
Loading…
Add table
Add a link
Reference in a new issue