Class ForkClient
java.lang.Object
org.apache.maven.plugin.surefire.booterclient.output.ForkClient
- All Implemented Interfaces:
EventHandler<Event>
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 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 DefaultReporterFactoryprivate StackTraceWriterprivate final intprivate final NotifiableTestStreamprivate final ForkedProcessEventNotifierprivate booleanWritten by one Thread and read by another: Main Thread and ForkStarter's Thread.private static final longprivate static final longprivate TestReportListener<TestOutputReportEntry>private final AtomicLongtestSetStartedAt is set to non-zero after receivedMasterProcessChannelEncoder.testSetStarting(TestSetReportEntry, boolean). -
Constructor Summary
ConstructorsConstructorDescriptionForkClient(DefaultReporterFactory defaultReporterFactory, NotifiableTestStream notifiableTestStream, int forkNumber) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose(boolean hadTimeout) (package private) voiddumpToLoFile(String msg) private ConsoleLoggerUsed when getting reporters on the plugin side of a fork.private TestReportListener<TestOutputReportEntry>OnlygetConsoleOutputReceiver()may call this method in another Thread.booleanvoidhandleEvent(Event event) booleanbooleanbooleanvoidkill()private voidvoidvoidtryToTimeout(long currentTimeMillis, int forkedProcessTimeoutInSeconds) Called in concurrent Thread.private voidwriteTestOutput(String output, boolean isStdout, boolean newLine, RunMode runMode, Long testRunId)
-
Field Details
-
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 receivedMasterProcessChannelEncoder.testSetStarting(TestSetReportEntry, boolean). -
notifier
-
forkNumber
private final int forkNumber -
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, int forkNumber)
-
-
Method Details
-
setStopOnNextTestListener
-
kill
public void kill() -
tryToTimeout
public 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
-
handleEvent
- Specified by:
handleEventin interfaceEventHandler<Event>
-
setCurrentStartTime
private void setCurrentStartTime() -
hadTimeout
public boolean hadTimeout() -
getTestSetReporter
OnlygetConsoleOutputReceiver()may call this method in another Thread. -
dumpToLoFile
-
writeTestOutput
-
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
-
getConsoleOutputReceiver
-
getOrCreateConsoleLogger
-
close
public void close(boolean hadTimeout) -
isSaidGoodBye
public boolean isSaidGoodBye() -
getErrorInFork
-
isErrorInFork
public boolean isErrorInFork() -
testsInProgress
-
hasTestsInProgress
public boolean hasTestsInProgress()
-