io.vertx.ext.unit.Async.complete()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(182)

本文整理了Java中io.vertx.ext.unit.Async.complete()方法的一些代码示例,展示了Async.complete()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Async.complete()方法的具体详情如下:
包路径:io.vertx.ext.unit.Async
类名称:Async
方法名:complete

Async.complete介绍

暂无

代码示例

代码示例来源:origin: vert-x3/vertx-web

@Before
public void before(TestContext context) {
  vertx = Vertx.vertx();
  Async async = context.async();
  vertx.deployVerticle(TestVerticle.class.getName(), context.asyncAssertSuccess(event -> async.complete()));
}

代码示例来源:origin: vert-x3/vertx-web

@Test
public void test(TestContext testContext) {
  HttpClient client =
      vertx.createHttpClient(new HttpClientOptions()
          .setConnectTimeout(10000));
  Async async = testContext.async();
  client.getNow(PORT, "127.0.0.1", "/test", testContext.asyncAssertSuccess(httpClientResponse -> {
   testContext.assertEquals(HttpURLConnection.HTTP_NO_CONTENT, httpClientResponse.statusCode());
   async.complete();
  }));
}

代码示例来源:origin: io.vertx/vertx-shell

@Override
 public void complete(List<String> candidates) {
  context.assertEquals(Collections.emptyList(), candidates);
  async.complete();
 }
});

代码示例来源:origin: io.vertx/vertx-config

@Test
 public void testLoadingFromEnvironmentVariables(TestContext context) {
  Async async = context.async();
  getJsonConfiguration(vertx, store, ar -> {
   assertThat(ar.succeeded()).isTrue();
   assertThat(ar.result().getString(KEY_1)).isEqualTo(VAL_1);
   assertThat(ar.result().getString(KEY_2)).isEqualTo(VAL_2);
   async.complete();
  });
 }
}

代码示例来源:origin: reactiverse/reactive-pg-client

@Test
public void testConnectInvalidPassword(TestContext ctx) {
 Async async = ctx.async();
 options.setPassword("incorrect");
 connector.accept(ctx.asyncAssertFailure(conn -> {
  ctx.assertEquals("password authentication failed for user \"postgres\"", conn.getMessage());
  async.complete();
 }));
}

代码示例来源:origin: io.vertx/vertx-config

@Test
public void testLoadingFromAJsonArrayFile(TestContext context) {
 Async async = context.async();
 store = factory.create(vertx, new JsonObject().put("path", "src/test/resources/file/array.json"));
 getJsonConfiguration(vertx, store, ar -> {
  assertThat(ar.failed()).isTrue();
  async.complete();
 });
}

代码示例来源:origin: io.vertx/vertx-shell

@Override
 public void complete(List<String> candidates) {
  context.assertEquals(Collections.emptyList(), candidates);
  async.complete();
 }
});

代码示例来源:origin: reactiverse/reactive-pg-client

@Test
public void testConnectInvalidDatabase(TestContext ctx) {
 Async async = ctx.async();
 options.setDatabase("blah_db");
 connector.accept(ctx.asyncAssertFailure(conn -> {
  ctx.assertEquals("database \"blah_db\" does not exist", conn.getMessage());
  async.complete();
 }));
}

代码示例来源:origin: io.vertx/vertx-config

@Test
public void testLoadingFromEnvWithNullKeySet(TestContext context) {
 Async async = context.async();
 store = factory.create(vertx, new JsonObject().put("keys", (JsonArray) null));
 getJsonConfiguration(vertx, store, ar -> {
  assertThat(ar.succeeded()).isTrue();
  assertThat(ar.result().getString("PATH")).isNotNull();
  async.complete();
 });
}

代码示例来源:origin: io.vertx/vertx-shell

@Override
 public void complete(List<String> candidates) {
  context.assertEquals(Arrays.asList("bar", "baz", "err", "foo"), candidates.stream().sorted().collect(Collectors.toList()));
  async.complete();
 }
});

