/** * Cause the current thread to wait until this completion completes with a configurable timeout.<p/> * * If completion times out or the current thread is interrupted, an exception will be thrown. * @param timeoutMillis the timeout in milliseconds */ public void await(long timeoutMillis) { delegate.await(timeoutMillis); }
/** * Cause the current thread to wait until this completion completes and succeeds with a configurable timeout.<p/> * * If completion times out or the current thread is interrupted or the suite fails, an exception will be thrown. * @param timeoutMillis the timeout in milliseconds */ public void awaitSuccess(long timeoutMillis) { delegate.awaitSuccess(timeoutMillis); }
public static void handler(io.vertx.ext.unit.Completion<Object> j_receiver, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Object>> completionHandler) { j_receiver.handler(completionHandler != null ? new io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Object>>() { public void handle(io.vertx.core.AsyncResult<java.lang.Object> ar) { completionHandler.handle(ar.map(event -> io.vertx.core.impl.ConversionHelper.fromObject(event))); } } : null); } }
private void testSucceeded(Consumer<Completion> consumer) { TestSuite suite = TestSuite.create("my_suite").test("my_test", context -> { }); Completion completion = suite.run(Vertx.vertx()); consumer.accept(completion); assertTrue(completion.isCompleted()); assertTrue(completion.isSucceeded()); assertFalse(completion.isFailed()); }
/** * @return true if this completion is completed */ public boolean isCompleted() { boolean ret = delegate.isCompleted(); return ret; }
/** * @return true if this completion is completed and succeeded */ public boolean isSucceeded() { boolean ret = delegate.isSucceeded(); return ret; }
/** * @return true if the this completion is completed and failed */ public boolean isFailed() { boolean ret = delegate.isFailed(); return ret; }
/** * Completes the future upon completion, otherwise fails it. * @param future the future to resolve */ public void resolve(io.vertx.rxjava.core.Future<T> future) { delegate.resolve(future.getDelegate()); }
private void testAwaitFailed(Consumer<Completion> consumer) { TestSuite suite = TestSuite.create("my_suite").test("my_test", context -> { context.fail(); }); Completion completion = suite.run(Vertx.vertx()); consumer.accept(completion); assertTrue(completion.isCompleted()); assertFalse(completion.isSucceeded()); assertTrue(completion.isFailed()); }
/** * @return true if this completion is completed */ public boolean isCompleted() { boolean ret = delegate.isCompleted(); return ret; }
/** * @return true if this completion is completed and succeeded */ public boolean isSucceeded() { boolean ret = delegate.isSucceeded(); return ret; }
/** * @return true if the this completion is completed and failed */ public boolean isFailed() { boolean ret = delegate.isFailed(); return ret; }
/** * Completes the future upon completion, otherwise fails it. * @param future the future to resolve */ public void resolve(io.vertx.rxjava.core.Future<T> future) { delegate.resolve(future.getDelegate()); }
private void testTimeout(Consumer<Completion> consumer) { TestSuite suite = TestSuite.create("my_suite").test("my_test", context -> { context.async(); }); Completion completion = suite.run(Vertx.vertx()); try { consumer.accept(completion); fail(); } catch (Exception e) { assertTrue(e instanceof TimeoutException); assertFalse(completion.isCompleted()); assertFalse(completion.isSucceeded()); assertFalse(completion.isFailed()); } }
/** * Cause the current thread to wait until this completion completes.<p/> * * If the current thread is interrupted, an exception will be thrown. */ public void await() { delegate.await(); }
/** * Cause the current thread to wait until this completion completes and succeeds with a configurable timeout.<p/> * * If completion times out or the current thread is interrupted or the suite fails, an exception will be thrown. * @param timeoutMillis the timeout in milliseconds */ public void awaitSuccess(long timeoutMillis) { delegate.awaitSuccess(timeoutMillis); }
/** * Completion handler to receive a completion signal when this completions completes. * @param completionHandler the completion handler */ public void handler(Handler<AsyncResult<T>> completionHandler) { delegate.handler(new Handler<AsyncResult<T>>() { public void handle(AsyncResult<T> ar) { if (ar.succeeded()) { completionHandler.handle(io.vertx.core.Future.succeededFuture((T)__typeArg_0.wrap(ar.result()))); } else { completionHandler.handle(io.vertx.core.Future.failedFuture(ar.cause())); } } }); }
private void testAwaitSuccessFailed(Consumer<Completion> consumer) throws Exception { AtomicReference<AssertionError> expected = new AtomicReference<>(); TestSuite suite = TestSuite.create("my_suite").test("my_test", context -> { try { context.fail(); } catch (AssertionError ae) { expected.set(ae); throw ae; } }); Completion completion = suite.run(Vertx.vertx()); try { consumer.accept(completion); fail(); } catch (AssertionError ae) { assertSame(expected.get(), ae); } assertTrue(completion.isCompleted()); assertFalse(completion.isSucceeded()); assertTrue(completion.isFailed()); }
/** * Cause the current thread to wait until this completion completes with a configurable timeout.<p/> * * If completion times out or the current thread is interrupted, an exception will be thrown. * @param timeoutMillis the timeout in milliseconds */ public void await(long timeoutMillis) { delegate.await(timeoutMillis); }
/** * Cause the current thread to wait until this completion completes and succeeds.<p/> * * If the current thread is interrupted or the suite fails, an exception will be thrown. */ public void awaitSuccess() { delegate.awaitSuccess(); }