git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@273605 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -1530,6 +1530,10 @@ | |||||
| <exclude name="${optional.package}/XalanLiaisonTest.java" | <exclude name="${optional.package}/XalanLiaisonTest.java" | ||||
| unless="bsf.present"/> | unless="bsf.present"/> | ||||
| <!-- needs resolver.jar to work --> | |||||
| <exclude name="${optional.package}/XmlValidateCatalogTest.java" | |||||
| unless="apache.resolver.present"/> | |||||
| <!-- | <!-- | ||||
| XXX need to figure out what's causing this InvocationTargetException | XXX need to figure out what's causing this InvocationTargetException | ||||
| --> | --> | ||||
| @@ -0,0 +1,2 @@ | |||||
| PUBLIC "-//stevo//DTD doc 1.0//EN" "doc.dtd" | |||||
| @@ -38,8 +38,9 @@ | |||||
| </xmlcatalog> | </xmlcatalog> | ||||
| </xmlvalidate> | </xmlvalidate> | ||||
| </target> | </target> | ||||
| <target name="xmlcatalogfiles"> | |||||
| <!-- The -override tests should pass without resolver.jar --> | |||||
| <target name="xmlcatalogfiles-override"> | |||||
| <xmlvalidate warn="false"> | <xmlvalidate warn="false"> | ||||
| <fileset dir="xml" includes="**/about.xml"/> | <fileset dir="xml" includes="**/about.xml"/> | ||||
| <xmlcatalog classpath="xml"> | <xmlcatalog classpath="xml"> | ||||
| @@ -50,7 +51,7 @@ | |||||
| </xmlvalidate> | </xmlvalidate> | ||||
| </target> | </target> | ||||
| <target name="xmlcatalogpath"> | |||||
| <target name="xmlcatalogpath-override"> | |||||
| <xmlvalidate warn="false"> | <xmlvalidate warn="false"> | ||||
| <fileset dir="xml" includes="**/about.xml"/> | <fileset dir="xml" includes="**/about.xml"/> | ||||
| <xmlcatalog classpath="xml"> | <xmlcatalog classpath="xml"> | ||||
| @@ -62,6 +63,26 @@ | |||||
| </xmlcatalog> | </xmlcatalog> | ||||
| </xmlvalidate> | </xmlvalidate> | ||||
| </target> | </target> | ||||
| <target name="xmlcatalogfiles"> | |||||
| <xmlvalidate warn="false"> | |||||
| <fileset dir="xml" includes="**/about.xml"/> | |||||
| <xmlcatalog classpath="xml"> | |||||
| <catalogfiles dir="xml" includes="catalog"/> | |||||
| </xmlcatalog> | |||||
| </xmlvalidate> | |||||
| </target> | |||||
| <target name="xmlcatalogpath"> | |||||
| <xmlvalidate warn="false"> | |||||
| <fileset dir="xml" includes="**/about.xml"/> | |||||
| <xmlcatalog classpath="xml"> | |||||
| <catalogpath> | |||||
| <pathelement location="xml/catalog"/> | |||||
| </catalogpath> | |||||
| </xmlcatalog> | |||||
| </xmlvalidate> | |||||
| </target> | |||||
| <target name="testSchemaGood"> | <target name="testSchemaGood"> | ||||
| <xmlvalidate warn="false" lenient="no" > | <xmlvalidate warn="false" lenient="no" > | ||||
| @@ -123,6 +123,8 @@ public class ApacheCatalogResolver extends CatalogResolver { | |||||
| System.getProperties().put("xml.catalog.className", | System.getProperties().put("xml.catalog.className", | ||||
| ApacheCatalog.class.getName()); | ApacheCatalog.class.getName()); | ||||
| CatalogManager.getStaticManager().setUseStaticCatalog(false); | |||||
| // debug | // debug | ||||
| // System.setProperty("xml.catalog.verbosity", "4"); | // System.setProperty("xml.catalog.verbosity", "4"); | ||||
| } | } | ||||
| @@ -0,0 +1,125 @@ | |||||
| /* | |||||
| * The Apache Software License, Version 1.1 | |||||
| * | |||||
| * Copyright (c) 2002 The Apache Software Foundation. All rights | |||||
| * reserved. | |||||
| * | |||||
| * Redistribution and use in source and binary forms, with or without | |||||
| * modification, are permitted provided that the following conditions | |||||
| * are met: | |||||
| * | |||||
| * 1. Redistributions of source code must retain the above copyright | |||||
| * notice, this list of conditions and the following disclaimer. | |||||
| * | |||||
| * 2. Redistributions in binary form must reproduce the above copyright | |||||
| * notice, this list of conditions and the following disclaimer in | |||||
| * the documentation and/or other materials provided with the | |||||
| * distribution. | |||||
| * | |||||
| * 3. The end-user documentation included with the redistribution, if | |||||
| * any, must include the following acknowlegement: | |||||
| * "This product includes software developed by the | |||||
| * Apache Software Foundation (http://www.apache.org/)." | |||||
| * Alternately, this acknowlegement may appear in the software itself, | |||||
| * if and wherever such third-party acknowlegements normally appear. | |||||
| * | |||||
| * 4. The names "The Jakarta Project", "Ant", and "Apache Software | |||||
| * Foundation" must not be used to endorse or promote products derived | |||||
| * from this software without prior written permission. For written | |||||
| * permission, please contact apache@apache.org. | |||||
| * | |||||
| * 5. Products derived from this software may not be called "Apache" | |||||
| * nor may "Apache" appear in their names without prior written | |||||
| * permission of the Apache Group. | |||||
| * | |||||
| * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED | |||||
| * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |||||
| * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||||
| * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR | |||||
| * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||||
| * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||||
| * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | |||||
| * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |||||
| * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||||
| * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | |||||
| * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |||||
| * SUCH DAMAGE. | |||||
| * ==================================================================== | |||||
| * | |||||
| * This software consists of voluntary contributions made by many | |||||
| * individuals on behalf of the Apache Software Foundation. For more | |||||
| * information on the Apache Software Foundation, please see | |||||
| * <http://www.apache.org/>. | |||||
| */ | |||||
| package org.apache.tools.ant.taskdefs.optional; | |||||
| import java.io.*; | |||||
| import java.util.Properties; | |||||
| import org.apache.tools.ant.BuildException; | |||||
| import org.apache.tools.ant.BuildFileTest; | |||||
| /** | |||||
| * Tests the XMLValidate optional task with nested external catalogs. | |||||
| * | |||||
| * @see XmlValidateTest | |||||
| * @author steve loughran | |||||
| * @author Jeff Turner | |||||
| * @since Ant 1.6 | |||||
| */ | |||||
| public class XmlValidateCatalogTest extends BuildFileTest { | |||||
| /** | |||||
| * where tasks run | |||||
| */ | |||||
| private final static String TASKDEFS_DIR = "src/etc/testcases/taskdefs/optional/"; | |||||
| /** | |||||
| * Constructor | |||||
| * | |||||
| * @param name testname | |||||
| */ | |||||
| public XmlValidateCatalogTest(String name) { | |||||
| super(name); | |||||
| } | |||||
| /** | |||||
| * The JUnit setup method | |||||
| */ | |||||
| public void setUp() { | |||||
| configureProject(TASKDEFS_DIR + "xmlvalidate.xml"); | |||||
| } | |||||
| /** | |||||
| * The teardown method for JUnit | |||||
| */ | |||||
| public void tearDown() { | |||||
| } | |||||
| /** | |||||
| * catalogfiles fileset should be ignored | |||||
| * if resolver.jar is not present, but will | |||||
| * be used if it is. either way, test should | |||||
| * work b/c we have a nested dtd with the same | |||||
| * entity | |||||
| */ | |||||
| public void testXmlCatalogFiles() { | |||||
| executeTarget("xmlcatalogfiles"); | |||||
| } | |||||
| /** | |||||
| * Test nested catalogpath. | |||||
| * It should be ignored if resolver.jar is not | |||||
| * present, but will be used if it is. either | |||||
| * way, test should work b/c we have a nested | |||||
| * dtd with the same entity | |||||
| */ | |||||
| public void testXmlCatalogPath() { | |||||
| executeTarget("xmlcatalogpath"); | |||||
| } | |||||
| } | |||||
| @@ -60,9 +60,13 @@ import org.apache.tools.ant.BuildException; | |||||
| import org.apache.tools.ant.BuildFileTest; | import org.apache.tools.ant.BuildFileTest; | ||||
| /** | /** | ||||
| * Tests the XmlValidateTest task. | |||||
| * Tests the XMLValidate optional task, by running targets in the test script | |||||
| * <code>src/etc/testcases/taskdefs/optional/xmlvalidate.xml</code> | |||||
| * <p> | |||||
| * | * | ||||
| * @see XmlValidateCatalogTest | |||||
| * @author steve loughran | * @author steve loughran | ||||
| * @author Jeff Turner | |||||
| * @since Ant 1.5 | * @since Ant 1.5 | ||||
| */ | */ | ||||
| public class XmlValidateTest extends BuildFileTest { | public class XmlValidateTest extends BuildFileTest { | ||||
| @@ -100,7 +104,7 @@ public class XmlValidateTest extends BuildFileTest { | |||||
| /** | /** | ||||
| * A unit test for JUnit | |||||
| * Basic inline 'dtd' element test. | |||||
| */ | */ | ||||
| public void testValidate() throws Exception { | public void testValidate() throws Exception { | ||||
| executeTarget("testValidate"); | executeTarget("testValidate"); | ||||
| @@ -108,7 +112,7 @@ public class XmlValidateTest extends BuildFileTest { | |||||
| /** | /** | ||||
| * A unit test for JUnit | |||||
| * Test indirect validation. | |||||
| */ | */ | ||||
| public void testDeepValidate() throws Exception { | public void testDeepValidate() throws Exception { | ||||
| executeTarget("testDeepValidate"); | executeTarget("testDeepValidate"); | ||||
| @@ -122,25 +126,20 @@ public class XmlValidateTest extends BuildFileTest { | |||||
| } | } | ||||
| /** | /** | ||||
| * catalogfiles fileset should be ignored | |||||
| * if resolver.jar is not present, but will | |||||
| * be used if it is. either way, test should | |||||
| * work b/c we have a nested dtd with the same | |||||
| * entity | |||||
| * Test that the nested dtd element is used when resolver.jar is not | |||||
| * present. This test should pass either way. | |||||
| */ | */ | ||||
| public void testXmlCatalogFiles() { | public void testXmlCatalogFiles() { | ||||
| executeTarget("xmlcatalogfiles"); | |||||
| executeTarget("xmlcatalogfiles-override"); | |||||
| } | } | ||||
| /** | /** | ||||
| * Test nested catalogpath. | * Test nested catalogpath. | ||||
| * It should be ignored if resolver.jar is not | |||||
| * present, but will be used if it is. either | |||||
| * way, test should work b/c we have a nested | |||||
| * dtd with the same entity | |||||
| * Test that the nested dtd element is used when resolver.jar is not | |||||
| * present. This test should pass either way. | |||||
| */ | */ | ||||
| public void testXmlCatalogPath() { | public void testXmlCatalogPath() { | ||||
| executeTarget("xmlcatalogpath"); | |||||
| executeTarget("xmlcatalogpath-override"); | |||||
| } | } | ||||
| /** | /** | ||||