vmassol     2003/10/12 12:59:47

  Modified:    framework build.xml
               framework/src/test/share/org/apache/cactus/util
                        TestStringUtil.java TestUniqueGenerator.java
                        TestAll.java TestCookieUtil.java
               framework/src/test/share/org/apache/cactus/client
                        TestWebTestResultParser.java TestAll.java
               framework/src/test/share/org/apache/cactus TestAll.java
                        TestAbstractTestCase.java TestServletUtil.java
                        TestServletURL.java TestWebTestResult.java
                        TestWebRequest.java
               .        build.properties.sample
  Log:
  Allow easy turning on/off of logging during the cactus build.
  
  Revision  Changes    Path
  1.68      +11 -1     jakarta-cactus/framework/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/framework/build.xml,v
  retrieving revision 1.67
  retrieving revision 1.68
  diff -u -r1.67 -r1.68
  --- build.xml 12 Oct 2003 16:07:43 -0000      1.67
  +++ build.xml 12 Oct 2003 19:59:47 -0000      1.68
  @@ -399,7 +399,17 @@
     <target name="test" depends="test.clover.prepare,test.main.prepare"
         description="Run the unit tests">
   
  +    <!-- Save all Ant properties to a file so that it can be read by the
  +         TestAll test suite. This is to allow passing system properties
  +         to the tests. This is useful for example to configure logging
  +         properties. For example, if you are using the JDK 1.4 and you 
  +         wish to pass your custom logging file, you can can:
  +           ant -Djava.util.logging.config.file=logging.properties test -->
  +    <echoproperties destfile="${target.dir}/test.properties"/>
  +
       <junit printsummary="yes" haltonfailure="yes" fork="yes">
  +      <sysproperty key="cactus.test.propertiesFile" 
  +          file="${target.dir}/test.properties"/>
         <classpath>
           <path refid="test.class.path"/>
         </classpath>
  
  
  
  1.6       +1 -8      
