public static class TestPublisher.ManualProbe<I>
extends java.lang.Object
implements org.reactivestreams.Publisher<I>
Publisher
that allows various assertions.
This probe does not track demand. Therefore you need to expect demand before sending
elements downstream.Constructor and Description |
---|
ManualProbe(boolean autoOnSubscribe,
ActorSystem system) |
Modifier and Type | Method and Description |
---|---|
<T> T |
expectEventPF(scala.PartialFunction<TestPublisher.PublisherEvent,T> f) |
TestPublisher.ManualProbe |
expectNoMsg()
Expect no messages.
|
TestPublisher.ManualProbe |
expectNoMsg(scala.concurrent.duration.FiniteDuration max)
Expect no messages for a given duration.
|
TestPublisher.ManualProbe |
expectRequest(org.reactivestreams.Subscription subscription,
int n)
Expect demand from a given subscription.
|
StreamTestKit.PublisherProbeSubscription<I> |
expectSubscription()
Expect a subscription.
|
org.reactivestreams.Publisher<I> |
getPublisher() |
<T> scala.collection.immutable.Seq<T> |
receiveWhile(scala.concurrent.duration.Duration max,
scala.concurrent.duration.Duration idle,
int messages,
scala.PartialFunction<TestPublisher.PublisherEvent,T> f)
Receive messages for a given duration or until one does not match a given partial function.
|
void |
subscribe(org.reactivestreams.Subscriber<? super I> subscriber)
Subscribes a given
Subscriber to this probe publisher. |
<T> T |
within(scala.concurrent.duration.FiniteDuration min,
scala.concurrent.duration.FiniteDuration max,
scala.Function0<T> f)
Execute code block while bounding its execution time between
min and
max . |
<T> T |
within(scala.concurrent.duration.FiniteDuration max,
scala.Function0<T> f)
Same as calling
within(0 seconds, max)(f) . |
public ManualProbe(boolean autoOnSubscribe, ActorSystem system)
public void subscribe(org.reactivestreams.Subscriber<? super I> subscriber)
Subscriber
to this probe publisher.subscribe
in interface org.reactivestreams.Publisher<I>
subscriber
- (undocumented)public StreamTestKit.PublisherProbeSubscription<I> expectSubscription()
public TestPublisher.ManualProbe expectRequest(org.reactivestreams.Subscription subscription, int n)
subscription
- (undocumented)n
- (undocumented)public TestPublisher.ManualProbe expectNoMsg()
public TestPublisher.ManualProbe expectNoMsg(scala.concurrent.duration.FiniteDuration max)
max
- (undocumented)public <T> scala.collection.immutable.Seq<T> receiveWhile(scala.concurrent.duration.Duration max, scala.concurrent.duration.Duration idle, int messages, scala.PartialFunction<TestPublisher.PublisherEvent,T> f)
max
- (undocumented)idle
- (undocumented)messages
- (undocumented)f
- (undocumented)public <T> T expectEventPF(scala.PartialFunction<TestPublisher.PublisherEvent,T> f)
public org.reactivestreams.Publisher<I> getPublisher()
public <T> T within(scala.concurrent.duration.FiniteDuration min, scala.concurrent.duration.FiniteDuration max, scala.Function0<T> f)
min
and
max
. within
blocks may be nested. All methods in this trait which
take maximum wait times are available in a version which implicitly uses
the remaining time governed by the innermost enclosing within
block.
Note that the timeout is scaled using Duration.dilated, which uses the configuration entry "akka.test.timefactor", while the min Duration is not.
val ret = within(50 millis) {
test ! "ping"
expectMsgClass(classOf[String])
}
min
- (undocumented)max
- (undocumented)f
- (undocumented)public <T> T within(scala.concurrent.duration.FiniteDuration max, scala.Function0<T> f)
within(0 seconds, max)(f)
.max
- (undocumented)f
- (undocumented)