use of io.reactivex.internal.subscriptions.BooleanSubscription 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());
}
use of io.reactivex.internal.subscriptions.BooleanSubscription in project RxJava by ReactiveX.
the class SerializedProcessorTest method onCompleteOnSubscribeRace.
@Test
public void onCompleteOnSubscribeRace() {
for (int i = 0; i < 500; i++) {
final FlowableProcessor<Integer> s = PublishProcessor.<Integer>create().toSerialized();
TestSubscriber<Integer> ts = s.test();
final BooleanSubscription bs = new BooleanSubscription();
Runnable r1 = new Runnable() {
@Override
public void run() {
s.onComplete();
}
};
Runnable r2 = new Runnable() {
@Override
public void run() {
s.onSubscribe(bs);
}
};
TestHelper.race(r1, r2, Schedulers.single());
ts.assertResult();
}
}
use of io.reactivex.internal.subscriptions.BooleanSubscription in project RxJava by ReactiveX.
the class SerializedProcessorTest method onSubscribeOnSubscribeRace.
@Test
public void onSubscribeOnSubscribeRace() {
for (int i = 0; i < 500; i++) {
final FlowableProcessor<Integer> s = PublishProcessor.<Integer>create().toSerialized();
TestSubscriber<Integer> ts = s.test();
final BooleanSubscription bs1 = new BooleanSubscription();
final BooleanSubscription bs2 = new BooleanSubscription();
Runnable r1 = new Runnable() {
@Override
public void run() {
s.onSubscribe(bs1);
}
};
Runnable r2 = new Runnable() {
@Override
public void run() {
s.onSubscribe(bs2);
}
};
TestHelper.race(r1, r2, Schedulers.single());
ts.assertEmpty();
}
}
use of io.reactivex.internal.subscriptions.BooleanSubscription in project RxJava by ReactiveX.
the class ResourceSubscriberTest method startOnce.
@Test
public void startOnce() {
List<Throwable> error = TestHelper.trackPluginErrors();
try {
TestResourceSubscriber<Integer> tc = new TestResourceSubscriber<Integer>();
tc.onSubscribe(new BooleanSubscription());
BooleanSubscription d = new BooleanSubscription();
tc.onSubscribe(d);
assertTrue(d.isCancelled());
assertEquals(1, tc.start);
TestHelper.assertError(error, 0, IllegalStateException.class, "Subscription already set!");
} finally {
RxJavaPlugins.reset();
}
}
use of io.reactivex.internal.subscriptions.BooleanSubscription in project RxJava by ReactiveX.
the class ResourceSubscriberTest method dispose.
@Test
public void dispose() {
TestResourceSubscriber<Integer> tc = new TestResourceSubscriber<Integer>();
tc.dispose();
BooleanSubscription d = new BooleanSubscription();
tc.onSubscribe(d);
assertTrue(d.isCancelled());
assertEquals(0, tc.start);
}
Aggregations