avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: avalon-phoenix/src/test/org/apache/avalon/phoenix/components/logger/test LogManagerTestCase.java config3.xml
Date Sun, 16 Mar 2003 11:02:00 GMT
donaldp     2003/03/16 03:02:00

  Modified:    src/test/org/apache/avalon/phoenix/components/logger/test
                        LogManagerTestCase.java config3.xml
  Log:
  Enable unit tests for the Log4j component of LogManager
  
  Revision  Changes    Path
  1.8       +20 -6     avalon-phoenix/src/test/org/apache/avalon/phoenix/components/logger/test/LogManagerTestCase.java
  
  Index: LogManagerTestCase.java
  ===================================================================
  RCS file: /home/cvs/avalon-phoenix/src/test/org/apache/avalon/phoenix/components/logger/test/LogManagerTestCase.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- LogManagerTestCase.java	2 Nov 2002 00:29:28 -0000	1.7
  +++ LogManagerTestCase.java	16 Mar 2003 11:01:59 -0000	1.8
  @@ -84,7 +84,7 @@
           runtTestForConfigFile( 2 );
       }
   
  -    public void _testLog4jVersion()
  +    public void testLog4jVersion()
           throws Exception
       {
           runtTestForConfigFile( 3 );
  @@ -118,20 +118,34 @@
   
       private long getFileSize( final int index, final String filename )
       {
  -        final String baseDir = getBaseDir( index );
  -        final File base = new File( m_baseDirectory, baseDir );
  +        final File base = getBaseDir( index );
           final File file = new File( base, filename );
           return file.length();
       }
   
  +    private File getBaseDir( final int index )
  +    {
  +        final String baseDir = getBaseDirName( index );
  +        return new File( m_baseDirectory, baseDir );
  +    }
  +
       private Logger createHierarchy( final int index )
           throws Exception
       {
           final Configuration logs = loadConfig( "config" + index + ".xml" );
           final LogManager logManager = createLogManager();
  -        final SarMetaData sarMetaData = createSarMetaData( getBaseDir( index ) );
  +        final SarMetaData sarMetaData = createSarMetaData( getBaseDirName( index ) );
   
           cleanHomeDirectory( sarMetaData );
  +
  +        //make sure directory is created else log4j will fail.
  +        if( 3 == index )
  +        {
  +            final File file =
  +                new File( getBaseDir( index ).getAbsolutePath() + "/logs" );
  +            file.mkdirs();
  +        }
  +
           final DefaultContext context = new DefaultContext();
           context.put( BlockContext.APP_NAME, sarMetaData.getName() );
           context.put( BlockContext.APP_HOME_DIR, sarMetaData.getHomeDirectory() );
  @@ -140,7 +154,7 @@
           return logManager.createHierarchy( logs, context );
       }
   
  -    private String getBaseDir( final int index )
  +    private String getBaseDirName( final int index )
       {
           return "test" + index;
       }
  
  
  
  1.2       +5 -5      avalon-phoenix/src/test/org/apache/avalon/phoenix/components/logger/test/config3.xml
  
  Index: config3.xml
  ===================================================================
  RCS file: /home/cvs/avalon-phoenix/src/test/org/apache/avalon/phoenix/components/logger/test/config3.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- config3.xml	28 Oct 2002 01:22:59 -0000	1.1
  +++ config3.xml	16 Mar 2003 11:02:00 -0000	1.2
  @@ -1,20 +1,20 @@
   <logs version="log4j">
   
       <appender name="DEFAULT" class="org.apache.log4j.FileAppender">
  -        <param name="File" value="./logs/default.log"/>
  +        <param name="File" value="test/test3/logs/default.log"/>
           <param name="Append" value="false"/>
           <layout class="org.apache.log4j.PatternLayout">
               <param name="ConversionPattern"
  -                value="%p - %m%n"/>
  +                value="%p [%c] - %m%n"/>
           </layout>
       </appender>
   
       <appender name="MYBLOCK_FILE" class="org.apache.log4j.FileAppender">
  -        <param name="File" value="./logs/myBlock.log"/>
  +        <param name="File" value="test/test3/logs/myBlock.log"/>
           <param name="Append" value="false"/>
           <layout class="org.apache.log4j.PatternLayout">
               <param name="ConversionPattern"
  -                value="%p - %m%n"/>
  +                value="%p [%c] - %m%n"/>
           </layout>
       </appender>
   
  @@ -23,7 +23,7 @@
           <appender-ref ref="DEFAULT"/>
       </root>
   
  -    <logger name="myBlock">
  +    <logger name="root.myBlock">
           <priority value="debug"/>
           <appender-ref ref="MYBLOCK_FILE"/>
       </logger>
  
  
  

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


Mime
View raw message