-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
239 additions
and
0 deletions.
There are no files selected for viewing
65 changes: 65 additions & 0 deletions
65
ph-schematron-pure/src/test/java/com/helger/schematron/pure/supplementary/Issue083Test.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* | ||
* Copyright (C) 2014-2021 Philip Helger (www.helger.com) | ||
* philip[at]helger[dot]com | ||
* | ||
* 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. | ||
*/ | ||
package com.helger.schematron.pure.supplementary; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertNotNull; | ||
|
||
import java.io.File; | ||
|
||
import javax.annotation.Nonnull; | ||
|
||
import org.junit.Test; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import com.helger.commons.io.resource.FileSystemResource; | ||
import com.helger.schematron.SchematronDebug; | ||
import com.helger.schematron.pure.SchematronResourcePure; | ||
import com.helger.schematron.svrl.SVRLHelper; | ||
import com.helger.schematron.svrl.SVRLMarshaller; | ||
import com.helger.schematron.svrl.jaxb.SchematronOutputType; | ||
|
||
public final class Issue083Test | ||
{ | ||
private static final Logger LOGGER = LoggerFactory.getLogger (Issue083Test.class); | ||
|
||
private static void _validateAndProduceSVRL (@Nonnull final File aSchematron, @Nonnull final File aXML) throws Exception | ||
{ | ||
final SchematronResourcePure aSCH = SchematronResourcePure.fromFile (aSchematron); | ||
SchematronDebug.setSaveIntermediateXSLTFiles (true); | ||
|
||
// Perform validation | ||
final SchematronOutputType aSVRL = aSCH.applySchematronValidationToSVRL (new FileSystemResource (aXML)); | ||
assertNotNull (aSVRL); | ||
|
||
final String sSVRL = new SVRLMarshaller ().getAsString (aSVRL); | ||
assertNotNull (sSVRL); | ||
if (true) | ||
LOGGER.info ("SVRL:\n" + sSVRL); | ||
|
||
// XXX should be 1 according to #83 | ||
assertEquals (0, SVRLHelper.getAllFailedAssertionsAndSuccessfulReports (aSVRL).size ()); | ||
} | ||
|
||
@Test | ||
public void testIssue () throws Exception | ||
{ | ||
_validateAndProduceSVRL (new File ("src/test/resources/issues/github83/schematron.sch"), | ||
new File ("src/test/resources/issues/github83/test.xml")); | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
ph-schematron-pure/src/test/resources/issues/github83/schematron.sch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2"> | ||
<sch:pattern> | ||
<sch:rule context="comment()"> | ||
<sch:assert test="false()">Found a comment</sch:assert> | ||
</sch:rule> | ||
</sch:pattern> | ||
</sch:schema> |
6 changes: 6 additions & 0 deletions
6
ph-schematron-pure/src/test/resources/issues/github83/test.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<?pi Processing instruction ?> | ||
<element attribute="value"> | ||
<!-- Comment --> | ||
<element>Text content</element> | ||
</element> |
67 changes: 67 additions & 0 deletions
67
ph-schematron-schxslt/src/test/java/com/helger/schematron/supplementary/Issue083Test.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* | ||
* Copyright (C) 2014-2021 Philip Helger (www.helger.com) | ||
* philip[at]helger[dot]com | ||
* | ||
* 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. | ||
*/ | ||
package com.helger.schematron.supplementary; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertNotNull; | ||
|
||
import java.io.File; | ||
|
||
import javax.annotation.Nonnull; | ||
|
||
import org.junit.Test; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import com.helger.commons.io.resource.FileSystemResource; | ||
import com.helger.schematron.SchematronDebug; | ||
import com.helger.schematron.schxslt.xslt2.SchematronResourceSchXslt_XSLT2; | ||
import com.helger.schematron.svrl.SVRLHelper; | ||
import com.helger.schematron.svrl.SVRLMarshaller; | ||
import com.helger.schematron.svrl.jaxb.SchematronOutputType; | ||
|
||
public final class Issue083Test | ||
{ | ||
private static final Logger LOGGER = LoggerFactory.getLogger (Issue083Test.class); | ||
|
||
private static void _validateAndProduceSVRL (@Nonnull final File aSchematron, @Nonnull final File aXML) throws Exception | ||
{ | ||
final SchematronResourceSchXslt_XSLT2 aSCH = SchematronResourceSchXslt_XSLT2.fromFile (aSchematron); | ||
aSCH.parameters ().put ("schxslt.compile.metadata", "false"); | ||
|
||
SchematronDebug.setSaveIntermediateXSLTFiles (true); | ||
|
||
// Perform validation | ||
final SchematronOutputType aSVRL = aSCH.applySchematronValidationToSVRL (new FileSystemResource (aXML)); | ||
assertNotNull (aSVRL); | ||
|
||
final String sSVRL = new SVRLMarshaller ().getAsString (aSVRL); | ||
assertNotNull (sSVRL); | ||
if (true) | ||
LOGGER.info ("SVRL:\n" + sSVRL); | ||
|
||
// XXX should be 1 according to #83 | ||
assertEquals (0, SVRLHelper.getAllFailedAssertionsAndSuccessfulReports (aSVRL).size ()); | ||
} | ||
|
||
@Test | ||
public void testIssue () throws Exception | ||
{ | ||
_validateAndProduceSVRL (new File ("src/test/resources/issues/github83/schematron.sch"), | ||
new File ("src/test/resources/issues/github83/test.xml")); | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
ph-schematron-schxslt/src/test/resources/issues/github83/schematron.sch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2"> | ||
<sch:pattern> | ||
<sch:rule context="comment()"> | ||
<sch:assert test="false()">Found a comment</sch:assert> | ||
</sch:rule> | ||
</sch:pattern> | ||
</sch:schema> |
6 changes: 6 additions & 0 deletions
6
ph-schematron-schxslt/src/test/resources/issues/github83/test.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<?pi Processing instruction ?> | ||
<element attribute="value"> | ||
<!-- Comment --> | ||
<element>Text content</element> | ||
</element> |
65 changes: 65 additions & 0 deletions
65
ph-schematron-xslt/src/test/java/com/helger/schematron/supplementary/Issue083Test.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* | ||
* Copyright (C) 2014-2021 Philip Helger (www.helger.com) | ||
* philip[at]helger[dot]com | ||
* | ||
* 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. | ||
*/ | ||
package com.helger.schematron.supplementary; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertNotNull; | ||
|
||
import java.io.File; | ||
|
||
import javax.annotation.Nonnull; | ||
|
||
import org.junit.Test; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import com.helger.commons.io.resource.FileSystemResource; | ||
import com.helger.schematron.SchematronDebug; | ||
import com.helger.schematron.sch.SchematronResourceSCH; | ||
import com.helger.schematron.svrl.SVRLHelper; | ||
import com.helger.schematron.svrl.SVRLMarshaller; | ||
import com.helger.schematron.svrl.jaxb.SchematronOutputType; | ||
|
||
public final class Issue083Test | ||
{ | ||
private static final Logger LOGGER = LoggerFactory.getLogger (Issue083Test.class); | ||
|
||
private static void _validateAndProduceSVRL (@Nonnull final File aSchematron, @Nonnull final File aXML) throws Exception | ||
{ | ||
final SchematronResourceSCH aSCH = SchematronResourceSCH.fromFile (aSchematron); | ||
SchematronDebug.setSaveIntermediateXSLTFiles (true); | ||
|
||
// Perform validation | ||
final SchematronOutputType aSVRL = aSCH.applySchematronValidationToSVRL (new FileSystemResource (aXML)); | ||
assertNotNull (aSVRL); | ||
|
||
final String sSVRL = new SVRLMarshaller ().getAsString (aSVRL); | ||
assertNotNull (sSVRL); | ||
if (true) | ||
LOGGER.info ("SVRL:\n" + sSVRL); | ||
|
||
// XXX should be 1 according to #83 | ||
assertEquals (0, SVRLHelper.getAllFailedAssertionsAndSuccessfulReports (aSVRL).size ()); | ||
} | ||
|
||
@Test | ||
public void testIssue () throws Exception | ||
{ | ||
_validateAndProduceSVRL (new File ("src/test/resources/issues/github83/schematron.sch"), | ||
new File ("src/test/resources/issues/github83/test.xml")); | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
ph-schematron-xslt/src/test/resources/issues/github83/schematron.sch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2"> | ||
<sch:pattern> | ||
<sch:rule context="comment()"> | ||
<sch:assert test="false()">Found a comment</sch:assert> | ||
</sch:rule> | ||
</sch:pattern> | ||
</sch:schema> |
6 changes: 6 additions & 0 deletions
6
ph-schematron-xslt/src/test/resources/issues/github83/test.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<?pi Processing instruction ?> | ||
<element attribute="value"> | ||
<!-- Comment --> | ||
<element>Text content</element> | ||
</element> |