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


Java RequestBuilder类代码示例

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


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

示例1: testCreateOrg

import play.mvc.Http.RequestBuilder; //导入依赖的package包/类
@Test
public void testCreateOrg() {
  PowerMockito.mockStatic(RequestInterceptor.class);
  when( RequestInterceptor.verifyRequestData(Mockito.anyObject()) ).thenReturn("{userId} uuiuhcf784508 8y8c79-fhh");
  Map<String , Object> requestMap = new HashMap<>();
  Map<String , Object> innerMap = new HashMap<>();
  innerMap.put(JsonKey.ORG_NAME , "org123");
  requestMap.put(JsonKey.REQUEST , innerMap);
  String data = mapToJson(requestMap);

  JsonNode json = Json.parse(data);
  RequestBuilder req = new RequestBuilder().bodyJson(json).uri("/v1/org/create").method("POST");
  req.headers(headerMap);
  Result result = route(req);
  assertEquals(200, result.status());
}
 
开发者ID:project-sunbird,项目名称:sunbird-lms-service,代码行数:17,代码来源:OrganisationControllerTest.java

示例2: testCreateOrgInvalidRequestData

import play.mvc.Http.RequestBuilder; //导入依赖的package包/类
@Test
public void testCreateOrgInvalidRequestData() {
  PowerMockito.mockStatic(RequestInterceptor.class);
  when( RequestInterceptor.verifyRequestData(Mockito.anyObject()) ).thenReturn("{userId} uuiuhcf784508 8y8c79-fhh");
  Map<String , Object> requestMap = new HashMap<>();
  Map<String , Object> innerMap = new HashMap<>();
  innerMap.put(JsonKey.ORG_NAME , null);
  requestMap.put(JsonKey.REQUEST , innerMap);
  String data = mapToJson(requestMap);

  JsonNode json = Json.parse(data);
  RequestBuilder req = new RequestBuilder().bodyJson(json).uri("/v1/org/create").method("POST");
  req.headers(headerMap);
  Result result = route(req);
  assertEquals(400, result.status());
}
 
开发者ID:project-sunbird,项目名称:sunbird-lms-service,代码行数:17,代码来源:OrganisationControllerTest.java

示例3: testApproveOrg

import play.mvc.Http.RequestBuilder; //导入依赖的package包/类
@Test
public void testApproveOrg() {
  PowerMockito.mockStatic(RequestInterceptor.class);
  when( RequestInterceptor.verifyRequestData(Mockito.anyObject()) ).thenReturn("{userId} uuiuhcf784508 8y8c79-fhh");

  Map<String , Object> requestMap = new HashMap<>();
  Map<String , Object> innerMap = new HashMap<>();
  innerMap.put(JsonKey.ORGANISATION_ID , "org123");
  requestMap.put(JsonKey.REQUEST , innerMap);

  String data = mapToJson(requestMap);


  JsonNode json = Json.parse(data);
  RequestBuilder req = new RequestBuilder().bodyJson(json).uri("/v1/org/approve").method("POST");
  req.headers(headerMap);
  Result result = route(req);
  assertEquals(200, result.status());
}
 
开发者ID:project-sunbird,项目名称:sunbird-lms-service,代码行数:20,代码来源:OrganisationControllerTest.java

示例4: testApproveOrgInvalidRequestData

import play.mvc.Http.RequestBuilder; //导入依赖的package包/类
@Test
public void testApproveOrgInvalidRequestData() {
  PowerMockito.mockStatic(RequestInterceptor.class);
  when( RequestInterceptor.verifyRequestData(Mockito.anyObject()) ).thenReturn("{userId} uuiuhcf784508 8y8c79-fhh");

  Map<String , Object> requestMap = new HashMap<>();
  Map<String , Object> innerMap = new HashMap<>();
  innerMap.put(JsonKey.ORGANISATION_ID , null);
  requestMap.put(JsonKey.REQUEST , innerMap);

  String data = mapToJson(requestMap);


  JsonNode json = Json.parse(data);
  RequestBuilder req = new RequestBuilder().bodyJson(json).uri("/v1/org/approve").method("POST");
  req.headers(headerMap);
  Result result = route(req);
  assertEquals(400, result.status());
}
 