jakarta-cactus/framework/src/test/share/org/apache/cactus/util/TestStringUtil.java
  
  Index: TestStringUtil.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-cactus/framework/src/test/share/org/apache/cactus/util/TestStringUtil.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TestStringUtil.java       22 Jun 2003 16:10:52 -0000      1.5
  +++ TestStringUtil.java       12 Oct 2003 19:59:47 -0000      1.6
  @@ -67,13 +67,6 @@
    */
   public class TestStringUtil extends TestCase
   {
  -    // Make sure logging is disabled
  -    static
  -    {
  -        System.setProperty("org.apache.commons.logging.Log", 
  -            "org.apache.commons.logging.impl.NoOpLog");
  -    }
  -
       /**
        * Verify package-based stack-trace filtering.
        */
  
  
  
  1.3       +1 -2      
jakarta-cactus/framework/src/test/share/org/apache/cactus/util/TestUniqueGenerator.java
  
  Index: TestUniqueGenerator.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-cactus/framework/src/test/share/org/apache/cactus/util/TestUniqueGenerator.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestUniqueGenerator.java  29 Jun 2003 15:01:39 -0000      1.2
  +++ TestUniqueGenerator.java  12 Oct 2003 19:59:47 -0000      1.3
  @@ -76,7 +76,6 @@
    */
   public class TestUniqueGenerator extends TestCase
   {
  -
       /**
        * @see TestCase#setUp
        */
  
  
  
  1.2       +2 -23     
jakarta-cactus/framework/src/test/share/org/apache/cactus/util/TestAll.java
  
  Index: TestAll.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-cactus/framework/src/test/share/org/apache/cactus/util/TestAll.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestAll.java      9 Jul 2003 16:43:37 -0000       1.1
  +++ TestAll.java      12 Oct 2003 19:59:47 -0000      1.2
  @@ -57,7 +57,6 @@
   package org.apache.cactus.util;
   
   import junit.framework.Test;
  -import junit.framework.TestCase;
   import junit.framework.TestSuite;
   
   /**
  @@ -69,28 +68,8 @@
    *
    * @version $Id$
    */
  -public class TestAll extends TestCase
  +public class TestAll
   {
  -    /**
  -     * Defines the testcase name for JUnit.
  -     *
  -     * @param theName the testcase's name.
  -     */
  -    public TestAll(String theName)
  -    {
  -        super(theName);
  -    }
  -
  -    /**
  -     * Start the tests.
  -     *
  -     * @param theArgs the arguments. Not used
  -     */
  -    public static void main(String[] theArgs)
  -    {
  -        junit.swingui.TestRunner.main(new String[] {TestAll.class.getName()});
  -    }
  -
       /**
        * @return a test suite (<code>TestSuite</code>) that includes all methods
        *         starting with "test"
  
  
  
  1.2       +1 -8      
jakarta-cactus/framework/src/test/share/org/apache/cactus/util/TestCookieUtil.java
  
  Index: TestCookieUtil.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-cactus/framework/src/test/share/org/apache/cactus/util/TestCookieUtil.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestCookieUtil.java       22 Jun 2003 16:34:45 -0000      1.1
  +++ TestCookieUtil.java       12 Oct 2003 19:59:47 -0000      1.2
  @@ -72,13 +72,6 @@
    */
   public class TestCookieUtil extends TestCase
   {
  -    // Make sure logging is disabled
  -    static
  -    {
  -        System.setProperty("org.apache.commons.logging.Log", 
  -            "org.apache.commons.logging.impl.NoOpLog");
  -    }
  -
       /**
        * Verify that an HttpClient HttpState object can be created when
        * no Cactus cookies have been defined.
  
  
  
  1.10      +1 -8      
jakarta-cactus/framework/src/test/share/org/apache/cactus/client/TestWebTestResultParser.java
  
  Index: TestWebTestResultParser.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-cactus/framework/src/test/share/org/apache/cactus/client/TestWebTestResultParser.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- TestWebTestResultParser.java      22 Jun 2003 18:00:27 -0000      1.9
  +++ TestWebTestResultParser.java      12 Oct 2003 19:59:47 -0000      1.10
  @@ -69,13 +69,6 @@
    */
   public class TestWebTestResultParser extends TestCase
   {
  -    // Make sure logging is disabled
  -    static
  -    {
  -        System.setProperty("org.apache.commons.logging.Log", 
  -            "org.apache.commons.logging.impl.NoOpLog");
  -    }
  -
       /**
        * Verify parsing when the test result contains no exception.
        *
  
  
  
  1.2       +2 -23     
jakarta-cactus/framework/src/test/share/org/apache/cactus/client/TestAll.java
  
  Index: TestAll.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-cactus/framework/src/test/share/org/apache/cactus/client/TestAll.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestAll.java      9 Jul 2003 16:43:37 -0000       1.1
  +++ TestAll.java      12 Oct 2003 19:59:47 -0000      1.2
  @@ -57,7 +57,6 @@
   package org.apache.cactus.client;
   
   import junit.framework.Test;
  -import junit.framework.TestCase;
   import junit.framework.TestSuite;
   
   /**
  @@ -69,28 +68,8 @@
    *
    * @version $Id$
    */
  -public class TestAll extends TestCase
  +public class TestAll
   {
  -    /**
  -     * Defines the testcase name for JUnit.
  -     *
  -     * @param theName the testcase's name.
  -     */
  -    public TestAll(String theName)
  -    {
  -        super(theName);
  -    }
  -
  -    /**
  -     * Start the tests.
  -     *
  -     * @param theArgs the arguments. Not used
  -     */
  -    public static void main(String[] theArgs)
  -    {
  -        junit.swingui.TestRunner.main(new String[] {TestAll.class.getName()});
  -    }
  -
       /**
        * @return a test suite (<code>TestSuite</code>) that includes all methods
        *         starting with "test"
  
  
  
  1.13      +24 -24    
jakarta-cactus/framework/src/test/share/org/apache/cactus/TestAll.java
  
  Index: TestAll.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-cactus/framework/src/test/share/org/apache/cactus/TestAll.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- TestAll.java      9 Jul 2003 16:43:37 -0000       1.12
  +++ TestAll.java      12 Oct 2003 19:59:47 -0000      1.13
  @@ -56,8 +56,11 @@
    */
   package org.apache.cactus;
   
  +import java.io.File;
  +import java.io.FileInputStream;
  +import java.util.Properties;
  +
   import junit.framework.Test;
  -import junit.framework.TestCase;
   import junit.framework.TestSuite;
   
   /**
  @@ -70,37 +73,34 @@
    *
    * @version $Id$
    */
  -public class TestAll extends TestCase
  +public class TestAll
   {
       /**
  -     * Defines the testcase name for JUnit.
  -     *
  -     * @param theName the testcase's name.
  -     */
  -    public TestAll(String theName)
  -    {
  -        super(theName);
  -    }
  -
  -    /**
  -     * Start the tests.
  -     *
  -     * @param theArgs the arguments. Not used
  -     */
  -    public static void main(String[] theArgs)
  -    {
  -        junit.swingui.TestRunner.main(new String[] {TestAll.class.getName()});
  -    }
  -
  -    /**
        * @return a test suite (<code>TestSuite</code>) that includes all methods
        *         starting with "test"
  +     * @exception Exception on failure to load the cactus properties file
        */
  -    public static Test suite()
  +    public static Test suite() throws Exception
       {
           TestSuite suite = new TestSuite(
               "Cactus unit tests not needing servlet engine");
   
  +        // Load a Cactus properties file so that we can pass system
  +        // properties to the tests. For example, this is useful to
  +        // set logging properties. If you are using the JDK 1.4 and
  +        // you wish to pass your custom logging file, you'll add the
  +        // following line to the Cactus properties file:
  +        //
  +        // java.util.logging.config.file=logging.properties
  +        
  +        String propsFile = System.getProperty("cactus.test.propertiesFile");
  +        if ((propsFile != null) && (new File(propsFile).exists()))
  +        {    
  +            Properties props = new Properties();
  +            props.load(new FileInputStream(propsFile));
  +            System.setProperties(props);
  +        }        
  +        
           suite.addTestSuite(TestAbstractTestCase.class);
           suite.addTestSuite(TestServletURL.class);
           suite.addTestSuite(TestServletUtil.class);
  
  
  
  1.12      +1 -8      
jakarta-cactus/framework/src/test/share/org/apache/cactus/TestAbstractTestCase.java
  
  Index: TestAbstractTestCase.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-cactus/framework/src/test/share/org/apache/cactus/TestAbstractTestCase.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- TestAbstractTestCase.java 21 Sep 2003 09:05:48 -0000      1.11
  +++ TestAbstractTestCase.java 12 Oct 2003 19:59:47 -0000      1.12
  @@ -67,13 +67,6 @@
    */
   public class TestAbstractTestCase extends AbstractTestAbstractTestCase
   {
  -    // Make sure logging is disabled
  -    static
  -    {
  -        System.setProperty("org.apache.commons.logging.Log", 
  -            "org.apache.commons.logging.impl.NoOpLog");
  -    }
  -
       /**
        * @see #testBeginMethodBadReturnType()
        */
  
  
  
  1.10      +1 -8      
jakarta-cactus/framework/src/test/share/org/apache/cactus/TestServletUtil.java
  
  Index: TestServletUtil.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-cactus/framework/src/test/share/org/apache/cactus/TestServletUtil.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- TestServletUtil.java      22 Jun 2003 18:00:26 -0000      1.9
  +++ TestServletUtil.java      12 Oct 2003 19:59:47 -0000      1.10
  @@ -69,13 +69,6 @@
    */
   public class TestServletUtil extends TestCase
   {
  -    // Make sure logging is disabled
  -    static
  -    {
  -        System.setProperty("org.apache.commons.logging.Log", 
  -            "org.apache.commons.logging.impl.NoOpLog");
  -    }
  -
       /**
        * Verify than <code>getQueryStringParameterEmpty()</code> returns an
        * empty string if the parameter existe but has no value defined.
  
  
  
  1.14      +1 -8      
jakarta-cactus/framework/src/test/share/org/apache/cactus/TestServletURL.java
  
  Index: TestServletURL.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-cactus/framework/src/test/share/org/apache/cactus/TestServletURL.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- TestServletURL.java       22 Jun 2003 18:00:26 -0000      1.13
  +++ TestServletURL.java       12 Oct 2003 19:59:47 -0000      1.14
  @@ -67,13 +67,6 @@
    */
   public class TestServletURL extends TestCase
   {
  -    // Make sure logging is disabled
  -    static
  -    {
  -        System.setProperty("org.apache.commons.logging.Log", 
  -            "org.apache.commons.logging.impl.NoOpLog");
  -    }
  -
       /**
        * Verify that if the context path is not empty or null it must start with
        * a "/" character.
  
  
  
  1.9       +1 -8      
jakarta-cactus/framework/src/test/share/org/apache/cactus/TestWebTestResult.java
  
  Index: TestWebTestResult.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-cactus/framework/src/test/share/org/apache/cactus/TestWebTestResult.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- TestWebTestResult.java    22 Jun 2003 18:00:26 -0000      1.8
  +++ TestWebTestResult.java    12 Oct 2003 19:59:47 -0000      1.9
  @@ -67,13 +67,6 @@
    */
   public class TestWebTestResult extends TestCase
   {
  -    // Make sure logging is disabled
  -    static
  -    {
  -        System.setProperty("org.apache.commons.logging.Log", 
  -            "org.apache.commons.logging.impl.NoOpLog");
  -    }
  -
       /**
        * Verify the correctness of the XML representation for a test result with
        * no error.
  
  
  
  1.17      +1 -8      
jakarta-cactus/framework/src/test/share/org/apache/cactus/TestWebRequest.java
  
  Index: TestWebRequest.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-cactus/framework/src/test/share/org/apache/cactus/TestWebRequest.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- TestWebRequest.java       26 Jun 2003 15:09:02 -0000      1.16
  +++ TestWebRequest.java       12 Oct 2003 19:59:47 -0000      1.17
  @@ -72,13 +72,6 @@
    */
   public class TestWebRequest extends TestCase
   {
  -    // Make sure logging is disabled
  -    static
  -    {
  -        System.setProperty("org.apache.commons.logging.Log", 
  -            "org.apache.commons.logging.impl.NoOpLog");
  -    }
  -
       /**
        * Verify that an exception is thrown when an invalid HTTP METHOD is used
        * when adding an HTTP parameter.
  
  
  
  1.84      +30 -1     jakarta-cactus/build.properties.sample
  
  Index: build.properties.sample
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/build.properties.sample,v
  retrieving revision 1.83
  retrieving revision 1.84
  diff -u -r1.83 -r1.84
  --- build.properties.sample   12 Oct 2003 16:07:43 -0000      1.83
  +++ build.properties.sample   12 Oct 2003 19:59:47 -0000      1.84
  @@ -177,3 +177,32 @@
   #jakarta.username = vmassol
   #scp = pscp
   #ssh = tortoisePlink
  +
  +# -----------------------------------------------------------------------------
  +# Logging properties
  +# -----------------------------------------------------------------------------
  +
  +# Disable logging by default when running the tests. If you wish to use a 
  +# logging subsystem, uncomment the line below. That will let Commons logging
  +# decide automatically of a suitable logging system for you. For more info, see
  +# 
http://jakarta.apache.org/commons/logging/api/org/apache/commons/logging/package-summary.html#package_description
  +org.apache.commons.logging.Log=org.apache.commons.logging.impl.NoOpLog
  +
  +# ---- JDK 1.4 logging properties
  +
  +# Following properties are useful if you're using the JDK 1.4 logging subsystem
  +# and wish to output logs to the console. Comment the NoOpLog line above and
  +# uncommment the following lines as needed.
  +java.util.logging.config.file=${basedir}/build.properties
  +handlers= java.util.logging.FileHandler,java.util.logging.ConsoleHandler
  +java.util.logging.ConsoleHandler.level = FINEST
  +java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
  +java.util.logging.FileHandler.pattern = test%u.log
  +java.util.logging.FileHandler.limit = 50000
  +java.util.logging.FileHandler.count = 1
  +java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter
  +
  +# If you want to provide finer grained logging, restrict the level for the 
  +# specific package name. 
  +# For example: org.apache.cactus.server.level = FINEST
  +org.apache.cactus.level = FINEST
  
  
  

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

Reply via email to