diff --git a/.gitignore b/.gitignore
index 8d2ff7e..a70a722 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,7 +5,6 @@
# Log file
*.log
-.idea
#*.iml
# Package Files #
@@ -35,9 +34,15 @@ src/generated
.project
.classpath
.factorypath
-.settings
+.idea/
+.settings/
.vscode
*.code-workspace
*.xpr
# Testing stuff
xrechnung
+
+# Mac stuff
+.DS_Store
+andre*-simple.xml
+somePrefix*.xml
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 5673d45..56e5cc7 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -3,7 +3,8 @@ image: maven:latest
variables:
BUILD_PROPS: "-Dbuild.revision=$CI_COMMIT_SHA -Dbuild.branch=$CI_COMMIT_REF_NAME -Dbuild.number=$CI_PIPELINE_IID -Dfile.encoding=UTF-8 -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false"
MAVEN_OPTS: "-Dmaven.repo.local=$CI_PROJECT_DIR/.m2/repository -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Dorg.slf4j.simpleLogger.showDateTime=true -Djava.awt.headless=true"
- MAVEN_CLI_OPTS: " --batch-mode --errors --fail-at-end --show-version -s .mvn/settings.xml"
+ MAVEN_CLI_OPTS: " --batch-mode --update-snapshots --errors --fail-at-end --show-version -s .mvn/settings.xml"
+ MAVEN_CLI_OPTS_CENTRAL: " --batch-mode --show-version -s .mvn/settings-maven-central.xml"
before_script:
- export CI_JOB_TIMESTAMP="-Dbuild.timestamp=$(date --utc --iso-8601=seconds)"
@@ -92,6 +93,11 @@ deploy:
- mvn $MAVEN_CLI_OPTS deploy:deploy-file -Dfile=target/validationtool-${PROJECT_VERSION}-sources.jar -DgroupId=kosit -DartifactId=validator -Dclassifier="sources" -Dversion=${PROJECT_VERSION} -Dpackaging=jar -DrepositoryId="gitlab-maven" -Durl=https://projekte.kosit.org/api/v4/projects/7/packages/maven
when: manual
+deploy-snapshot:
+ extends: java-8
+ script:
+ - mvn $MAVEN_CLI_OPTS_CENTRAL -P release-snapshot deploy
+
create-build-image:
stage: deploy
image: docker:latest
diff --git a/.idea/checkstyle-idea.xml b/.idea/checkstyle-idea.xml
deleted file mode 100644
index ef7efd6..0000000
--- a/.idea/checkstyle-idea.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
deleted file mode 100644
index c09264f..0000000
--- a/.idea/compiler.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/copyright/KoSIT_Validator.xml b/.idea/copyright/KoSIT_Validator.xml
deleted file mode 100644
index 16895e8..0000000
--- a/.idea/copyright/KoSIT_Validator.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml
deleted file mode 100644
index bc6a0ba..0000000
--- a/.idea/copyright/profiles_settings.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/eclipseCodeFormatter.xml b/.idea/eclipseCodeFormatter.xml
deleted file mode 100644
index a63598c..0000000
--- a/.idea/eclipseCodeFormatter.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
deleted file mode 100644
index 893896a..0000000
--- a/.idea/encodings.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
deleted file mode 100644
index 4d7210a..0000000
--- a/.idea/misc.xml
+++ /dev/null
@@ -1,89 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/saveactions_settings.xml b/.idea/saveactions_settings.xml
deleted file mode 100644
index 3b2acd8..0000000
--- a/.idea/saveactions_settings.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
deleted file mode 100644
index 94a25f7..0000000
--- a/.idea/vcs.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.mvn/settings-maven-central.xml b/.mvn/settings-maven-central.xml
new file mode 100644
index 0000000..7fc46fe
--- /dev/null
+++ b/.mvn/settings-maven-central.xml
@@ -0,0 +1,11 @@
+
+
+
+ central
+ ${MVN_CENTRAL_USER}
+ ${MVN_CENTRAL_TOKEN}
+
+
+
diff --git a/.mvn/settings.xml b/.mvn/settings.xml
index d1b2b61..0b53a90 100644
--- a/.mvn/settings.xml
+++ b/.mvn/settings.xml
@@ -1,36 +1,6 @@
-
-
-
-
+
gitlab-maven
diff --git a/.settings/org.eclipse.jdt.ui.prefs b/.settings/org.eclipse.jdt.ui.prefs
deleted file mode 100644
index 4b3eff9..0000000
--- a/.settings/org.eclipse.jdt.ui.prefs
+++ /dev/null
@@ -1,127 +0,0 @@
-cleanup.add_default_serial_version_id=false
-cleanup.add_generated_serial_version_id=true
-cleanup.add_missing_annotations=true
-cleanup.add_missing_deprecated_annotations=true
-cleanup.add_missing_methods=false
-cleanup.add_missing_nls_tags=false
-cleanup.add_missing_override_annotations=true
-cleanup.add_missing_override_annotations_interface_methods=true
-cleanup.add_serial_version_id=false
-cleanup.always_use_blocks=true
-cleanup.always_use_parentheses_in_expressions=false
-cleanup.always_use_this_for_non_static_field_access=true
-cleanup.always_use_this_for_non_static_method_access=false
-cleanup.convert_functional_interfaces=false
-cleanup.convert_to_enhanced_for_loop=true
-cleanup.correct_indentation=false
-cleanup.format_source_code=true
-cleanup.format_source_code_changes_only=false
-cleanup.insert_inferred_type_arguments=false
-cleanup.make_local_variable_final=true
-cleanup.make_parameters_final=true
-cleanup.make_private_fields_final=true
-cleanup.make_type_abstract_if_missing_method=false
-cleanup.make_variable_declarations_final=true
-cleanup.never_use_blocks=false
-cleanup.never_use_parentheses_in_expressions=true
-cleanup.organize_imports=true
-cleanup.qualify_static_field_accesses_with_declaring_class=false
-cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
-cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
-cleanup.qualify_static_member_accesses_with_declaring_class=true
-cleanup.qualify_static_method_accesses_with_declaring_class=false
-cleanup.remove_private_constructors=true
-cleanup.remove_redundant_type_arguments=true
-cleanup.remove_trailing_whitespaces=true
-cleanup.remove_trailing_whitespaces_all=true
-cleanup.remove_trailing_whitespaces_ignore_empty=false
-cleanup.remove_unnecessary_casts=true
-cleanup.remove_unnecessary_nls_tags=true
-cleanup.remove_unused_imports=true
-cleanup.remove_unused_local_variables=false
-cleanup.remove_unused_private_fields=true
-cleanup.remove_unused_private_members=false
-cleanup.remove_unused_private_methods=true
-cleanup.remove_unused_private_types=true
-cleanup.sort_members=false
-cleanup.sort_members_all=false
-cleanup.use_anonymous_class_creation=false
-cleanup.use_blocks=true
-cleanup.use_blocks_only_for_return_and_throw=false
-cleanup.use_lambda=true
-cleanup.use_parentheses_in_expressions=true
-cleanup.use_this_for_non_static_field_access=true
-cleanup.use_this_for_non_static_field_access_only_if_necessary=false
-cleanup.use_this_for_non_static_method_access=true
-cleanup.use_this_for_non_static_method_access_only_if_necessary=true
-cleanup.use_type_arguments=false
-cleanup_profile=_initCleanUpProfile
-cleanup_settings_version=2
-eclipse.preferences.version=1
-editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
-formatter_profile=_init
-formatter_settings_version=23
-org.eclipse.jdt.ui.ignorelowercasenames=true
-org.eclipse.jdt.ui.importorder=java;javax;org;com;lombok;de;
-org.eclipse.jdt.ui.javadoc=true
-org.eclipse.jdt.ui.ondemandthreshold=99
-org.eclipse.jdt.ui.staticondemandthreshold=99
-org.eclipse.jdt.ui.text.custom_code_templates=/**\r\n * The ${bare_field_name} of this {@link ${enclosing_type}}.\r\n * \r\n * @return the ${bare_field_name}\r\n *//**\r\n * Sets the ${bare_field_name} of this {@link ${enclosing_type}}.\r\n *\r\n * @param ${param} the new ${bare_field_name} to set\r\n *//**\r\n * Creates a new instance of {@link ${enclosing_type}}.\r\n * ${tags}\r\n *//**\r\n * ${todo} Describe this class\r\n *\r\n * @author ${user}\r\n * ${tags}\r\n *//**\r\n * ${todo} Describe this method\r\n * ${tags}\r\n *//**\r\n * ${todo} Describe why this method is overridden.\r\n *//**\r\n * ${tags}\r\n * ${see_to_target}\r\n */${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}\r\n\r\n\r\n\r\n// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();// ${todo} Auto-generated method stub\r\n${body_statement}${body_statement}\r\n// ${todo} Auto-generated constructor stubreturn ${field};${field} \= ${param};
-sp_cleanup.add_default_serial_version_id=true
-sp_cleanup.add_generated_serial_version_id=false
-sp_cleanup.add_missing_annotations=true
-sp_cleanup.add_missing_deprecated_annotations=true
-sp_cleanup.add_missing_methods=false
-sp_cleanup.add_missing_nls_tags=false
-sp_cleanup.add_missing_override_annotations=true
-sp_cleanup.add_missing_override_annotations_interface_methods=true
-sp_cleanup.add_serial_version_id=false
-sp_cleanup.always_use_blocks=true
-sp_cleanup.always_use_parentheses_in_expressions=false
-sp_cleanup.always_use_this_for_non_static_field_access=true
-sp_cleanup.always_use_this_for_non_static_method_access=false
-sp_cleanup.convert_functional_interfaces=false
-sp_cleanup.convert_to_enhanced_for_loop=true
-sp_cleanup.correct_indentation=false
-sp_cleanup.format_source_code=true
-sp_cleanup.format_source_code_changes_only=false
-sp_cleanup.insert_inferred_type_arguments=false
-sp_cleanup.make_local_variable_final=true
-sp_cleanup.make_parameters_final=true
-sp_cleanup.make_private_fields_final=true
-sp_cleanup.make_type_abstract_if_missing_method=false
-sp_cleanup.make_variable_declarations_final=true
-sp_cleanup.never_use_blocks=false
-sp_cleanup.never_use_parentheses_in_expressions=true
-sp_cleanup.on_save_use_additional_actions=true
-sp_cleanup.organize_imports=true
-sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
-sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_with_declaring_class=true
-sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
-sp_cleanup.remove_private_constructors=true
-sp_cleanup.remove_redundant_type_arguments=false
-sp_cleanup.remove_trailing_whitespaces=true
-sp_cleanup.remove_trailing_whitespaces_all=true
-sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
-sp_cleanup.remove_unnecessary_casts=true
-sp_cleanup.remove_unnecessary_nls_tags=false
-sp_cleanup.remove_unused_imports=true
-sp_cleanup.remove_unused_local_variables=false
-sp_cleanup.remove_unused_private_fields=true
-sp_cleanup.remove_unused_private_members=false
-sp_cleanup.remove_unused_private_methods=true
-sp_cleanup.remove_unused_private_types=true
-sp_cleanup.sort_members=false
-sp_cleanup.sort_members_all=false
-sp_cleanup.use_anonymous_class_creation=false
-sp_cleanup.use_blocks=true
-sp_cleanup.use_blocks_only_for_return_and_throw=false
-sp_cleanup.use_lambda=false
-sp_cleanup.use_parentheses_in_expressions=true
-sp_cleanup.use_this_for_non_static_field_access=true
-sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=false
-sp_cleanup.use_this_for_non_static_method_access=true
-sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
-sp_cleanup.use_type_arguments=false
diff --git a/.settings/settings.xml b/.settings/settings.xml
deleted file mode 100644
index d1b2b61..0000000
--- a/.settings/settings.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-
-
-
-
-
-
- gitlab-maven
-
-
-
- Job-Token
- ${env.CI_JOB_TOKEN}
-
-
-
-
-
-
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 2690237..7214bfe 100644
--- a/pom.xml
+++ b/pom.xml
@@ -21,10 +21,10 @@
KoSIT XML Prüftool Implementierung
- de.kosit
- 1.5.1
-
+ org.kosit
validationtool
+ 1.5.1-SNAPSHOT
+
KoSIT XML Validator against XSD and Schematron based on defined scenarios.
@@ -67,12 +67,25 @@
12.8
2.0.17
+
project.local
project
file:${project.basedir}/libs
+
+
+ Central Portal Snapshots
+ central-portal-snapshots
+ https://central.sonatype.com/repository/maven-snapshots/
+
+ false
+
+
+ true
+
+
@@ -172,6 +185,26 @@
true
+
+
+
+
+ org.sonatype.central
+ central-publishing-maven-plugin
+ 0.8.0
+ true
+
+ central
+ true
+
+
+
+ org.apache.maven.plugins
+ maven-gpg-plugin
+ 3.2.8
+
+
+
@@ -590,7 +623,6 @@
org.apache.maven.plugins
maven-gpg-plugin
- 3.2.8
sign-artifacts
@@ -660,6 +692,17 @@
+
+ release-snapshot
+
+
+
+ org.sonatype.central
+ central-publishing-maven-plugin
+
+
+
+
@@ -669,12 +712,14 @@
- https://github.com/itplr-kosit/validationtool.git
+ scm:git:https://github.com/itplr-kosit/validator.git
scm:git:https://projekte.kosit.org/kosit/validator.git
- v1.1.0
+ release/1.5.x
https://github.com/itplr-kosit/validator
+
https://github.com/itplr-kosit/validator
+
Apache License, Version 2.0
@@ -682,12 +727,4 @@
repo
-
-
- sonatype-nexus-staging
- Nexus Release Repository
- https://oss.sonatype.org/service/local/staging/deploy/maven2
-
-
-
diff --git a/src/main/java/de/kosit/validationtool/impl/Scenario.java b/src/main/java/de/kosit/validationtool/impl/Scenario.java
index 23deb7d..d92768a 100644
--- a/src/main/java/de/kosit/validationtool/impl/Scenario.java
+++ b/src/main/java/de/kosit/validationtool/impl/Scenario.java
@@ -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 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 getAcceptSelector() {
final XPathSelector selector = this.acceptExecutable != null ? this.acceptExecutable.load() : null;
diff --git a/src/test/java/de/kosit/validationtool/config/ScenarioBuilderTest.java b/src/test/java/de/kosit/validationtool/config/ScenarioBuilderTest.java
index 42f2f58..f9f5590 100644
--- a/src/test/java/de/kosit/validationtool/config/ScenarioBuilderTest.java
+++ b/src/test/java/de/kosit/validationtool/config/ScenarioBuilderTest.java
@@ -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 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();
diff --git a/src/test/java/de/kosit/validationtool/config/TestConfigurationFactory.java b/src/test/java/de/kosit/validationtool/config/TestConfigurationFactory.java
index 79ec407..0daacf7 100644
--- a/src/test/java/de/kosit/validationtool/config/TestConfigurationFactory.java
+++ b/src/test/java/de/kosit/validationtool/config/TestConfigurationFactory.java
@@ -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")
diff --git a/src/test/java/de/kosit/validationtool/impl/Helper.java b/src/test/java/de/kosit/validationtool/impl/Helper.java
index 334791c..4562fb6 100644
--- a/src/test/java/de/kosit/validationtool/impl/Helper.java
+++ b/src/test/java/de/kosit/validationtool/impl/Helper.java
@@ -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;
@@ -84,6 +83,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);