org.apache.anteater.test.log
Class CompositeLogger

java.lang.Object
  |
  +--org.apache.anteater.test.log.CompositeLogger
All Implemented Interfaces:
Groupable, Logger

public class CompositeLogger
extends Object
implements Logger

A Logger that implements the Composite (GoF) pattern, by delegating method calls to a group of Loggers. With this, ActionTasks and Tests that use logging don't need to care how many or what type of Logger they're actually using.

Since:
June 15, 2002
Version:
$Revision: 1.9 $ $Date: 2003/03/09 15:33:12 $
Author:
Jeff Turner
See Also:
ActionTask

Constructor Summary
CompositeLogger()
           
 
Method Summary
 void actionTaskError(String msg, Exception e)
          Indicates that an error occurred before any of the tests were attempted.
 void addLogger(Logger logger)
           
 void endActionTask(ActionTask task)
          Indicates that an ActionTask has ended.
 void endTest(MatcherTest test)
          Indicates that a test against the retrieved response has completed.
 void setExtension(String ext)
          Set the extension of the log file (if any).
 void setFilenameFormat(String filenameFormat)
          Sets a template with which the names of log files are determined.
 void setGroup(Group group)
           
 void setGroup(String name)
           
 void setOverwrite(boolean overwrite)
          Set whether the logger should overwrite old log files from previous runs.
 void setTodir(File destDir)
          Set the destination directory for the log file (if any).
 void setUseFile(boolean useFile)
          Set whether the logger should log to a file (or stdout).
 int size()
           
 void startActionTask(ActionTask task)
          Indicates that an ActionTask (aka HTTP operation) has started.
 void startTest(MatcherTest test)
          Indicates the start of a test against the retrieved Response.
 void testError(String msg, Exception e)
          ActionTasks may fail unexpectedly, and these are classed as Errors and should be reported here.
 void testFailure(String msg, Exception e)
          If the ActionTask fails to validate the service, then a failure should be recorded via this method.
 void testLog(String msg)
          ActionTasks may log anything they think relevant to the user here.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompositeLogger

public CompositeLogger()
Method Detail

addLogger

public void addLogger(Logger logger)

setGroup

public void setGroup(String name)
Specified by:
setGroup in interface Groupable

setGroup

public void setGroup(Group group)
Specified by:
setGroup in interface Groupable

startActionTask

public void startActionTask(ActionTask task)
Description copied from interface: Logger
Indicates that an ActionTask (aka HTTP operation) has started. At this point the underlying implementation should start a timer. We can also conceptually start writing a new testsuite file, and fill in a blank header:

Specified by:
startActionTask in interface Logger

actionTaskError

public void actionTaskError(String msg,
                            Exception e)
Description copied from interface: Logger
Indicates that an error occurred before any of the tests were attempted. Eg, if the HTTP request times out, or the DNS lookup fails.

If this event occurs, no further tests are expected to be logged.

Specified by:
actionTaskError in interface Logger

startTest

public void startTest(MatcherTest test)
Description copied from interface: Logger
Indicates the start of a test against the retrieved Response. An internal test timer should start. Can start writing: The 'tests' field of the actiontask will be incremented

Specified by:
startTest in interface Logger

testLog

public void testLog(String msg)
Description copied from interface: Logger
ActionTasks may log anything they think relevant to the user here.

Specified by:
testLog in interface Logger

testError

public void testError(String msg,
                      Exception e)
Description copied from interface: Logger
ActionTasks may fail unexpectedly, and these are classed as Errors and should be reported here. This will add an child to the current . The 'errors' field of the actiontask will be incremented.

Specified by:
testError in interface Logger

testFailure

public void testFailure(String msg,
                        Exception e)
Description copied from interface: Logger
If the ActionTask fails to validate the service, then a failure should be recorded via this method. This will add a child to the current . The 'failures' field of the actiontask will be incremented.

Specified by:
testFailure in interface Logger

endTest

public void endTest(MatcherTest test)
Description copied from interface: Logger
Indicates that a test against the retrieved response has completed. An internal test timer should end. If the request succeeded, an entry like: is written. If the request failed or generated an error, the @testError or

Specified by:
endTest in interface Logger

endActionTask

public void endActionTask(ActionTask task)
Description copied from interface: Logger
Indicates that an ActionTask has ended. The actiontask timer should be stopped Here we can also write the assembled actiontask to a file.

Specified by:
endActionTask in interface Logger

setTodir

public void setTodir(File destDir)
Description copied from interface: Logger
Set the destination directory for the log file (if any).

Specified by:
setTodir in interface Logger

setUseFile

public void setUseFile(boolean useFile)
Description copied from interface: Logger
Set whether the logger should log to a file (or stdout).

Specified by:
setUseFile in interface Logger

setFilenameFormat

public void setFilenameFormat(String filenameFormat)
Description copied from interface: Logger
Sets a template with which the names of log files are determined.

Specified by:
setFilenameFormat in interface Logger

setOverwrite

public void setOverwrite(boolean overwrite)
Description copied from interface: Logger
Set whether the logger should overwrite old log files from previous runs.

Specified by:
setOverwrite in interface Logger

setExtension

public void setExtension(String ext)
Description copied from interface: Logger
Set the extension of the log file (if any).

Specified by:
setExtension in interface Logger

size

public int size()


Ant Functional Tester -- see Project home page for details