You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by cu...@apache.org on 2002/10/10 20:53:39 UTC

cvs commit: xml-xalan/test/java/src/org/apache/qetest XMLFileLogger.java

curcuru     2002/10/10 11:53:39

  Modified:    test/java/src/org/apache/qetest XMLFileLogger.java
  Log:
  Use a BufferedWriter for better performance in large test sets; 
  also added settable property for setFlushOnCaseClose()
  Submitted by: jo_grant@us.ibm.com
  
  Revision  Changes    Path
  1.11      +26 -12    xml-xalan/test/java/src/org/apache/qetest/XMLFileLogger.java
  
  Index: XMLFileLogger.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/test/java/src/org/apache/qetest/XMLFileLogger.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- XMLFileLogger.java	3 May 2002 21:56:53 -0000	1.10
  +++ XMLFileLogger.java	10 Oct 2002 18:53:39 -0000	1.11
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 2000 The Apache Software Foundation.  All rights 
  + * Copyright (c) 2000-2002 The Apache Software Foundation.  All rights 
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -63,6 +63,7 @@
   package org.apache.qetest;
   
   import java.io.File;
  +import java.io.BufferedWriter;
   import java.io.FileWriter;
   import java.io.IOException;
   import java.io.PrintWriter;
  @@ -155,6 +156,9 @@
       /** XML attribute tag: test filename on ELEM_TESTFILE.  */
       public static final String ATTR_TESTFILENAME = "filename";
   
  +    /** Parameter: if we should flush on every testCaseClose().  */
  +    public static final String OPT_FLUSHONCASECLOSE = "flushOnCaseClose";
  +
       //-----------------------------------------------------
       //-------- Class members and accessors --------
       //-----------------------------------------------------
  @@ -165,13 +169,13 @@
       /** If an error has occoured in this Logger. */
       protected boolean error = false;
   
  -    /** If we should flush after every logTestCaseClose. */
  +    /** If we should flush on every testCaseClose(). */
       protected boolean flushOnCaseClose = true;
   
       /**
        * Accessor for flushing; is set from properties.  
        *
  -     * NEEDSDOC ($objectName$) @return
  +     * @return current flushing status
        */
       public boolean getFlushOnCaseClose()
       {
  @@ -181,7 +185,7 @@
       /**
        * Accessor for flushing; is set from properties.  
        *
  -     * NEEDSDOC @param b
  +     * @param b If we should flush on every testCaseClose() 
        */
       public void setFlushOnCaseClose(boolean b)
       {
  @@ -244,7 +248,9 @@
           String pinfo[][] =
           {
               { OPT_LOGFILE, "String",
  -              "Name of file to use for output; required" }
  +              "Name of file to use for output; required" },
  +            { OPT_FLUSHONCASECLOSE, "boolean",
  +              "if we should flush on every testCaseClose(); optional; default:true" }
           };
   
           return pinfo;
  @@ -253,7 +259,7 @@
       /**
        * Accessor methods for our properties block.  
        *
  -     * NEEDSDOC ($objectName$) @return
  +     * @return our current properties; may be null
        */
       public Properties getProperties()
       {
  @@ -351,7 +357,14 @@
               return false;
           }
   
  -        reportPrinter = new PrintWriter(reportWriter);
  +        String tmp = loggerProps.getProperty(OPT_FLUSHONCASECLOSE);
  +        if (null != tmp)
  +        {
  +            setFlushOnCaseClose((Boolean.valueOf(tmp)).booleanValue());
  +        }
  +
  +        // Use BufferedWriter for better general performance
  +        reportPrinter = new PrintWriter(new BufferedWriter(reportWriter));
           ready = true;
   
           return startResultsFile();
  @@ -409,7 +422,8 @@
       /**
        * worker method to dump the xml header and open the resultsfile element.  
        *
  -     * NEEDSDOC ($objectName$) @return
  +     * @return true if ready/OK, false if not ready (meaning we may 
  +     * not have output anything!)
        */
       protected boolean startResultsFile()
       {
  @@ -433,7 +447,8 @@
       /**
        * worker method to close the resultsfile element.  
        *
  -     * NEEDSDOC ($objectName$) @return
  +     * @return true if ready/OK, false if not ready (meaning we may 
  +     * not have output a closing tag!)
        */
       protected boolean closeResultsFile()
       {
  @@ -506,9 +521,8 @@
        * Report that a testcase has begun.
        * Begins a testcase element.  Record format:
        * <pre>&lt;testcase desc="<i>case description</i>"&gt;</pre>
  -     * @param msg message to log out
        *
  -     * NEEDSDOC @param comment
  +     * @param comment message to log out
        */
       public void testCaseInit(String comment)
       {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org