Class TestPublisher.ManualProbe<I>

java.lang.Object
org.apache.pekko.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 Object implements org.reactivestreams.Publisher<I>
  • Method Details

    • subscribe

      public void subscribe(org.reactivestreams.Subscriber<? super I> subscriber)
      Subscribes a given Subscriber to this probe publisher.
      Specified by:
      subscribe in interface org.reactivestreams.Publisher<I>
    • executeAfterSubscription

      public <T> T executeAfterSubscription(scala.Function0<T> f)
    • executeAfterSubscription

      public <T> T executeAfterSubscription(Creator<T> f)
      JAVA API
      Since:
      1.1.0
    • expectSubscription

      public StreamTestKit.PublisherProbeSubscription<I> expectSubscription()
      Expect a subscription.
    • expectRequest

      public TestPublisher.ManualProbe expectRequest(org.reactivestreams.Subscription subscription, int n)
      Expect demand from a given subscription.
    • expectNoMessage

      public TestPublisher.ManualProbe expectNoMessage()
      Expect no messages. Waits for the default period configured as pekko.actor.testkit.expect-no-message-default.
    • expectNoMessage

      public TestPublisher.ManualProbe expectNoMessage(scala.concurrent.duration.FiniteDuration max)
      Expect no messages for a given duration.
    • expectNoMessage

      public TestPublisher.ManualProbe expectNoMessage(Duration max)
      JAVA API

      Expect no messages for a given duration.

      Since:
      1.1.0
    • 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.
    • receiveWhile

      public <T> List<T> receiveWhile(Duration max, Duration idle, int messages, scala.PartialFunction<TestPublisher.PublisherEvent,T> f)
      JAVA API

      Receive messages for a given duration or until one does not match a given partial function.

      Since:
      1.1.0
    • 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)
      JAVA API

      Receive messages for a given duration or until one does not match a given partial function.

      Since:
      1.1.0
    • 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 between 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 "pekko.test.timefactor", while the min Duration is not.

      
       val ret = within(50 millis) {
         test ! "ping"
         expectMsgClass(classOf[String])
       }
       
    • within

      public <T> T within(Duration min, Duration max, Creator<T> creator)
      JAVA API

      Execute code block while bounding its execution time between 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 "pekko.test.timefactor", while the min Duration is not.

      
       val ret = within(Duration.ofMillis(50)) {
         test ! "ping"
         expectMsgClass(classOf[String])
       }
       

      Since:
      1.1.0
    • within

      public <T> T within(scala.concurrent.duration.FiniteDuration max, scala.Function0<T> f)
      Same as calling within(0 seconds, max)(f).
    • within

      public <T> T within(Duration max, Creator<T> creator)
      JAVA API

      Same as calling within(Duration.ofSeconds(0), max)(f).

      Since:
      1.1.0