org.apache.maven.surefire.booter
Class ForkingRunListener

java.lang.Object
  extended by org.apache.maven.surefire.booter.ForkingRunListener
All Implemented Interfaces:
ConsoleLogger, ConsoleOutputReceiver, RunListener

public class ForkingRunListener
extends Object
implements RunListener, ConsoleLogger, ConsoleOutputReceiver

Encodes the full output of the test run to the stdout stream.

This class and the ForkClient contain the full definition of the "wire-level" protocol used by the forked process. The protocol is *not* part of any public api and may change without further notice.

This class is threadsafe.

The synchronization in the underlying PrintStream (target instance) is used to preserve thread safety of the output stream. To perform multiple writes/prints for a single request, they must synchronize on "target" variable in this class.

Author:
Kristian Rosenvold

Field Summary
static byte BOOTERCODE_BYE
           
static byte BOOTERCODE_CONSOLE
           
static byte BOOTERCODE_ERROR
           
static byte BOOTERCODE_NEXT_TEST
           
static byte BOOTERCODE_STDERR
           
static byte BOOTERCODE_STDOUT
           
static byte BOOTERCODE_SYSPROPS
           
static byte BOOTERCODE_TEST_ASSUMPTIONFAILURE
           
static byte BOOTERCODE_TEST_ERROR
           
static byte BOOTERCODE_TEST_FAILED
           
static byte BOOTERCODE_TEST_SKIPPED
           
static byte BOOTERCODE_TEST_STARTING
           
static byte BOOTERCODE_TEST_SUCCEEDED
           
static byte BOOTERCODE_TESTSET_COMPLETED
           
static byte BOOTERCODE_TESTSET_STARTING
           
 
Constructor Summary
ForkingRunListener(PrintStream target, int testSetChannelId, boolean trimStackTraces)
           
 
Method Summary
static byte[] createHeader(byte booterCode, int testSetChannel)
           
static void encode(StringBuffer stringBuffer, StackTraceWriter stackTraceWriter, boolean trimStackTraces)
           
 void info(String message)
           
 void testAssumptionFailure(ReportEntry report)
          Event fired when a test assumption failure was encountered.
 void testError(ReportEntry report)
          Event fired when a test ended with an error (non anticipated problem)
 void testFailed(ReportEntry report)
          Event fired when a test ended with a failure (anticipated problem)
 void testSetCompleted(ReportEntry report)
          Indicates end of a given test-set
 void testSetStarting(ReportEntry report)
          Indicates the start of a given test-set
 void testSkipped(ReportEntry report)
          Event fired when a test is skipped
 void testStarting(ReportEntry report)
          Event fired when a test is about to start
 void testSucceeded(ReportEntry report)
          Event fired when a test ended successfully
 void writeTestOutput(byte[] buf, int off, int len, boolean stdout)
          Forwards process output from the running test-case into the reporting system
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BOOTERCODE_TESTSET_STARTING

public static final byte BOOTERCODE_TESTSET_STARTING
See Also:
Constant Field Values

BOOTERCODE_TESTSET_COMPLETED

public static final byte BOOTERCODE_TESTSET_COMPLETED
See Also:
Constant Field Values

BOOTERCODE_STDOUT

public static final byte BOOTERCODE_STDOUT
See Also:
Constant Field Values

BOOTERCODE_STDERR

public static final byte BOOTERCODE_STDERR
See Also:
Constant Field Values

BOOTERCODE_TEST_STARTING

public static final byte BOOTERCODE_TEST_STARTING
See Also:
Constant Field Values

BOOTERCODE_TEST_SUCCEEDED

public static final byte BOOTERCODE_TEST_SUCCEEDED
See Also:
Constant Field Values

BOOTERCODE_TEST_ERROR

public static final byte BOOTERCODE_TEST_ERROR
See Also:
Constant Field Values

BOOTERCODE_TEST_FAILED

public static final byte BOOTERCODE_TEST_FAILED
See Also:
Constant Field Values

BOOTERCODE_TEST_SKIPPED

public static final byte BOOTERCODE_TEST_SKIPPED
See Also:
Constant Field Values

BOOTERCODE_TEST_ASSUMPTIONFAILURE

public static final byte BOOTERCODE_TEST_ASSUMPTIONFAILURE
See Also:
Constant Field Values

BOOTERCODE_CONSOLE

public static final byte BOOTERCODE_CONSOLE
See Also:
Constant Field Values

BOOTERCODE_SYSPROPS

public static final byte BOOTERCODE_SYSPROPS
See Also:
Constant Field Values

BOOTERCODE_NEXT_TEST

public static final byte BOOTERCODE_NEXT_TEST
See Also:
Constant Field Values

BOOTERCODE_ERROR

public static final byte BOOTERCODE_ERROR
See Also:
Constant Field Values

BOOTERCODE_BYE

public static final byte BOOTERCODE_BYE
See Also:
Constant Field Values
Constructor Detail

ForkingRunListener

public ForkingRunListener(PrintStream target,
                          int testSetChannelId,
                          boolean trimStackTraces)
Method Detail

testSetStarting

public void testSetStarting(ReportEntry report)
Description copied from interface: RunListener
Indicates the start of a given test-set

Specified by:
testSetStarting in interface RunListener
Parameters:
report - the report entry describing the testset

testSetCompleted

public void testSetCompleted(ReportEntry report)
Description copied from interface: RunListener
Indicates end of a given test-set

Specified by:
testSetCompleted in interface RunListener
Parameters:
report - the report entry describing the testset

testStarting

public void testStarting(ReportEntry report)
Description copied from interface: RunListener
Event fired when a test is about to start

Specified by:
testStarting in interface RunListener
Parameters:
report - The report entry to log for

testSucceeded

public void testSucceeded(ReportEntry report)
Description copied from interface: RunListener
Event fired when a test ended successfully

Specified by:
testSucceeded in interface RunListener
Parameters:
report - The report entry to log for

testAssumptionFailure

public void testAssumptionFailure(ReportEntry report)
Description copied from interface: RunListener
Event fired when a test assumption failure was encountered. An assumption failure indicates that the test is not relevant

Specified by:
testAssumptionFailure in interface RunListener
Parameters:
report - The report entry to log for

testError

public void testError(ReportEntry report)
Description copied from interface: RunListener
Event fired when a test ended with an error (non anticipated problem)

Specified by:
testError in interface RunListener
Parameters:
report - The report entry to log for

testFailed

public void testFailed(ReportEntry report)
Description copied from interface: RunListener
Event fired when a test ended with a failure (anticipated problem)

Specified by:
testFailed in interface RunListener
Parameters:
report - The report entry to log for

testSkipped

public void testSkipped(ReportEntry report)
Description copied from interface: RunListener
Event fired when a test is skipped

Specified by:
testSkipped in interface RunListener
Parameters:
report - The report entry to log for

writeTestOutput

public void writeTestOutput(byte[] buf,
                            int off,
                            int len,
                            boolean stdout)
Description copied from interface: ConsoleOutputReceiver
Forwards process output from the running test-case into the reporting system

Specified by:
writeTestOutput in interface ConsoleOutputReceiver
Parameters:
buf - the buffer to write
off - offset
len - len
stdout - Indicates if this is stdout

createHeader

public static byte[] createHeader(byte booterCode,
                                  int testSetChannel)

info

public void info(String message)
Specified by:
info in interface ConsoleLogger

encode

public static void encode(StringBuffer stringBuffer,
                          StackTraceWriter stackTraceWriter,
                          boolean trimStackTraces)


Copyright © 2004-2013 The Apache Software Foundation. All Rights Reserved.