curcuru     01/12/12 14:08:47

  Modified:    test/java/src/org/apache/qetest/xsl
                        StylesheetTestletDriver.java
                        XSLDirectoryIterator.java XSLProcessorTestBase.java
  Log:
  Remove unused parameters and code; simplify, simplify, simplify;
  StylesheetTestletDriver now uses StylesheetDataletManager to read fileLists
  
  Revision  Changes    Path
  1.5       +10 -143   
xml-xalan/test/java/src/org/apache/qetest/xsl/StylesheetTestletDriver.java
  
  Index: StylesheetTestletDriver.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/test/java/src/org/apache/qetest/xsl/StylesheetTestletDriver.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- StylesheetTestletDriver.java      2001/03/16 17:00:18     1.4
  +++ StylesheetTestletDriver.java      2001/12/12 22:08:47     1.5
  @@ -55,11 +55,6 @@
    * <http://www.apache.org/>.
    */
   
  -/*
  - *
  - * StylesheetTestletDriver.java
  - *
  - */
   package org.apache.qetest.xsl;
   
   // Support for test reporting and harness classes
  @@ -79,8 +74,6 @@
   import java.util.StringTokenizer;
   import java.util.Vector;
   
  -//-------------------------------------------------------------------------
  -
   /**
    * Test driver for XSLT stylesheet Testlets.
    * 
  @@ -92,7 +85,7 @@
    * would be a good model for a completely generic TestletDriver.
    *
    * @author [EMAIL PROTECTED]
  - * @version $Id: StylesheetTestletDriver.java,v 1.4 2001/03/16 17:00:18 
curcuru Exp $
  + * @version $Id: StylesheetTestletDriver.java,v 1.5 2001/12/12 22:08:47 
curcuru Exp $
    */
   public class StylesheetTestletDriver extends XSLProcessorTestBase
   {
  @@ -245,8 +238,9 @@
           if (null != fileList)
           {
               // Process the specific list of tests the user supplied
  -            String desc = "User-supplied fileList"; // provide default value
  -            Vector datalets = readFileList(fileList, desc);
  +            String desc = "User-supplied fileList: " + fileList; // provide 
default value
  +            // Use static worker class to process the list
  +            Vector datalets = 
StylesheetDataletManager.readFileList(reporter, fileList, desc);
   
               // Actually process the specified files in a testCase
               processFileList(datalets, desc);
  @@ -587,117 +581,6 @@
   
   
       /**
  -     * Read in a file specifying a list of files to test.
  -     * <p>File format is pretty simple:</p>
  -     * <ul>
  -     * <li># first line of comments is copied into desc</li>
  -     * <li># beginning a line is a comment</li>
  -     * <li># rest of lines are whitespace delimited filenames and 
options</li>
  -     * <li>inputName xmlName outName goldName flavor options...</li>
  -     * <li><b>Note:</b> see [EMAIL PROTECTED] StylesheetDatalet} for
  -     * details on how the file lines are parsed!</li>
  -     * </ul>
  -     * <p>Most items are optional, but not having them may result 
  -     * in validation oddities.  Future work would be to coordinate 
  -     * this with various Datalet's implementations of .load() so 
  -     * that Datalets can do better defaulting of non-provided 
  -     * items; or maybe so that a user can specific a default 'mask' 
  -     * of values to use for unspecified items.</p>
  -     *
  -     * @param fileName String; name of the file
  -     * @param desc description; caller's copy changed
  -     * @return Vector of StylesheetDatalets, or null if error
  -     */
  -    public Vector readFileList(String fileName, String desc)
  -    {
  -        final String COMMENT_CHAR = "#";
  -        final String ABSOLUTE = "absolute";
  -        final String RELATIVE = "relative";
  -
  -        // Verify the file is there
  -        File f = new File(fileName);
  -        if (!f.exists())
  -        {
  -            reporter.logErrorMsg("readFileList: " + fileName  + " does not 
exist!");
  -            return null;
  -        }
  -
  -        Vector vec = new Vector();
  -        BufferedReader br = null;
  -        String line = null;
  -        try
  -        {
  -            br = new BufferedReader(new FileReader(f));
  -            line = br.readLine(); // read just first line
  -        }
  -        catch (IOException ioe)
  -        {
  -            reporter.logErrorMsg("readFileList: " + fileName + " threw: "
  -                                 + ioe.toString());
  -            return null;
  -        }
  -
  -        // Verify the first line
  -        if (line == null)
  -        {
  -            reporter.logErrorMsg("readFileList: " + fileName
  -                                 + " appears to be blank!");
  -            return null;
  -        }
  -
  -        // Check if the first line is a comment 
  -        if (line.startsWith(COMMENT_CHAR))
  -        {
  -            // Save it as the description
  -            desc = line;
  -        }
  -
  -        // Load each line into a StylesheetDatalet
  -        for (;;)
  -        {
  -            // Skip any lines beginning with # comment char or that are blank
  -            if ((!line.startsWith(COMMENT_CHAR)) && (line.length() > 0))
  -            {
  -                // Create a Datalet and initialize with the line's contents
  -                StylesheetDatalet d = new StylesheetDatalet(line);
  -
  -                //@todo Avoid spurious passes when output & gold not 
specified
  -                //  needs to detect when StylesheetDatalet doesn't 
  -                //  properly have outputName and goldName set
  -
  -                // Add it to our vector
  -                vec.addElement(d);
  -            }
  -
  -            // Read next line and loop
  -            try
  -            {
  -                line = br.readLine();
  -            }
  -            catch (IOException ioe2)
  -            {
  -                // Just force us out of the loop; if we've already 
  -                //  read part of the file, fine
  -                reporter.logWarningMsg("readFileList: " + fileName
  -                                       + " threw: " + ioe2.toString());
  -                break;
  -            }
  -
  -            if (line == null)
  -                break;
  -        } // end of for (;;)
  -
  -        if (vec.size() == 0)
  -        {
  -            reporter.logErrorMsg("readFileList: " + fileName
  -                                 + " did not have any non-comment lines!");
  -            return null;
  -        }
  -        return vec;
  -    }
  -
  -
  -    /**
        * Validate existence of or create various directories needed.
        * <p>If any optionalDir cannot be created, it's array entry 
        * will be null.</p>
  @@ -773,22 +656,6 @@
       }
   
   
  -    /**
  -     * List of common packages that Xalan testing classes are in.
  -     * Note that Xalan-J 2.x packages are listed before Xalan-J 1.x 
  -     * packages, and there is an inherent danger in the ordering 
  -     * when two classes have the same name.
  -     * This is used in QetestUtils.testClassForName()
  -     */
  -    protected String[] testPackages = 
  -    {
  -        "org.apache.qetest.xsl",
  -        "org.apache.qetest.trax",
  -        "org.apache.qetest.xalanj2",
  -        "org.apache.qetest.xalanj1",
  -        "org.apache.qetest"
  -    };
  -
       /** Default FilenameFilter FQCN for directories.   */
       protected String defaultDirFilter = 
"org.apache.qetest.xsl.ConformanceDirRules";
   
  @@ -814,7 +681,7 @@
           if (null == cachedTestletClazz)
           {
               cachedTestletClazz = QetestUtils.testClassForName(testlet, 
  -                                                              testPackages,
  +                                                              
QetestUtils.defaultPackages,
                                                                 
defaultTestlet);
           }
           try
  @@ -841,9 +708,9 @@
        */
       public FilenameFilter getDirFilter()
       {
  -        // Find a Testlet class to use
  +        // Find a FilenameFilter class to use
           Class clazz = QetestUtils.testClassForName(dirFilter, 
  -                                                   testPackages,
  +                                                   
QetestUtils.defaultPackages,
                                                      defaultDirFilter);
           try
           {
  @@ -877,13 +744,13 @@
        */
       public FilenameFilter getFileFilter()
       {
  -        // Find a Testlet class to use
  +        // Find a FilenameFilter class to use
           Class clazz = QetestUtils.testClassForName(fileFilter, 
  -                                                   testPackages,
  +                                                   
QetestUtils.defaultPackages,
                                                      defaultFileFilter);
           try
           {
  -            // Create it, optionally with a category
  +            // Create it, optionally with excludes
               if ((null != excludes) && (excludes.length() > 1))  // Arbitrary 
check for non-null, non-blank string
               {
                   Class[] parameterTypes = { java.lang.String.class };
  
  
  
  1.11      +9 -41     
xml-xalan/test/java/src/org/apache/qetest/xsl/XSLDirectoryIterator.java
  
  Index: XSLDirectoryIterator.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/test/java/src/org/apache/qetest/xsl/XSLDirectoryIterator.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- XSLDirectoryIterator.java 2001/05/18 15:17:17     1.10
  +++ XSLDirectoryIterator.java 2001/12/12 22:08:47     1.11
  @@ -99,7 +99,7 @@
    * </ul>
    * @todo improve file discovery - file execution paradigm
    * @author Shane Curcuru
  - * @version $Id: XSLDirectoryIterator.java,v 1.10 2001/05/18 15:17:17 
curcuru Exp $
  + * @version $Id: XSLDirectoryIterator.java,v 1.11 2001/12/12 22:08:47 
curcuru Exp $
    * @deprecated Please use StylesheetTestletDriver instead.
    * The preferred way to test trees of stylesheets (like the conf 
    * test) is to use the StylesheetTestletDriver to iterate over the 
  @@ -1127,14 +1127,11 @@
                   processorW.setIndent(indentLevel);
               }
   
  -            // Force filerefs to be URI's if needed
  -            if (useURI)
  -            {
  -                xmlURI = QetestUtils.filenameToURL(XMLName);
  -                xslURI = QetestUtils.filenameToURL(XSLName);
  -                // Note: Currently 28-Jun-00, the output of files is handled 
differently, so 
  -                //  we do NOT want to convert those.  Subject to change, 
however.
  -            }
  +            // Force filerefs to be URI's
  +            xmlURI = QetestUtils.filenameToURL(XMLName);
  +            xslURI = QetestUtils.filenameToURL(XSLName);
  +            // Note: Currently 28-Jun-00, the output of files is handled 
differently, so 
  +            //  we do NOT want to convert those.  Subject to change, however.
   
               fileTime = processorW.processToFile(xmlURI, xslURI, OutName);
   
  @@ -1213,12 +1210,9 @@
                   processorW.setIndent(indentLevel);
               }
   
  -            // Force filerefs to be URI's if needed
  -            if (useURI)
  -            {
  -                // Use this static convenience method; returns a URL; 
convert to String via toExternalForm()
  -                XMLName = QetestUtils.filenameToURL(XMLName);
  -            }
  +            // Force filerefs to be URI's
  +            // Use this static convenience method; returns a URL; convert to 
String via toExternalForm()
  +            XMLName = QetestUtils.filenameToURL(XMLName);
               fileTime = processorW.processEmbeddedToFile(XMLName, OutName);
   
               if (fileTime != ProcessorWrapper.ERROR)
  @@ -1410,32 +1404,6 @@
               return false;
           }
   
  -        if (diagnostics != null)
  -        {
  -            if (diagNameMgr == null)
  -            {
  -                // Create a new name manager, hardcode the .log extension 
just because
  -                // New: put them in outputDir
  -                diagNameMgr = new OutputNameManager(outputDir + 
File.separator 
  -                                                    + diagnostics, ".log");
  -            }
  -
  -            try
  -            {
  -                processorW.setDiagnosticsOutput(
  -                    new PrintWriter(new FileWriter(diagNameMgr.nextName())));
  -                reporter.logInfoMsg("createNewProcessor() new diagnostics = "
  -                                    + diagNameMgr.currentName());
  -            }
  -            catch (IOException ioe)
  -            {
  -                reporter.logWarningMsg(
  -                    "createNewProcessor() could not create new diagnostics = 
"
  -                    + diagNameMgr.currentName());
  -
  -                return false;
  -            }
  -        }
   
           // Apply an optional indent if asked; this needs to be documented!
           // @todo this name conflicts with Logger.OPT_INDENT: we should 
  
  
  
  1.15      +1 -116    
xml-xalan/test/java/src/org/apache/qetest/xsl/XSLProcessorTestBase.java
  
  Index: XSLProcessorTestBase.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/test/java/src/org/apache/qetest/xsl/XSLProcessorTestBase.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- XSLProcessorTestBase.java 2001/12/05 19:58:50     1.14
  +++ XSLProcessorTestBase.java 2001/12/12 22:08:47     1.15
  @@ -89,13 +89,10 @@
    * <li>embedded - special case: tests with no .xsl file (embedded 
stylesheets)</li>
    * <li>liaison</li>
    * <li>flavor</li>
  - * <li>diagnostics</li>
  - * <li>noReuse</li>
  - * <li>precompile</li>
    * <li>runErr</li>
    * </ul>
    * @author [EMAIL PROTECTED]
  - * @version $Id: XSLProcessorTestBase.java,v 1.14 2001/12/05 19:58:50 
curcuru Exp $
  + * @version $Id: XSLProcessorTestBase.java,v 1.15 2001/12/12 22:08:47 
curcuru Exp $
    */
   public class XSLProcessorTestBase extends FileBasedTest
   {
  @@ -122,12 +119,6 @@
                   + "   (liaisonClassName)\n" 
                   + "    -" + OPT_FLAVOR
                   + "    (xalan|lotusxsl|xt|etc...)  which kind of Processor 
to test\n"
  -                + "    -" + OPT_DIAGNOSTICS
  -                + "  (root filename for diagnostics output)\n" 
  -                + "    -" + OPT_NOREUSE
  -                + "    will force recreate processor each time\n" 
  -                + "    -" + OPT_PRECOMPILE
  -                + "  will use precompiled stylesheet, if applicable\n"
                   + "    -" + OPT_NOERRTEST
                   + "   will skip running 'err' tests, if applicable\n"
                   + super.usage());
  @@ -148,22 +139,9 @@
       protected String category = null;
   
       /**
  -     * Parameter: Reuse/reset processor between cases or create a new one 
each time?
  -     * <p>Default: false - create one processor and call reset between 
tests.</p>
  -     * <p>Should be deprecated, I think. -sc 21-Mar-01</p>
  -     */
  -    // TODO: Move to directoryiterator
  -    public static final String OPT_NOREUSE = "noReuse";
  -
  -    /** Parameter: Reuse/reset processor between cases or create a new one 
each time?  */
  -    protected boolean noReuse = true;
  -
  -    /**
        * Parameter: What parser liaison or option to use?
        * <p>Default: null, Whichever default your processor uses.</p>
        */
  -
  -    // TODO: Move to directoryiterator
       public static final String OPT_LIAISON = "liaison";
   
       /** Parameter: What parser liaison or option to use?.   */
  @@ -179,27 +157,6 @@
       protected String flavor = "trax";
   
       /**
  -     * Parameter: Name of output file for diagnostics/error logs?
  -     * <p>Default: null, do not use one</p>
  -     * <p>Should be deprecated, I think. -sc 21-Mar-01</p>
  -     */
  -
  -    // TODO: Move to directoryiterator
  -    public static final String OPT_DIAGNOSTICS = "diagnostics";
  -
  -    /** Parameter: Name of output file for diagnostics/error logs?  */
  -    protected String diagnostics = null;
  -
  -    /**
  -     * Parameter: Should we try to use a precompiled stylesheet?
  -     * <p>Default: false, no (not applicable in all cases).</p>
  -     */
  -    public static final String OPT_PRECOMPILE = "precompile";
  -
  -    /** Parameter: Should we try to use a precompiled stylesheet?  */
  -    protected boolean precompile = false;
  -
  -    /**
        * Parameter: Should we run any 'err' subdir tests or not?
        * <p>Default: false (i.e. <b>do</B> run error tests by default).</p>
        * <p>Should be deprecated, I think: don't try to run both 
  @@ -212,16 +169,6 @@
       protected boolean noErrTest = false;
   
       /**
  -     * Parameter: force use of URI's or leave filenames alone?
  -     * <p>Default: true, use URI's</p>
  -     * @todo update, this is clumsy
  -     */
  -    public static final String OPT_USEURI = "useURI";
  -
  -    /** Parameter: force use of URI's or leave filenames alone?  */
  -    protected boolean useURI = true;
  -
  -    /**
        * Parameter: Which CheckService should we use for XML output Files?
        * <p>Default: org.apache.qetest.XHTFileCheckService.</p>
        */
  @@ -449,15 +396,6 @@
           fileCheckerName = props.getProperty(OPT_FILECHECKER, 
fileCheckerName);
           excludes = props.getProperty(OPT_EXCLUDES, excludes);
           embedded = props.getProperty(OPT_EMBEDDED, embedded);
  -        diagnostics = props.getProperty(OPT_DIAGNOSTICS, diagnostics);
  -
  -        String prec = props.getProperty(OPT_PRECOMPILE);
  -        if ((prec != null) && prec.equalsIgnoreCase("true"))
  -        {
  -            precompile = true;
  -            // Default the value in properties block too
  -            testProps.put(OPT_PRECOMPILE, "true");
  -        }
   
           String noet = props.getProperty(OPT_NOERRTEST);
   
  @@ -468,15 +406,6 @@
               testProps.put(OPT_NOERRTEST, "true");
           }
   
  -        String uURI = props.getProperty(OPT_USEURI);
  -
  -        if ((uURI != null) && uURI.equalsIgnoreCase("false"))
  -        {
  -            useURI = false;
  -            // Default the value in properties block too
  -            testProps.put(OPT_USEURI, "false");
  -        }
  -
           return b;
       }
   
  @@ -598,23 +527,6 @@
                   continue;
               }
   
  -            if (args[i].equalsIgnoreCase(optPrefix + OPT_DIAGNOSTICS))
  -            {
  -                if (++i >= nArgs)
  -                {
  -                    System.out.println("ERROR: must supply arg for: "
  -                                       + optPrefix + OPT_DIAGNOSTICS);
  -
  -                    return false;
  -                }
  -
  -                diagnostics = args[i];
  -
  -                testProps.put(OPT_DIAGNOSTICS, diagnostics);
  -
  -                continue;
  -            }
  -
               if (args[i].equalsIgnoreCase(optPrefix + OPT_FILECHECKER))
               {
                   if (++i >= nArgs)
  @@ -666,38 +578,11 @@
                   continue;
               }
   
  -            if (args[i].equalsIgnoreCase(optPrefix + OPT_NOREUSE))
  -            {
  -                noReuse = false;
  -
  -                testProps.put(OPT_NOREUSE, "false");
  -
  -                continue;
  -            }
  -
  -            if (args[i].equalsIgnoreCase(optPrefix + OPT_PRECOMPILE))
  -            {
  -                precompile = true;
  -
  -                testProps.put(OPT_PRECOMPILE, "true");
  -
  -                continue;
  -            }
  -
               if (args[i].equalsIgnoreCase(optPrefix + OPT_NOERRTEST))
               {
                   noErrTest = true;
   
                   testProps.put(OPT_NOERRTEST, "true");
  -
  -                continue;
  -            }
  -
  -            if (args[i].equalsIgnoreCase(optPrefix + OPT_USEURI))
  -            {
  -                useURI = false;  // Toggle from default of true; ugly but 
I'm in a hurry
  -
  -                testProps.put(OPT_USEURI, "false");
   
                   continue;
               }
  
  
  

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

Reply via email to