portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject cvs commit: jakarta-jetspeed-2/components/cm/src/java/org/apache/jetspeed/components AbstractComponentAwareTestCase.java
Date Sun, 29 Feb 2004 06:00:08 GMT
taylor      2004/02/28 22:00:08

  Modified:    components/cm/src/java/org/apache/jetspeed/components
                        AbstractComponentAwareTestCase.java
  Log:
  temporary patch to keep several tests from crashing (including anything that uses Digester)
  starts up Log4J in unit tests
  
  Revision  Changes    Path
  1.3       +32 -0     jakarta-jetspeed-2/components/cm/src/java/org/apache/jetspeed/components/AbstractComponentAwareTestCase.java
  
  Index: AbstractComponentAwareTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/components/cm/src/java/org/apache/jetspeed/components/AbstractComponentAwareTestCase.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AbstractComponentAwareTestCase.java	24 Feb 2004 00:46:03 -0000	1.2
  +++ AbstractComponentAwareTestCase.java	29 Feb 2004 06:00:08 -0000	1.3
  @@ -6,6 +6,12 @@
    */
   package org.apache.jetspeed.components;
   
  +import java.io.FileInputStream;
  +import java.util.Properties;
  +import org.apache.commons.logging.LogFactory;
  +import org.apache.commons.logging.impl.Log4jFactory;
  +import org.apache.log4j.PropertyConfigurator;
  +
   import org.picocontainer.MutablePicoContainer;
   
   import junit.framework.TestCase;
  @@ -61,5 +67,31 @@
       {
           this.container = container;
       }
  +
  +    public static final String LOG4J_CONFIG_FILE = "log4j.file";
  +	// TODO: make this relative, move it into script
  +    public static final String LOG4J_CONFIG_FILE_DEFAULT = "src/webapp/WEB-INF/conf/Log4j.properties";
  +    
  +    protected void setUp() throws Exception
  +    {
  +        super.setUp();
  +        
  +        System.out.println("MAIN --------------");
  +        String log4jFile = LOG4J_CONFIG_FILE_DEFAULT;
  +        Properties p = new Properties();
  +        try
  +        {
  +            p.load(new FileInputStream(log4jFile));
  +        }
  +        catch (Exception e)
  +        {
  +            e.printStackTrace();
  +        }
  +        PropertyConfigurator.configure(p);
  +        
  +        System.getProperties().setProperty(LogFactory.class.getName(), Log4jFactory.class.getName());
  +        
  +    }
  +    
   
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org


Mime
View raw message