Package org.apache.maven.surefire.booter
Class ForkingRunListener
java.lang.Object
org.apache.maven.surefire.booter.ForkingRunListener
- All Implemented Interfaces:
org.apache.maven.plugin.surefire.log.api.ConsoleLogger
,ConsoleOutputReceiver
,ConsoleStream
,RunListener
public class ForkingRunListener
extends Object
implements RunListener, org.apache.maven.plugin.surefire.log.api.ConsoleLogger, ConsoleOutputReceiver, ConsoleStream
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.
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
FieldsModifier and TypeFieldDescriptionstatic final byte
static final byte
INFO loggerstatic final byte
DEBUG loggerstatic final byte
ERROR loggerstatic final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
WARNING logger -
Constructor Summary
ConstructorsConstructorDescriptionForkingRunListener
(PrintStream target, int testSetChannelId, boolean trimStackTraces) -
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]
createHeader
(byte booterCode, int testSetChannel) void
static void
encode
(StringBuilder stringBuilder, StackTraceWriter stackTraceWriter, boolean trimStackTraces) void
void
void
void
boolean
boolean
boolean
boolean
void
println
(byte[] buf, int off, int len) void
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
Event fired skipping an execution of remaining test-set in other fork(s); or does nothing if no forks.void
testFailed
(ReportEntry report) Event fired when a test ended with a failure (anticipated problem)void
testSetCompleted
(TestSetReportEntry report) Indicates end of a given test-setvoid
testSetStarting
(TestSetReportEntry report) Indicates the start of a given test-setvoid
testSkipped
(ReportEntry report) Event fired when a test is skippedvoid
testStarting
(ReportEntry report) Event fired when a test is about to startvoid
testSucceeded
(ReportEntry report) Event fired when a test ended successfullyvoid
void
writeTestOutput
(byte[] buf, int off, int len, boolean stdout) Forwards process output from the running test-case into the reporting system
-
Field Details
-
BOOTERCODE_TESTSET_STARTING
public static final byte BOOTERCODE_TESTSET_STARTING- See Also:
-
BOOTERCODE_TESTSET_COMPLETED
public static final byte BOOTERCODE_TESTSET_COMPLETED- See Also:
-
BOOTERCODE_STDOUT
public static final byte BOOTERCODE_STDOUT- See Also:
-
BOOTERCODE_STDERR
public static final byte BOOTERCODE_STDERR- See Also:
-
BOOTERCODE_TEST_STARTING
public static final byte BOOTERCODE_TEST_STARTING- See Also:
-
BOOTERCODE_TEST_SUCCEEDED
public static final byte BOOTERCODE_TEST_SUCCEEDED- See Also:
-
BOOTERCODE_TEST_ERROR
public static final byte BOOTERCODE_TEST_ERROR- See Also:
-
BOOTERCODE_TEST_FAILED
public static final byte BOOTERCODE_TEST_FAILED- See Also:
-
BOOTERCODE_TEST_SKIPPED
public static final byte BOOTERCODE_TEST_SKIPPED- See Also:
-
BOOTERCODE_TEST_ASSUMPTIONFAILURE
public static final byte BOOTERCODE_TEST_ASSUMPTIONFAILURE- See Also:
-
BOOTERCODE_CONSOLE
public static final byte BOOTERCODE_CONSOLEINFO logger- See Also:
-
BOOTERCODE_SYSPROPS
public static final byte BOOTERCODE_SYSPROPS- See Also:
-
BOOTERCODE_NEXT_TEST
public static final byte BOOTERCODE_NEXT_TEST- See Also:
-
BOOTERCODE_STOP_ON_NEXT_TEST
public static final byte BOOTERCODE_STOP_ON_NEXT_TEST- See Also:
-
BOOTERCODE_ERROR
public static final byte BOOTERCODE_ERRORERROR logger- See Also:
-
BOOTERCODE_BYE
public static final byte BOOTERCODE_BYE- See Also:
-
BOOTERCODE_DEBUG
public static final byte BOOTERCODE_DEBUGDEBUG logger- See Also:
-
BOOTERCODE_WARNING
public static final byte BOOTERCODE_WARNINGWARNING logger- See Also:
-
-
Constructor Details
-
ForkingRunListener
-
-
Method Details
-
testSetStarting
Description copied from interface:RunListener
Indicates the start of a given test-set- Specified by:
testSetStarting
in interfaceRunListener
- Parameters:
report
- the report entry describing the testset
-
testSetCompleted
Description copied from interface:RunListener
Indicates end of a given test-set- Specified by:
testSetCompleted
in interfaceRunListener
- Parameters:
report
- the report entry describing the testset
-
testStarting
Description copied from interface:RunListener
Event fired when a test is about to start- Specified by:
testStarting
in interfaceRunListener
- Parameters:
report
- The report entry to log for
-
testSucceeded
Description copied from interface:RunListener
Event fired when a test ended successfully- Specified by:
testSucceeded
in interfaceRunListener
- Parameters:
report
- The report entry to log for
-
testAssumptionFailure
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 interfaceRunListener
- Parameters:
report
- The report entry to log for
-
testError
Description copied from interface:RunListener
Event fired when a test ended with an error (non anticipated problem)- Specified by:
testError
in interfaceRunListener
- Parameters:
report
- The report entry to log for
-
testFailed
Description copied from interface:RunListener
Event fired when a test ended with a failure (anticipated problem)- Specified by:
testFailed
in interfaceRunListener
- Parameters:
report
- The report entry to log for
-
testSkipped
Description copied from interface:RunListener
Event fired when a test is skipped- Specified by:
testSkipped
in interfaceRunListener
- Parameters:
report
- The report entry to log for
-
testExecutionSkippedByUser
public void testExecutionSkippedByUser()Description copied from interface:RunListener
Event fired skipping an execution of remaining test-set in other fork(s); or does nothing if no forks. The method is called bySurefireProvider
.(The event is fired after the Nth test failed to signal skipping the rest of test-set.)
- Specified by:
testExecutionSkippedByUser
in interfaceRunListener
-
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 interfaceConsoleOutputReceiver
- Parameters:
buf
- the buffer to writeoff
- offsetlen
- lenstdout
- Indicates if this is stdout
-
createHeader
public static byte[] createHeader(byte booterCode, int testSetChannel) -
isDebugEnabled
public boolean isDebugEnabled()- Specified by:
isDebugEnabled
in interfaceorg.apache.maven.plugin.surefire.log.api.ConsoleLogger
-
debug
- Specified by:
debug
in interfaceorg.apache.maven.plugin.surefire.log.api.ConsoleLogger
-
isInfoEnabled
public boolean isInfoEnabled()- Specified by:
isInfoEnabled
in interfaceorg.apache.maven.plugin.surefire.log.api.ConsoleLogger
-
info
- Specified by:
info
in interfaceorg.apache.maven.plugin.surefire.log.api.ConsoleLogger
-
isWarnEnabled
public boolean isWarnEnabled()- Specified by:
isWarnEnabled
in interfaceorg.apache.maven.plugin.surefire.log.api.ConsoleLogger
-
warning
- Specified by:
warning
in interfaceorg.apache.maven.plugin.surefire.log.api.ConsoleLogger
-
isErrorEnabled
public boolean isErrorEnabled()- Specified by:
isErrorEnabled
in interfaceorg.apache.maven.plugin.surefire.log.api.ConsoleLogger
-
error
- Specified by:
error
in interfaceorg.apache.maven.plugin.surefire.log.api.ConsoleLogger
-
error
- Specified by:
error
in interfaceorg.apache.maven.plugin.surefire.log.api.ConsoleLogger
-
error
- Specified by:
error
in interfaceorg.apache.maven.plugin.surefire.log.api.ConsoleLogger
-
encode
public static void encode(StringBuilder stringBuilder, StackTraceWriter stackTraceWriter, boolean trimStackTraces) -
println
- Specified by:
println
in interfaceConsoleStream
-
println
public void println(byte[] buf, int off, int len) - Specified by:
println
in interfaceConsoleStream
-