use of io.reactivex.rxjava3.internal.subscriptions.BooleanSubscription in project RxJava by ReactiveX.
the class ParallelMapTest method conditionalCancelIgnored.
@Test
public void conditionalCancelIgnored() {
Flowable<Integer> f = new Flowable<Integer>() {
@Override
protected void subscribeActual(@NonNull Subscriber<@NonNull ? super @NonNull Integer> s) {
@SuppressWarnings("unchecked") ConditionalSubscriber<Integer> subscriber = (ConditionalSubscriber<Integer>) s;
subscriber.onSubscribe(new BooleanSubscription());
subscriber.tryOnNext(1);
subscriber.tryOnNext(2);
}
};
ParallelFlowable.fromArray(f).map(v -> {
throw new TestException();
}).filter(v -> true).sequential().test().assertFailure(TestException.class);
}
use of io.reactivex.rxjava3.internal.subscriptions.BooleanSubscription in project RxJava by ReactiveX.
the class FlowableConcatMapSingleTest method cancelNoConcurrentClean.
@Test
public void cancelNoConcurrentClean() {
TestSubscriber<Integer> ts = new TestSubscriber<>();
ConcatMapSingleSubscriber<Integer, Integer> operator = new ConcatMapSingleSubscriber<>(ts, Functions.justFunction(Single.<Integer>never()), 16, ErrorMode.IMMEDIATE);
operator.onSubscribe(new BooleanSubscription());
operator.queue.offer(1);
operator.getAndIncrement();
ts.cancel();
assertFalse(operator.queue.isEmpty());
operator.addAndGet(-2);
operator.cancel();
assertTrue(operator.queue.isEmpty());
}
use of io.reactivex.rxjava3.internal.subscriptions.BooleanSubscription in project RxJava by ReactiveX.
the class FlowableConcatMapMaybeTest method cancelNoConcurrentClean.
@Test
public void cancelNoConcurrentClean() {
TestSubscriber<Integer> ts = new TestSubscriber<>();
ConcatMapMaybeSubscriber<Integer, Integer> operator = new ConcatMapMaybeSubscriber<>(ts, Functions.justFunction(Maybe.<Integer>never()), 16, ErrorMode.IMMEDIATE);
operator.onSubscribe(new BooleanSubscription());
operator.queue.offer(1);
operator.getAndIncrement();
ts.cancel();
assertFalse(operator.queue.isEmpty());
operator.addAndGet(-2);
operator.cancel();
assertTrue(operator.queue.isEmpty());
}
use of io.reactivex.rxjava3.internal.subscriptions.BooleanSubscription in project RxJava by ReactiveX.
the class HalfSerializerSubscriberTest method reentrantOnNextOnComplete.
@Test
@SuppressWarnings({ "rawtypes", "unchecked" })
public void reentrantOnNextOnComplete() {
final AtomicInteger wip = new AtomicInteger();
final AtomicThrowable error = new AtomicThrowable();
final Subscriber[] a = { null };
final TestSubscriber ts = new TestSubscriber();
FlowableSubscriber s = new FlowableSubscriber() {
@Override
public void onSubscribe(Subscription s) {
ts.onSubscribe(s);
}
@Override
public void onNext(Object t) {
if (t.equals(1)) {
HalfSerializer.onComplete(a[0], wip, error);
}
ts.onNext(t);
}
@Override
public void onError(Throwable t) {
ts.onError(t);
}
@Override
public void onComplete() {
ts.onComplete();
}
};
a[0] = s;
s.onSubscribe(new BooleanSubscription());
HalfSerializer.onNext(s, 1, wip, error);
ts.assertResult(1);
}
use of io.reactivex.rxjava3.internal.subscriptions.BooleanSubscription in project RxJava by ReactiveX.
the class HalfSerializerSubscriberTest method reentrantErrorOnError.
@Test
@SuppressUndeliverable
@SuppressWarnings({ "rawtypes", "unchecked" })
public void reentrantErrorOnError() {
final AtomicInteger wip = new AtomicInteger();
final AtomicThrowable error = new AtomicThrowable();
final Subscriber[] a = { null };
final TestSubscriber ts = new TestSubscriber();
FlowableSubscriber s = new FlowableSubscriber() {
@Override
public void onSubscribe(Subscription s) {
ts.onSubscribe(s);
}
@Override
public void onNext(Object t) {
ts.onNext(t);
}
@Override
public void onError(Throwable t) {
ts.onError(t);
HalfSerializer.onError(a[0], new IOException(), wip, error);
}
@Override
public void onComplete() {
ts.onComplete();
}
};
a[0] = s;
s.onSubscribe(new BooleanSubscription());
HalfSerializer.onError(s, new TestException(), wip, error);
ts.assertFailure(TestException.class);
}
Aggregations