当前位置: 首页>>代码示例>>Java>>正文


Java RxJavaPlugins类代码示例

本文整理汇总了Java中rx.plugins.RxJavaPlugins的典型用法代码示例。如果您正苦于以下问题:Java RxJavaPlugins类的具体用法?Java RxJavaPlugins怎么用?Java RxJavaPlugins使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


RxJavaPlugins类属于rx.plugins包,在下文中一共展示了RxJavaPlugins类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setUp

import rx.plugins.RxJavaPlugins; //导入依赖的package包/类
@Before
public void setUp() {
	MockitoAnnotations.initMocks(this);
	presenter = new SignInPresenter();
	presenter.setViewState(signInViewState);

	RxJavaPlugins.getInstance().reset();
	RxJavaPlugins.getInstance().registerSchedulersHook(new RxJavaSchedulersHook() {
		@Override
		public Scheduler getIOScheduler() {
			return Schedulers.immediate();
		}
	});
	RxAndroidPlugins.getInstance().reset();
	RxAndroidPlugins.getInstance().registerSchedulersHook(new RxAndroidSchedulersHook() {
		@Override
		public Scheduler getMainThreadScheduler() {
			return Schedulers.immediate();
		}
	});
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:22,代码来源:SignInPresenterTest.java

示例2: setUp

import rx.plugins.RxJavaPlugins; //导入依赖的package包/类
@Before
public void setUp() {
	MockitoAnnotations.initMocks(this);
	presenter = new RepositoriesPresenter();
	presenter.setViewState(repositoriesViewState);

	RxJavaPlugins.getInstance().reset();
	RxJavaPlugins.getInstance().registerSchedulersHook(new RxJavaSchedulersHook() {
		@Override
		public Scheduler getIOScheduler() {
			return Schedulers.immediate();
		}
	});
	RxAndroidPlugins.getInstance().reset();
	RxAndroidPlugins.getInstance().registerSchedulersHook(new RxAndroidSchedulersHook() {
		@Override
		public Scheduler getMainThreadScheduler() {
			return Schedulers.immediate();
		}
	});
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:22,代码来源:RepositoriesPresenterTest.java

示例3: emitError

import rx.plugins.RxJavaPlugins; //导入依赖的package包/类
void emitError(Throwable t) {
  set(STATE_TERMINATED);

  if (!isUnsubscribed()) {
    try {
      subscriber.onError(t);
    } catch (OnCompletedFailedException
        | OnErrorFailedException
        | OnErrorNotImplementedException e) {
      RxJavaPlugins.getInstance().getErrorHandler().handleError(e);
    } catch (Throwable inner) {
      Exceptions.throwIfFatal(inner);
      CompositeException composite = new CompositeException(t, inner);
      RxJavaPlugins.getInstance().getErrorHandler().handleError(composite);
    }
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:18,代码来源:CallArbiter.java

示例4: onNext

import rx.plugins.RxJavaPlugins; //导入依赖的package包/类
@Override public void onNext(Response<R> response) {
  if (response.isSuccessful()) {
    subscriber.onNext(response.body());
  } else {
    subscriberTerminated = true;
    Throwable t = new HttpException(response);
    try {
      subscriber.onError(t);
    } catch (OnCompletedFailedException
        | OnErrorFailedException
        | OnErrorNotImplementedException e) {
      RxJavaPlugins.getInstance().getErrorHandler().handleError(e);
    } catch (Throwable inner) {
      Exceptions.throwIfFatal(inner);
      CompositeException composite = new CompositeException(t, inner);
      RxJavaPlugins.getInstance().getErrorHandler().handleError(composite);
    }
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:20,代码来源:BodyOnSubscribe.java

示例5: onError

import rx.plugins.RxJavaPlugins; //导入依赖的package包/类
@Override public void onError(Throwable throwable) {
  try {
    subscriber.onNext(Result.<R>error(throwable));
  } catch (Throwable t) {
    try {
      subscriber.onError(t);
    } catch (OnCompletedFailedException
        | OnErrorFailedException
        | OnErrorNotImplementedException e) {
      RxJavaPlugins.getInstance().getErrorHandler().handleError(e);
    } catch (Throwable inner) {
      Exceptions.throwIfFatal(inner);
      CompositeException composite = new CompositeException(t, inner);
      RxJavaPlugins.getInstance().getErrorHandler().handleError(composite);
    }
    return;
  }
  subscriber.onCompleted();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:20,代码来源:ResultOnSubscribe.java

示例6: throwingInOnCompleteDeliveredToPlugin

import rx.plugins.RxJavaPlugins; //导入依赖的package包/类
@Test public void throwingInOnCompleteDeliveredToPlugin() {
  server.enqueue(new MockResponse());

  final AtomicReference<Throwable> pluginRef = new AtomicReference<>();
  RxJavaPlugins.getInstance().registerErrorHandler(new RxJavaErrorHandler() {
    @Override public void handleError(Throwable throwable) {
      if (!pluginRef.compareAndSet(null, throwable)) {
        throw Exceptions.propagate(throwable); // Don't swallow secondary errors!
      }
    }
  });

  RecordingSubscriber<Void> observer = subscriberRule.create();
  final RuntimeException e = new RuntimeException();
  service.completable().unsafeSubscribe(new ForwardingCompletableObserver(observer) {
    @Override public void onCompleted() {
      throw e;
    }
  });

  assertThat(pluginRef.get()).isSameAs(e);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:23,代码来源:CompletableThrowingTest.java

示例7: bodyThrowingInOnCompleteDeliveredToPlugin

import rx.plugins.RxJavaPlugins; //导入依赖的package包/类
@Test public void bodyThrowingInOnCompleteDeliveredToPlugin() {
  server.enqueue(new MockResponse());

  final AtomicReference<Throwable> pluginRef = new AtomicReference<>();
  RxJavaPlugins.getInstance().registerErrorHandler(new RxJavaErrorHandler() {
    @Override public void handleError(Throwable throwable) {
      if (!pluginRef.compareAndSet(null, throwable)) {
        throw Exceptions.propagate(throwable); // Don't swallow secondary errors!
      }
    }
  });

  RecordingSubscriber<String> observer = subscriberRule.create();
  final RuntimeException e = new RuntimeException();
  service.body().unsafeSubscribe(new ForwardingSubscriber<String>(observer) {
    @Override public void onCompleted() {
      throw e;
    }
  });

  observer.assertAnyValue();
  assertThat(pluginRef.get()).isSameAs(e);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:24,代码来源:ObservableThrowingTest.java

示例8: responseThrowingInOnCompleteDeliveredToPlugin

import rx.plugins.RxJavaPlugins; //导入依赖的package包/类
@Test public void responseThrowingInOnCompleteDeliveredToPlugin() {
  server.enqueue(new MockResponse());

  final AtomicReference<Throwable> pluginRef = new AtomicReference<>();
  RxJavaPlugins.getInstance().registerErrorHandler(new RxJavaErrorHandler() {
    @Override public void handleError(Throwable throwable) {
      if (!pluginRef.compareAndSet(null, throwable)) {
        throw Exceptions.propagate(throwable); // Don't swallow secondary errors!
      }
    }
  });

  RecordingSubscriber<Response<String>> observer = subscriberRule.create();
  final RuntimeException e = new RuntimeException();
  service.response().unsafeSubscribe(new ForwardingSubscriber<Response<String>>(observer) {
    @Override public void onCompleted() {
      throw e;
    }
  });

  observer.assertAnyValue();
  assertThat(pluginRef.get()).isSameAs(e);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:24,代码来源:ObservableThrowingTest.java

示例9: resultThrowingInOnCompletedDeliveredToPlugin

import rx.plugins.RxJavaPlugins; //导入依赖的package包/类
@Test public void resultThrowingInOnCompletedDeliveredToPlugin() {
  server.enqueue(new MockResponse());

  final AtomicReference<Throwable> pluginRef = new AtomicReference<>();
  RxJavaPlugins.getInstance().registerErrorHandler(new RxJavaErrorHandler() {
    @Override public void handleError(Throwable throwable) {
      if (!pluginRef.compareAndSet(null, throwable)) {
        throw Exceptions.propagate(throwable); // Don't swallow secondary errors!
      }
    }
  });

  RecordingSubscriber<Result<String>> observer = subscriberRule.create();
  final RuntimeException e = new RuntimeException();
  service.result().unsafeSubscribe(new ForwardingSubscriber<Result<String>>(observer) {
    @Override public void onCompleted() {
      throw e;
    }
  });

  observer.assertAnyValue();
  assertThat(pluginRef.get()).isSameAs(e);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:24,代码来源:ObservableThrowingTest.java

示例10: throwingInOnCompleteDeliveredToPlugin

import rx.plugins.RxJavaPlugins; //导入依赖的package包/类
@Test public void throwingInOnCompleteDeliveredToPlugin() {
  server.enqueue(new MockResponse());

  final AtomicReference<Throwable> pluginRef = new AtomicReference<>();
  RxJavaPlugins.getInstance().registerErrorHandler(new RxJavaErrorHandler() {
    @Override public void handleError(Throwable throwable) {
      if (throwable instanceof OnCompletedFailedException) {
        if (!pluginRef.compareAndSet(null, throwable)) {
          throw Exceptions.propagate(throwable); // Don't swallow secondary errors!
        }
      }
    }
  });

  RecordingSubscriber<Void> observer = subscriberRule.create();
  final RuntimeException e = new RuntimeException();
  service.completable().subscribe(new ForwardingCompletableObserver(observer) {
    @Override public void onCompleted() {
      throw e;
    }
  });

  assertThat(pluginRef.get().getCause()).isSameAs(e);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:25,代码来源:CompletableThrowingSafeSubscriberTest.java

示例11: bodyThrowingInOnSuccessDeliveredToPlugin

import rx.plugins.RxJavaPlugins; //导入依赖的package包/类
@Test public void bodyThrowingInOnSuccessDeliveredToPlugin() {
  server.enqueue(new MockResponse());

  final AtomicReference<Throwable> pluginRef = new AtomicReference<>();
  RxJavaPlugins.getInstance().registerErrorHandler(new RxJavaErrorHandler() {
    @Override public void handleError(Throwable throwable) {
      if (!pluginRef.compareAndSet(null, throwable)) {
        throw Exceptions.propagate(throwable); // Don't swallow secondary errors!
      }
    }
  });

  RecordingSubscriber<String> observer = subscriberRule.create();
  final RuntimeException e = new RuntimeException();
  service.body().subscribe(new ForwardingObserver<String>(observer) {
    @Override public void onSuccess(String value) {
      throw e;
    }
  });

  assertThat(pluginRef.get()).isSameAs(e);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:23,代码来源:SingleThrowingTest.java

示例12: responseThrowingInOnSuccessDeliveredToPlugin

import rx.plugins.RxJavaPlugins; //导入依赖的package包/类
@Test public void responseThrowingInOnSuccessDeliveredToPlugin() {
  server.enqueue(new MockResponse());

  final AtomicReference<Throwable> pluginRef = new AtomicReference<>();
  RxJavaPlugins.getInstance().registerErrorHandler(new RxJavaErrorHandler() {
    @Override public void handleError(Throwable throwable) {
      if (!pluginRef.compareAndSet(null, throwable)) {
        throw Exceptions.propagate(throwable); // Don't swallow secondary errors!
      }
    }
  });

  RecordingSubscriber<Response<String>> observer = subscriberRule.create();
  final RuntimeException e = new RuntimeException();
  service.response().subscribe(new ForwardingObserver<Response<String>>(observer) {
    @Override public void onSuccess(Response<String> value) {
      throw e;
    }
  });

  assertThat(pluginRef.get()).isSameAs(e);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:23,代码来源:SingleThrowingTest.java

示例13: resultThrowingInOnSuccessDeliveredToPlugin

import rx.plugins.RxJavaPlugins; //导入依赖的package包/类
@Test public void resultThrowingInOnSuccessDeliveredToPlugin() {
  server.enqueue(new MockResponse());

  final AtomicReference<Throwable> pluginRef = new AtomicReference<>();
  RxJavaPlugins.getInstance().registerErrorHandler(new RxJavaErrorHandler() {
    @Override public void handleError(Throwable throwable) {
      if (!pluginRef.compareAndSet(null, throwable)) {
        throw Exceptions.propagate(throwable); // Don't swallow secondary errors!
      }
    }
  });

  RecordingSubscriber<Result<String>> observer = subscriberRule.create();
  final RuntimeException e = new RuntimeException();
  service.result().subscribe(new ForwardingObserver<Result<String>>(observer) {
    @Override public void onSuccess(Result<String> value) {
      throw e;
    }
  });

  assertThat(pluginRef.get()).isSameAs(e);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:23,代码来源:SingleThrowingTest.java

示例14: bodyThrowingInOnCompleteDeliveredToPlugin

import rx.plugins.RxJavaPlugins; //导入依赖的package包/类
@Test public void bodyThrowingInOnCompleteDeliveredToPlugin() {
  server.enqueue(new MockResponse());

  final AtomicReference<Throwable> pluginRef = new AtomicReference<>();
  RxJavaPlugins.getInstance().registerErrorHandler(new RxJavaErrorHandler() {
    @Override public void handleError(Throwable throwable) {
      if (throwable instanceof OnCompletedFailedException) {
        if (!pluginRef.compareAndSet(null, throwable)) {
          throw Exceptions.propagate(throwable); // Don't swallow secondary errors!
        }
      }
    }
  });

  RecordingSubscriber<String> observer = subscriberRule.create();
  final RuntimeException e = new RuntimeException();
  service.body().subscribe(new ForwardingSubscriber<String>(observer) {
    @Override public void onCompleted() {
      throw e;
    }
  });

  observer.assertAnyValue();
  assertThat(pluginRef.get().getCause()).isSameAs(e);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:26,代码来源:ObservableThrowingSafeSubscriberTest.java

示例15: responseThrowingInOnCompleteDeliveredToPlugin

import rx.plugins.RxJavaPlugins; //导入依赖的package包/类
@Test public void responseThrowingInOnCompleteDeliveredToPlugin() {
  server.enqueue(new MockResponse());

  final AtomicReference<Throwable> pluginRef = new AtomicReference<>();
  RxJavaPlugins.getInstance().registerErrorHandler(new RxJavaErrorHandler() {
    @Override public void handleError(Throwable throwable) {
      if (throwable instanceof OnCompletedFailedException) {
        if (!pluginRef.compareAndSet(null, throwable)) {
          throw Exceptions.propagate(throwable); // Don't swallow secondary errors!
        }
      }
    }
  });

  RecordingSubscriber<Response<String>> observer = subscriberRule.create();
  final RuntimeException e = new RuntimeException();
  service.response().subscribe(new ForwardingSubscriber<Response<String>>(observer) {
    @Override public void onCompleted() {
      throw e;
    }
  });

  observer.assertAnyValue();
  assertThat(pluginRef.get().getCause()).isSameAs(e);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:26,代码来源:ObservableThrowingSafeSubscriberTest.java


注:本文中的rx.plugins.RxJavaPlugins类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。