Search in sources :

Example 86 with TestSubscriber

use of io.reactivex.rxjava3.subscribers.TestSubscriber in project RxJava by ReactiveX.

the class QueueDrainHelperTest method checkTerminatedNonDelayErrorError.

@Test
public void checkTerminatedNonDelayErrorError() {
    TestSubscriber<Integer> ts = new TestSubscriber<>();
    ts.onSubscribe(new BooleanSubscription());
    QueueDrain<Integer, Integer> qd = new QueueDrain<Integer, Integer>() {

        @Override
        public boolean cancelled() {
            return false;
        }

        @Override
        public boolean done() {
            return false;
        }

        @Override
        public Throwable error() {
            return new TestException();
        }

        @Override
        public boolean enter() {
            return true;
        }

        @Override
        public long requested() {
            return 0;
        }

        @Override
        public long produced(long n) {
            return 0;
        }

        @Override
        public int leave(int m) {
            return 0;
        }

        @Override
        public boolean accept(Subscriber<? super Integer> a, Integer v) {
            return false;
        }
    };
    SpscArrayQueue<Integer> q = new SpscArrayQueue<>(32);
    QueueDrainHelper.checkTerminated(true, false, ts, false, q, qd);
    ts.assertFailure(TestException.class);
}
Also used : BooleanSubscription(io.reactivex.rxjava3.internal.subscriptions.BooleanSubscription) SpscArrayQueue(io.reactivex.rxjava3.operators.SpscArrayQueue) TestSubscriber(io.reactivex.rxjava3.subscribers.TestSubscriber) TestSubscriber(io.reactivex.rxjava3.subscribers.TestSubscriber) RxJavaTest(io.reactivex.rxjava3.core.RxJavaTest) Test(org.junit.Test)

Example 87 with TestSubscriber

use of io.reactivex.rxjava3.subscribers.TestSubscriber in project RxJava by ReactiveX.

the class QueueDrainHelperTest method checkTerminatedDelayErrorNonEmpty.

@Test
public void checkTerminatedDelayErrorNonEmpty() {
    TestSubscriber<Integer> ts = new TestSubscriber<>();
    ts.onSubscribe(new BooleanSubscription());
    QueueDrain<Integer, Integer> qd = new QueueDrain<Integer, Integer>() {

        @Override
        public boolean cancelled() {
            return false;
        }

        @Override
        public boolean done() {
            return false;
        }

        @Override
        public Throwable error() {
            return null;
        }

        @Override
        public boolean enter() {
            return true;
        }

        @Override
        public long requested() {
            return 0;
        }

        @Override
        public long produced(long n) {
            return 0;
        }

        @Override
        public int leave(int m) {
            return 0;
        }

        @Override
        public boolean accept(Subscriber<? super Integer> a, Integer v) {
            return false;
        }
    };
    SpscArrayQueue<Integer> q = new SpscArrayQueue<>(32);
    QueueDrainHelper.checkTerminated(true, false, ts, true, q, qd);
    ts.assertEmpty();
}
Also used : BooleanSubscription(io.reactivex.rxjava3.internal.subscriptions.BooleanSubscription) SpscArrayQueue(io.reactivex.rxjava3.operators.SpscArrayQueue) TestSubscriber(io.reactivex.rxjava3.subscribers.TestSubscriber) TestSubscriber(io.reactivex.rxjava3.subscribers.TestSubscriber) RxJavaTest(io.reactivex.rxjava3.core.RxJavaTest) Test(org.junit.Test)

Example 88 with TestSubscriber

use of io.reactivex.rxjava3.subscribers.TestSubscriber in project RxJava by ReactiveX.

the class QueueDrainHelperTest method checkTerminatedDelayErrorEmptyError.

@Test
public void checkTerminatedDelayErrorEmptyError() {
    TestSubscriber<Integer> ts = new TestSubscriber<>();
    ts.onSubscribe(new BooleanSubscription());
    QueueDrain<Integer, Integer> qd = new QueueDrain<Integer, Integer>() {

        @Override
        public boolean cancelled() {
            return false;
        }

        @Override
        public boolean done() {
            return false;
        }

        @Override
        public Throwable error() {
            return new TestException();
        }

        @Override
        public boolean enter() {
            return true;
        }

        @Override
        public long requested() {
            return 0;
        }

        @Override
        public long produced(long n) {
            return 0;
        }

        @Override
        public int leave(int m) {
            return 0;
        }

        @Override
        public boolean accept(Subscriber<? super Integer> a, Integer v) {
            return false;
        }
    };
    SpscArrayQueue<Integer> q = new SpscArrayQueue<>(32);
    QueueDrainHelper.checkTerminated(true, true, ts, true, q, qd);
    ts.assertFailure(TestException.class);
}
Also used : BooleanSubscription(io.reactivex.rxjava3.internal.subscriptions.BooleanSubscription) SpscArrayQueue(io.reactivex.rxjava3.operators.SpscArrayQueue) TestSubscriber(io.reactivex.rxjava3.subscribers.TestSubscriber) TestSubscriber(io.reactivex.rxjava3.subscribers.TestSubscriber) RxJavaTest(io.reactivex.rxjava3.core.RxJavaTest) Test(org.junit.Test)

