Search in sources :

Example 6 with ReplayProcessor

use of io.reactivex.rxjava3.processors.ReplayProcessor in project RxJava by ReactiveX.

the class ReplayProcessorTest method timeAndSizeBoundZeroRequestError.

@Test
public void timeAndSizeBoundZeroRequestError() {
    final ReplayProcessor<Integer> source = ReplayProcessor.createWithTimeAndSize(1, TimeUnit.MINUTES, Schedulers.single(), 16);
    source.onError(new TestException());
    source.test(0).assertFailure(TestException.class);
}
Also used : TestException(io.reactivex.rxjava3.exceptions.TestException)

Example 7 with ReplayProcessor

use of io.reactivex.rxjava3.processors.ReplayProcessor in project RxJava by ReactiveX.

the class ReplayProcessorTest method subscribeAfterDone.

@Test
public void subscribeAfterDone() {
    ReplayProcessor<Integer> rp = ReplayProcessor.create();
    rp.onComplete();
    BooleanSubscription bs = new BooleanSubscription();
    rp.onSubscribe(bs);
    assertTrue(bs.isCancelled());
}
Also used : BooleanSubscription(io.reactivex.rxjava3.internal.subscriptions.BooleanSubscription)

Example 8 with ReplayProcessor

use of io.reactivex.rxjava3.processors.ReplayProcessor in project RxJava by ReactiveX.

the class ReplayProcessorTest method sizeAndHasAnyValueUnboundedError.

@Test
public void sizeAndHasAnyValueUnboundedError() {
    ReplayProcessor<Object> rs = ReplayProcessor.create();
    assertEquals(0, rs.size());
    assertFalse(rs.hasValue());
    rs.onNext(1);
    assertEquals(1, rs.size());
    assertTrue(rs.hasValue());
    rs.onNext(1);
    assertEquals(2, rs.size());
    assertTrue(rs.hasValue());
    rs.onError(new TestException());
    assertEquals(2, rs.size());
    assertTrue(rs.hasValue());
}
Also used : TestException(io.reactivex.rxjava3.exceptions.TestException)

Example 9 with ReplayProcessor

use of io.reactivex.rxjava3.processors.ReplayProcessor in project RxJava by ReactiveX.

the class ReplayProcessorTest method sizeAndTimeBoundReplayError.

@Test
public void sizeAndTimeBoundReplayError() {
    ReplayProcessor<Integer> rp = ReplayProcessor.createWithTimeAndSize(1, TimeUnit.DAYS, Schedulers.single(), 2);
    rp.onNext(1);
    rp.onNext(2);
    rp.onNext(3);
    rp.onNext(4);
    rp.onError(new TestException());
    rp.test().assertFailure(TestException.class, 3, 4);
}
Also used : TestException(io.reactivex.rxjava3.exceptions.TestException)

Example 10 with ReplayProcessor

use of io.reactivex.rxjava3.processors.ReplayProcessor in project RxJava by ReactiveX.

the class ReplayProcessorTest method sizeboundReplayError.

@Test
public void sizeboundReplayError() {
    ReplayProcessor<Integer> rp = ReplayProcessor.createWithSize(2);
    rp.onNext(1);
    rp.onNext(2);
    rp.onNext(3);
    rp.onNext(4);
    rp.onError(new TestException());
    rp.test().assertFailure(TestException.class, 3, 4);
}
Also used : TestException(io.reactivex.rxjava3.exceptions.TestException)

Aggregations

TestException (io.reactivex.rxjava3.exceptions.TestException)16 Flowable (io.reactivex.rxjava3.core.Flowable)3 LongConsumer (io.reactivex.rxjava3.functions.LongConsumer)3 ReplayProcessor (io.reactivex.rxjava3.processors.ReplayProcessor)3 Action (io.reactivex.rxjava3.functions.Action)2 AtomicLong (java.util.concurrent.atomic.AtomicLong)2 Test (org.junit.Test)2 Publisher (org.reactivestreams.Publisher)2 RFuture (org.redisson.api.RFuture)2 Single (io.reactivex.rxjava3.core.Single)1 Disposable (io.reactivex.rxjava3.disposables.Disposable)1 Consumer (io.reactivex.rxjava3.functions.Consumer)1 BooleanSubscription (io.reactivex.rxjava3.internal.subscriptions.BooleanSubscription)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 RedissonKeys (org.redisson.RedissonKeys)1 RTopic (org.redisson.api.RTopic)1 MessageListener (org.redisson.api.listener.MessageListener)1 RedisClient (org.redisson.client.RedisClient)1