Class TestProvidingInputStream
- java.lang.Object
-
- org.apache.maven.plugin.surefire.booterclient.lazytestprovider.AbstractCommandReader
-
- org.apache.maven.plugin.surefire.booterclient.lazytestprovider.DefaultCommandReader
-
- org.apache.maven.plugin.surefire.booterclient.lazytestprovider.TestProvidingInputStream
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,NotifiableTestStream
,CommandReader
public final class TestProvidingInputStream extends DefaultCommandReader
AnInputStream
that, 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.
The instance is used only in reusable forks inForkStarter
by one Thread.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.concurrent.Semaphore
barrier
private java.util.concurrent.atomic.AtomicBoolean
closed
private java.util.Queue<Command>
commands
private 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 void
acknowledgeByeEventReceived()
private void
awaitNextTest()
protected void
beforeNextCommand()
Possibly waiting for next command (seeDefaultCommandReader.nextCommand()
) unless the stream is atomically closed (seeCommandReader.isClosed()
returnstrue
) before this method has returned.void
close()
boolean
isClosed()
protected Command
nextCommand()
void
noop()
void
provideNewTest()
Signal that a new test is to be provided.void
shutdown(Shutdown shutdownType)
void
skipSinceNextTest()
Sends an event to a fork jvm in order to skip tests.(package private) void
testSetFinished()
For testing purposes.-
Methods inherited from class org.apache.maven.plugin.surefire.booterclient.lazytestprovider.DefaultCommandReader
canContinue, readNextCommand
-
-
-
-
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:NotifiableTestStream
Sends 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:
nextCommand
in classDefaultCommandReader
-
beforeNextCommand
protected void beforeNextCommand() throws java.io.IOException
Description copied from class:DefaultCommandReader
Possibly waiting for next command (seeDefaultCommandReader.nextCommand()
) unless the stream is atomically closed (seeCommandReader.isClosed()
returnstrue
) before this method has returned.- Overrides:
beforeNextCommand
in classDefaultCommandReader
- Throws:
java.io.IOException
- stream error while waiting for notification regarding next test required by forked jvm
-
isClosed
public boolean isClosed()
-
provideNewTest
public void provideNewTest()
Signal that a new test is to be provided.
-
close
public void close()
-
awaitNextTest
private void awaitNextTest() throws java.io.IOException
- Throws:
java.io.IOException
-
-