You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bo...@apache.org on 2002/12/03 15:40:50 UTC

cvs commit: jakarta-ant/src/testcases/org/apache/tools/ant/taskdefs/optional XmlValidateCatalogTest.java XmlValidateTest.java

bodewig     2002/12/03 06:40:50

  Modified:    .        build.xml
               src/etc/testcases/taskdefs/optional xmlvalidate.xml
               src/main/org/apache/tools/ant/types/resolver
                        ApacheCatalogResolver.java
               src/testcases/org/apache/tools/ant/taskdefs/optional
                        XmlValidateTest.java
  Added:       src/etc/testcases/taskdefs/optional/xml catalog
               src/testcases/org/apache/tools/ant/taskdefs/optional
                        XmlValidateCatalogTest.java
  Log:
  Actually test the resolver stuff of xmlcatalog
  
  Revision  Changes    Path
  1.337     +4 -0      jakarta-ant/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/build.xml,v
  retrieving revision 1.336
  retrieving revision 1.337
  diff -u -r1.336 -r1.337
  --- build.xml	1 Dec 2002 03:56:07 -0000	1.336
  +++ build.xml	3 Dec 2002 14:40:49 -0000	1.337
  @@ -1530,6 +1530,10 @@
             <exclude name="${optional.package}/XalanLiaisonTest.java"
                      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
             -->
  
  
  
  1.10      +24 -3     jakarta-ant/src/etc/testcases/taskdefs/optional/xmlvalidate.xml
  
  Index: xmlvalidate.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/etc/testcases/taskdefs/optional/xmlvalidate.xml,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- xmlvalidate.xml	2 Dec 2002 16:06:09 -0000	1.9
  +++ xmlvalidate.xml	3 Dec 2002 14:40:50 -0000	1.10
  @@ -38,8 +38,9 @@
         </xmlcatalog>
       </xmlvalidate>
     </target>
  - 
  -  <target name="xmlcatalogfiles">
  +
  +  <!-- The -override tests should pass without resolver.jar -->
  +  <target name="xmlcatalogfiles-override">
       <xmlvalidate warn="false">
         <fileset dir="xml" includes="**/about.xml"/>
         <xmlcatalog classpath="xml">
  @@ -50,7 +51,7 @@
       </xmlvalidate>
     </target>
    
  -  <target name="xmlcatalogpath">
  +  <target name="xmlcatalogpath-override">
       <xmlvalidate warn="false">
         <fileset dir="xml" includes="**/about.xml"/>
         <xmlcatalog classpath="xml">
  @@ -59,6 +60,26 @@
           </catalogpath>
           <dtd publicID="-//stevo//DTD doc 1.0//EN"
             location="doc.dtd"/>
  +      </xmlcatalog>
  +    </xmlvalidate>
  +  </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>
  
  
  
  1.1                  jakarta-ant/src/etc/testcases/taskdefs/optional/xml/catalog
  
  Index: catalog
  ===================================================================
  PUBLIC "-//stevo//DTD doc 1.0//EN" "doc.dtd"
  
  
  
  
  1.5       +3 -1      jakarta-ant/src/main/org/apache/tools/ant/types/resolver/ApacheCatalogResolver.java
  
  Index: ApacheCatalogResolver.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/types/resolver/ApacheCatalogResolver.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ApacheCatalogResolver.java	20 Nov 2002 10:10:13 -0000	1.4
  +++ ApacheCatalogResolver.java	3 Dec 2002 14:40:50 -0000	1.5
  @@ -123,6 +123,8 @@
           System.getProperties().put("xml.catalog.className",
                                      ApacheCatalog.class.getName());
   
  +        CatalogManager.getStaticManager().setUseStaticCatalog(false);
  +
           // debug
           // System.setProperty("xml.catalog.verbosity", "4");
       }
  
  
  
  1.10      +13 -14    jakarta-ant/src/testcases/org/apache/tools/ant/taskdefs/optional/XmlValidateTest.java
  
  Index: XmlValidateTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/testcases/org/apache/tools/ant/taskdefs/optional/XmlValidateTest.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- XmlValidateTest.java	2 Dec 2002 16:30:51 -0000	1.9
  +++ XmlValidateTest.java	3 Dec 2002 14:40:50 -0000	1.10
  @@ -60,9 +60,13 @@
   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 Jeff Turner
    * @since Ant 1.5
    */
   public class XmlValidateTest extends BuildFileTest {
  @@ -100,7 +104,7 @@
   
   
       /**
  -     * A unit test for JUnit
  +     * Basic inline 'dtd' element test.
        */
       public void testValidate() throws Exception {
            executeTarget("testValidate");
  @@ -108,7 +112,7 @@
       
   
       /**
  -     * A unit test for JUnit
  +     * Test indirect validation.
        */
       public void testDeepValidate() throws Exception {
            executeTarget("testDeepValidate");
  @@ -122,25 +126,20 @@
       }
   
       /**
  -     * 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() {
  -        executeTarget("xmlcatalogfiles");
  +        executeTarget("xmlcatalogfiles-override");
       }
   
       /**
        * 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() {
  -        executeTarget("xmlcatalogpath");
  +        executeTarget("xmlcatalogpath-override");
       }
   
       /**
  
  
  
  1.1                  jakarta-ant/src/testcases/org/apache/tools/ant/taskdefs/optional/XmlValidateCatalogTest.java
  
  Index: XmlValidateCatalogTest.java
  ===================================================================
  /*
   *  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");
      }
  
  }
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>