public class WaitingConsumer extends Object implements Consumer<OutputFrame>
BlockingDeque and enables tests
to wait for a matching condition.| Constructor and Description |
|---|
WaitingConsumer() |
| Modifier and Type | Method and Description |
|---|---|
void |
accept(OutputFrame frame) |
LinkedBlockingDeque<OutputFrame> |
getFrames()
Get access to the underlying frame buffer.
|
void |
waitUntil(Predicate<OutputFrame> predicate)
Wait until any frame (usually, line) of output matches the provided predicate.
|
void |
waitUntil(Predicate<OutputFrame> predicate,
int limit,
TimeUnit limitUnit)
Wait until any frame (usually, line) of output matches the provided predicate.
|
void |
waitUntil(Predicate<OutputFrame> predicate,
long limit,
TimeUnit limitUnit,
int times)
Wait until any frame (usually, line) of output matches the provided predicate.
|
void |
waitUntilEnd()
Wait until Docker closes the stream of output.
|
void |
waitUntilEnd(long limit,
TimeUnit limitUnit)
Wait until Docker closes the stream of output.
|
public void accept(OutputFrame frame)
accept in interface Consumer<OutputFrame>public LinkedBlockingDeque<OutputFrame> getFrames()
public void waitUntil(Predicate<OutputFrame> predicate) throws TimeoutException
Note that lines will often have a trailing newline character, and this is not stripped off before the predicate is tested.
predicate - a predicate to test against each frameTimeoutExceptionpublic void waitUntil(Predicate<OutputFrame> predicate, int limit, TimeUnit limitUnit) throws TimeoutException
Note that lines will often have a trailing newline character, and this is not stripped off before the predicate is tested.
predicate - a predicate to test against each framelimit - maximum time to waitlimitUnit - maximum time to wait (units)TimeoutExceptionpublic void waitUntil(Predicate<OutputFrame> predicate, long limit, TimeUnit limitUnit, int times) throws TimeoutException
Note that lines will often have a trailing newline character, and this is not stripped off before the predicate is tested.
predicate - a predicate to test against each framelimit - maximum time to waitlimitUnit - maximum time to wait (units)times - number of times the predicate has to matchTimeoutExceptionpublic void waitUntilEnd()
throws TimeoutException
TimeoutExceptionpublic void waitUntilEnd(long limit,
TimeUnit limitUnit)
throws TimeoutException
limit - maximum time to waitlimitUnit - maximum time to wait (units)TimeoutExceptionCopyright © 2017. All rights reserved.