-
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
6 changed files
with
152 additions
and
1 deletion.
There are no files selected for viewing
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
54 changes: 54 additions & 0 deletions
54
ph-schematron-ant-task/src/test/java/com/helger/schematron/ant/Issue66Test.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,54 @@ | ||
/** | ||
* Copyright (C) 2017-2018 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.ant; | ||
|
||
import org.apache.tools.ant.BuildException; | ||
import org.apache.tools.ant.BuildFileRule; | ||
import org.junit.Before; | ||
import org.junit.Rule; | ||
import org.junit.Test; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
public final class Issue66Test | ||
{ | ||
private static final Logger s_aLogger = LoggerFactory.getLogger (Issue66Test.class); | ||
|
||
@Rule | ||
public final BuildFileRule m_aBuildRule = new BuildFileRule (); | ||
|
||
@Before | ||
public void init () | ||
{ | ||
m_aBuildRule.configureProject ("src/test/resources/issues/66/build.xml"); | ||
m_aBuildRule.getProject ().addBuildListener (new LoggingBuildListener ()); | ||
} | ||
|
||
@Test | ||
public void testWithExternalDTD () | ||
{ | ||
try | ||
{ | ||
// Do not redirect stdout etc. | ||
m_aBuildRule.getProject ().executeTarget ("schematron"); | ||
} | ||
catch (final BuildException ex) | ||
{ | ||
s_aLogger.error ("Ooops", ex); | ||
} | ||
} | ||
} |
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 @@ | ||
tmp/ |
17 changes: 17 additions & 0 deletions
17
ph-schematron-ant-task/src/test/resources/issues/66/build.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,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project> | ||
<taskdef name="schematron" classname="com.helger.schematron.ant.Schematron" /> | ||
|
||
<target name="schematron" description="Schematron rule tests"> | ||
<schematron svrlDirectory="tmp" | ||
schematronProcessingEngine="pure" | ||
schematronFile="rules.sch"> | ||
<fileset dir="."> | ||
<include name="dog*.xml" /> | ||
</fileset> | ||
<errorRole role="foo" /> | ||
<errorRole role="bar" /> | ||
</schematron> | ||
</target> | ||
|
||
</project> |
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,4 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<dog xml:lang="de"> | ||
<fleas/> | ||
</dog> |
9 changes: 9 additions & 0 deletions
9
ph-schematron-ant-task/src/test/resources/issues/66/rules.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,9 @@ | ||
<schema xmlns="http://purl.oclc.org/dsdl/schematron" xml:lang="de"> | ||
<title>Example of a custom error role</title> | ||
<pattern> | ||
<rule context="dog"> | ||
<assert test="bone" role="bar"> A dog should have a bone.</assert> | ||
<assert test="xyz" role="info">Information only that xyz should be present.</assert> | ||
</rule> | ||
</pattern> | ||
</schema> |