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


Java Http.RequestBuilder方法代码示例

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


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

示例1: testIndex

import play.mvc.Http; //导入方法依赖的package包/类
@Test
public void testIndex() {
    Http.RequestBuilder request = new Http.RequestBuilder()
            .method(GET)
            .uri("/");

    Result result = route(app, request);
    assertEquals(OK, result.status());
}
 
开发者ID:Clivern,项目名称:Racter,代码行数:10,代码来源:HomeControllerTest.java

示例2: testUnauthenticatedUserRequestingProtectedPage

import play.mvc.Http; //导入方法依赖的package包/类
@Test
public void testUnauthenticatedUserRequestingProtectedPage() {
    Http.RequestBuilder request = Helpers.fakeRequest()
            .method(GET)
            .uri(controllers.routes.PostController.getNewPostForm().url());

    Result result = route(app, request);
    assertThat(result.status()).isEqualTo(UNAUTHORIZED);
}
 
开发者ID:reljicd,项目名称:play-framework-blog,代码行数:10,代码来源:SecurityTest.java

示例3: testAuthenticatedUserRequestingProtectedPage

import play.mvc.Http; //导入方法依赖的package包/类
@Test
public void testAuthenticatedUserRequestingProtectedPage() {
    Http.RequestBuilder request = Helpers.fakeRequest()
            .method(GET)
            .session("username", USERNAME)
            .uri(controllers.routes.PostController.getNewPostForm().url());

    Result result = route(app, request);
    assertThat(result.status()).isEqualTo(OK);
}
 
开发者ID:reljicd,项目名称:play-framework-blog,代码行数:11,代码来源:SecurityTest.java

示例4: testAuthenticatedUserRequestingRegisterPage

import play.mvc.Http; //导入方法依赖的package包/类
@Test
public void testAuthenticatedUserRequestingRegisterPage() {
    Http.RequestBuilder request = Helpers.fakeRequest()
            .method(GET)
            .session("username", USERNAME)
            .uri(controllers.routes.UserController.getRegistrationForm().url());

    Result result = route(app, request);
    assertThat(result.status()).isEqualTo(SEE_OTHER);
}
 
开发者ID:reljicd,项目名称:play-framework-blog,代码行数:11,代码来源:SecurityTest.java

示例5: testAuthenticatedUserRequestingToEditHisPost

import play.mvc.Http; //导入方法依赖的package包/类
@Test
public void testAuthenticatedUserRequestingToEditHisPost() {
    PostDTO postDTO = postService.savePost(new PostDTO(null, "TEST", "TEST", null, USERNAME));
    Http.RequestBuilder request = Helpers.fakeRequest()
            .method(GET)
            .session("username", USERNAME)
            .uri(controllers.routes.PostController.getEditPostForm(postDTO.id).url());

    Result result = route(app, request);
    assertThat(result.status()).isEqualTo(OK);
}
 
开发者ID:reljicd,项目名称:play-framework-blog,代码行数:12,代码来源:SecurityTest.java

示例6: testAuthenticatedUserRequestingToEditPostByOtherUser

import play.mvc.Http; //导入方法依赖的package包/类
@Test
public void testAuthenticatedUserRequestingToEditPostByOtherUser() {
    UserDTO userDTO = new UserDTO("TEST", "TEST", "[email protected]", "firstName", "lastName");
    userService.saveUser(userDTO);
    PostDTO postDTO = postService.savePost(new PostDTO(null, "TEST", "TEST", null, userDTO.username));

    Http.RequestBuilder request = Helpers.fakeRequest()
            .method(GET)
            .session("username", USERNAME)
            .uri(controllers.routes.PostController.getEditPostForm(postDTO.id).url());

    Result result = route(app, request);
    assertThat(result.status()).isEqualTo(UNAUTHORIZED);
}
 
开发者ID:reljicd,项目名称:play-framework-blog,代码行数:15,代码来源:SecurityTest.java

示例7: enviaPOSTAddOpiniao

import play.mvc.Http; //导入方法依赖的package包/类
public static Result enviaPOSTAddOpiniao(JsonNode json, long iniciativaExemplo, String token) {
    Logger.debug("Requisição para add opinião: " + json.toString());
    Http.RequestBuilder request = new Http.RequestBuilder().method("POST")
            .bodyJson(json)
            .header("authorization", "token " + token)
            .uri(controllers.routes.OpiniaoController.addOpiniao(iniciativaExemplo).url());
    return route(request);
}
 
开发者ID:nazareno,项目名称:diferentonas-server,代码行数:9,代码来源:ControllersTestUtils.java

示例8: testIndex

import play.mvc.Http; //导入方法依赖的package包/类
@Test
public void testIndex() {
    Http.RequestBuilder request = new Http.RequestBuilder()
            .method(GET)
            .uri("/login");

    Result result = route(app, request);
    assertEquals(OK, result.status());
}
 
开发者ID:bekce,项目名称:oauthly,代码行数:10,代码来源:HomeControllerTest.java


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