org.apache.anteater.test.log
Class BaseLogger

java.lang.Object
  |
  +--org.apache.tools.ant.ProjectComponent
        |
        +--org.apache.tools.ant.types.DataType
              |
              +--org.apache.anteater.test.BaseDataType
                    |
                    +--org.apache.anteater.test.log.BaseLogger
All Implemented Interfaces:
Groupable, Logger
Direct Known Subclasses:
ColourLogger, DebugLogger, TextLogger, XMLLogger

public abstract class BaseLogger
extends BaseDataType
implements Logger

A basic Logger implementation. Implements functionality common to most Logger classes. It performs the following functions:

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

Nested Class Summary
 class BaseLogger.TestLog
           
 
Field Summary
protected  File _destDir
           
protected  long _dt
           
protected  int _errors
           
protected  String _extension
           
protected  int _failures
           
protected  String _filenameFormat
           
protected  Boolean _overwrite
           
protected  long _t0
           
protected  int _tasks
           
protected  BaseLogger.TestLog _testLog
           
protected  boolean _useFile
           
protected  String DEFAULT_LOGDIR
          Directory relative to ${basedir} which will be the default location for log files, unless the 'todir' property is set.
 
Fields inherited from class org.apache.anteater.test.BaseDataType
debug, debugWasSet
 
Fields inherited from class org.apache.tools.ant.types.DataType
checked, description, ref
 
Fields inherited from class org.apache.tools.ant.ProjectComponent
project
 
Constructor Summary
BaseLogger()
           
 
Method Summary
 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 extension)
          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 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).
 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 org.apache.anteater.test.BaseDataType
debug, getDataTypeName, getDebug, getGroup, getRef, print, println, setDebug, setGroup, setGroup, setRefid
 
Methods inherited from class org.apache.tools.ant.types.DataType
circularReference, dieOnCircularReference, getCheckedRef, getDescription, isReference, noChildrenAllowed, setDescription, tooManyAttributes
 
Methods inherited from class org.apache.tools.ant.ProjectComponent
getProject, log, log, setProject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.anteater.test.log.Logger
actionTaskError
 
Methods inherited from interface org.apache.anteater.test.Groupable
setGroup, setGroup
 

Field Detail

DEFAULT_LOGDIR

protected String DEFAULT_LOGDIR
Directory relative to ${basedir} which will be the default location for log files, unless the 'todir' property is set.


_tasks

protected int _tasks

_errors

protected int _errors

_failures

protected int _failures

_t0

protected long _t0

_dt

protected long _dt

_testLog

protected BaseLogger.TestLog _testLog

_destDir

protected File _destDir

_extension

protected String _extension

_useFile

protected boolean _useFile

_filenameFormat

protected String _filenameFormat

_overwrite

protected Boolean _overwrite
Constructor Detail

BaseLogger

public BaseLogger()
Method Detail

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

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 extension)
Description copied from interface: Logger
Set the extension of the log file (if any).

Specified by:
setExtension in interface Logger


Ant Functional Tester -- see Project home page for details