Class ForkingRunListener
- java.lang.Object
-
- org.apache.maven.surefire.api.booter.ForkingRunListener
-
- All Implemented Interfaces:
ConsoleLogger
,RunListener
,TestOutputReceiver<TestOutputReportEntry>
,TestReportListener<TestOutputReportEntry>
public class ForkingRunListener extends java.lang.Object implements TestReportListener<TestOutputReportEntry>
Encodes the full output of the test run to the "target".
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 thread-safe.
The synchronization in the underlying (target instance) is used to preserve thread safety of the target stream. To perform multiple writes/prints for a single request, they must synchronize on "target" variable in this class.
-
-
Field Summary
Fields Modifier and Type Field Description private MasterProcessChannelEncoder
target
private boolean
trim
-
Constructor Summary
Constructors Constructor Description ForkingRunListener(MasterProcessChannelEncoder target, boolean trim)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
debug(java.lang.String message)
void
error(java.lang.String message)
void
error(java.lang.String message, java.lang.Throwable t)
Simply delegates toerror( toString( t, message ) )
.void
error(java.lang.Throwable t)
Simply delegates to methoderror(null, Throwable)
.void
info(java.lang.String message)
boolean
isDebugEnabled()
boolean
isErrorEnabled()
boolean
isInfoEnabled()
boolean
isWarnEnabled()
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
testExecutionSkippedByUser()
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
warning(java.lang.String message)
void
writeTestOutput(TestOutputReportEntry reportEntry)
Forwards process output from the running test-case into the reporting system
-
-
-
Field Detail
-
target
private final MasterProcessChannelEncoder target
-
trim
private final boolean trim
-
-
Constructor Detail
-
ForkingRunListener
public ForkingRunListener(MasterProcessChannelEncoder target, boolean trim)
-
-
Method Detail
-
testSetStarting
public void testSetStarting(TestSetReportEntry report)
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
public void testSetCompleted(TestSetReportEntry report)
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
public void testStarting(ReportEntry report)
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
public void testSucceeded(ReportEntry report)
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
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 interfaceRunListener
- 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 interfaceRunListener
- 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 interfaceRunListener
- 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 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(TestOutputReportEntry reportEntry)
Description copied from interface:TestOutputReceiver
Forwards process output from the running test-case into the reporting system- Specified by:
writeTestOutput
in interfaceTestOutputReceiver<TestOutputReportEntry>
- Parameters:
reportEntry
- wraps test output with descriptive information of the output
-
isDebugEnabled
public boolean isDebugEnabled()
- Specified by:
isDebugEnabled
in interfaceConsoleLogger
-
debug
public void debug(java.lang.String message)
- Specified by:
debug
in interfaceConsoleLogger
-
isInfoEnabled
public boolean isInfoEnabled()
- Specified by:
isInfoEnabled
in interfaceConsoleLogger
-
info
public void info(java.lang.String message)
- Specified by:
info
in interfaceConsoleLogger
-
isWarnEnabled
public boolean isWarnEnabled()
- Specified by:
isWarnEnabled
in interfaceConsoleLogger
-
warning
public void warning(java.lang.String message)
- Specified by:
warning
in interfaceConsoleLogger
-
isErrorEnabled
public boolean isErrorEnabled()
- Specified by:
isErrorEnabled
in interfaceConsoleLogger
-
error
public void error(java.lang.String message)
- Specified by:
error
in interfaceConsoleLogger
- Parameters:
message
- message to log
-
error
public void error(java.lang.String message, java.lang.Throwable t)
Description copied from interface:ConsoleLogger
Simply delegates toerror( toString( t, message ) )
.- Specified by:
error
in interfaceConsoleLogger
- Parameters:
message
- message to logt
- exception, message and trace to log
-
error
public void error(java.lang.Throwable t)
Description copied from interface:ConsoleLogger
Simply delegates to methoderror(null, Throwable)
.- Specified by:
error
in interfaceConsoleLogger
- Parameters:
t
- exception, message and trace to log
-
-