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


Java RxHelper.toSubscriber方法代码示例

本文整理汇总了Java中io.vertx.rx.java.RxHelper.toSubscriber方法的典型用法代码示例。如果您正苦于以下问题:Java RxHelper.toSubscriber方法的具体用法?Java RxHelper.toSubscriber怎么用?Java RxHelper.toSubscriber使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在io.vertx.rx.java.RxHelper的用法示例。


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

示例1: testSingleFutureSubscriptionSuccess

import io.vertx.rx.java.RxHelper; //导入方法依赖的package包/类
@Test
public void testSingleFutureSubscriptionSuccess() {
  List<Object> results = new ArrayList<>();
  Subscriber<String> sub = RxHelper.toSubscriber(handler(results));
  SingleEmitter<String> emitter = subscribeToSingle(sub);
  assertEquals(Collections.emptyList(), results);
  emitter.onSuccess("the-value-1");
  assertEquals(Collections.singletonList("the-value-1"), results);
  emitter.onSuccess("the-value-2");
  assertEquals(Collections.singletonList("the-value-1"), results);
}
 
开发者ID:vert-x3,项目名称:vertx-rx,代码行数:12,代码来源:SubscriberTest.java

示例2: testSingleFutureSubscriptionError

import io.vertx.rx.java.RxHelper; //导入方法依赖的package包/类
@Test
public void testSingleFutureSubscriptionError() {
  List<Object> results = new ArrayList<>();
  Subscriber<String> sub = RxHelper.toSubscriber(handler(results));
  SingleEmitter<String> emitter = subscribeToSingle(sub);
  assertEquals(Collections.emptyList(), results);
  Throwable cause = new Throwable();
  emitter.onError(cause);
  assertEquals(Collections.singletonList(cause), results);
  emitter.onSuccess("the-value");
  assertEquals(Collections.singletonList(cause), results);
}
 
开发者ID:vert-x3,项目名称:vertx-rx,代码行数:13,代码来源:SubscriberTest.java

示例3: testObservableFutureSubscriptionCompletedWithNoItems

import io.vertx.rx.java.RxHelper; //导入方法依赖的package包/类
@Test
public void testObservableFutureSubscriptionCompletedWithNoItems() {
  List<Object> results = new ArrayList<>();
  Subscriber<String> sub = RxHelper.toSubscriber(handler(results));
  Emitter<String> emitter = subscribe(sub);
  assertEquals(Collections.emptyList(), results);
  emitter.onCompleted();
  assertEquals(Collections.singletonList(null), results);
  emitter.onNext("the-value-1");
  assertEquals(Collections.singletonList(null), results);
}
 
开发者ID:vert-x3,项目名称:vertx-rx,代码行数:12,代码来源:SubscriberTest.java

示例4: testObservableFutureSubscriptionCompletedWithItem

import io.vertx.rx.java.RxHelper; //导入方法依赖的package包/类
@Test
public void testObservableFutureSubscriptionCompletedWithItem() {
  List<Object> results = new ArrayList<>();
  Subscriber<String> sub = RxHelper.toSubscriber(handler(results));
  Emitter<String> emitter = subscribe(sub);
  assertEquals(Collections.emptyList(), results);
  emitter.onNext("the-value-1");
  assertEquals(Collections.singletonList("the-value-1"), results);
  emitter.onCompleted();
  emitter.onNext("the-value-1");
  assertEquals(Collections.singletonList("the-value-1"), results);
}
 
开发者ID:vert-x3,项目名称:vertx-rx,代码行数:13,代码来源:SubscriberTest.java

示例5: testObservableFutureSubscriptionCompletedWithItems

import io.vertx.rx.java.RxHelper; //导入方法依赖的package包/类
@Test
public void testObservableFutureSubscriptionCompletedWithItems() {
  List<Object> results = new ArrayList<>();
  Subscriber<String> sub = RxHelper.toSubscriber(handler(results));
  Emitter<String> emitter = subscribe(sub);
  assertEquals(Collections.emptyList(), results);
  emitter.onNext("the-value-1");
  assertEquals(Collections.singletonList("the-value-1"), results);
  emitter.onNext("the-value-2");
  assertEquals(Collections.singletonList("the-value-1"), results);
}
 
开发者ID:vert-x3,项目名称:vertx-rx,代码行数:12,代码来源:SubscriberTest.java

示例6: testObservableFutureSubscriptionError

import io.vertx.rx.java.RxHelper; //导入方法依赖的package包/类
@Test
public void testObservableFutureSubscriptionError() {
  List<Object> results = new ArrayList<>();
  Subscriber<String> sub = RxHelper.toSubscriber(handler(results));
  Emitter<String> emitter = subscribe(sub);
  assertEquals(Collections.emptyList(), results);
  Throwable cause = new Throwable();
  emitter.onError(cause);
  assertEquals(Collections.singletonList(cause), results);
  emitter.onNext("the-value");
  assertEquals(Collections.singletonList(cause), results);
}
 
开发者ID:vert-x3,项目名称:vertx-rx,代码行数:13,代码来源:SubscriberTest.java

示例7: toSubscriber

import io.vertx.rx.java.RxHelper; //导入方法依赖的package包/类
public static <T> Subscriber<T> toSubscriber(Handler<AsyncResult<T>> handler) {
  return RxHelper.toSubscriber(handler);
}
 
开发者ID:kristenkotkas,项目名称:moviediary,代码行数:4,代码来源:RxUtils.java


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