Search in sources :

Example 1 with FlowableReplay

use of io.reactivex.rxjava3.internal.operators.flowable.FlowableReplay in project RxJava by ReactiveX.

the class FlowableReplayEagerTruncateTest method noHeadRetentionErrorSize.

@Test
public void noHeadRetentionErrorSize() {
    PublishProcessor<Integer> source = PublishProcessor.create();
    FlowableReplay<Integer> co = (FlowableReplay<Integer>) source.replay(1, true);
    co.test();
    co.connect();
    BoundedReplayBuffer<Integer> buf = (BoundedReplayBuffer<Integer>) (co.current.get().buffer);
    source.onNext(1);
    source.onNext(2);
    source.onError(new TestException());
    assertNull(buf.get().value);
    Object o = buf.get();
    buf.trimHead();
    assertSame(o, buf.get());
}
Also used : FlowableReplay(io.reactivex.rxjava3.internal.operators.flowable.FlowableReplay) TestException(io.reactivex.rxjava3.exceptions.TestException)

Example 2 with FlowableReplay

use of io.reactivex.rxjava3.internal.operators.flowable.FlowableReplay in project RxJava by ReactiveX.

the class FlowableReplayEagerTruncateTest method noHeadRetentionErrorTime.

@Test
public void noHeadRetentionErrorTime() {
    PublishProcessor<Integer> source = PublishProcessor.create();
    FlowableReplay<Integer> co = (FlowableReplay<Integer>) source.replay(1, TimeUnit.MINUTES, Schedulers.computation(), true);
    co.test();
    co.connect();
    BoundedReplayBuffer<Integer> buf = (BoundedReplayBuffer<Integer>) (co.current.get().buffer);
    source.onNext(1);
    source.onNext(2);
    source.onError(new TestException());
    assertNull(buf.get().value);
    Object o = buf.get();
    buf.trimHead();
    assertSame(o, buf.get());
}
Also used : FlowableReplay(io.reactivex.rxjava3.internal.operators.flowable.FlowableReplay) TestException(io.reactivex.rxjava3.exceptions.TestException)

Example 3 with FlowableReplay

use of io.reactivex.rxjava3.internal.operators.flowable.FlowableReplay in project RxJava by ReactiveX.

the class FlowableReplayTest method noHeadRetentionErrorTime.

@Test
public void noHeadRetentionErrorTime() {
    PublishProcessor<Integer> source = PublishProcessor.create();
    FlowableReplay<Integer> co = (FlowableReplay<Integer>) source.replay(1, TimeUnit.MINUTES, Schedulers.computation());
    co.test();
    co.connect();
    BoundedReplayBuffer<Integer> buf = (BoundedReplayBuffer<Integer>) (co.current.get().buffer);
    source.onNext(1);
    source.onNext(2);
    source.onError(new TestException());
    assertNull(buf.get().value);
    Object o = buf.get();
    buf.trimHead();
    assertSame(o, buf.get());
}
Also used : FlowableReplay(io.reactivex.rxjava3.internal.operators.flowable.FlowableReplay) TestException(io.reactivex.rxjava3.exceptions.TestException)

Example 4 with FlowableReplay

use of io.reactivex.rxjava3.internal.operators.flowable.FlowableReplay in project RxJava by ReactiveX.

the class FlowableReplayTest method noHeadRetentionErrorSize.

@Test
public void noHeadRetentionErrorSize() {
    PublishProcessor<Integer> source = PublishProcessor.create();
    FlowableReplay<Integer> co = (FlowableReplay<Integer>) source.replay(1);
    co.test();
    co.connect();
    BoundedReplayBuffer<Integer> buf = (BoundedReplayBuffer<Integer>) (co.current.get().buffer);
    source.onNext(1);
    source.onNext(2);
    source.onError(new TestException());
    assertNull(buf.get().value);
    Object o = buf.get();
    buf.trimHead();
    assertSame(o, buf.get());
}
Also used : FlowableReplay(io.reactivex.rxjava3.internal.operators.flowable.FlowableReplay) TestException(io.reactivex.rxjava3.exceptions.TestException)

Aggregations

TestException (io.reactivex.rxjava3.exceptions.TestException)4 FlowableReplay (io.reactivex.rxjava3.internal.operators.flowable.FlowableReplay)4