public final class TestProvidingInputStream extends AbstractCommandStream
InputStream that, when read, provides test class names out of a queue.
The Stream provides only one test at a time, but only after provideNewTest() has been invoked.
After providing each test class name, followed by a newline character, a flush is performed on the
FlushReceiver provided by the FlushReceiverProvider that can be set using
AbstractForkInputStream.setFlushReceiverProvider(FlushReceiverProvider).
The instance is used only in reusable forks in ForkStarter
by one Thread.| Modifier and Type | Field and 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 and Description |
|---|
TestProvidingInputStream(java.util.Queue<java.lang.String> testClassNames)
C'tor
|
| Modifier and Type | Method and Description |
|---|---|
private void |
awaitNextTest() |
protected void |
beforeNextCommand()
Possibly waiting for next command (see
AbstractCommandStream.nextCommand()) unless the stream is atomically
closed (see AbstractCommandStream.isClosed() returns true) before this method has returned. |
protected boolean |
canContinue()
Unnecessarily opposite to
AbstractCommandStream.isClosed() however may respect
last command and AbstractCommandStream.isClosed(). |
void |
close() |
protected 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.
|
getLastCommand, invalidateInternalBuffer, readsetFlushReceiverProvider, tryFlushprivate final java.util.concurrent.Semaphore barrier
private final java.util.Queue<Command> commands
private final java.util.concurrent.atomic.AtomicBoolean closed
private final java.util.Queue<java.lang.String> testClassNames
public TestProvidingInputStream(java.util.Queue<java.lang.String> testClassNames)
testClassNames - source of the tests to be read from this streamvoid testSetFinished()
public void skipSinceNextTest()
NotifiableTestStreampublic void shutdown(Shutdown shutdownType)
public void noop()
protected Command nextCommand()
nextCommand in class AbstractCommandStreamprotected void beforeNextCommand()
throws java.io.IOException
AbstractCommandStreamAbstractCommandStream.nextCommand()) unless the stream is atomically
closed (see AbstractCommandStream.isClosed() returns true) before this method has returned.beforeNextCommand in class AbstractCommandStreamjava.io.IOExceptionprotected boolean isClosed()
isClosed in class AbstractCommandStreamprotected boolean canContinue()
AbstractCommandStreamAbstractCommandStream.isClosed() however may respect
last command and AbstractCommandStream.isClosed().canContinue in class AbstractCommandStreampublic void provideNewTest()
public void close()
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.InputStreamprivate void awaitNextTest()
throws java.io.IOException
java.io.IOException