sboag       00/12/23 14:54:07

  Modified:    test/java/src/org/apache/qetest/xsl
                        XSLProcessorTestBase.java
  Log:
  Add createStatusFile method, and call it in doMain.  This allows
  other tests to be run like the minitest stuff, from Ant.
  
  Revision  Changes    Path
  1.6       +36 -1     
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.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- XSLProcessorTestBase.java 2000/12/21 15:22:05     1.5
  +++ XSLProcessorTestBase.java 2000/12/23 22:54:07     1.6
  @@ -91,7 +91,7 @@
    * <li>runErr</li>
    * </ul>
    * @author [EMAIL PROTECTED]
  - * @version $Id: XSLProcessorTestBase.java,v 1.5 2000/12/21 15:22:05 curcuru 
Exp $
  + * @version $Id: XSLProcessorTestBase.java,v 1.6 2000/12/23 22:54:07 sboag 
Exp $
    */
   public class XSLProcessorTestBase extends FileBasedTest
   {
  @@ -726,6 +726,39 @@
                                    + diagnostics);
           }
       }
  +    
  +    /**
  +     * Write a "{TestName}.Pass" or "{TestName}.Not.Pass" file 
  +     * according to whether or not the overall test passed.
  +     */
  +    protected void createStatusFile()
  +    {
  +      System.out.println("reporter: "+reporter);
  +      if(null != reporter)
  +      {
  +        String testName = this.getTestName();
  +        File resultsFile = new File(testProps.getProperty("logFile"));
  +        File passfile = new File(resultsFile.getParent(), testName+".Pass");
  +        File failfile = new File(resultsFile.getParent(), 
testName+".Not.Pass");
  +        if(passfile.exists())
  +          passfile.delete();
  +        if(failfile.exists())
  +          failfile.delete();
  +        
  +        File statusfile = reporter.didPass() ? passfile : failfile;          
       
  +        try
  +        {
  +          java.io.FileOutputStream fio = new 
java.io.FileOutputStream(statusfile);
  +          fio.write(0);
  +          fio.close();
  +        }
  +        catch(Exception e)
  +        {
  +          System.out.println("Can't write: "+statusfile.toString());
  +        }
  +      }
  +
  +    }
   
       /**
        * Main worker method to run test from the command line.
  @@ -764,6 +797,8 @@
           //  specific code that's counting on this
           testProps.put(MAIN_CMDLINE, args);
           runTest(testProps);
  +        
  +        createStatusFile();
       }
   
       /**
  
  
  

Reply via email to