ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adammurd...@apache.org
Subject cvs commit: jakarta-ant-myrmidon/container/src/test/org/apache/myrmidon LogMessageTracker.java
Date Mon, 27 May 2002 02:08:56 GMT
adammurdoch    02/05/26 19:08:56

  Modified:    container/src/test/org/apache/myrmidon
                        LogMessageTracker.java
  Log:
  Ignore verbose and debug log messages when checking test output.  Fixes antlib tests.
  
  Revision  Changes    Path
  1.5       +25 -5     jakarta-ant-myrmidon/container/src/test/org/apache/myrmidon/LogMessageTracker.java
  
  Index: LogMessageTracker.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/test/org/apache/myrmidon/LogMessageTracker.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- LogMessageTracker.java	15 May 2002 10:11:55 -0000	1.4
  +++ LogMessageTracker.java	27 May 2002 02:08:56 -0000	1.5
  @@ -10,19 +10,21 @@
   import java.util.ArrayList;
   import java.util.List;
   import org.apache.myrmidon.api.event.TaskEvent;
  +import org.apache.myrmidon.api.event.LogLevel;
   
   /**
    * Asserts that the log messages are delivered, as expected and in the
    * correct order.
    *
    * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
  - * @version $Revision: 1.4 $ $Date: 2002/05/15 10:11:55 $
  + * @version $Revision: 1.5 $ $Date: 2002/05/27 02:08:56 $
    */
   public class LogMessageTracker
       extends TrackingTaskListener
   {
  -    private List m_tasks = new ArrayList();
  -    private List m_messages = new ArrayList();
  +    private final List m_tasks = new ArrayList();
  +    private final List m_messages = new ArrayList();
  +    private final List m_levels = new ArrayList();
   
       /**
        * Notify the listener that the task logged
  @@ -34,11 +36,18 @@
       {
           super.taskMessage( event );
   
  +        // Ignore the event if it is a verbose or debug message
  +        if( event.getLogLevel().isLessThan( LogLevel.INFO ) )
  +        {
  +            return;
  +        }
  +
           // Pop the next expected message off the list, and make sure it
           // matches the message in the event
  -        assertTrue( "Unexpected log message \"" + event.getMessage() + "\"", m_tasks.size()
> 0 && m_messages.size() > 0 );
  +        assertTrue( "Unexpected log message \"" + event.getMessage() + "\"", m_tasks.size()
> 0 );
           assertEquals( "Incorrect task path", m_tasks.remove( 0 ), event.getPath() );
           assertEquals( "Incorrect log message", m_messages.remove( 0 ), event.getMessage()
);
  +        assertEquals( "Incorrect log level", m_levels.remove( 0 ), event.getLogLevel()
);
       }
   
       /**
  @@ -53,11 +62,22 @@
       }
   
       /**
  -     * Adds an expected log message.
  +     * Adds an expected info message.
        */
       public void addExpectedMessage( final String taskPath, final String message )
       {
  +        addExpectedMessage( taskPath, message, LogLevel.INFO );
  +    }
  +
  +    /**
  +     * Adds an expected message.
  +     */
  +    public void addExpectedMessage( final String taskPath,
  +                                    final String message,
  +                                    final LogLevel logLevel )
  +    {
           m_tasks.add( taskPath );
           m_messages.add( message );
  +        m_levels.add( logLevel );
       }
   }
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message