代码示例来源:origin: reactiverse/reactive-pg-client

@Test
public void testConnectNonSSLServer(TestContext ctx) {
 Async async = ctx.async();
 options.setSslMode(SslMode.REQUIRE).setTrustAll(true);
 connector.accept(ctx.asyncAssertFailure(err -> {
  ctx.assertEquals("Postgres Server does not handle SSL connection", err.getMessage());
  async.complete();
 }));
}

代码示例来源:origin: io.vertx/vertx-unit

@Test
 public void testMethod(TestContext context) {
  requestCount.set(0);
  Async async = context.async();
  vertx.createHttpClient().getNow(8080, "localhost", "/", resp -> {
   async.complete();
  });
 }
}

代码示例来源:origin: io.vertx/vertx-shell

@Override
 public void complete(String value, boolean terminal) {
  context.assertFalse(terminal);
  context.assertEquals("a", value);
  async.complete();
 }
});

代码示例来源:origin: io.vertx/vertx-shell

@Test
public void testBusSendJsonObject(TestContext context) {
 Async consumerAsync = context.async();
 assertBusSend(context, "bus-send --type JSON_OBJECT the_address '{\"foo\":\"foo_value\",\"bar\":3}'", msg -> {
  context.assertEquals(new JsonObject().put("foo", "foo_value").put("bar", 3), msg.body());
  consumerAsync.complete();
 });
}

代码示例来源:origin: io.vertx/vertx-kafka-client

@Test
public void testExceptionHandler(TestContext ctx) throws Exception {
 Async async = ctx.async();
 Properties props = new Properties();
 props.setProperty(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9092");
 props.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class);
 props.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, StringSerializer.class);
 Date invalidValue = new Date();
 KafkaProducer.create(Vertx.vertx(), props).
  exceptionHandler(exception -> async.complete()).
  write(KafkaProducerRecord.create("topic", "key", invalidValue));
}

代码示例来源:origin: reactiverse/reactive-pg-client

@Override
 public void onComplete() {
  ctx.assertEquals(Collections.emptySet(), ids);
  // Check the pool is back in the pool by the commit
  pool.rxGetConnection().subscribe(conn -> {
   conn.close();
   async.complete();
  }, ctx::fail);
 }
});

代码示例来源:origin: io.vertx/vertx-shell

@Test
public void testBusSendBase64(TestContext context) {
 Async consumerAsync = context.async();
 assertBusSend(context, "bus-send --type BASE64 the_address " + new String(Base64.getEncoder().encode(new byte[]{0,31,-1})), msg -> {
  context.assertEquals(Buffer.buffer(new byte[]{0,31,-1}), msg.body());
  consumerAsync.complete();
 });
}

代码示例来源:origin: io.vertx/vertx-web-templ-mvel

@Test
public void testNoSuchTemplate(TestContext should) {
 final Async test = should.async();
 TemplateEngine engine = MVELTemplateEngine.create(vertx);
 engine.render(new JsonObject(), "nosuchtemplate.templ", render -> {
  should.assertFalse(render.succeeded());
  test.complete();
 });
 test.await();
}

代码示例来源:origin: io.vertx/vertx-shell

@Test
public void testBusSendHex(TestContext context) {
 Async consumerAsync = context.async();
 assertBusSend(context, "bus-send --type HEX the_address 001FFF", msg -> {
  context.assertEquals(Buffer.buffer(new byte[]{0,31,-1}), msg.body());
  consumerAsync.complete();
 });
}

代码示例来源:origin: io.vertx/vertx-web-templ-rocker

@Test
public void testNoSuchTemplate(TestContext should) {
 final Async test = should.async();
 TemplateEngine engine = RockerTemplateEngine.create();
 final JsonObject context = new JsonObject();
 engine.render(context, "nosuchtemplate.rocker.html", render -> {
  should.assertFalse(render.succeeded());
  test.complete();
 });
 test.await();
}

相关文章