net.sourceforge.sqlunit.reporters
Class ReporterList

java.lang.Object
  extended by net.sourceforge.sqlunit.reporters.ReporterList
All Implemented Interfaces:
IReporter

public class ReporterList
extends java.lang.Object
implements IReporter

A IReporter that contains a list of other IReporters. Used to provide reporting to multiple places.

Version:
$Revision: 1.2 $
Author:
Ivan Ivanov

Field Summary
static java.lang.String NAME
          The name of the reporter.
 
Constructor Summary
ReporterList(int initialCapacity)
          Constructs a new IReporterList.
ReporterList(java.lang.String outputFile)
          Always throws IllegalStateException since it is not real reporter; it is just a holder of other regular reporters.
 
Method Summary
 void add(IReporter r)
          Adds a new reporter to the reporter list.
 void addFailure(java.lang.Throwable t, boolean isError)
          Called when an exception is raised during test execution.
 void echo(java.lang.String message)
          Prints the given the message to the reporter's output destination.
 void finishedTest(long elapsed, boolean success)
          Called when a test is finished.
 java.lang.String getName()
          Returns the name of the reporter that will be used in Ant task.
 boolean hasContainer()
          Returns true if the reporter is run in another context (container).
 java.util.Iterator iterator()
          Returns an iterator over all reporters.
 void newTestFile(java.lang.String testName, java.lang.String testFile)
          Called when a new test file is entered.
 void runningTest(java.lang.String name, int testIndex, java.lang.String desc)
          Called after the test is executed.
 void setConfig(java.util.Map configMap)
          Called after the connection to the database is made.
 void settingUpConnection(java.lang.String connectionId)
          Called before a new connection to a database is established.
 void setUp()
          Called before the setup section of the test file.
 int size()
          Returns the number of the reporters.
 void skippedTest(java.lang.String name, int testIndex, java.lang.String desc)
          Called when the test is skipped.
 void tearDown()
          Called before tearDown is executed.
 void tempFile(int testId, java.lang.String result, java.lang.String file)
          Called when a test has failed and a temporary file is left containing data.
 void testFileComplete(boolean success)
          Called when a test file is completed (when all tests in it are executed(.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NAME

public static final java.lang.String NAME
The name of the reporter.

See Also:
Constant Field Values
Constructor Detail

ReporterList

public ReporterList(java.lang.String outputFile)
Always throws IllegalStateException since it is not real reporter; it is just a holder of other regular reporters.

Parameters:
outputFile - not used

ReporterList

public ReporterList(int initialCapacity)
Constructs a new IReporterList.

Parameters:
initialCapacity - the initial capacity of the reporter list.
Method Detail

hasContainer

public boolean hasContainer()
Returns true if the reporter is run in another context (container). If the method returns false SQLUnit engine will print to the reporter's logfile the output from the Ant process.

Specified by:
hasContainer in interface IReporter
Returns:
true

getName

public java.lang.String getName()
Returns the name of the reporter that will be used in Ant task.

Specified by:
getName in interface IReporter
Returns:
the name of the reporter

add

public void add(IReporter r)
Adds a new reporter to the reporter list.

Parameters:
r - the new reporter

newTestFile

public void newTestFile(java.lang.String testName,
                        java.lang.String testFile)
Called when a new test file is entered. The delegation is passed to the reporters in the list.

Specified by:
newTestFile in interface IReporter
Parameters:
testName - the type of the test
testFile - the location of the rest file

settingUpConnection

public void settingUpConnection(java.lang.String connectionId)
Called before a new connection to a database is established. The delegation is passed to the reporters in the list.

Specified by:
settingUpConnection in interface IReporter
Parameters:
elConnection - the XML node describing the connection as taken from the test file

setConfig

public void setConfig(java.util.Map configMap)
Called after the connection to the database is made. The delegation is passed to the reporters in the list.

Specified by:
setConfig in interface IReporter
Parameters:
configMap - contains configuration key-value pairs.

setUp

public void setUp()
Called before the setup section of the test file. The delegation is passed to the reporters in the list.

Specified by:
setUp in interface IReporter

runningTest

public void runningTest(java.lang.String name,
                        int testIndex,
                        java.lang.String desc)
Called after the test is executed. The delegation is passed to the reporters in the list.

Specified by:
runningTest in interface IReporter
Parameters:
elTest - the XML node describing the test as taken from the test file.
testIndex - the index of the test

finishedTest

public void finishedTest(long elapsed,
                         boolean success)
Called when a test is finished. The delegation is passed to the reporters in the list.

Specified by:
finishedTest in interface IReporter
Parameters:
elTest - the XML node describing the test as taken from the test file
elapsed - the time taken for the test to execute
success - true if the test succeed; false otherwise.

skippedTest

public void skippedTest(java.lang.String name,
                        int testIndex,
                        java.lang.String desc)
Called when the test is skipped. The delegation is passed to the reporters in the list.

Specified by:
skippedTest in interface IReporter
Parameters:
elTest - the XML node describing the test as taken from the test file
testIndex - the index of the test
reason - the reason why the test is skipped

addFailure

public void addFailure(java.lang.Throwable t,
                       boolean isError)
Called when an exception is raised during test execution. The delegation is passed to the reporters in the list.

Specified by:
addFailure in interface IReporter
Parameters:
t - the exception that is thrown
isError - if true it is a test error (cause not by the very test, but by an external factor); if false it is a test failure (like a failed assertion)

tearDown

public void tearDown()
Called before tearDown is executed. The delegation is passed to the reporters in the list.

Specified by:
tearDown in interface IReporter

tempFile

public void tempFile(int testId,
                     java.lang.String result,
                     java.lang.String file)
Called when a test has failed and a temporary file is left containing data. The delegation is passed to the reporters in the list.

Specified by:
tempFile in interface IReporter
Parameters:
testId - the index of the test
result - the result of the test
file - the temporary file

testFileComplete

public void testFileComplete(boolean success)
Called when a test file is completed (when all tests in it are executed(. The delegation is passed to the reporters in the list.

Specified by:
testFileComplete in interface IReporter
Parameters:
success - if true the test is successful; if false it failed

echo

public void echo(java.lang.String message)
Prints the given the message to the reporter's output destination. The delegation is passed to the reporters in the list.

Specified by:
echo in interface IReporter
Parameters:
message - the message to be printed

size

public int size()
Returns the number of the reporters.

Returns:
the number of the reporters

iterator

public java.util.Iterator iterator()
Returns an iterator over all reporters.

Returns:
an iterator.