mirror of
https://github.com/itplr-kosit/validator.git
synced 2026-05-25 16:55:39 +00:00
(chore) load from jar test case added
This commit is contained in:
parent
183ddab179
commit
4e48730c71
10 changed files with 43 additions and 17 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -10,6 +10,8 @@
|
|||
|
||||
# Package Files #
|
||||
*.jar
|
||||
!libs/**/*.jar
|
||||
|
||||
**/generated
|
||||
|
||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1,9 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>de.kosit.validationtool</groupId>
|
||||
<artifactId>packaged-test-scenarios</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<description>POM was created from install:install-file</description>
|
||||
</project>
|
||||
Binary file not shown.
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project 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"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>de.kosit.validationtool</groupId>
|
||||
<artifactId>packaged-test-scenarios</artifactId>
|
||||
<version>1.0.1/version>
|
||||
<description>POM was created from install:install-file</description>
|
||||
</project>
|
||||
|
|
@ -3,10 +3,10 @@
|
|||
<groupId>de.kosit.validationtool</groupId>
|
||||
<artifactId>packaged-test-scenarios</artifactId>
|
||||
<versioning>
|
||||
<release>1.0.0</release>
|
||||
<release>1.0.1</release>
|
||||
<versions>
|
||||
<version>1.0.0</version>
|
||||
<version>1.0.1</version>
|
||||
</versions>
|
||||
<lastUpdated>20190507064929</lastUpdated>
|
||||
<lastUpdated>20200507064929</lastUpdated>
|
||||
</versioning>
|
||||
</metadata>
|
||||
|
|
|
|||
5
pom.xml
5
pom.xml
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!-- License below -->
|
||||
<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">
|
||||
<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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<name>KoSIT XML Prüftool Implementierung</name>
|
||||
|
|
@ -132,7 +132,7 @@
|
|||
<dependency>
|
||||
<groupId>de.kosit.validationtool</groupId>
|
||||
<artifactId>packaged-test-scenarios</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<version>1.0.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
|
@ -430,6 +430,7 @@
|
|||
<async>true</async>
|
||||
<asyncDestroyOnShutdown>true</asyncDestroyOnShutdown>
|
||||
<arguments>
|
||||
<!--suppress MavenModelInspection -->
|
||||
<argument>${jacocoFailsafe}</argument>
|
||||
<argument>-classpath</argument>
|
||||
<classpath />
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ public class ContentRepositoryTest {
|
|||
public void loadFromJar() throws URISyntaxException {
|
||||
assert Helper.JAR_REPOSITORY != null;
|
||||
this.repository = new ContentRepository(ResolvingMode.STRICT_RELATIVE.getStrategy(), Helper.JAR_REPOSITORY.toURI());
|
||||
final XsltExecutable xsltExecutable = this.repository.loadXsltScript(URI.create("resources/eRechnung/report.xsl"));
|
||||
final XsltExecutable xsltExecutable = this.repository.loadXsltScript(URI.create("report.xsl"));
|
||||
assertThat(xsltExecutable).isNotNull();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,8 +27,10 @@ import static de.kosit.validationtool.impl.Helper.Simple.REJECTED;
|
|||
import static de.kosit.validationtool.impl.Helper.Simple.SCHEMATRON_INVALID;
|
||||
import static de.kosit.validationtool.impl.Helper.Simple.SIMPLE_VALID;
|
||||
import static de.kosit.validationtool.impl.Helper.Simple.UNKNOWN;
|
||||
import static java.util.Objects.requireNonNull;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.IntStream;
|
||||
|
|
@ -57,13 +59,22 @@ public class DefaultCheckTest {
|
|||
// for checking certain error scenarios.
|
||||
private DefaultCheck errorCheck;
|
||||
|
||||
private DefaultCheck jarScenarioCheck;
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
public void setup() throws URISyntaxException {
|
||||
final Configuration validConfig = Configuration.load(Simple.SCENARIOS, Simple.REPOSITORY_URI).build();
|
||||
this.validCheck = new DefaultCheck(validConfig);
|
||||
|
||||
final Configuration errorConfig = Configuration.load(Simple.ERROR_SCENARIOS, Simple.REPOSITORY_URI).build();
|
||||
this.errorCheck = new DefaultCheck(errorConfig);
|
||||
|
||||
final Configuration jarConfig = Configuration
|
||||
.load(requireNonNull(DefaultCheckTest.class.getClassLoader().getResource("simple/packaged/scenarios.xml")).toURI(),
|
||||
requireNonNull(DefaultCheckTest.class.getClassLoader().getResource("simple/packaged/repository/")).toURI())
|
||||
.build();
|
||||
|
||||
this.jarScenarioCheck = new DefaultCheck(jarConfig);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -77,6 +88,17 @@ public class DefaultCheckTest {
|
|||
assertThat(doc.getAcceptRecommendation()).isEqualTo(AcceptRecommendation.ACCEPTABLE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testJarCase() {
|
||||
final Result doc = this.jarScenarioCheck.checkInput(read(SIMPLE_VALID));
|
||||
assertThat(doc).isNotNull();
|
||||
assertThat(doc.getReport()).isNotNull();
|
||||
assertThat(doc.isAcceptable()).isTrue();
|
||||
assertThat(doc.isSchematronValid()).isTrue();
|
||||
assertThat(doc.isSchemaValid()).isTrue();
|
||||
assertThat(doc.getAcceptRecommendation()).isEqualTo(AcceptRecommendation.ACCEPTABLE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithoutAcceptMatch() {
|
||||
final Result doc = this.validCheck.checkInput(read(Simple.FOO));
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ public class Helper {
|
|||
|
||||
public static final URI ASSERTIONS = EXAMPLES_DIR.resolve("assertions/tests-xrechnung.xml");
|
||||
|
||||
public static final URL JAR_REPOSITORY = Helper.class.getClassLoader().getResource("xrechnung/repository/");
|
||||
public static final URL JAR_REPOSITORY = Helper.class.getClassLoader().getResource("simple/packaged/repository/");
|
||||
|
||||
/**
|
||||
* Lädt ein XML-Dokument von der gegebenen URL
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue