Package akka.stream.testkit
Class TestPublisher.ManualProbe<I>
- java.lang.Object
-
- akka.stream.testkit.TestPublisher.ManualProbe<I>
-
- All Implemented Interfaces:
org.reactivestreams.Publisher<I>
- Direct Known Subclasses:
TestPublisher.Probe
- Enclosing class:
- TestPublisher
public static class TestPublisher.ManualProbe<I> extends java.lang.Object implements org.reactivestreams.Publisher<I>
Subscribes a givenSubscriber
to this probe publisher.
-
-
Constructor Summary
Constructors Constructor Description ManualProbe(boolean autoOnSubscribe, ActorSystem system)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description <T> T
executeAfterSubscription(scala.Function0<T> f)
<T> T
expectEventPF(scala.PartialFunction<TestPublisher.PublisherEvent,T> f)
TestPublisher.ManualProbe
expectNoMessage()
Expect no messages.TestPublisher.ManualProbe
expectNoMessage(scala.concurrent.duration.FiniteDuration max)
Expect no messages for a given duration.TestPublisher.ManualProbe
expectNoMsg()
Deprecated.Use expectNoMessage instead.TestPublisher.ManualProbe
expectNoMsg(scala.concurrent.duration.FiniteDuration max)
Deprecated.Use expectNoMessage instead.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.<T> scala.concurrent.duration.Duration
receiveWhile$default$1()
<T> scala.concurrent.duration.Duration
receiveWhile$default$2()
<T> int
receiveWhile$default$3()
void
subscribe(org.reactivestreams.Subscriber<? super I> subscriber)
Subscribes a givenSubscriber
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 betweenmin
andmax
.<T> T
within(scala.concurrent.duration.FiniteDuration max, scala.Function0<T> f)
Same as callingwithin(0 seconds, max)(f)
.
-
-
-
Constructor Detail
-
ManualProbe
public ManualProbe(boolean autoOnSubscribe, ActorSystem system)
-
-
Method Detail
-
subscribe
public void subscribe(org.reactivestreams.Subscriber<? super I> subscriber)
Subscribes a givenSubscriber
to this probe publisher.- Specified by:
subscribe
in interfaceorg.reactivestreams.Publisher<I>
- Parameters:
subscriber
- (undocumented)
-
executeAfterSubscription
public <T> T executeAfterSubscription(scala.Function0<T> f)
-
expectSubscription
public StreamTestKit.PublisherProbeSubscription<I> expectSubscription()
Expect a subscription.- Returns:
- (undocumented)
-
expectRequest
public TestPublisher.ManualProbe expectRequest(org.reactivestreams.Subscription subscription, int n)
Expect demand from a given subscription.- Parameters:
subscription
- (undocumented)n
- (undocumented)- Returns:
- (undocumented)
-
expectNoMsg
public TestPublisher.ManualProbe expectNoMsg()
Deprecated.Use expectNoMessage instead. Since 2.5.5.Expect no messages. NOTE! Timeout value is automatically multiplied by timeFactor.- Returns:
- (undocumented)
-
expectNoMsg
public TestPublisher.ManualProbe expectNoMsg(scala.concurrent.duration.FiniteDuration max)
Deprecated.Use expectNoMessage instead. Since 2.5.5.Expect no messages for a given duration. NOTE! Timeout value is automatically multiplied by timeFactor.- Parameters:
max
- (undocumented)- Returns:
- (undocumented)
-
expectNoMessage
public TestPublisher.ManualProbe expectNoMessage()
Expect no messages.- Returns:
- (undocumented)
-
expectNoMessage
public TestPublisher.ManualProbe expectNoMessage(scala.concurrent.duration.FiniteDuration max)
Expect no messages for a given duration.- Parameters:
max
- (undocumented)- Returns:
- (undocumented)
-
receiveWhile
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)
Receive messages for a given duration or until one does not match a given partial function.- Parameters:
max
- (undocumented)idle
- (undocumented)messages
- (undocumented)f
- (undocumented)- Returns:
- (undocumented)
-
receiveWhile$default$1
public <T> scala.concurrent.duration.Duration receiveWhile$default$1()
-
receiveWhile$default$2
public <T> scala.concurrent.duration.Duration receiveWhile$default$2()
-
receiveWhile$default$3
public <T> int receiveWhile$default$3()
-
expectEventPF
public <T> T expectEventPF(scala.PartialFunction<TestPublisher.PublisherEvent,T> f)
-
getPublisher
public org.reactivestreams.Publisher<I> getPublisher()
-
within
public <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 betweenmin
andmax
.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 enclosingwithin
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]) }
- Parameters:
min
- (undocumented)max
- (undocumented)f
- (undocumented)- Returns:
- (undocumented)
-
within
public <T> T within(scala.concurrent.duration.FiniteDuration max, scala.Function0<T> f)
Same as callingwithin(0 seconds, max)(f)
.- Parameters:
max
- (undocumented)f
- (undocumented)- Returns:
- (undocumented)
-
-