本文整理汇总了Java中play.mvc.Http.RequestBuilder.headers方法的典型用法代码示例。如果您正苦于以下问题:Java RequestBuilder.headers方法的具体用法?Java RequestBuilder.headers怎么用?Java RequestBuilder.headers使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类play.mvc.Http.RequestBuilder
的用法示例。
在下文中一共展示了RequestBuilder.headers方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testenrollCourse
import play.mvc.Http.RequestBuilder; //导入方法依赖的package包/类
@Test
public void testenrollCourse() {
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("courseId" , "course-123");
requestMap.put(JsonKey.REQUEST , innerMap);
String data = mapToJson(requestMap);
System.out.println(data);
JsonNode json = Json.parse(data);
RequestBuilder req = new RequestBuilder().bodyJson(json).uri("/v1/user/courses/enroll").method("POST");
req.headers(headerMap);
Result result = route(req);
assertEquals(200, result.status());
}
示例2: 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());
}
示例3: testcreateBatchWithInvalidEnrollmentType
import play.mvc.Http.RequestBuilder; //导入方法依赖的package包/类
@Test
public void testcreateBatchWithInvalidEnrollmentType() {
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.COURSE_ID , "org123");
innerMap.put(JsonKey.NAME ,"IT BATCH");
innerMap.put(JsonKey.ENROLLMENT_TYPE , "inlaid_invite_type");
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
Date currentdate = new Date();
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DAY_OF_MONTH , 2);
Date futureDate = calendar.getTime();
innerMap.put(JsonKey.START_DATE , format.format(currentdate));
innerMap.put(JsonKey.END_DATE , format.format(futureDate));
requestMap.put(JsonKey.REQUEST , innerMap);
String data = mapToJson(requestMap);
JsonNode json = Json.parse(data);
RequestBuilder req = new RequestBuilder().bodyJson(json).uri("/v1/course/batch/create").method("POST");
req.headers(headerMap);
Result result = route(req);
assertEquals(400, result.status());
}
示例4: testupdateSystemSettings
import play.mvc.Http.RequestBuilder; //导入方法依赖的package包/类
@Test
public void testupdateSystemSettings() {
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<>();
List<String> list = new ArrayList(Arrays.asList(PropertiesCache.getInstance().getProperty("system_settings_properties").split(",")));
if(list.size()>0){
innerMap.put(list.get(0),list.get(0));
requestMap.put(JsonKey.REQUEST , innerMap);
String data = mapToJson(requestMap);
JsonNode json = Json.parse(data);
RequestBuilder req = new RequestBuilder().bodyJson(json).uri("/v1/system/settings").method("POST");
req.headers(headerMap);
Result result = route(req);
assertEquals(200, result.status());
}
}
示例5: testuploadFileService
import play.mvc.Http.RequestBuilder; //导入方法依赖的package包/类
@Test
public void testuploadFileService() {
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.DATA , "uploadFILEData".getBytes());
requestMap.put(JsonKey.REQUEST , innerMap);
String data = mapToJson(requestMap);
JsonNode json = Json.parse(data);
RequestBuilder req = new RequestBuilder().bodyJson(json).uri("/v1/file/upload").method("POST");
req.headers(headerMap);
Result result = route(req);
assertEquals(200, result.status());
}
示例6: testprofileVisibility
import play.mvc.Http.RequestBuilder; //导入方法依赖的package包/类
@Test
public void testprofileVisibility() {
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.USER_ID , "user01");
List<String> privateFields = new ArrayList<>();
privateFields.add(JsonKey.PHONE);
List<String> publicFields = new ArrayList<>();
publicFields.add(JsonKey.EMAIL);
innerMap.put(JsonKey.PRIVATE , privateFields);
innerMap.put(JsonKey.PUBLIC , publicFields);
requestMap.put(JsonKey.REQUEST , innerMap);
String data = mapToJson(requestMap);
JsonNode json = Json.parse(data);
RequestBuilder req = new RequestBuilder().bodyJson(json).uri("/v1/user/profile/visibility").method("POST");
req.headers(headerMap);
Result result = route(req);
assertEquals(200, result.status());
}
示例7: 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());
}
示例8: testremoveUsersFromBatch
import play.mvc.Http.RequestBuilder; //导入方法依赖的package包/类
@Test
public void testremoveUsersFromBatch() {
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.BATCH_ID , "batch123");
innerMap.put(JsonKey.USER_IDs ,"LIST OF USER IDs");
requestMap.put(JsonKey.REQUEST , innerMap);
String data = mapToJson(requestMap);
JsonNode json = Json.parse(data);
RequestBuilder req = new RequestBuilder().bodyJson(json).uri("/v1/course/batch/users/remove").method("POST");
req.headers(headerMap);
Result result = route(req);
assertEquals(200, result.status());
}
示例9: 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());
}
示例10: 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());
}
示例11: testchangePassword
import play.mvc.Http.RequestBuilder; //导入方法依赖的package包/类
@Test
public void testchangePassword() {
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.PASSWORD , "password");
innerMap.put(JsonKey.NEW_PASSWORD , "newpssword");
requestMap.put(JsonKey.REQUEST , innerMap);
String data = mapToJson(requestMap);
JsonNode json = Json.parse(data);
RequestBuilder req = new RequestBuilder().bodyJson(json).uri("/v1/user/changepassword").method("POST");
req.headers(headerMap);
Result result = route(req);
assertEquals(200, result.status());
}
示例12: testGetSkills
import play.mvc.Http.RequestBuilder; //导入方法依赖的package包/类
@Test
public void testGetSkills() {
PowerMockito.mockStatic(RequestInterceptor.class);
when( RequestInterceptor.verifyRequestData(Mockito.anyObject()) ).thenReturn("{userId} uuiuhcf784508 8y8c79-fhh");
RequestBuilder req = new RequestBuilder().uri("/v1/skills").method("GET");
req.headers(headerMap);
Result result = route(req);
assertEquals(200, result.status());
}
示例13: testcourseProgress
import play.mvc.Http.RequestBuilder; //导入方法依赖的package包/类
@Test
public void testcourseProgress() {
PowerMockito.mockStatic(RequestInterceptor.class);
when( RequestInterceptor.verifyRequestData(Mockito.anyObject()) ).thenReturn("{userId} uuiuhcf784508 8y8c79-fhh");
RequestBuilder req = new RequestBuilder().uri("/v1/dashboard/progress/course/batchId?period=7d").method("GET");
req.headers(headerMap);
Result result = route(req);
assertEquals(200, result.status());
}
示例14: testgetRoles
import play.mvc.Http.RequestBuilder; //导入方法依赖的package包/类
@Test
public void testgetRoles() {
PowerMockito.mockStatic(RequestInterceptor.class);
when( RequestInterceptor.verifyRequestData(Mockito.anyObject()) ).thenReturn("{userId} uuiuhcf784508 8y8c79-fhh");
RequestBuilder req = new RequestBuilder().uri("/v1/role/read").method("GET");
req.headers(headerMap);
Result result = route(req);
assertEquals(200, result.status());
}
示例15: testuserConsumption
import play.mvc.Http.RequestBuilder; //导入方法依赖的package包/类
@Test
public void testuserConsumption() {
PowerMockito.mockStatic(RequestInterceptor.class);
when( RequestInterceptor.verifyRequestData(Mockito.anyObject()) ).thenReturn("{userId} uuiuhcf784508 8y8c79-fhh");
RequestBuilder req = new RequestBuilder().uri("/v1/dashboard/consumption/user/userId").method("GET");
req.headers(headerMap);
Result result = route(req);
assertEquals(200, result.status());
}