mirror of
https://github.com/itplr-kosit/validator.git
synced 2026-05-25 16:55:39 +00:00
Compare commits
55 commits
e3ac6cdb39
...
51e573f02c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
51e573f02c | ||
|
|
100644fb38 | ||
|
|
1bda64f610 | ||
|
|
0be3eac6ed | ||
|
|
f082d48dd8 | ||
|
|
4e0a1e1fc5 | ||
|
|
c906adf39b | ||
|
|
e5f2298293 | ||
|
|
561d719b28 | ||
|
|
c0f823f399 | ||
|
|
6a60bc561a | ||
|
|
3aab435d8e | ||
|
|
1e6f96dfad | ||
|
|
fc31e98da9 | ||
|
|
05079676b5 | ||
|
|
e444a60695 | ||
|
|
cf10fa09e5 | ||
|
|
4a15af6ef2 | ||
|
|
da42b9e404 | ||
|
|
2dd5e0dbb0 | ||
|
|
be30c80617 | ||
|
|
90b860d8ec | ||
|
|
eb7fc87f07 | ||
|
|
f4f0d9eceb | ||
|
|
269862503e | ||
|
|
02d12b614e | ||
|
|
740a880276 | ||
|
|
da7515a055 | ||
|
|
05c3d9ea09 | ||
|
|
d4d1aaea51 | ||
|
|
5e57c3e978 | ||
|
|
22910c1ca0 | ||
|
|
911b9a3291 | ||
|
|
7eaf9bcc09 | ||
|
|
122b647853 | ||
|
|
a8a3fd100c | ||
|
|
7a7712188d | ||
|
|
ce65c99f6c | ||
|
|
6698e6b865 | ||
|
|
edde0f5134 | ||
|
|
e4d4ee44e5 | ||
|
|
a45563e41a | ||
|
|
3edc5c6ae4 | ||
|
|
6cc9a6eea7 | ||
|
|
5bbb5b373d | ||
|
|
b24e97e43f | ||
|
|
361ed5863d | ||
|
|
0092c2f0e1 | ||
|
|
ef6ea7a92c | ||
|
|
864c36b3c2 | ||
|
|
7bfd3309d1 | ||
|
|
827eded0ed | ||
|
|
910320a5f1 | ||
|
|
6950a98f09 | ||
|
|
acd7740846 |
38 changed files with 641 additions and 685 deletions
9
.gitignore
vendored
9
.gitignore
vendored
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -3,13 +3,15 @@ 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)"
|
||||
|
||||
cache:
|
||||
key: "$CI_JOB_NAME"
|
||||
# Change the cache key if major dependencies change
|
||||
key: constant160
|
||||
paths:
|
||||
- .m2/repository
|
||||
|
||||
|
|
@ -37,7 +39,7 @@ cache:
|
|||
|
||||
java-11:
|
||||
extends: .java
|
||||
image: $CI_REGISTRY_IMAGE/maven:3-jdk-11
|
||||
image: $CI_REGISTRY_IMAGE/maven:3-eclipse-temurin-11-alpine
|
||||
needs: [ ]
|
||||
script:
|
||||
- mvn $MAVEN_CLI_OPTS $BUILD_PROPS $CI_JOB_TIMESTAMP install
|
||||
|
|
@ -56,25 +58,9 @@ java-11-openj9:
|
|||
extends: .java_extended
|
||||
image: $CI_REGISTRY_IMAGE/maven:3-jdk-11-openj9
|
||||
|
||||
java-15:
|
||||
extends: .java_extended
|
||||
image: $CI_REGISTRY_IMAGE/maven:3-openjdk-15
|
||||
|
||||
java-16:
|
||||
extends: .java_extended
|
||||
image: $CI_REGISTRY_IMAGE/maven:3-openjdk-16
|
||||
|
||||
java-17:
|
||||
extends: .java
|
||||
image: $CI_REGISTRY_IMAGE/maven:3-openjdk-17
|
||||
|
||||
java-18:
|
||||
extends: .java_extended
|
||||
image: $CI_REGISTRY_IMAGE/maven:3-openjdk-18
|
||||
|
||||
java-19:
|
||||
extends: .java_extended
|
||||
image: $CI_REGISTRY_IMAGE/maven:3-eclipse-temurin-19-alpine
|
||||
image: $CI_REGISTRY_IMAGE/maven:3-eclipse-temurin-17-alpine
|
||||
|
||||
java-21:
|
||||
extends: .java
|
||||
|
|
@ -86,19 +72,23 @@ java-24:
|
|||
|
||||
deploy:
|
||||
stage: deploy
|
||||
image: $CI_REGISTRY_IMAGE/maven:3-jdk-11
|
||||
image: $CI_REGISTRY_IMAGE/maven:3-eclipse-temurin-11-alpine
|
||||
needs:
|
||||
- job: java-11
|
||||
script:
|
||||
- export PROJECT_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
|
||||
- mvn $MAVEN_CLI_OPTS deploy:deploy-file -Dfile=target/validationtool-${PROJECT_VERSION}.zip -DgroupId=kosit -DartifactId=validator -Dclassifier="distribution" -Dversion=${PROJECT_VERSION} -Dpackaging=zip -DrepositoryId="gitlab-maven" -Durl=https://projekte.kosit.org/api/v4/projects/7/packages/maven
|
||||
- mvn $MAVEN_CLI_OPTS deploy:deploy-file -Dfile=target/validationtool-${PROJECT_VERSION}.jar -DgroupId=kosit -DartifactId=validator -Dversion=${PROJECT_VERSION} -Dpackaging=jar -DrepositoryId="gitlab-maven" -Durl=https://projekte.kosit.org/api/v4/projects/7/packages/maven
|
||||
- mvn $MAVEN_CLI_OPTS deploy:deploy-file -Dfile=target/validationtool-${PROJECT_VERSION}-javadoc.jar -DgroupId=kosit -DartifactId=validator -Dclassifier="javadoc" -Dversion=${PROJECT_VERSION} -Dpackaging=zip -DrepositoryId="gitlab-maven" -Durl=https://projekte.kosit.org/api/v4/projects/7/packages/maven
|
||||
- mvn $MAVEN_CLI_OPTS deploy:deploy-file -Dfile=target/validationtool-${PROJECT_VERSION}-standalone.jar -DgroupId=kosit -DartifactId=validator -Dclassifier="standalone" -Dversion=${PROJECT_VERSION} -Dpackaging=jar -DrepositoryId="gitlab-maven" -Durl=https://projekte.kosit.org/api/v4/projects/7/packages/maven
|
||||
- mvn $MAVEN_CLI_OPTS deploy:deploy-file -Dfile=target/validationtool-${PROJECT_VERSION}-java8-standalone.jar -DgroupId=kosit -DartifactId=validator -Dclassifier="java8-standalone" -Dversion=${PROJECT_VERSION} -Dpackaging=jar -DrepositoryId="gitlab-maven" -Durl=https://projekte.kosit.org/api/v4/projects/7/packages/maven
|
||||
- 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
|
||||
- mvn $MAVEN_CLI_OPTS deploy:deploy-file -Dfile=target/validator-${PROJECT_VERSION}.zip -DgroupId=kosit -DartifactId=validator -Dclassifier="distribution" -Dversion=${PROJECT_VERSION} -Dpackaging=zip -DrepositoryId="gitlab-maven" -Durl=https://projekte.kosit.org/api/v4/projects/7/packages/maven
|
||||
- mvn $MAVEN_CLI_OPTS deploy:deploy-file -Dfile=target/validator-${PROJECT_VERSION}.jar -DgroupId=kosit -DartifactId=validator -Dversion=${PROJECT_VERSION} -Dpackaging=jar -DrepositoryId="gitlab-maven" -Durl=https://projekte.kosit.org/api/v4/projects/7/packages/maven
|
||||
- mvn $MAVEN_CLI_OPTS deploy:deploy-file -Dfile=target/validator-${PROJECT_VERSION}-javadoc.jar -DgroupId=kosit -DartifactId=validator -Dclassifier="javadoc" -Dversion=${PROJECT_VERSION} -Dpackaging=zip -DrepositoryId="gitlab-maven" -Durl=https://projekte.kosit.org/api/v4/projects/7/packages/maven
|
||||
- mvn $MAVEN_CLI_OPTS deploy:deploy-file -Dfile=target/validator-${PROJECT_VERSION}-standalone.jar -DgroupId=kosit -DartifactId=validator -Dclassifier="standalone" -Dversion=${PROJECT_VERSION} -Dpackaging=jar -DrepositoryId="gitlab-maven" -Durl=https://projekte.kosit.org/api/v4/projects/7/packages/maven
|
||||
- mvn $MAVEN_CLI_OPTS deploy:deploy-file -Dfile=target/validator-${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-11
|
||||
script:
|
||||
- mvn $MAVEN_CLI_OPTS_CENTRAL -P release-snapshot deploy
|
||||
|
||||
create-build-image:
|
||||
stage: deploy
|
||||
image: docker:latest
|
||||
|
|
@ -116,7 +106,7 @@ create-build-image:
|
|||
|
||||
owasp-check:
|
||||
extends: .java
|
||||
image: $CI_REGISTRY_IMAGE/maven:3-jdk-11
|
||||
image: $CI_REGISTRY_IMAGE/maven:3-eclipse-temurin-11-alpine
|
||||
needs: [ ]
|
||||
script:
|
||||
- mvn $MAVEN_CLI_OPTS $BUILD_PROPS $CI_JOB_TIMESTAMP validate -Powasp-check
|
||||
|
|
@ -126,5 +116,3 @@ owasp-check:
|
|||
changes:
|
||||
- pom.xml
|
||||
- owasp-suppressions.xml
|
||||
|
||||
|
||||
|
|
|
|||
16
.idea/checkstyle-idea.xml
generated
16
.idea/checkstyle-idea.xml
generated
|
|
@ -1,16 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CheckStyle-IDEA">
|
||||
<option name="configuration">
|
||||
<map>
|
||||
<entry key="checkstyle-version" value="8.16" />
|
||||
<entry key="copy-libs" value="true" />
|
||||
<entry key="location-0" value="BUNDLED:(bundled):Sun Checks" />
|
||||
<entry key="location-1" value="BUNDLED:(bundled):Google Checks" />
|
||||
<entry key="scan-before-checkin" value="false" />
|
||||
<entry key="scanscope" value="JavaOnly" />
|
||||
<entry key="suppress-errors" value="false" />
|
||||
</map>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
18
.idea/compiler.xml
generated
18
.idea/compiler.xml
generated
|
|
@ -1,18 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<annotationProcessing>
|
||||
<profile default="true" name="Default" enabled="true" />
|
||||
<profile name="Maven default annotation processors profile" enabled="true">
|
||||
<sourceOutputDir name="target/generated-sources/annotations" />
|
||||
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||
<outputRelativeToContentRoot value="true" />
|
||||
<module name="validator" />
|
||||
<module name="validationtool" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
<bytecodeTargetLevel>
|
||||
<module name="validator" target="1.8" />
|
||||
</bytecodeTargetLevel>
|
||||
</component>
|
||||
</project>
|
||||
6
.idea/copyright/KoSIT_Validator.xml
generated
6
.idea/copyright/KoSIT_Validator.xml
generated
|
|
@ -1,6 +0,0 @@
|
|||
<component name="CopyrightManager">
|
||||
<copyright>
|
||||
<option name="notice" value="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." />
|
||||
<option name="myName" value="KoSIT Validator" />
|
||||
</copyright>
|
||||
</component>
|
||||
7
.idea/copyright/profiles_settings.xml
generated
7
.idea/copyright/profiles_settings.xml
generated
|
|
@ -1,7 +0,0 @@
|
|||
<component name="CopyrightManager">
|
||||
<settings default="KoSIT Validator">
|
||||
<module2copyright>
|
||||
<element module="All" copyright="KoSIT Validator" />
|
||||
</module2copyright>
|
||||
</settings>
|
||||
</component>
|
||||
17
.idea/eclipseCodeFormatter.xml
generated
17
.idea/eclipseCodeFormatter.xml
generated
|
|
@ -1,17 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="EclipseCodeFormatterProjectSettings">
|
||||
<option name="projectSpecificProfile">
|
||||
<ProjectSpecificProfile>
|
||||
<option name="disabledFileTypes" value="xml" />
|
||||
<option name="formatSeletedTextInAllFileTypes" value="false" />
|
||||
<option name="formatter" value="ECLIPSE" />
|
||||
<option name="importOrderConfigFilePath" value="$PROJECT_DIR$/.settings/org.eclipse.jdt.ui.prefs" />
|
||||
<option name="importOrderFromFile" value="true" />
|
||||
<option name="pathToConfigFileJava" value="$PROJECT_DIR$/formatter.xml" />
|
||||
<option name="selectedJavaProfile" value="init" />
|
||||
<option name="useForLiveTemplates" value="true" />
|
||||
</ProjectSpecificProfile>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
11
.idea/encodings.xml
generated
11
.idea/encodings.xml
generated
|
|
@ -1,11 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding">
|
||||
<file url="file://$PROJECT_DIR$" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/src/main/model" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/target/generated-sources/xjc" charset="UTF-8" />
|
||||
<file url="PROJECT" charset="UTF-8" />
|
||||
</component>
|
||||
</project>
|
||||
89
.idea/misc.xml
generated
89
.idea/misc.xml
generated
|
|
@ -1,89 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="JavaScriptSettings">
|
||||
<option name="languageLevel" value="ES6" />
|
||||
</component>
|
||||
<component name="JavadocGenerationManager">
|
||||
<option name="OUTPUT_DIRECTORY" value="$PROJECT_DIR$/target" />
|
||||
</component>
|
||||
<component name="MarkdownProjectSettings">
|
||||
<PreviewSettings splitEditorLayout="SPLIT" splitEditorPreview="PREVIEW" useGrayscaleRendering="false" zoomFactor="1.0" maxImageWidth="0" showGitHubPageIfSynced="false" allowBrowsingInPreview="false" synchronizePreviewPosition="true" highlightPreviewType="LINE" highlightFadeOut="5" highlightOnTyping="true" synchronizeSourcePosition="true">
|
||||
<PanelProvider>
|
||||
<provider providerId="com.vladsch.idea.multimarkdown.editor.swing.html.panel" providerName="Default - Swing" />
|
||||
</PanelProvider>
|
||||
</PreviewSettings>
|
||||
<ParserSettings>
|
||||
<PegdownExtensions>
|
||||
<option name="ABBREVIATIONS" value="false" />
|
||||
<option name="ANCHORLINKS" value="true" />
|
||||
<option name="ATXHEADERSPACE" value="true" />
|
||||
<option name="AUTOLINKS" value="true" />
|
||||
<option name="DEFINITIONS" value="false" />
|
||||
<option name="FENCED_CODE_BLOCKS" value="true" />
|
||||
<option name="FOOTNOTES" value="false" />
|
||||
<option name="HARDWRAPS" value="false" />
|
||||
<option name="INSERTED" value="false" />
|
||||
<option name="QUOTES" value="false" />
|
||||
<option name="RELAXEDHRULES" value="true" />
|
||||
<option name="SMARTS" value="false" />
|
||||
<option name="STRIKETHROUGH" value="true" />
|
||||
<option name="SUBSCRIPT" value="false" />
|
||||
<option name="SUPERSCRIPT" value="false" />
|
||||
<option name="SUPPRESS_HTML_BLOCKS" value="false" />
|
||||
<option name="SUPPRESS_INLINE_HTML" value="false" />
|
||||
<option name="TABLES" value="true" />
|
||||
<option name="TASKLISTITEMS" value="true" />
|
||||
<option name="TOC" value="false" />
|
||||
<option name="WIKILINKS" value="true" />
|
||||
</PegdownExtensions>
|
||||
<ParserOptions>
|
||||
<option name="COMMONMARK_LISTS" value="false" />
|
||||
<option name="DUMMY" value="false" />
|
||||
<option name="EMOJI_SHORTCUTS" value="true" />
|
||||
<option name="FLEXMARK_FRONT_MATTER" value="false" />
|
||||
<option name="GFM_TABLE_RENDERING" value="true" />
|
||||
<option name="GITBOOK_URL_ENCODING" value="false" />
|
||||
<option name="GITHUB_EMOJI_URL" value="false" />
|
||||
<option name="GITHUB_LISTS" value="true" />
|
||||
<option name="GITHUB_WIKI_LINKS" value="true" />
|
||||
<option name="JEKYLL_FRONT_MATTER" value="false" />
|
||||
<option name="SIM_TOC_BLANK_LINE_SPACER" value="true" />
|
||||
</ParserOptions>
|
||||
</ParserSettings>
|
||||
<HtmlSettings headerTopEnabled="false" headerBottomEnabled="false" bodyTopEnabled="false" bodyBottomEnabled="false" embedUrlContent="false" addPageHeader="true">
|
||||
<GeneratorProvider>
|
||||
<provider providerId="com.vladsch.idea.multimarkdown.editor.swing.html.generator" providerName="Default Swing HTML Generator" />
|
||||
</GeneratorProvider>
|
||||
<headerTop />
|
||||
<headerBottom />
|
||||
<bodyTop />
|
||||
<bodyBottom />
|
||||
</HtmlSettings>
|
||||
<CssSettings previewScheme="UI_SCHEME" cssUri="" isCssUriEnabled="false" isCssTextEnabled="false" isDynamicPageWidth="true">
|
||||
<StylesheetProvider>
|
||||
<provider providerId="com.vladsch.idea.multimarkdown.editor.swing.html.css" providerName="Default Swing Stylesheet" />
|
||||
</StylesheetProvider>
|
||||
<ScriptProviders />
|
||||
<cssText />
|
||||
</CssSettings>
|
||||
<HtmlExportSettings updateOnSave="false" parentDir="$ProjectFileDir$" targetDir="$ProjectFileDir$" cssDir="" scriptDir="" plainHtml="false" imageDir="" copyLinkedImages="false" imageUniquifyType="0" targetExt="" useTargetExt="false" noCssNoScripts="false" linkToExportedHtml="true" exportOnSettingsChange="true" regenerateOnProjectOpen="false" />
|
||||
<LinkMapSettings>
|
||||
<textMaps />
|
||||
</LinkMapSettings>
|
||||
</component>
|
||||
<component name="MavenProjectsManager">
|
||||
<option name="originalFiles">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/pom.xml" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="NodePackageJsonFileManager">
|
||||
<packageJsonPaths />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_10" project-jdk-name="corretto-11" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
<component name="jetbrains.communicator.idea.IdProvider" IDEtalkID="4B2DA906C3A7DF4F7B6EA28093E19A3F" />
|
||||
</project>
|
||||
22
.idea/saveactions_settings.xml
generated
22
.idea/saveactions_settings.xml
generated
|
|
@ -1,22 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="SaveActionSettings">
|
||||
<option name="actions">
|
||||
<set>
|
||||
<option value="activate" />
|
||||
<option value="activateOnShortcut" />
|
||||
<option value="activateOnBatch" />
|
||||
<option value="organizeImports" />
|
||||
<option value="reformatChangedCode" />
|
||||
<option value="rearrange" />
|
||||
<option value="fieldCanBeFinal" />
|
||||
<option value="localCanBeFinal" />
|
||||
<option value="methodMayBeStatic" />
|
||||
<option value="unqualifiedFieldAccess" />
|
||||
<option value="missingOverrideAnnotation" />
|
||||
<option value="useBlocks" />
|
||||
</set>
|
||||
</option>
|
||||
<option name="configurationPath" value="" />
|
||||
</component>
|
||||
</project>
|
||||
6
.idea/vcs.xml
generated
6
.idea/vcs.xml
generated
|
|
@ -1,6 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
# limitations under the License.
|
||||
#
|
||||
|
||||
TAGS=("3-openjdk-16" "3-jdk-11" "3-jdk-11-openj9" "3-jdk-8" "3-jdk-8-openj9" "3-openjdk-15" "3-openjdk-17" "3-openjdk-18" "3-eclipse-temurin-19-alpine")
|
||||
TAGS=("3-jdk-8" "3-jdk-8-openj9" "3-eclipse-temurin-11-alpine" "3-jdk-11-openj9" "3-eclipse-temurin-17-alpine" "3-eclipse-temurin-21-alpine" "3-eclipse-temurin-24-alpine")
|
||||
|
||||
docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY"
|
||||
for i in "${TAGS[@]}"
|
||||
|
|
|
|||
11
.mvn/settings-maven-central.xml
Normal file
11
.mvn/settings-maven-central.xml
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
|
||||
<servers>
|
||||
<server>
|
||||
<id>central</id>
|
||||
<username>${MVN_CENTRAL_USER}</username>
|
||||
<password>${MAVEN_CENTRAL_TOKEN}</password>
|
||||
</server>
|
||||
</servers>
|
||||
</settings>
|
||||
|
|
@ -1,36 +1,6 @@
|
|||
<!--
|
||||
~ 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.
|
||||
-->
|
||||
|
||||
<settings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/SETTINGS/1.1.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd">
|
||||
<!--
|
||||
~ Copyright 2017-2021 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.
|
||||
-->
|
||||
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
|
||||
<servers>
|
||||
<server>
|
||||
<id>gitlab-maven</id>
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -1,47 +0,0 @@
|
|||
<!--
|
||||
~ 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.
|
||||
-->
|
||||
|
||||
<settings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/SETTINGS/1.1.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd">
|
||||
<!--
|
||||
~ Copyright 2017-2021 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.
|
||||
-->
|
||||
<servers>
|
||||
<server>
|
||||
<id>gitlab-maven</id>
|
||||
<configuration>
|
||||
<httpHeaders>
|
||||
<property>
|
||||
<name>Job-Token</name>
|
||||
<value>${env.CI_JOB_TOKEN}</value>
|
||||
</property>
|
||||
</httpHeaders>
|
||||
</configuration>
|
||||
</server>
|
||||
</servers>
|
||||
</settings>
|
||||
68
CHANGELOG.md
68
CHANGELOG.md
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## 1.6.0
|
||||
|
|
@ -15,13 +15,47 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
- (CORE) java 8 support. new default jdk 11
|
||||
|
||||
## 1.5.0 (to be released)
|
||||
## 1.5.2 - 2025-09-01
|
||||
|
||||
### Fixed
|
||||
|
||||
- (BUILD) [#148](https://projekte.kosit.org/kosit/validator/-/issues/148): Regression that due to renaming from `validationtool` to `validator` the distribution zip did not contain all jars anymore
|
||||
|
||||
## 1.5.1 - 2025-09-01
|
||||
|
||||
### Fixed
|
||||
|
||||
- (CORE) [#130](https://projekte.kosit.org/kosit/validator/-/issues/130) Check result to stdout causes an exception. This also fixes [GitHub #131](https://github.com/itplr-kosit/validator/issues/131)
|
||||
- (CORE) [#131](https://projekte.kosit.org/kosit/validator/-/issues/131) `UnsupportedOperationException` because of read-only list. This also fixes [GitHub #136](https://github.com/itplr-kosit/validator/issues/136)
|
||||
- (CLI) [#104](https://projekte.kosit.org/kosit/validator/-/issues/104) made the usage of the `-r` parameter optional, if only one unnamed scenario is used
|
||||
- (CLI) [#145](https://projekte.kosit.org/kosit/validator/-/issues/145) If the CLI is invoked without any parameter, the usage is shown twice
|
||||
- (DOC) [#129](https://projekte.kosit.org/kosit/validator/-/issues/129) API documentation is outdated. This also fixes [GitHub #130](https://github.com/itplr-kosit/validator/issues/130)
|
||||
- (BUILD) [#62](https://projekte.kosit.org/kosit/validator/-/issues/62) Surefire Test Error running `de.kosit.validationtool.impl.xml.RemoteResolvingStrategyTest` fails without `http.proxy` setting
|
||||
- (BUILD) [#110](https://projekte.kosit.org/kosit/validator/-/issues/110) reactivated the GitLab CI environment
|
||||
|
||||
### Added
|
||||
|
||||
- (BUILD) [#140](https://projekte.kosit.org/kosit/validator/-/issues/140) prepare pom.xml to be able to release to Maven Central
|
||||
- (BUILD) [#144](https://projekte.kosit.org/kosit/validator/-/issues/144) created a Maven profile to release on Maven Central
|
||||
|
||||
### Changed
|
||||
|
||||
- (CORE) [#109](https://projekte.kosit.org/kosit/validator/-/issues/109) dependencies were updated to the latest Java 1.8 compatible versions
|
||||
- Bump [Saxon HE](https://www.saxonica.com/documentation11/documentation.xml) to 12.8
|
||||
- Bump [jaxb-ri](https://github.com/eclipse-ee4j/jaxb-ri) to 2.3.9
|
||||
- Bump [SLF4J](https://www.slf4j.org/) to 2.0.17
|
||||
- (CORE) [#136](https://projekte.kosit.org/kosit/validator/-/issues/136) removed IDE project folders from git
|
||||
- (BUILD) [#135](https://projekte.kosit.org/kosit/validator/-/issues/135) protected specific git branches
|
||||
- (BUILD) [#137](https://projekte.kosit.org/kosit/validator/-/issues/137) GitLab CI should only run on Java LTS versions as well as the latest Java version
|
||||
- (BUILD) [#147](https://projekte.kosit.org/kosit/validator/-/issues/147) Change Maven coordinates from `de.kosit:validationtool` to `org.kosit:validator`
|
||||
|
||||
## 1.5.0
|
||||
|
||||
### Fixed
|
||||
|
||||
- (CLI) [#93](https://projekte.kosit.org/kosit/validator/-/issues/93) Remove usage information, when validation failed
|
||||
- (CLI) [#95](https://projekte.kosit.org/kosit/validator/-/issues/95) NPE when using empty repository definition (-r "")
|
||||
- (CORE) [#101](https://github.com/itplr-kosit/validator/issues/101) Role is null in FailedAssert
|
||||
- (CORE) [GitHub #101](https://github.com/itplr-kosit/validator/issues/101) Role is null in FailedAssert
|
||||
|
||||
### Added
|
||||
|
||||
|
|
@ -29,15 +63,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- (API) Possibility to use preconfigured Saxon `Processor` instance for validation
|
||||
|
||||
### Changed
|
||||
- (CORE) [#100](https://github.com/itplr-kosit/validator/issues/100) Make createReport optional
|
||||
|
||||
- (CORE) [GitHub #100](https://github.com/itplr-kosit/validator/issues/100) Make createReport optional
|
||||
- (DAEMON) UI rewrite based on [Docusaurs](https://docusaurus.io)
|
||||
- (
|
||||
API) [ResolvingConfigurationStrategy.java#getProcessor()](de/kosit/validationtool/api/ResolvingConfigurationStrategy)
|
||||
is removed.
|
||||
- (API) [ResolvingConfigurationStrategy.java#getProcessor()](de/kosit/validationtool/api/ResolvingConfigurationStrategy) is removed.
|
||||
- (CORE) Bump [Saxon HE](https://www.saxonica.com/documentation11/documentation.xml) to 11.4
|
||||
- (CORE) Bump [jaxb-ri](https://github.com/eclipse-ee4j/jaxb-ri) to 2.3.7
|
||||
- (CORE) Various other dependency updates. See pom.xml
|
||||
|
||||
- (CORE) CLI parsing based on pico-cli, commons-cli is removed
|
||||
|
||||
## 1.4.2
|
||||
|
|
@ -48,14 +80,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- [#80](https://github.com/itplr-kosit/validator/issues/80) using classloader to initialize jaxb context (to support
|
||||
usage in OSGi
|
||||
environments)
|
||||
- [#75] (https://github.com/itplr-kosit/validator/issues/75) Improve logging on invalid documents
|
||||
- [#75] (<https://github.com/itplr-kosit/validator/issues/75>) Improve logging on invalid documents
|
||||
|
||||
## 1.4.1
|
||||
|
||||
### Fixed
|
||||
|
||||
- Allow more than 3 customLevel elements in scenarios (see xrechnung
|
||||
configuration [ issue 49](https://github.com/itplr-kosit/validator-configuration-xrechnung/issues/49))
|
||||
configuration [issue 49](https://github.com/itplr-kosit/validator-configuration-xrechnung/issues/49))
|
||||
- Remove saxon signature from java8 uber-jar (see [67](https://github.com/itplr-kosit/validator/issues/67))
|
||||
|
||||
## 1.4.0
|
||||
|
|
@ -145,13 +177,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
### Changed
|
||||
|
||||
- *Result#getAcceptRecommendation()* does not _only_ work when _acceptMatch_ is configured in the scenario
|
||||
- schema correctness is a precondition, if the checked instance is not valid, this evaluates to _REJECTED_
|
||||
- if _acceptMatch_ is configured, the result is based on the boolean result of the xpath expression evaluated against
|
||||
- *Result#getAcceptRecommendation()* does not *only* work when *acceptMatch* is configured in the scenario
|
||||
- schema correctness is a precondition, if the checked instance is not valid, this evaluates to *REJECTED*
|
||||
- if *acceptMatch* is configured, the result is based on the boolean result of the xpath expression evaluated against
|
||||
the generated report
|
||||
- if *no* _acceptMatch_ is configured, the result is based on evaluation of schema and schematron correctness
|
||||
- _UNDEFINED_ is only returned, when processing is stopped somehow
|
||||
- *Result#isAcceptable()* can now evaluate to true, when no _acceptMatch_ is configured (see above)
|
||||
- if *no* *acceptMatch* is configured, the result is based on evaluation of schema and schematron correctness
|
||||
- *UNDEFINED* is only returned, when processing is stopped somehow
|
||||
- *Result#isAcceptable()* can now evaluate to true, when no *acceptMatch* is configured (see above)
|
||||
|
||||
## 1.1.3
|
||||
|
||||
|
|
@ -182,10 +214,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
### Added
|
||||
|
||||
- Enhanced API-Usage e.g. return _Result_ object with processing information
|
||||
- Enhanced API-Usage e.g. return *Result* object with processing information
|
||||
- Support loading scenarios and content from a JAR-File
|
||||
- Simple Daemon-Mode exposing validation functionality via http
|
||||
- cli option to serialize the 'report input' xml document to _cwd_ (current working directory)
|
||||
- cli option to serialize the 'report input' xml document to *cwd* (current working directory)
|
||||
- Documentation in `docs` folder
|
||||
|
||||
### Changed
|
||||
|
|
|
|||
6
NOTICE
6
NOTICE
|
|
@ -1,5 +1,5 @@
|
|||
KoSIT Validator
|
||||
Copyright 2017-2022 Koordinierungsstelle für IT-Standards (KoSIT)
|
||||
KoSIT XML Validator
|
||||
Copyright 2017-2025 Koordinierungsstelle für IT-Standards (KoSIT)
|
||||
|
||||
This product includes software developed by
|
||||
Koordinierungsstelle für IT-Standards (https://www.xoev.de/).
|
||||
Koordinierungsstelle für IT-Standards (<https://www.xoev.de/>).
|
||||
|
|
|
|||
37
README.md
37
README.md
|
|
@ -1,4 +1,5 @@
|
|||
# KoSIT Validator
|
||||
|
||||
- [Introduction](#introduction)
|
||||
- [Validation Configurations](#validation-configurations)
|
||||
* [Third Party Validation Configurations](#third-party-validation-configurations)
|
||||
|
|
@ -9,17 +10,18 @@
|
|||
- [Packages](#packages)
|
||||
|
||||
## Introduction
|
||||
The validator is an XML validation engine to validate and process XML files in various formats. It basically does the following in order:
|
||||
|
||||
1. identify actual xml format
|
||||
1. validate the xml file (using schema and schematron rules)
|
||||
1. generate a custom report / extract custom data from the xml file
|
||||
The validator is an XML validation engine to validate and process XML files in various formats. It basically does the following in order:
|
||||
|
||||
1. identify actual XML format
|
||||
1. validate the XML file (using schema and schematron rules)
|
||||
1. generate a custom report / extract custom data from the XML file
|
||||
1. compute an acceptance status (according the supplied schema and rules)
|
||||
|
||||
The validator depends on self defined [scenarios](docs/configurations.md) which are used to fully configure the process.
|
||||
It always creates a [validation report in XML](docs/configurations.md#validators-report). The actual content of this is controlled by the scenario.
|
||||
The validator depends on self defined [scenarios](docs/configurations.md) in order to fully configure the whole process.
|
||||
It always creates a [validation report in XML](docs/configurations.md#validators-report). The actual content of the report can also be controlled by the scenario.
|
||||
|
||||
See [architecture](docs/architecture.md) for information about the actual validation process.
|
||||
See [architecture](docs/architecture.md) for information about the whole validation process.
|
||||
|
||||
|
||||
## Validation configurations
|
||||
|
|
@ -30,7 +32,7 @@ All configurations are self-contained modules which are deployed and developed o
|
|||
|
||||
### Third party validation configurations
|
||||
|
||||
Currently, there are two public third party validation configurations available.
|
||||
Here are two public third party validation configurations available which might serve as examples:
|
||||
|
||||
* Validation Configuration for [XRechnung](http://www.xoev.de/de/xrechnung):
|
||||
* Source code is available on [GitHub](https://github.com/itplr-kosit/validator-configuration-xrechnung)
|
||||
|
|
@ -43,29 +45,31 @@ Currently, there are two public third party validation configurations available.
|
|||
|
||||
The validator can be used in three different ways:
|
||||
|
||||
* as standalone application running from the cli
|
||||
* as standalone application running from the CLI
|
||||
* as library embedded within a custom application
|
||||
* as a daemon providing a http interface
|
||||
|
||||
### Standalone Command-Line Interface
|
||||
### Standalone Command Line Interface (CLI)
|
||||
|
||||
**Important hint**: since v1.5.1 the filename has been changed from `validationtool-*` to `validator-*`
|
||||
|
||||
The general way using the CLI is:
|
||||
|
||||
```shell
|
||||
java -jar validationtool-<version>-standalone.jar -s <scenario-config-file> -r <repository-path>
|
||||
java -jar validator-<version>-standalone.jar -s <scenario-config-file> -r <repository-path>
|
||||
[OPTIONS] [FILE] [FILE] [FILE] ...
|
||||
```
|
||||
|
||||
The help option displays further CLI options to customize the process:
|
||||
|
||||
```shell
|
||||
java -jar validationtool-<version>-standalone.jar --help
|
||||
java -jar validator-<version>-standalone.jar --help
|
||||
```
|
||||
|
||||
A concrete example with a specific validator configuration can be found on
|
||||
[GitHub](https://github.com/itplr-kosit/validator-configuration-xrechnung)
|
||||
|
||||
The [CLI documentation](./docs/cli.md) shows further configuration options.
|
||||
The [CLI documentation](./docs/cli.md) shows further configuration options.
|
||||
|
||||
### Application User Interface (API / embedded usage)
|
||||
|
||||
|
|
@ -93,7 +97,7 @@ will thus not be resolved transitively.
|
|||
You can also start the validator as a HTTP-Server. Just start it in _Daemon-Mode_ with the `-D` option.
|
||||
|
||||
```shell
|
||||
java -jar validationtool-<version>-standalone.jar -s <scenario-config-file> -D
|
||||
java -jar validator-<version>-standalone.jar -s <scenario-config-file> -D
|
||||
```
|
||||
|
||||
|
||||
|
|
@ -103,7 +107,6 @@ The [daemon documentation](./docs/daemon.md) shows more usage details and furthe
|
|||
|
||||
The validator distribution contains the following artifacts:
|
||||
|
||||
1. **validationtool-`<version>`.jar**: Java library for embedded use within an application
|
||||
1. **validationtool-`<version`>-standalone.jar**: Uber-JAR for standalone usage containing all dependencies in one jar file. This file comes with JAXB *embedded* and can be used with Java 8 and Java >= 11)
|
||||
1. **validationtool-`<version`>-java8-standalone.jar**: Uber-JAR for standalone usage with Java JDK 8 containing all dependencies in one jar file. This file file *does not* contain JAXB and depends on the bundled version of the JDK.
|
||||
1. **validator-`<version>`.jar**: Java library for embedded use within an application
|
||||
1. **validator-`<version`>-standalone.jar**: Uber-JAR for standalone usage containing all dependencies in one jar file. This file comes with JAXB *embedded* and can be used with Java >= 11)
|
||||
1. **libs/***: directory containing all (incl. optional) dependencies of the validator
|
||||
|
|
|
|||
102
docs/api.md
102
docs/api.md
|
|
@ -12,8 +12,8 @@ Then you can declare the dependency as follows:
|
|||
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>de.kosit</groupId>
|
||||
<artifactId>validationtool</artifactId>
|
||||
<groupId>org.kosit</groupId>
|
||||
<artifactId>validator</artifactId>
|
||||
<version>${validator.version}</version>
|
||||
</dependency>
|
||||
```
|
||||
|
|
@ -22,10 +22,12 @@ Then you can declare the dependency as follows:
|
|||
|
||||
```js
|
||||
dependencies {
|
||||
compile group: 'de.kosit', name: 'validationtool', version: '1.1.0'
|
||||
compile group: 'org.kosit', name: 'validator', version: '1.5.1'
|
||||
}
|
||||
```
|
||||
|
||||
Hint: prior to v1.5.1 the group ID was `de.kosit` and the artifact ID was `validationtool`.
|
||||
|
||||
## Usage
|
||||
|
||||
Prerequisite for use is a valid [scenario definition](configurations.md) and the a folder with all necessary artifacts for validation (repository) either on the filesystem or on the classpath.
|
||||
|
|
@ -33,34 +35,39 @@ Prerequisite for use is a valid [scenario definition](configurations.md) and the
|
|||
The following example demonstrates loading scenario.xml and whole configuration from classpath and validating one XML document:
|
||||
|
||||
```java
|
||||
package org.kosit.validator.example;
|
||||
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 org.w3c.dom.Document;
|
||||
import de.kosit.validationtool.impl.xml.ProcessorProvider;
|
||||
|
||||
/**
|
||||
* Example code that is used in the docs/api.md file
|
||||
*/
|
||||
public class StandardExample {
|
||||
|
||||
public void run(Path testDocument) throws URISyntaxException {
|
||||
public void run(final Path testDocument) throws URISyntaxException {
|
||||
// Load scenarios.xml from classpath
|
||||
URL scenarios = this.getClass().getClassLoader().getResource("scenarios.xml");
|
||||
final URL scenarios = this.getClass().getClassLoader().getResource("examples/simple/scenarios-with-relative-paths.xml");
|
||||
// Load the rest of the specific Validator configuration from classpath
|
||||
Configuration config = Configuration.load(scenarios.toURI()).build();
|
||||
final Configuration config = Configuration.load(scenarios.toURI()).build(ProcessorProvider.getProcessor());
|
||||
// Use the default validation procedure
|
||||
Check validator = new DefaultCheck(config);
|
||||
final Check validator = new DefaultCheck(config);
|
||||
// Validate a single document
|
||||
Input document = InputFactory.read(testDocument);
|
||||
final Input document = InputFactory.read(testDocument);
|
||||
// Get Result including information about the whole validation
|
||||
Result report = validator.checkInput(document);
|
||||
final Result report = validator.checkInput(document);
|
||||
System.out.println("Is processing succesful=" + report.isProcessingSuccessful());
|
||||
// Get report document if processing was successful
|
||||
Document result = null;
|
||||
|
|
@ -70,13 +77,16 @@ public class StandardExample {
|
|||
// continue processing results...
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
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
|
||||
Path testDoc = Paths.get(args[0]);
|
||||
StandardExample example = new StandardExample();
|
||||
final Path testDoc = Paths.get(args[0]);
|
||||
final StandardExample example = new StandardExample();
|
||||
// run example validation
|
||||
example.run(testDoc);
|
||||
|
||||
}
|
||||
}
|
||||
```
|
||||
|
|
@ -134,26 +144,36 @@ Instead of pre-configured [scenario files](configurations.md) it is possible to
|
|||
A simple configuration looks like this:
|
||||
|
||||
```java
|
||||
import static de.kosit.validationtool.config.ConfigurationBuilder.*;
|
||||
import de.kosit.validationtool.api.Configuration;
|
||||
import java.net.URI;
|
||||
import java.nio.file.Path;
|
||||
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(String[] args) {
|
||||
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();
|
||||
Check validator = new DefaultCheck(config);
|
||||
// .. run your checks
|
||||
}
|
||||
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
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
|
@ -188,19 +208,17 @@ which further opens the second to load resources also from remote locations via
|
|||
|
||||
You can configure usage of one of these implementations using the `ResolvingMode` via
|
||||
|
||||
````java
|
||||
Conifuguration config = Configuration.load(URI.create("myscenarios.xml"))
|
||||
.resolvingMode(ResolvingMode.STRICT_LOCAL)
|
||||
.build();
|
||||
````
|
||||
```java
|
||||
final Configuration config = Configuration.load(URI.create("myscenarios.xml")).setResolvingMode(ResolvingMode.STRICT_LOCAL)
|
||||
.build(ProcessorProvider.getProcessor());
|
||||
```
|
||||
|
||||
If you decide to implement your own strategy, you can configure this via:
|
||||
|
||||
````java
|
||||
Conifuguration config = Configuration.load(URI.create("myscenarios.xml"))
|
||||
.resolvingStrategy(new MyCustomResolvingConfigurationStrategy())
|
||||
.build();
|
||||
````
|
||||
```java
|
||||
final Configuration config = Configuration.load(URI.create("myscenarios.xml"))
|
||||
.setResolvingStrategy(new MyCustomResolvingConfigurationStrategy()).build(ProcessorProvider.getProcessor());
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
|
|
|
|||
59
docs/cli.md
59
docs/cli.md
|
|
@ -1,27 +1,29 @@
|
|||
# Validator CLI
|
||||
# Validator Command Line Interface (CLI)
|
||||
|
||||
The validator comes with a commandline interface (CLI) which allows validating any number of input xml files.
|
||||
The `validator` comes with a command line interface (CLI) which allows validating any number of input XML files.
|
||||
|
||||
**Important hint**: since v1.5.1 the filename has been changed from `validationtool-*` to `validator-*`
|
||||
|
||||
The general way using the CLI is:
|
||||
|
||||
```shell
|
||||
java -jar validationtool-<version>-standalone.jar -s <scenario-config-file> [OPTIONS] [FILE] [FILE] [FILE] ...
|
||||
java -jar validator-<version>-standalone.jar -s <scenario-config-file> [OPTIONS] [FILE] [FILE] [FILE] ...
|
||||
```
|
||||
|
||||
The validator can also read the xml file from the standard input
|
||||
|
||||
```shell script
|
||||
# via redirection
|
||||
java -jar validationtool-<version>-standalone.jar -s <scenario-config-file> [OPTIONS] < my-input.xml
|
||||
|
||||
# read from pipe
|
||||
cat my-input.xml | validationtool-<version>-standalone.jar -s <scenario-config-file> [OPTIONS]
|
||||
```
|
||||
|
||||
The help option displays further CLI options to customize the process:
|
||||
The validator can also read the XML file from the standard input
|
||||
|
||||
```shell
|
||||
java -jar validationtool-<version>-standalone.jar --help
|
||||
# via redirection
|
||||
java -jar validator-<version>-standalone.jar -s <scenario-config-file> [OPTIONS] < my-input.xml
|
||||
|
||||
# read from pipe
|
||||
cat my-input.xml | validator-<version>-standalone.jar -s <scenario-config-file> [OPTIONS]
|
||||
```
|
||||
|
||||
The help option displays further CLI options:
|
||||
|
||||
```shell
|
||||
java -jar validator-<version>-standalone.jar --help
|
||||
```
|
||||
|
||||
You can also use multiple scenario configurations and multiple repositories with resources for these. The validator either supports
|
||||
|
|
@ -29,35 +31,36 @@ supplying the parameters in order or using named configuration. Valid usages are
|
|||
|
||||
```shell
|
||||
# multiple scenarios, implicit repository
|
||||
java -jar validationtool-<version>-standalone.jar -s <scenario-config-file1> -s <scenario-config-file2> [OPTIONS] [FILE]
|
||||
java -jar validator-<version>-standalone.jar -s <scenario-config-file1> -s <scenario-config-file2> [OPTIONS] [FILE]
|
||||
|
||||
# multiple scenarios, single defined repository
|
||||
java -jar validationtool-<version>-standalone.jar -s <scenario-config-file1> -s <scenario-config-file2> -r <path-to-repo> [OPTIONS] [FILE]
|
||||
java -jar validator-<version>-standalone.jar -s <scenario-config-file1> -s <scenario-config-file2> -r <path-to-repo> [OPTIONS] [FILE]
|
||||
|
||||
# multiple scenarios, multiple repositories ordered
|
||||
java -jar validationtool-<version>-standalone.jar -s <scenario-config-file1> -r <path-to-repo1> -s <scenario-config-file2> -r <path-to-repo2> [OPTIONS] [FILE]
|
||||
java -jar validationtool-<version>-standalone.jar -s <scenario-config-file1> -s <scenario-config-file2> -r <path-to-repo1> -r <path-to-repo2> [OPTIONS] [FILE]
|
||||
java -jar validator-<version>-standalone.jar -s <scenario-config-file1> -r <path-to-repo1> -s <scenario-config-file2> -r <path-to-repo2> [OPTIONS] [FILE]
|
||||
java -jar validator-<version>-standalone.jar -s <scenario-config-file1> -s <scenario-config-file2> -r <path-to-repo1> -r <path-to-repo2> [OPTIONS] [FILE]
|
||||
|
||||
# multiple scenarios, multiple repositories (named)
|
||||
java -jar validationtool-<version>-standalone.jar -s "NAME1=<scenario-config-file1>" -s "NAME2=<scenario-config-file2>" -r "NAME1=<path-to-repo1>" -r "NAME2=<path-to-repo2>" [OPTIONS] [FILE]
|
||||
java -jar validator-<version>-standalone.jar -s "NAME1=<scenario-config-file1>" -s "NAME2=<scenario-config-file2>" -r "NAME1=<path-to-repo1>" -r "NAME2=<path-to-repo2>" [OPTIONS] [FILE]
|
||||
```
|
||||
|
||||
## Special features
|
||||
|
||||
Besides the obvious functionality of validating, the cli provides additional functionality to customize the processing:
|
||||
|
||||
|name | option | description | | - | - | - | | [Daemon mode](daemon.md) | `-D` | Starts the validator in daemon mode as an HTTP service | |
|
||||
print mode | `-p` | Print the report to stdout | | extract html | `-h` | Extracts any html blocks within the report and saves the content to
|
||||
the filesystem. Note: the file name is derived from the node name the html appears in | | print memory stats | `-m` | Prints some memory
|
||||
usage information. Mainly for debugging purposes on processing huge xml files | | check assertions | `-c <file>` | Check assertions on the
|
||||
generated reports. This is mainly useful for scenario developers. Ask KoSIT for documentation, if you want to use this feauture |
|
||||
|
||||
| name | option | description |
|
||||
| - | - | - |
|
||||
| [Daemon mode](daemon.md) | `-D` | Starts the validator in daemon mode as an HTTP service |
|
||||
| print mode | `-p` | Print the report to stdout |
|
||||
| extract html | `-h` | Extracts any html blocks within the report and saves the content to the filesystem. Note: the file name is derived from the node name the html appears in |
|
||||
| print memory stats | `-m` | Prints some memory usage information. Mainly for debugging purposes on processing huge xml files |
|
||||
| check assertions | `-c <file>` | Check assertions on the generated reports. This is mainly useful for scenario developers. Ask KoSIT for documentation, if you want to use this feauture |
|
||||
|
||||
## Return codes
|
||||
|
||||
| code | description |
|
||||
|-|-|
|
||||
| 0 | All validated xml files are acceptable according to the scenario configurations |
|
||||
| 0 | All validated xml files are acceptable according to the scenario configurations or application usage was requested |
|
||||
| positive integer | Number of rejected (e.g. not acceptable) xml files according to the scenario configurations|
|
||||
| -1 | Parsing error. The commandline arguments specified are incorrect |
|
||||
| -2 | Configuration error. There is an error loading the configuration and/or validation targets |
|
||||
| -2 | Configuration error. There is an error loading the configuration and/or validation targets |
|
||||
|
|
|
|||
|
|
@ -8,8 +8,10 @@ and should work with OpenJDK based distributions. Keep this in mind, if you want
|
|||
To use the validator daemon as is, start the _Daemon-Mode_ with the `-D` option and supply a suitable
|
||||
[validator configuration](configurations.md).
|
||||
|
||||
**Important hint**: since v1.5.1 the filename has been changed from `validationtool-*` to `validator-*`
|
||||
|
||||
```shell
|
||||
java -jar validationtool-<version>-standalone.jar -s <scenario-config-file> -D
|
||||
java -jar validator-<version>-standalone.jar -s <scenario-config-file> -D
|
||||
```
|
||||
|
||||
Per default the HTTP-Server listens on _localhost_ at Port 8080.
|
||||
|
|
@ -17,7 +19,7 @@ Per default the HTTP-Server listens on _localhost_ at Port 8080.
|
|||
You can configure the daemon with `-H` for IP Adress and `-P` for port number:
|
||||
|
||||
```shell
|
||||
java -jar validationtool-<version>-standalone.jar -s <scenario-config-file> -D -H 192.168.1.x -P 8081
|
||||
java -jar validator-<version>-standalone.jar -s <scenario-config-file> -D -H 192.168.1.x -P 8081
|
||||
```
|
||||
|
||||
## Customized usage
|
||||
|
|
@ -135,5 +137,5 @@ The daemon provides a simple GUI when issuing `GET` requests providing the follo
|
|||
The GUI can be disabled using the API (see above) or via CLI:
|
||||
|
||||
```shell script
|
||||
java -jar validationtool-<version>-standalone.jar -s <scenario-config-file> -D --disable-gui
|
||||
java -jar validator-<version>-standalone.jar -s <scenario-config-file> -D --disable-gui
|
||||
```
|
||||
|
|
|
|||
107
pom.xml
107
pom.xml
|
|
@ -1,30 +1,13 @@
|
|||
<?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.
|
||||
-->
|
||||
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<name>KoSIT XML Prüftool Implementierung</name>
|
||||
<name>KoSIT XML Validator</name>
|
||||
|
||||
<groupId>de.kosit</groupId>
|
||||
<version>1.6.0</version>
|
||||
<groupId>org.kosit</groupId>
|
||||
<artifactId>validator</artifactId>
|
||||
<version>1.6.0-SNAPSHOT</version>
|
||||
|
||||
<artifactId>validationtool</artifactId>
|
||||
<description>KoSIT XML Validator against XSD and Schematron based on defined scenarios.</description>
|
||||
<developers>
|
||||
<!-- In alphabetical order by last name -->
|
||||
|
|
@ -59,7 +42,8 @@
|
|||
<version.commons-io>2.20.0</version.commons-io>
|
||||
<version.commons-lang>3.18.0</version.commons-lang>
|
||||
<version.jacoco>0.8.13</version.jacoco>
|
||||
<version.jaxb>4.0.2</version.jaxb>
|
||||
<version.jaxb-api>4.0.2</version.jaxb-api>
|
||||
<version.jaxb-impl>4.0.5</version.jaxb-impl>
|
||||
<version.lombok>1.18.38</version.lombok>
|
||||
<version.mockito>4.11.0</version.mockito>
|
||||
<version.owasp-dependency-check>10.0.4</version.owasp-dependency-check>
|
||||
|
|
@ -68,12 +52,25 @@
|
|||
<version.slf4j>2.0.17</version.slf4j>
|
||||
<version.jaxb-maven-plugin>4.0.9</version.jaxb-maven-plugin>
|
||||
</properties>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>project.local</id>
|
||||
<name>project</name>
|
||||
<url>file:${project.basedir}/libs</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<name>Central Portal Snapshots</name>
|
||||
<id>central-portal-snapshots</id>
|
||||
<url>https://central.sonatype.com/repository/maven-snapshots/</url>
|
||||
<releases>
|
||||
<enabled>false</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
|
|
@ -121,13 +118,13 @@
|
|||
<dependency>
|
||||
<groupId>org.glassfish.jaxb</groupId>
|
||||
<artifactId>jaxb-runtime</artifactId>
|
||||
<version>${version.jaxb}</version>
|
||||
<version>${version.jaxb-impl}</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>jakarta.xml.bind</groupId>
|
||||
<artifactId>jakarta.xml.bind-api</artifactId>
|
||||
<version>${version.jaxb}</version>
|
||||
<version>${version.jaxb-api}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.assertj</groupId>
|
||||
|
|
@ -178,9 +175,29 @@
|
|||
</resource>
|
||||
</resources>
|
||||
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.sonatype.central</groupId>
|
||||
<artifactId>central-publishing-maven-plugin</artifactId>
|
||||
<version>0.8.0</version>
|
||||
<extensions>true</extensions>
|
||||
<configuration>
|
||||
<publishingServerId>central</publishingServerId>
|
||||
<autoPublish>true</autoPublish>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-gpg-plugin</artifactId>
|
||||
<version>3.2.8</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
|
||||
<plugins>
|
||||
<!-- for PR 152 -->
|
||||
<plugin>
|
||||
<!-- for PR 152 -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>3.3.1</version>
|
||||
|
|
@ -392,6 +409,12 @@
|
|||
<configuration>
|
||||
<!--suppress MavenModelInspection -->
|
||||
<argLine>-Dfile.encoding=UTF-8 ${jacocoSurefire}</argLine>
|
||||
<systemProperties>
|
||||
<property>
|
||||
<name>java.net.useSystemProxies</name>
|
||||
<value>true</value>
|
||||
</property>
|
||||
</systemProperties>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
|
|
@ -549,7 +572,6 @@
|
|||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-gpg-plugin</artifactId>
|
||||
<version>3.2.8</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>sign-artifacts</id>
|
||||
|
|
@ -560,6 +582,10 @@
|
|||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.sonatype.central</groupId>
|
||||
<artifactId>central-publishing-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
|
|
@ -619,6 +645,17 @@
|
|||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>release-snapshot</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.sonatype.central</groupId>
|
||||
<artifactId>central-publishing-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<reporting>
|
||||
|
|
@ -628,12 +665,14 @@
|
|||
</reporting>
|
||||
|
||||
<scm>
|
||||
<connection>https://github.com/itplr-kosit/validationtool.git</connection>
|
||||
<connection>scm:git:https://github.com/itplr-kosit/validator.git</connection>
|
||||
<developerConnection>scm:git:https://projekte.kosit.org/kosit/validator.git</developerConnection>
|
||||
<tag>v1.1.0</tag>
|
||||
<tag>release/1.6.x</tag>
|
||||
<url>https://github.com/itplr-kosit/validator</url>
|
||||
</scm>
|
||||
|
||||
<url>https://github.com/itplr-kosit/validator</url>
|
||||
|
||||
<licenses>
|
||||
<license>
|
||||
<name>Apache License, Version 2.0</name>
|
||||
|
|
@ -641,12 +680,4 @@
|
|||
<distribution>repo</distribution>
|
||||
</license>
|
||||
</licenses>
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>sonatype-nexus-staging</id>
|
||||
<name>Nexus Release Repository</name>
|
||||
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -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