Class ForkClient
java.lang.Object
org.apache.maven.plugin.surefire.booterclient.output.ForkClient
- All Implemented Interfaces:
org.apache.maven.shared.utils.cli.StreamConsumer
Knows how to reconstruct *all* the state transmitted over stdout by the forked process.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate final class
private final class
private final class
private final class
private final class
private class
private final class
private final class
private final class
private final class
private final class
private final class
private final class
private final class
private final class
private final class
private final class
private final class
private final class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ForkedChannelDecoder
private final DefaultReporterFactory
private final ForkedChannelDecoderErrorHandler
Used by single Thread started byThreadedStreamConsumer
and therefore does not need to be volatile.private StackTraceWriter
private final int
private final ConsoleLogger
private final NotifiableTestStream
private static final String
private final AtomicBoolean
prevents from printing same warningprivate boolean
Written by one Thread and read by another: Main Thread and ForkStarter's Thread.private static final long
private static final long
private RunListener
private final AtomicLong
testSetStartedAt is set to non-zero after receivedForkedChannelEncoder.testSetStarting(ReportEntry, boolean)
. -
Constructor Summary
ConstructorsConstructorDescriptionForkClient
(DefaultReporterFactory defaultReporterFactory, NotifiableTestStream notifiableTestStream, ConsoleLogger log, AtomicBoolean printedErrorStream, int forkNumber) -
Method Summary
Modifier and TypeMethodDescriptionvoid
close
(boolean hadTimeout) final void
final void
private StackTraceWriter
deserializeStackTraceWriter
(String stackTraceMessage, String smartStackTrace, String stackTrace) private File
dumpToLoFile
(String msg, Throwable e) final DefaultReporterFactory
final StackTraceWriter
private ConsoleLogger
private ConsoleOutputReceiver
final RunListener
Used when getting reporters on the plugin side of a fork.private RunListener
final boolean
boolean
final boolean
final boolean
void
kill()
private void
logStreamWarning
(String event, Throwable e) private void
processLine
(String event) private void
protected void
Overridden by a subclass, seeForkStarter
.final void
tryToTimeout
(long currentTimeMillis, int forkedProcessTimeoutInSeconds) Called in concurrent Thread.private void
writeTestOutput
(String output, boolean newLine, boolean isStdout)
-
Field Details
-
PRINTABLE_JVM_NATIVE_STREAM
- See Also:
-
START_TIME_ZERO
private static final long START_TIME_ZERO- See Also:
-
START_TIME_NEGATIVE_TIMEOUT
private static final long START_TIME_NEGATIVE_TIMEOUT- See Also:
-
defaultReporterFactory
-
testVmSystemProperties
-
notifiableTestStream
-
testsInProgress
-
testSetStartedAt
testSetStartedAt is set to non-zero after receivedForkedChannelEncoder.testSetStarting(ReportEntry, boolean)
. -
decoder
-
log
-
printedErrorStream
prevents from printing same warning -
forkNumber
private final int forkNumber -
errorHandler
Used by single Thread started byThreadedStreamConsumer
and therefore does not need to be volatile. -
testSetReporter
-
saidGoodBye
private volatile boolean saidGoodByeWritten by one Thread and read by another: Main Thread and ForkStarter's Thread. -
errorInFork
-
-
Constructor Details
-
ForkClient
public ForkClient(DefaultReporterFactory defaultReporterFactory, NotifiableTestStream notifiableTestStream, ConsoleLogger log, AtomicBoolean printedErrorStream, int forkNumber)
-
-
Method Details
-
stopOnNextTest
protected void stopOnNextTest()Overridden by a subclass, seeForkStarter
. -
kill
public void kill() -
tryToTimeout
public final void tryToTimeout(long currentTimeMillis, int forkedProcessTimeoutInSeconds) Called in concurrent Thread. Will shutdown if timeout was reached.- Parameters:
currentTimeMillis
- current time in millis secondsforkedProcessTimeoutInSeconds
- timeout in seconds given by MOJO
-
getDefaultReporterFactory
-
consumeLine
- Specified by:
consumeLine
in interfaceorg.apache.maven.shared.utils.cli.StreamConsumer
-
setCurrentStartTime
private void setCurrentStartTime() -
hadTimeout
public final boolean hadTimeout() -
getTestSetReporter
-
processLine
-
dumpToLoFile
-
logStreamWarning
-
writeTestOutput
-
consumeMultiLineContent
- Throws:
IOException
-
getTestVmSystemProperties
-
getReporter
Used when getting reporters on the plugin side of a fork. Used by testing purposes only. May not be volatile variable.- Returns:
- A mock provider reporter
-
getOrCreateConsoleOutputReceiver
-
getOrCreateConsoleLogger
-
close
public void close(boolean hadTimeout) -
isSaidGoodBye
public final boolean isSaidGoodBye() -
getErrorInFork
-
isErrorInFork
public final boolean isErrorInFork() -
testsInProgress
-
hasTestsInProgress
public boolean hasTestsInProgress() -
deserializeStackTraceWriter
private StackTraceWriter deserializeStackTraceWriter(String stackTraceMessage, String smartStackTrace, String stackTrace)
-