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 classprivate final classprivate final classprivate final classprivate final classprivate classprivate final classprivate final classprivate final classprivate final classprivate final classprivate final classprivate final classprivate final classprivate final classprivate final classprivate final classprivate final classprivate final class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ForkedChannelDecoderprivate final DefaultReporterFactoryprivate final ForkedChannelDecoderErrorHandlerUsed by single Thread started byThreadedStreamConsumerand therefore does not need to be volatile.private StackTraceWriterprivate final intprivate final ConsoleLoggerprivate final NotifiableTestStreamprivate static final Stringprivate final AtomicBooleanprevents from printing same warningprivate booleanWritten by one Thread and read by another: Main Thread and ForkStarter's Thread.private static final longprivate static final longprivate RunListenerprivate final AtomicLongtestSetStartedAt 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 TypeMethodDescriptionvoidclose(boolean hadTimeout) final voidfinal voidprivate StackTraceWriterdeserializeStackTraceWriter(String stackTraceMessage, String smartStackTrace, String stackTrace) private FiledumpToLoFile(String msg, Throwable e) final DefaultReporterFactoryfinal StackTraceWriterprivate ConsoleLoggerprivate ConsoleOutputReceiverfinal RunListenerUsed when getting reporters on the plugin side of a fork.private RunListenerfinal booleanbooleanfinal booleanfinal booleanvoidkill()private voidlogStreamWarning(String event, Throwable e) private voidprocessLine(String event) private voidprotected voidOverridden by a subclass, seeForkStarter.final voidtryToTimeout(long currentTimeMillis, int forkedProcessTimeoutInSeconds) Called in concurrent Thread.private voidwriteTestOutput(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 byThreadedStreamConsumerand 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:
consumeLinein 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)
-