Search in sources :

Example 1 with ObservableReplay

use of io.reactivex.rxjava3.internal.operators.observable.ObservableReplay in project RxJava by ReactiveX.

the class ObservableReplayEagerTruncateTest method noHeadRetentionErrorTime.

@Test
public void noHeadRetentionErrorTime() {
    PublishSubject<Integer> source = PublishSubject.create();
    ObservableReplay<Integer> co = (ObservableReplay<Integer>) source.replay(1, TimeUnit.MINUTES, Schedulers.computation(), true);
    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 : TestException(io.reactivex.rxjava3.exceptions.TestException) ObservableReplay(io.reactivex.rxjava3.internal.operators.observable.ObservableReplay)

Example 2 with ObservableReplay

use of io.reactivex.rxjava3.internal.operators.observable.ObservableReplay in project RxJava by ReactiveX.

the class ObservableReplayEagerTruncateTest method noHeadRetentionErrorSize.

@Test
public void noHeadRetentionErrorSize() {
    PublishSubject<Integer> source = PublishSubject.create();
    ObservableReplay<Integer> co = (ObservableReplay<Integer>) source.replay(1, true);
    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 : TestException(io.reactivex.rxjava3.exceptions.TestException) ObservableReplay(io.reactivex.rxjava3.internal.operators.observable.ObservableReplay)

Example 3 with ObservableReplay

use of io.reactivex.rxjava3.internal.operators.observable.ObservableReplay in project RxJava by ReactiveX.

the class ObservableReplayTest method noHeadRetentionErrorSize.

@Test
public void noHeadRetentionErrorSize() {
    PublishSubject<Integer> source = PublishSubject.create();
    ObservableReplay<Integer> co = (ObservableReplay<Integer>) source.replay(1);
    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 : TestException(io.reactivex.rxjava3.exceptions.TestException) ObservableReplay(io.reactivex.rxjava3.internal.operators.observable.ObservableReplay)

Example 4 with ObservableReplay

use of io.reactivex.rxjava3.internal.operators.observable.ObservableReplay in project RxJava by ReactiveX.

the class ObservableReplayTest method noHeadRetentionErrorTime.

@Test
public void noHeadRetentionErrorTime() {
    PublishSubject<Integer> source = PublishSubject.create();
    ObservableReplay<Integer> co = (ObservableReplay<Integer>) source.replay(1, TimeUnit.MINUTES, Schedulers.computation());
    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 : TestException(io.reactivex.rxjava3.exceptions.TestException) ObservableReplay(io.reactivex.rxjava3.internal.operators.observable.ObservableReplay)

Aggregations

TestException (io.reactivex.rxjava3.exceptions.TestException)4 ObservableReplay (io.reactivex.rxjava3.internal.operators.observable.ObservableReplay)4