curcuru     01/11/08 13:05:16

  Modified:    test/java/src/org/apache/qetest QetestUtils.java
               test/java/src/org/apache/qetest/xsl XSLTestHarness.java
  Log:
  Update XSLTestHarness to look for non-FQCNs by using new QetestUtils 
class-searching-for utility
  
  Revision  Changes    Path
  1.9       +32 -4     
xml-xalan/test/java/src/org/apache/qetest/QetestUtils.java
  
  Index: QetestUtils.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/test/java/src/org/apache/qetest/QetestUtils.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- QetestUtils.java  2001/08/09 11:57:32     1.8
  +++ QetestUtils.java  2001/11/08 21:05:16     1.9
  @@ -68,7 +68,7 @@
    * line with a full or partial classname (in the org.apache.qetest 
    * area, obviously) and we'll load and execute that class instead.
    * @author [EMAIL PROTECTED]
  - * @version $Id: QetestUtils.java,v 1.8 2001/08/09 11:57:32 curcuru Exp $
  + * @version $Id: QetestUtils.java,v 1.9 2001/11/08 21:05:16 curcuru Exp $
    */
   public abstract class QetestUtils
   {
  @@ -126,9 +126,9 @@
           }
   
           // URLs must explicitly use only forward slashes
  -         if (File.separatorChar == '\\') {
  -             tmp = tmp.replace('\\', '/');
  -         }
  +        if (File.separatorChar == '\\') {
  +            tmp = tmp.replace('\\', '/');
  +        }
           // Note the presumption that it's a file reference
           // Ensure we have the correct number of slashes at the 
           //  start: we always want 3 /// if it's absolute
  @@ -216,6 +216,34 @@
               // You can't always get you what you want
               return null;
           }
  +    }
  +
  +
  +    /**
  +     * Utility method to get a class name of a test.  
  +     * This is mainly a bit of syntactic sugar built on 
  +     * top of testClassForName.
  +     *
  +     * @param String classname FQCN or partially specified classname
  +     * that you wish to load
  +     * @param String[] rootPackages a list of packages to search 
  +     * for the classname specified in array order; if null then 
  +     * we don't search any additional packages
  +     * @param String defaultClassname a default known-good FQCN to 
  +     * return if the classname was not found
  +     *
  +     * @return name of class that testClassForName returns; 
  +     * or null if an error occoured
  +     */
  +    public static String testClassnameForName(String classname, 
  +                                         String[] rootPackages,
  +                                         String defaultClassname)
  +    {
  +        Class clazz = testClassForName(classname, rootPackages, 
defaultClassname);
  +        if (null == clazz)
  +            return null;
  +        else
  +            return clazz.getName();
       }
   
   
  
  
  
  1.6       +3 -13     
xml-xalan/test/java/src/org/apache/qetest/xsl/XSLTestHarness.java
  
  Index: XSLTestHarness.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/test/java/src/org/apache/qetest/xsl/XSLTestHarness.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- XSLTestHarness.java       2001/10/29 18:37:24     1.5
  +++ XSLTestHarness.java       2001/11/08 21:05:16     1.6
  @@ -88,7 +88,7 @@
    *        user doesn't call testCaseClose (where do results go?)
    * @todo report on memory usage, etc.
    * @author [EMAIL PROTECTED]
  - * @version $Id: XSLTestHarness.java,v 1.5 2001/10/29 18:37:24 curcuru Exp $
  + * @version $Id: XSLTestHarness.java,v 1.6 2001/11/08 21:05:16 curcuru Exp $
    */
   public class XSLTestHarness
   {
  @@ -218,15 +218,6 @@
           for (int i = 0; st.hasMoreTokens(); i++)
           {
               String s = st.nextToken();
  -            // @todo use some intelligent way to prepend the 'right' 
  -            //  package name on the front: we might have tests in 
  -            //  various subpackages under org.apache.qetest: in .xsl; 
  -            //  in .trax; in .xalanj1; etc.
  -            // HACK: if it doesn't start with org, then prepend the 
  -            //  default package - otherwise assume it's FQCN
  -            //  thus 'trax.TransformerAPITest' becomes
  -            //  'org.apache.qetest.trax.TransformerAPITest'
  -            //@todo use QetestUtils.testClassForName instead!
               if (s.startsWith("org"))
               {   
                   // Assume user specified complete package.ClassName
  @@ -234,9 +225,8 @@
               }
               else
               {
  -                // Assume user specified (just ClassName or 
  -                //  subpackage.Classname) under org.apache.qetest.
  -                tests[i] = DEFAULT_PACKAGE + s;
  +                // Use QetestUtils to find the correct name.
  +                tests[i] = QetestUtils.testClassnameForName(s, 
QetestUtils.defaultPackages, null);
               }
           }
           // Munge the inputDir and goldDir to use platform path 
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to