org.apache.commons.configuration.event
Class ConfigurationListenerTestImpl

java.lang.Object
  extended by org.apache.commons.configuration.event.ConfigurationListenerTestImpl
All Implemented Interfaces:
ConfigurationListener

public class ConfigurationListenerTestImpl
extends Object
implements ConfigurationListener

A test event listener class that can be used for testing whether configurations generated correct events.

Version:
$Id: ConfigurationListenerTestImpl.java 1225648 2011-12-29 20:55:07Z oheger $
Author:
Commons Configuration team

Constructor Summary
ConfigurationListenerTestImpl(Object source)
          Creates a new instance of ConfigurationListenerTestImpl and sets the expected event source.
 
Method Summary
 void checkEvent(int type, String propName, Object propValue, boolean before)
          Checks an expected event.
 void checkEventCount(int minEvents)
          Checks if at least minEvents events have been received.
 void configurationChanged(ConfigurationEvent event)
           
 void done()
          Checks if all events has been processed.
 ConfigurationEvent nextEvent(int expectedType)
          Returns the next received event and checks for the expected type.
 void skipToLast(int type)
          Skips to the last received event and checks that no events of the given type have been received.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConfigurationListenerTestImpl

public ConfigurationListenerTestImpl(Object source)
Creates a new instance of ConfigurationListenerTestImpl and sets the expected event source.

Parameters:
source - the event source (null if the source need not to be checked)
Method Detail

configurationChanged

public void configurationChanged(ConfigurationEvent event)
Specified by:
configurationChanged in interface ConfigurationListener

checkEventCount

public void checkEventCount(int minEvents)
Checks if at least minEvents events have been received.

Parameters:
minEvents - the minimum number of expected events

checkEvent

public void checkEvent(int type,
                       String propName,
                       Object propValue,
                       boolean before)
Checks an expected event.

Parameters:
type - the event type
propName - the expected property name
propValue - the expected property value
before - the expected before flag

nextEvent

public ConfigurationEvent nextEvent(int expectedType)
Returns the next received event and checks for the expected type. This method can be used instead of checkEvent() for comparing complex event values.

Parameters:
expectedType - the expected type of the event
Returns:
the event object

skipToLast

public void skipToLast(int type)
Skips to the last received event and checks that no events of the given type have been received. This method is used by checks for detail events to ignore the detail events.

Parameters:
type - the event type

done

public void done()
Checks if all events has been processed.



Copyright © 2001-2012 The Apache Software Foundation. All Rights Reserved.