开发者ID:project-sunbird,项目名称:sunbird-lms-service,代码行数:20,代码来源:OrganisationControllerTest.java

示例5: testUpdateOrg

import play.mvc.Http.RequestBuilder; //导入依赖的package包/类
@Test
public void testUpdateOrg() {
  PowerMockito.mockStatic(RequestInterceptor.class);
  when( RequestInterceptor.verifyRequestData(Mockito.anyObject()) ).thenReturn("{userId} uuiuhcf784508 8y8c79-fhh");

  Map<String , Object> requestMap = new HashMap<>();
  Map<String , Object> innerMap = new HashMap<>();
  innerMap.put(JsonKey.ORGANISATION_ID , "org123");
  innerMap.put(JsonKey.ROOT_ORG_ID , "rootorg12");
  requestMap.put(JsonKey.REQUEST , innerMap);

  String data = mapToJson(requestMap);


  JsonNode json = Json.parse(data);
  RequestBuilder req = new RequestBuilder().bodyJson(json).uri("/v1/org/update").method("PATCH");
  req.headers(headerMap);
  Result result = route(req);
  assertEquals(200, result.status());
}
 
开发者ID:project-sunbird,项目名称:sunbird-lms-service,代码行数:21,代码来源:OrganisationControllerTest.java

示例6: testupdateOrgStatus

import play.mvc.Http.RequestBuilder; //导入依赖的package包/类
@Test
public void testupdateOrgStatus() {
  PowerMockito.mockStatic(RequestInterceptor.class);
  when( RequestInterceptor.verifyRequestData(Mockito.anyObject()) ).thenReturn("{userId} uuiuhcf784508 8y8c79-fhh");
  Map<String , Object> requestMap = new HashMap<>();
  Map<String , Object> innerMap = new HashMap<>();
  innerMap.put(JsonKey.ORGANISATION_ID , "org123");
  innerMap.put(JsonKey.STATUS, new BigInteger("1"));
  requestMap.put(JsonKey.REQUEST , innerMap);
  String data = mapToJson(requestMap);

  JsonNode json = Json.parse(data);
  RequestBuilder req = new RequestBuilder().bodyJson(json).uri("/v1/org/status/update").method("POST");
  req.headers(headerMap);
  Result result = route(req);
  assertEquals(404, result.status());
}
 
开发者ID:project-sunbird,项目名称:sunbird-lms-service,代码行数:18,代码来源:OrganisationControllerTest.java

示例7: testgetOrgDetails

import play.mvc.Http.RequestBuilder; //导入依赖的package包/类
@Test
public void testgetOrgDetails() {
  PowerMockito.mockStatic(RequestInterceptor.class);
  when( RequestInterceptor.verifyRequestData(Mockito.anyObject()) ).thenReturn("{userId} uuiuhcf784508 8y8c79-fhh");
  Map<String , Object> requestMap = new HashMap<>();
  Map<String , Object> innerMap = new HashMap<>();
  innerMap.put(JsonKey.ORGANISATION_ID , "org123");
  innerMap.put(JsonKey.STATUS, new BigInteger("1"));
  requestMap.put(JsonKey.REQUEST , innerMap);
  String data = mapToJson(requestMap);

  JsonNode json = Json.parse(data);
  RequestBuilder req = new RequestBuilder().bodyJson(json).uri("/v1/org/read").method("POST");
  req.headers(headerMap);
  Result result = route(req);
  assertEquals(200, result.status());
}
 
开发者ID:project-sunbird,项目名称:sunbird-lms-service,代码行数:18,代码来源:OrganisationControllerTest.java

示例8: testaddMemberToOrganisation

import play.mvc.Http.RequestBuilder; //导入依赖的package包/类
@Test
public void testaddMemberToOrganisation() {
  PowerMockito.mockStatic(RequestInterceptor.class);
  when( RequestInterceptor.verifyRequestData(Mockito.anyObject()) ).thenReturn("{userId} uuiuhcf784508 8y8c79-fhh");
  Map<String , Object> requestMap = new HashMap<>();
  Map<String , Object> innerMap = new HashMap<>();
  innerMap.put(JsonKey.ORGANISATION_ID , "org123");
  innerMap.put(JsonKey.STATUS, new BigInteger("1"));
  requestMap.put(JsonKey.REQUEST , innerMap);
  String data = mapToJson(requestMap);

  JsonNode json = Json.parse(data);
  RequestBuilder req = new RequestBuilder().bodyJson(json).uri("/v1/org/member/add").method("POST");
  req.headers(headerMap);
  Result result = route(req);
  assertEquals(200, result.status());
}
 
