Class TestProvidingInputStream
- java.lang.Object
-
- java.io.InputStream
-
- org.apache.maven.plugin.surefire.booterclient.lazytestprovider.AbstractForkInputStream
-
- org.apache.maven.plugin.surefire.booterclient.lazytestprovider.AbstractCommandStream
-
- org.apache.maven.plugin.surefire.booterclient.lazytestprovider.TestProvidingInputStream
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,NotifiableTestStream
public final class TestProvidingInputStream extends AbstractCommandStream
AnInputStreamthat, when read, provides test class names out of a queue.
The Stream provides only one test at a time, but only afterprovideNewTest()has been invoked.
After providing each test class name, followed by a newline character, a flush is performed on theFlushReceiverprovided by theFlushReceiverProviderthat can be set usingAbstractForkInputStream.setFlushReceiverProvider(FlushReceiverProvider).
The instance is used only in reusable forks inForkStarterby one Thread.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.concurrent.Semaphorebarrierprivate java.util.concurrent.atomic.AtomicBooleanclosedprivate java.util.Queue<Command>commandsprivate java.util.Queue<java.lang.String>testClassNames
-
Constructor Summary
Constructors Constructor Description TestProvidingInputStream(java.util.Queue<java.lang.String> testClassNames)C'tor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidacknowledgeByeEventReceived()private voidawaitNextTest()protected voidbeforeNextCommand()Possibly waiting for next command (seeAbstractCommandStream.nextCommand()) unless the stream is atomically closed (seeAbstractCommandStream.isClosed()returnstrue) before this method has returned.voidclose()protected booleanisClosed()protected CommandnextCommand()voidnoop()voidprovideNewTest()Signal that a new test is to be provided.voidshutdown(Shutdown shutdownType)voidskipSinceNextTest()Sends an event to a fork jvm in order to skip tests.(package private) voidtestSetFinished()For testing purposes.-
Methods inherited from class org.apache.maven.plugin.surefire.booterclient.lazytestprovider.AbstractCommandStream
canContinue, invalidateInternalBuffer, read
-
Methods inherited from class org.apache.maven.plugin.surefire.booterclient.lazytestprovider.AbstractForkInputStream
setFlushReceiverProvider, tryFlush
-
-
-
-
Field Detail
-
barrier
private final java.util.concurrent.Semaphore barrier
-
commands
private final java.util.Queue<Command> commands
-
closed
private final java.util.concurrent.atomic.AtomicBoolean closed
-
testClassNames
private final java.util.Queue<java.lang.String> testClassNames
-
-
Method Detail
-
testSetFinished
void testSetFinished()
For testing purposes.
-
skipSinceNextTest
public void skipSinceNextTest()
Description copied from interface:NotifiableTestStreamSends an event to a fork jvm in order to skip tests. Returns immediately without blocking.
-
shutdown
public void shutdown(Shutdown shutdownType)
-
noop
public void noop()
-
acknowledgeByeEventReceived
public void acknowledgeByeEventReceived()
-
nextCommand
protected Command nextCommand()
- Specified by:
nextCommandin classAbstractCommandStream
-
beforeNextCommand
protected void beforeNextCommand() throws java.io.IOExceptionDescription copied from class:AbstractCommandStreamPossibly waiting for next command (seeAbstractCommandStream.nextCommand()) unless the stream is atomically closed (seeAbstractCommandStream.isClosed()returnstrue) before this method has returned.- Overrides:
beforeNextCommandin classAbstractCommandStream- Throws:
java.io.IOException- stream error while waiting for notification regarding next test required by forked jvm
-
isClosed
protected boolean isClosed()
- Specified by:
isClosedin classAbstractCommandStream
-
provideNewTest
public void provideNewTest()
Signal that a new test is to be provided.
-
close
public void close()
- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.io.InputStream
-
awaitNextTest
private void awaitNextTest() throws java.io.IOException- Throws:
java.io.IOException
-
-