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


Java Async.complete方法代码示例

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


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

示例1: registerTwoRoutesTest

import io.vertx.ext.unit.Async; //导入方法依赖的package包/类
@Test
	public void registerTwoRoutesTest(TestContext context) throws IOException {

		TestRest testRest = new TestRest();
		TestPostRest testPostRest = new TestPostRest();

		Router router = RestRouter.register(vertx, testRest, testPostRest);
		vertx.createHttpServer()
			.requestHandler(router::accept)
			.listen(PORT);

		final Async async = context.async();

		// check if both are active
		Dummy json = new Dummy("test", "me");
		StringEntity input = new StringEntity(JsonUtils.toJson(json));
		input.setContentType("application/json");

	/*	HttpPost request = (HttpPost) HttpUtils.post(ROOT_PATH + "/test/json/post", null, null, input, null);
		HttpResponse response = HttpUtils.execute(request);

		assertEquals(200, response.getStatusLine().getStatusCode());
		String output = HttpUtils.getContentAsString(response);
		assertEquals("{\"name\":\"Received-test\",\"value\":\"Received-me\"}", output);
*/
		// 2nd REST
		HttpPost request = (HttpPost) HttpUtils.post(ROOT_PATH + "/post/json", null, null, input, null);
		HttpResponse response = HttpUtils.execute(request);

		assertEquals(200, response.getStatusLine().getStatusCode());
		String output = HttpUtils.getContentAsString(response);
		assertEquals("{\"name\":\"Received-test\",\"value\":\"Received-me\"}", output);

		async.complete();
	}
 
开发者ID:zandero,项目名称:rest.vertx,代码行数:36,代码来源:RouteRegistrationTest.java

示例2: shouldReturnNotFoundForBadMethod

import io.vertx.ext.unit.Async; //导入方法依赖的package包/类
@Test
public void shouldReturnNotFoundForBadMethod(TestContext context) {
    final Async async = context.async();
    given()
        .port(ExampleVerticle.HTTP_PORT)
    .when()
        .contentType("application/json")
        .post("/test-get")
    .then()
        .assertThat()
            .contentType("application/problem+json")
            .body("title", equalTo("Not Found"))
            .body("status", equalTo(404));
    async.complete();
}
 
开发者ID:valuelogic,项目名称:vertx-web-problem,代码行数:16,代码来源:NotFoundHandlerTest.java

示例3: verifyMissHandler

import io.vertx.ext.unit.Async; //导入方法依赖的package包/类
private Handler<HttpClientResponse> verifyMissHandler(TestContext context, Async f) {
	return r -> {
		context.assertEquals(404,  r.statusCode(), "Should have received an error for incorrect type");
		f.complete();
	};
}
 
开发者ID:GreenfieldTech,项目名称:irked,代码行数:7,代码来源:TestConsumes.java

示例4: validateProfiles

import io.vertx.ext.unit.Async; //导入方法依赖的package包/类
private Consumer<List<CommonProfile>> validateProfiles(final Matcher<List<CommonProfile>> expectedProfiles, final Async async) {
    return l -> {
        assertThat(l, is(expectedProfiles));
        async.complete();
    };
}
 
开发者ID:millross,项目名称:pac4j-async,代码行数:7,代码来源:AsyncSingleProfileSaveTest.java


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