本文整理汇总了Java中io.vertx.rx.java.RxHelper.toFuture方法的典型用法代码示例。如果您正苦于以下问题:Java RxHelper.toFuture方法的具体用法?Java RxHelper.toFuture怎么用?Java RxHelper.toFuture使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.vertx.rx.java.RxHelper
的用法示例。
在下文中一共展示了RxHelper.toFuture方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: observableToHandler
import io.vertx.rx.java.RxHelper; //导入方法依赖的package包/类
public void observableToHandler() {
Observer<HttpServer> observer = new Observer<HttpServer>() {
@Override
public void onNext(HttpServer o) {
}
@Override
public void onError(Throwable e) {
}
@Override
public void onCompleted() {
}
};
Handler<AsyncResult<HttpServer>> handler = RxHelper.toFuture(observer);
}
示例2: actionsToHandler
import io.vertx.rx.java.RxHelper; //导入方法依赖的package包/类
public void actionsToHandler() {
Action1<HttpServer> onNext = httpServer -> {};
Action1<Throwable> onError = httpServer -> {};
Action0 onComplete = () -> {};
Handler<AsyncResult<HttpServer>> handler1 = RxHelper.toFuture(onNext);
Handler<AsyncResult<HttpServer>> handler2 = RxHelper.toFuture(onNext, onError);
Handler<AsyncResult<HttpServer>> handler3 = RxHelper.toFuture(onNext, onError, onComplete);
}
示例3: testFulfillAdaptedSubscriber
import io.vertx.rx.java.RxHelper; //导入方法依赖的package包/类
@Test
public void testFulfillAdaptedSubscriber() {
SimpleSubscriber<String> subscriber = new SimpleSubscriber<>();
Handler<AsyncResult<String>> o = RxHelper.toFuture(subscriber.toObserver());
o.handle(Future.succeededFuture("abc"));
subscriber.assertItem("abc").assertCompleted().assertEmpty();
}
示例4: testRejectAdaptedSubscriber
import io.vertx.rx.java.RxHelper; //导入方法依赖的package包/类
@Test
public void testRejectAdaptedSubscriber() {
SimpleSubscriber<String> subscriber = new SimpleSubscriber<>();
Handler<AsyncResult<String>> o = RxHelper.toFuture(subscriber.toObserver());
Exception e = new Exception();
o.handle(Future.failedFuture(e));
subscriber.assertError(e).assertEmpty();
}
示例5: testFulfillAdaptedFunctions1
import io.vertx.rx.java.RxHelper; //导入方法依赖的package包/类
@Test
public void testFulfillAdaptedFunctions1() {
List<String> items = new ArrayList<>();
Handler<AsyncResult<String>> o = RxHelper.toFuture(items::add);
o.handle(Future.succeededFuture("abc"));
assertEquals(Collections.singletonList("abc"), items);
}
示例6: testFulfillAdaptedFunctions2
import io.vertx.rx.java.RxHelper; //导入方法依赖的package包/类
@Test
public void testFulfillAdaptedFunctions2() {
List<String> items = new ArrayList<>();
List<Throwable> errors = new ArrayList<>();
Handler<AsyncResult<String>> o = RxHelper.toFuture(items::add, errors::add);
o.handle(Future.succeededFuture("abc"));
assertEquals(Collections.singletonList("abc"), items);
assertEquals(Collections.emptyList(), errors);
}
示例7: testFulfillAdaptedFunctions3
import io.vertx.rx.java.RxHelper; //导入方法依赖的package包/类
@Test
public void testFulfillAdaptedFunctions3() {
List<String> items = new ArrayList<>();
List<Throwable> errors = new ArrayList<>();
AtomicInteger completions = new AtomicInteger();
Handler<AsyncResult<String>> o = RxHelper.toFuture(items::add, errors::add, completions::incrementAndGet);
o.handle(Future.succeededFuture("abc"));
assertEquals(Collections.singletonList("abc"), items);
assertEquals(Collections.emptyList(), errors);
assertEquals(1, completions.get());
}
示例8: testRejectAdaptedFunctions1
import io.vertx.rx.java.RxHelper; //导入方法依赖的package包/类
@Test
public void testRejectAdaptedFunctions1() {
SimpleSubscriber<String> subscriber = new SimpleSubscriber<>();
Handler<AsyncResult<String>> o = RxHelper.toFuture(subscriber::onNext);
Exception cause = new Exception();
try {
o.handle(Future.failedFuture(cause));
} catch (OnErrorNotImplementedException e) {
assertSame(cause, e.getCause());
}
subscriber.assertEmpty();
}
示例9: testRejectAdaptedFunctions2
import io.vertx.rx.java.RxHelper; //导入方法依赖的package包/类
@Test
public void testRejectAdaptedFunctions2() {
SimpleSubscriber<String> subscriber = new SimpleSubscriber<>();
Handler<AsyncResult<String>> o = RxHelper.toFuture(subscriber::onNext, subscriber::onError);
Exception cause = new Exception();
o.handle(Future.failedFuture(cause));
subscriber.assertError(cause).assertEmpty();
}
示例10: testRejectAdaptedFunctions3
import io.vertx.rx.java.RxHelper; //导入方法依赖的package包/类
@Test
public void testRejectAdaptedFunctions3() {
SimpleSubscriber<String> subscriber = new SimpleSubscriber<>();
Handler<AsyncResult<String>> o = RxHelper.toFuture(subscriber::onNext, subscriber::onError, subscriber::onCompleted);
Exception cause = new Exception();
o.handle(Future.failedFuture(cause));
subscriber.assertError(cause).assertEmpty();
}
示例11: toFuture
import io.vertx.rx.java.RxHelper; //导入方法依赖的package包/类
public static <T>Handler<AsyncResult<T>> toFuture(Observer<T> observer) {
return RxHelper.toFuture(observer);
}