开发者ID:project-sunbird,项目名称:sunbird-lms-service,代码行数:18,代码来源:OrganisationControllerTest.java

示例9: testremoveMemberFromOrganisation

import play.mvc.Http.RequestBuilder; //导入依赖的package包/类
@Test
public void testremoveMemberFromOrganisation() {
  PowerMockito.mockStatic(RequestInterceptor.class);
  when( RequestInterceptor.verifyRequestData(Mockito.anyObject()) ).thenReturn("{userId} uuiuhcf784508 8y8c79-fhh");
  Map<String , Object> requestMap = new HashMap<>();
  Map<String , Object> innerMap = new HashMap<>();
  innerMap.put(JsonKey.ORGANISATION_ID , "org123");
  innerMap.put(JsonKey.STATUS, new BigInteger("1"));
  requestMap.put(JsonKey.REQUEST , innerMap);
  String data = mapToJson(requestMap);

  JsonNode json = Json.parse(data);
  RequestBuilder req = new RequestBuilder().bodyJson(json).uri("/v1/org/member/remove").method("POST");
  req.headers(headerMap);
  Result result = route(req);
  assertEquals(200, result.status());
}
 
开发者ID:project-sunbird,项目名称:sunbird-lms-service,代码行数:18,代码来源:OrganisationControllerTest.java

示例10: testjoinUserOrganisation

import play.mvc.Http.RequestBuilder; //导入依赖的package包/类
@Test
public void testjoinUserOrganisation() {
  PowerMockito.mockStatic(RequestInterceptor.class);
  when( RequestInterceptor.verifyRequestData(Mockito.anyObject()) ).thenReturn("{userId} uuiuhcf784508 8y8c79-fhh");
  Map<String , Object> requestMap = new HashMap<>();
  Map<String , Object> innerMap = new HashMap<>();
  innerMap.put(JsonKey.ORGANISATION_ID , "org123");
  innerMap.put(JsonKey.STATUS, new BigInteger("1"));
  requestMap.put(JsonKey.REQUEST , innerMap);
  String data = mapToJson(requestMap);

  JsonNode json = Json.parse(data);
  RequestBuilder req = new RequestBuilder().bodyJson(json).uri("/v1/org/member/join").method("POST");
  req.headers(headerMap);
  Result result = route(req);
  assertEquals(200, result.status());
}
 
开发者ID:project-sunbird,项目名称:sunbird-lms-service,代码行数:18,代码来源:OrganisationControllerTest.java

示例11: testapproveUserOrganisation

import play.mvc.Http.RequestBuilder; //导入依赖的package包/类
@Test
public void testapproveUserOrganisation() {
  PowerMockito.mockStatic(RequestInterceptor.class);
  when( RequestInterceptor.verifyRequestData(Mockito.anyObject()) ).thenReturn("{userId} uuiuhcf784508 8y8c79-fhh");
  Map<String , Object> requestMap = new HashMap<>();
  Map<String , Object> innerMap = new HashMap<>();
  innerMap.put(JsonKey.ORGANISATION_ID , "org123");
  innerMap.put(JsonKey.STATUS, new BigInteger("1"));
  requestMap.put(JsonKey.REQUEST , innerMap);
  String data = mapToJson(requestMap);

  JsonNode json = Json.parse(data);
  RequestBuilder req = new RequestBuilder().bodyJson(json).uri("/v1/org/member/approve").method("POST");
  req.headers(headerMap);
  Result result = route(req);
  assertEquals(200, result.status());
}
 
开发者ID:project-sunbird,项目名称:sunbird-lms-service,代码行数:18,代码来源:OrganisationControllerTest.java

示例12: testrejectUserOrganisation

