當前位置: 首頁>>代碼示例>>Java>>正文


Java PublishProcessor.onError方法代碼示例

本文整理匯總了Java中io.reactivex.processors.PublishProcessor.onError方法的典型用法代碼示例。如果您正苦於以下問題:Java PublishProcessor.onError方法的具體用法?Java PublishProcessor.onError怎麽用?Java PublishProcessor.onError使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在io.reactivex.processors.PublishProcessor的用法示例。


在下文中一共展示了PublishProcessor.onError方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: errorImmediate

import io.reactivex.processors.PublishProcessor; //導入方法依賴的package包/類
@Test
public void errorImmediate() {
    TestScheduler scheduler = new TestScheduler();

    PublishProcessor<Integer> pp = PublishProcessor.create();

    TestSubscriber<Integer> ts = pp
        .compose(FlowableTransformers.<Integer>spanout(100, TimeUnit.MILLISECONDS, scheduler))
        .test();

    pp.onNext(1);
    pp.onError(new IOException());

    scheduler.advanceTimeBy(100, TimeUnit.MILLISECONDS);

    ts.assertFailure(IOException.class);
}
 
開發者ID:akarnokd,項目名稱:RxJava2Extensions,代碼行數:18,代碼來源:FlowableSpanoutTest.java

示例2: errorDelayed

import io.reactivex.processors.PublishProcessor; //導入方法依賴的package包/類
@Test
public void errorDelayed() {
    TestScheduler scheduler = new TestScheduler();

    PublishProcessor<Integer> pp = PublishProcessor.create();

    TestSubscriber<Integer> ts = pp
        .compose(FlowableTransformers.<Integer>spanout(100L, TimeUnit.MILLISECONDS, scheduler, true))
        .test();

    pp.onNext(1);
    pp.onError(new IOException());

    scheduler.advanceTimeBy(100, TimeUnit.MILLISECONDS);

    ts.assertFailure(IOException.class, 1);
}
 
開發者ID:akarnokd,項目名稱:RxJava2Extensions,代碼行數:18,代碼來源:FlowableSpanoutTest.java

示例3: flowableProcessorToFlowProcessorError

import io.reactivex.processors.PublishProcessor; //導入方法依賴的package包/類
@Test
public void flowableProcessorToFlowProcessorError() {
    PublishProcessor<Integer> pp = PublishProcessor.create();

    Flow.Processor<Integer, Integer> fp = FlowInterop.toFlowProcessor(pp);

    FlowTestSubscriber<Integer> ts = new FlowTestSubscriber<>();
    fp.subscribe(ts);

    pp.onNext(1);
    pp.onNext(2);
    pp.onNext(3);
    pp.onNext(4);
    pp.onNext(5);
    pp.onError(new IOException());

    ts.assertFailure(IOException.class, 1, 2, 3, 4, 5);
}
 
開發者ID:akarnokd,項目名稱:RxJava2Jdk9Interop,代碼行數:19,代碼來源:FlowInteropTest.java

示例4: errorImmediateWithoutValue

import io.reactivex.processors.PublishProcessor; //導入方法依賴的package包/類
@Test
public void errorImmediateWithoutValue() {
    TestScheduler scheduler = new TestScheduler();

    PublishProcessor<Integer> pp = PublishProcessor.create();

    TestSubscriber<Integer> ts = pp
        .compose(FlowableTransformers.<Integer>spanout(100, TimeUnit.MILLISECONDS, scheduler))
        .test();

    pp.onError(new IOException());

    scheduler.advanceTimeBy(1, TimeUnit.MILLISECONDS);

    ts.assertFailure(IOException.class);
}
 
開發者ID:akarnokd,項目名稱:RxJava2Extensions,代碼行數:17,代碼來源:FlowableSpanoutTest.java

示例5: errorDelayErrorWithoutValue

import io.reactivex.processors.PublishProcessor; //導入方法依賴的package包/類
@Test
public void errorDelayErrorWithoutValue() {
    TestScheduler scheduler = new TestScheduler();

    PublishProcessor<Integer> pp = PublishProcessor.create();

    TestSubscriber<Integer> ts = pp
        .compose(FlowableTransformers.<Integer>spanout(100, TimeUnit.MILLISECONDS, scheduler, true))
        .test();

    pp.onError(new IOException());

    scheduler.advanceTimeBy(1, TimeUnit.MILLISECONDS);

    ts.assertFailure(IOException.class);
}
 
開發者ID:akarnokd,項目名稱:RxJava2Extensions,代碼行數:17,代碼來源:FlowableSpanoutTest.java

示例6: firstErrors

import io.reactivex.processors.PublishProcessor; //導入方法依賴的package包/類
@Test
public void firstErrors() {
    PublishProcessor<Integer> pp1 = PublishProcessor.create();
    PublishProcessor<Integer> pp2 = PublishProcessor.create();

    TestSubscriber<String> ts = Flowables.zipLatest(pp1, pp2, toString2)
    .test();

    ts.assertEmpty();

    pp1.onNext(1);

    ts.assertEmpty();

    pp2.onNext(2);

    ts.assertValue("[1, 2]");

    pp1.onError(new IOException());

    Assert.assertFalse(pp2.hasSubscribers());

    ts.assertFailure(IOException.class, "[1, 2]");
}
 