Example 89 with TestSubscriber

use of io.reactivex.rxjava3.subscribers.TestSubscriber in project RxJava by ReactiveX.

the class QueueDrainHelperTest method drainMaxLoopMissingBackpressure.

@Test
public void drainMaxLoopMissingBackpressure() {
    TestSubscriber<Integer> ts = new TestSubscriber<>();
    ts.onSubscribe(new BooleanSubscription());
    QueueDrain<Integer, Integer> qd = new QueueDrain<Integer, Integer>() {

        @Override
        public boolean cancelled() {
            return false;
        }

        @Override
        public boolean done() {
            return false;
        }

        @Override
        public Throwable error() {
            return null;
        }

        @Override
        public boolean enter() {
            return true;
        }

        @Override
        public long requested() {
            return 0;
        }

        @Override
        public long produced(long n) {
            return 0;
        }

        @Override
        public int leave(int m) {
            return 0;
        }

        @Override
        public boolean accept(Subscriber<? super Integer> a, Integer v) {
            return false;
        }
    };
    SpscArrayQueue<Integer> q = new SpscArrayQueue<>(32);
    q.offer(1);
    QueueDrainHelper.drainMaxLoop(q, ts, false, null, qd);
    ts.assertFailure(MissingBackpressureException.class);
}
Also used : BooleanSubscription(io.reactivex.rxjava3.internal.subscriptions.BooleanSubscription) SpscArrayQueue(io.reactivex.rxjava3.operators.SpscArrayQueue) TestSubscriber(io.reactivex.rxjava3.subscribers.TestSubscriber) TestSubscriber(io.reactivex.rxjava3.subscribers.TestSubscriber) RxJavaTest(io.reactivex.rxjava3.core.RxJavaTest) Test(org.junit.Test)

Example 90 with TestSubscriber

use of io.reactivex.rxjava3.subscribers.TestSubscriber in project RxJava by ReactiveX.

the class QueueDrainHelperTest method checkTerminatedDelayErrorEmpty.

@Test
public void checkTerminatedDelayErrorEmpty() {
    TestSubscriber<Integer> ts = new TestSubscriber<>();
    ts.onSubscribe(new BooleanSubscription());
    QueueDrain<Integer, Integer> qd = new QueueDrain<Integer, Integer>() {

        @Override
        public boolean cancelled() {
            return false;
        }

        @Override
        public boolean done() {
            return false;
        }

        @Override
        public Throwable error() {
            return null;
        }

        @Override
        public boolean enter() {
            return true;
        }

        @Override
        public long requested() {
            return 0;
        }

        @Override
        public long produced(long n) {
            return 0;
        }

        @Override
        public int leave(int m) {
            return 0;
        }

        @Override
        public boolean accept(Subscriber<? super Integer> a, Integer v) {
            return false;
        }
    };
    SpscArrayQueue<Integer> q = new SpscArrayQueue<>(32);
    QueueDrainHelper.checkTerminated(true, true, ts, true, q, qd);
    ts.assertResult();
}
Also used : BooleanSubscription(io.reactivex.rxjava3.internal.subscriptions.BooleanSubscription) SpscArrayQueue(io.reactivex.rxjava3.operators.SpscArrayQueue) TestSubscriber(io.reactivex.rxjava3.subscribers.TestSubscriber) TestSubscriber(io.reactivex.rxjava3.subscribers.TestSubscriber) RxJavaTest(io.reactivex.rxjava3.core.RxJavaTest) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)169 TestSubscriber (io.reactivex.rxjava3.subscribers.TestSubscriber)116 BooleanSubscription (io.reactivex.rxjava3.internal.subscriptions.BooleanSubscription)106 TestException (io.reactivex.rxjava3.exceptions.TestException)56 RxJavaTest (io.reactivex.rxjava3.core.RxJavaTest)27 TimeUnit (java.util.concurrent.TimeUnit)19 FlowableRxInvokerProvider (org.apache.cxf.jaxrs.rx3.client.FlowableRxInvokerProvider)18 FlowableRxInvoker (org.apache.cxf.jaxrs.rx3.client.FlowableRxInvoker)17 JacksonJsonProvider (com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider)15 IOException (java.io.IOException)15 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)15 Flowable (io.reactivex.rxjava3.core.Flowable)13 InternalServerErrorException (javax.ws.rs.InternalServerErrorException)13 ClientBuilder (javax.ws.rs.client.ClientBuilder)13 MediaType (javax.ws.rs.core.MediaType)13 AbstractResourceInfo (org.apache.cxf.jaxrs.model.AbstractResourceInfo)13 AbstractBusClientServerTestBase (org.apache.cxf.testutil.common.AbstractBusClientServerTestBase)13 Assert.assertTrue (org.junit.Assert.assertTrue)13 BeforeClass (org.junit.BeforeClass)13 TestScheduler (io.reactivex.rxjava3.schedulers.TestScheduler)12