import play.mvc.Http.RequestBuilder; //导入依赖的package包/类
@Test
public void testrejectUserOrganisation() {
  PowerMockito.mockStatic(RequestInterceptor.class);
  when( RequestInterceptor.verifyRequestData(Mockito.anyObject()) ).thenReturn("{userId} uuiuhcf784508 8y8c79-fhh");
  Map<String , Object> requestMap = new HashMap<>();
  Map<String , Object> innerMap = new HashMap<>();
  innerMap.put(JsonKey.ORGANISATION_ID , "org123");
  innerMap.put(JsonKey.STATUS, new BigInteger("1"));
  requestMap.put(JsonKey.REQUEST , innerMap);
  String data = mapToJson(requestMap);

  JsonNode json = Json.parse(data);
  RequestBuilder req = new RequestBuilder().bodyJson(json).uri("/v1/org/member/approve").method("POST");
  req.headers(headerMap);
  Result result = route(req);
  assertEquals(200, result.status());
}
 
开发者ID:project-sunbird,项目名称:sunbird-lms-service,代码行数:18,代码来源:OrganisationControllerTest.java

示例13: testdownloadOrgs

import play.mvc.Http.RequestBuilder; //导入依赖的package包/类
@Test
public void testdownloadOrgs() {
  PowerMockito.mockStatic(RequestInterceptor.class);
  when( RequestInterceptor.verifyRequestData(Mockito.anyObject()) ).thenReturn("{userId} uuiuhcf784508 8y8c79-fhh");
  Map<String , Object> requestMap = new HashMap<>();
  Map<String , Object> innerMap = new HashMap<>();
  innerMap.put(JsonKey.ORGANISATION_ID , "org123");
  innerMap.put(JsonKey.STATUS, new BigInteger("1"));
  requestMap.put(JsonKey.REQUEST , innerMap);
  String data = mapToJson(requestMap);

  JsonNode json = Json.parse(data);
  RequestBuilder req = new RequestBuilder().bodyJson(json).uri("/v1/org/download").method("POST");
  req.headers(headerMap);
  Result result = route(req);
  assertEquals(200, result.status());
}
 
开发者ID:project-sunbird,项目名称:sunbird-lms-service,代码行数:18,代码来源:OrganisationControllerTest.java

示例14: testsearchOrgs

import play.mvc.Http.RequestBuilder; //导入依赖的package包/类
@Test
public void testsearchOrgs() {
  PowerMockito.mockStatic(RequestInterceptor.class);
  when( RequestInterceptor.verifyRequestData(Mockito.anyObject()) ).thenReturn("{userId} uuiuhcf784508 8y8c79-fhh");
  Map<String , Object> requestMap = new HashMap<>();
  Map<String , Object> innerMap = new HashMap<>();
  innerMap.put(JsonKey.ORGANISATION_ID , "org123");
  innerMap.put(JsonKey.STATUS, new BigInteger("1"));
  requestMap.put(JsonKey.REQUEST , innerMap);
  String data = mapToJson(requestMap);

  JsonNode json = Json.parse(data);
  RequestBuilder req = new RequestBuilder().bodyJson(json).uri("/v1/org/search").method("POST");
  req.headers(headerMap);
  Result result = route(req);
  assertEquals(200, result.status());
}
 
开发者ID:project-sunbird,项目名称:sunbird-lms-service,代码行数:18,代码来源:OrganisationControllerTest.java

示例15: testcreateOrgType

import play.mvc.Http.RequestBuilder; //导入依赖的package包/类
@Test
public void testcreateOrgType() {
  PowerMockito.mockStatic(RequestInterceptor.class);
  when( RequestInterceptor.verifyRequestData(Mockito.anyObject()) ).thenReturn("{userId} uuiuhcf784508 8y8c79-fhh");
  Map<String , Object> requestMap = new HashMap<>();
  Map<String , Object> innerMap = new HashMap<>();
  innerMap.put(JsonKey.NAME , "org123");
  innerMap.put(JsonKey.STATUS, new BigInteger("1"));
  requestMap.put(JsonKey.REQUEST , innerMap);
  String data = mapToJson(requestMap);

  JsonNode json = Json.parse(data);
  RequestBuilder req = new RequestBuilder().bodyJson(json).uri("/v1/org/type/create").method("POST");
  req.headers(headerMap);
  Result result = route(req);
  assertEquals(200, result.status());
}
 
开发者ID:project-sunbird,项目名称:sunbird-lms-service,代码行数:18,代码来源:OrganisationControllerTest.java


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