開發者ID:akarnokd,項目名稱:RxJava2Extensions,代碼行數:25,代碼來源:FlowableZipLatestTest.java

示例7: secondErrors

import io.reactivex.processors.PublishProcessor; //導入方法依賴的package包/類
@Test
public void secondErrors() {
    PublishProcessor<Integer> pp1 = PublishProcessor.create();
    PublishProcessor<Integer> pp2 = PublishProcessor.create();

    TestSubscriber<String> ts = Flowables.zipLatest(pp1, pp2, toString2)
    .test();

    ts.assertEmpty();

    pp1.onNext(1);

    ts.assertEmpty();

    pp2.onNext(2);

    ts.assertValue("[1, 2]");

    pp2.onError(new IOException());

    Assert.assertFalse(pp1.hasSubscribers());

    ts.assertFailure(IOException.class, "[1, 2]");
}
 
開發者ID:akarnokd,項目名稱:RxJava2Extensions,代碼行數:25,代碼來源:FlowableZipLatestTest.java

示例8: firstErrorsBackpressured

import io.reactivex.processors.PublishProcessor; //導入方法依賴的package包/類
@Test
public void firstErrorsBackpressured() {
    PublishProcessor<Integer> pp1 = PublishProcessor.create();
    PublishProcessor<Integer> pp2 = PublishProcessor.create();

    TestSubscriber<String> ts = Flowables.zipLatest(pp1, pp2, toString2)
    .test(1);

    ts.assertEmpty();

    pp1.onNext(1);

    ts.assertEmpty();

    pp2.onNext(2);

    ts.assertValue("[1, 2]");

    pp1.onError(new IOException());

    Assert.assertFalse(pp2.hasSubscribers());

    ts.assertFailure(IOException.class, "[1, 2]");
}
 
開發者ID:akarnokd,項目名稱:RxJava2Extensions,代碼行數:25,代碼來源:FlowableZipLatestTest.java

示例9: terminationRace

import io.reactivex.processors.PublishProcessor; //導入方法依賴的package包/類
@Test
public void terminationRace() {
    for (int i = 0; i < 1000; i++) {
        List<Throwable> errors = TestHelper.trackPluginErrors();
        try {
            final PublishProcessor<Integer> pp1 = PublishProcessor.create();
            final PublishProcessor<Integer> pp2 = PublishProcessor.create();

            TestSubscriber<String> ts = Flowables.zipLatest(pp1, pp2, toString2)
            .test();

            final Throwable ex = new IOException();

            Runnable r1 = new Runnable() {
                @Override
                public void run() {
                    pp1.onComplete();
                }
            };

            Runnable r2 = new Runnable() {
                @Override
                public void run() {
                    pp2.onError(ex);
                }
            };

            TestHelper.race(r1, r2, Schedulers.single());

            if (ts.errorCount() != 0) {
                ts.assertFailure(IOException.class);
                Assert.assertTrue(errors.toString(), errors.isEmpty());
            } else {
                ts.assertResult();
                if (!errors.isEmpty()) {
                    TestHelper.assertUndeliverable(errors, 0, IOException.class);
                }
            }
        } finally {
            RxJavaPlugins.reset();
        }
    }
}
 
開發者ID:akarnokd,項目名稱:RxJava2Extensions,代碼行數:44,代碼來源:FlowableZipLatestTest.java

示例10: delayPublisherError2

import io.reactivex.processors.PublishProcessor; //導入方法依賴的package包/類
@Test
public void delayPublisherError2() {
    PublishProcessor<Integer> pp = PublishProcessor.create();

    TestSubscriber<Integer> ts = Perhaps.<Integer>error(new IOException())
            .delay(pp).test();

    ts.assertEmpty();

    assertTrue(pp.hasSubscribers());

    pp.onError(new IllegalArgumentException());

    ts.assertFailure(CompositeException.class);

    assertFalse(pp.hasSubscribers());
}
 
開發者ID:akarnokd,項目名稱:RxJava2Extensions,代碼行數:18,代碼來源:PerhapsTest.java

示例11: delayPublisherError2

import io.reactivex.processors.PublishProcessor; //導入方法依賴的package包/類
@Test
public void delayPublisherError2() {
    PublishProcessor<Integer> pp = PublishProcessor.create();

    TestSubscriber<Integer> ts = Solo.<Integer>error(new IOException())
            .delay(pp).test();

    ts.assertEmpty();

    assertTrue(pp.hasSubscribers());

    pp.onError(new IllegalArgumentException());

    ts.assertFailure(CompositeException.class);

    assertFalse(pp.hasSubscribers());
}
 
開發者ID:akarnokd,項目名稱:RxJava2Extensions,代碼行數:18,代碼來源:SoloTest.java


注:本文中的io.reactivex.processors.PublishProcessor.onError方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。