-
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.
XML Catalogs for XML files should now work; #40
- Loading branch information
Showing
6 changed files
with
454 additions
and
23 deletions.
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
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
59 changes: 53 additions & 6 deletions
59
ph-schematron-ant-task/src/test/java/com/helger/schematron/ant/Issue40Test.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 |
---|---|---|
@@ -1,27 +1,74 @@ | ||
package com.helger.schematron.ant; | ||
|
||
import org.apache.tools.ant.BuildEvent; | ||
import org.apache.tools.ant.BuildException; | ||
import org.apache.tools.ant.BuildFileRule; | ||
import org.apache.tools.ant.BuildListener; | ||
import org.apache.tools.ant.Project; | ||
import org.junit.Before; | ||
import org.junit.Rule; | ||
import org.junit.Test; | ||
|
||
import com.helger.commons.system.SystemProperties; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
public final class Issue40Test | ||
{ | ||
private static final Logger s_aLogger = LoggerFactory.getLogger (Issue40Test.class); | ||
|
||
@Rule | ||
public final BuildFileRule buildRule = new BuildFileRule (); | ||
public final BuildFileRule m_aBuildRule = new BuildFileRule (); | ||
|
||
@Before | ||
public void init () | ||
{ | ||
SystemProperties.setPropertyValue ("javax.xml.accessExternalDTD", "all"); | ||
buildRule.configureProject ("src/test/resources/issues/40/build.xml"); | ||
m_aBuildRule.configureProject ("src/test/resources/issues/40/build.xml"); | ||
m_aBuildRule.getProject ().addBuildListener (new BuildListener () | ||
{ | ||
public void taskStarted (final BuildEvent aEvent) | ||
{} | ||
|
||
public void taskFinished (final BuildEvent aEvent) | ||
{} | ||
|
||
public void targetStarted (final BuildEvent aEvent) | ||
{} | ||
|
||
public void targetFinished (final BuildEvent aEvent) | ||
{} | ||
|
||
public void messageLogged (final BuildEvent aEvent) | ||
{ | ||
if (aEvent.getPriority () <= Project.MSG_ERR) | ||
s_aLogger.error (aEvent.getMessage (), aEvent.getException ()); | ||
else | ||
if (aEvent.getPriority () <= Project.MSG_WARN) | ||
s_aLogger.warn (aEvent.getMessage (), aEvent.getException ()); | ||
else | ||
if (aEvent.getPriority () <= Project.MSG_INFO) | ||
s_aLogger.info (aEvent.getMessage (), aEvent.getException ()); | ||
else | ||
s_aLogger.debug (aEvent.getMessage (), aEvent.getException ()); | ||
} | ||
|
||
public void buildStarted (final BuildEvent aEvent) | ||
{} | ||
|
||
public void buildFinished (final BuildEvent aEvent) | ||
{} | ||
}); | ||
} | ||
|
||
@Test | ||
public void testWithExternalDTD () | ||
{ | ||
buildRule.executeTarget ("check"); | ||
try | ||
{ | ||
// Do not redirect stdout etc. | ||
m_aBuildRule.getProject ().executeTarget ("check"); | ||
} | ||
catch (final BuildException ex) | ||
{ | ||
s_aLogger.error ("Ooops", ex); | ||
} | ||
} | ||
} |
Oops, something went wrong.