Search in sources :

Example 16 with ReplayProcessor

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

the class ReplayProcessorTest method timeBoundZeroRequestError.

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

Example 17 with ReplayProcessor

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

the class ReplayProcessorTest method currentStateMethodsError.

@Test
public void currentStateMethodsError() {
    ReplayProcessor<Object> as = ReplayProcessor.create();
    assertFalse(as.hasThrowable());
    assertFalse(as.hasComplete());
    assertNull(as.getThrowable());
    as.onError(new TestException());
    assertTrue(as.hasThrowable());
    assertFalse(as.hasComplete());
    assertTrue(as.getThrowable() instanceof TestException);
}
Also used : TestException(io.reactivex.rxjava3.exceptions.TestException)

Example 18 with ReplayProcessor

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

the class ReplayProcessorTest method noHeadRetentionErrorSize.

@Test
public void noHeadRetentionErrorSize() {
    ReplayProcessor<Integer> source = ReplayProcessor.createWithSize(1);
    source.onNext(1);
    source.onNext(2);
    source.onError(new TestException());
    SizeBoundReplayBuffer<Integer> buf = (SizeBoundReplayBuffer<Integer>) source.buffer;
    assertNull(buf.head.value);
    Object o = buf.head;
    source.cleanupBuffer();
    assertSame(o, buf.head);
}
Also used : TestException(io.reactivex.rxjava3.exceptions.TestException)

Example 19 with ReplayProcessor

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

the class ReplayProcessorTest method sizeAndHasAnyValueEffectivelyUnboundedError.

@Test
public void sizeAndHasAnyValueEffectivelyUnboundedError() {
    ReplayProcessor<Object> rs = ReplayProcessor.createUnbounded();
    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 20 with ReplayProcessor

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

the class ReplayProcessorTest method sizeAndHasAnyValueEffectivelyUnboundedEmptyError.

@Test
public void sizeAndHasAnyValueEffectivelyUnboundedEmptyError() {
    ReplayProcessor<Object> rs = ReplayProcessor.createUnbounded();
    rs.onError(new TestException());
    assertEquals(0, rs.size());
    assertFalse(rs.hasValue());
}
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