Search in sources :

Example 1 with MultiSubscriptionSubscriber

use of reactor.core.publisher.Operators.MultiSubscriptionSubscriber in project reactor-core by reactor.

the class OperatorsTest method scanMultiSubscriptionSubscriber.

@Test
public void scanMultiSubscriptionSubscriber() {
    CoreSubscriber<Integer> actual = new LambdaSubscriber<>(null, null, null, null);
    MultiSubscriptionSubscriber<Integer, Integer> test = new MultiSubscriptionSubscriber<Integer, Integer>(actual) {

        @Override
        public void onNext(Integer t) {
        }
    };
    Subscription parent = Operators.emptySubscription();
    test.onSubscribe(parent);
    assertThat(test.scan(Scannable.Attr.ACTUAL)).isSameAs(actual);
    assertThat(test.scan(Scannable.Attr.PARENT)).isSameAs(parent);
    test.request(34);
    assertThat(test.scan(Scannable.Attr.REQUESTED_FROM_DOWNSTREAM)).isEqualTo(34);
    assertThat(test.scan(Scannable.Attr.CANCELLED)).isFalse();
    test.cancel();
    assertThat(test.scan(Scannable.Attr.CANCELLED)).isTrue();
}
Also used : MultiSubscriptionSubscriber(reactor.core.publisher.Operators.MultiSubscriptionSubscriber) CancelledSubscription(reactor.core.publisher.Operators.CancelledSubscription) Subscription(org.reactivestreams.Subscription) ScalarSubscription(reactor.core.publisher.Operators.ScalarSubscription) DeferredSubscription(reactor.core.publisher.Operators.DeferredSubscription) EmptySubscription(reactor.core.publisher.Operators.EmptySubscription) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 Subscription (org.reactivestreams.Subscription)1 CancelledSubscription (reactor.core.publisher.Operators.CancelledSubscription)1 DeferredSubscription (reactor.core.publisher.Operators.DeferredSubscription)1 EmptySubscription (reactor.core.publisher.Operators.EmptySubscription)1 MultiSubscriptionSubscriber (reactor.core.publisher.Operators.MultiSubscriptionSubscriber)1 ScalarSubscription (reactor.core.publisher.Operators.ScalarSubscription)1