curcuru     02/03/05 13:25:01

  Modified:    test/java/src/org/apache/qetest FileBasedTest.java
  Log:
  Remove unused debugPrintln method;
  Split main() into improved doMain() from XSLProcessorTestBase
  
  Revision  Changes    Path
  1.2       +38 -34    xml-xalan/test/java/src/org/apache/qetest/FileBasedTest.java
  
  Index: FileBasedTest.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/test/java/src/org/apache/qetest/FileBasedTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FileBasedTest.java        1 Nov 2000 23:30:51 -0000       1.1
  +++ FileBasedTest.java        5 Mar 2002 21:25:01 -0000       1.2
  @@ -348,8 +348,6 @@
       public boolean initializeFromProperties(Properties props)
       {
   
  -        debugPrintln("FileBasedTest.initializeFromProperties(" + props + ")");
  -
           // Parse out any values that match our internal convenience variables
           // default all values to our current values
           // String values are simply getProperty()'d
  @@ -433,8 +431,6 @@
       public boolean initializeFromArray(String[] args, boolean flag)
       {
   
  -        debugPrintln("FileBasedTest.initializeFromArray(" + args + ")");
  -
           // Read in command line args and setup internal variables
           String optPrefix = "-";
           int nArgs = args.length;
  @@ -651,12 +647,6 @@
               }
           }  // end of for() loop
   
  -        debugPrintln(
  -            "FileBasedTest.initializeFromArray(): testProps are now:");
  -
  -        if (debug)
  -            testProps.list(System.err);
  -
           // If we got here, we set the array params OK, so simply return 
           //  the value the initializeFromProperties method returned
           return propsOK;
  @@ -717,48 +707,62 @@
           return t;
       }
   
  +
       /**
  -     * Debugging the Test infrastructure - dumps to System.err.  
  +     * Main worker method to run test from the command line.
  +     * Test subclasses generally need not override.
  +     * <p>This is primarily provided to make subclasses implementations
  +     * of the main method as simple as possible: in general, they
  +     * should simply do:
  +     * <code>
  +     *   public static void main (String[] args)
  +     *   {
  +     *       TestSubClass app = new TestSubClass();
  +     *       app.doMain(args);
  +     *   }
  +     * </code>
        *
  -     * NEEDSDOC @param s
  +     * @param args command line arguments
        */
  -    protected void debugPrintln(String s)
  +    public void doMain(String[] args)
       {
  +        // Initialize any instance variables from the command line 
  +        //  OR specified properties block
  +        if (!initializeFromArray(args, true))
  +        {
  +            System.err.println("ERROR in usage:");
  +            System.err.println(usage());
   
  -        if (!debug)
  +            // Don't use System.exit, since that will blow away any containing 
harnesses
               return;
  +        }
  +
  +        // Also pass along the command line, in case someone has 
  +        //  specific code that's counting on this
  +        StringBuffer buf = new StringBuffer();
  +        for (int i = 0; i < args.length; i++)
  +        {
  +            buf.append(args[i]);
  +            buf.append(", "); // Ignore messiness of extra trailing ,
  +        }
  +        testProps.put(MAIN_CMDLINE, buf.toString());
   
  -        System.err.println(s);
  +        // Actually go and execute the test
  +        runTest(testProps);
       }
   
       /**
        * Main method to run test from the command line.
  +     * @author Shane Curcuru
        * <p>Test subclasses <b>must</b> override, obviously.
        * Only provided here for debugging.</p>
  -     * @author Shane Curcuru
        *
  -     * NEEDSDOC @param args
  +     * @param args command line arguments
        */
       public static void main(String[] args)
       {
  -
           FileBasedTest app = new FileBasedTest();
  -
  -        // Initialize any instance variables from the command line 
  -        //  OR specified properties block
  -        if (!app.initializeFromArray(args, true))
  -        {
  -            System.err.println("ERROR in usage:");
  -            System.err.println(app.usage());
  -
  -            // Don't use System.exit, since that will blow away any containing 
harnesses
  -            return;
  -        }
  -
  -        // Also pass along the command line, in case someone has 
  -        //  specific code that's counting on this
  -        app.testProps.put(MAIN_CMDLINE, args);
  -        app.runTest(app.testProps);
  +        app.doMain(args);
       }
   }  // end of class FileBasedTest
   
  
  
  

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

Reply via email to