use of com.fasterxml.jackson.datatype.jsr310.JSR310Module in project muikku by otavanopisto.
the class AbstractUITest method createDiscussion.
protected Discussion createDiscussion(Long groupId, String name) throws IOException {
ObjectMapper objectMapper = new ObjectMapper().registerModule(new JSR310Module()).disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
Discussion payload = new Discussion(null, name, null, groupId);
Response response = asAdmin().contentType("application/json").body(payload).post("/test/discussiongroups/{GROUPID}/discussions", groupId);
response.then().statusCode(200);
Discussion discussion = objectMapper.readValue(response.asString(), Discussion.class);
assertNotNull(discussion);
assertNotNull(discussion.getId());
return discussion;
}
use of com.fasterxml.jackson.datatype.jsr310.JSR310Module in project muikku by otavanopisto.
the class AbstractUITest method createFlag.
protected Long createFlag(String name, String color, String description) throws JsonParseException, JsonMappingException, IOException {
ObjectMapper objectMapper = new ObjectMapper().registerModule(new JSR310Module()).disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
Flag flag = new Flag(null, name, color, description, "STAFF-1/PYRAMUS");
Response response = asAdmin().contentType("application/json").body(flag).post("/test/flags");
response.then().statusCode(200);
Flag result = objectMapper.readValue(response.asString(), Flag.class);
return result.getId();
}
use of com.fasterxml.jackson.datatype.jsr310.JSR310Module in project muikku by otavanopisto.
the class AbstractUITest method createWorkspaceDiscussionGroup.
protected DiscussionGroup createWorkspaceDiscussionGroup(Long workspaceEntityId, String name) throws IOException {
ObjectMapper objectMapper = new ObjectMapper().registerModule(new JSR310Module()).disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
DiscussionGroup payload = new DiscussionGroup(null, name);
Response response = asAdmin().contentType("application/json").body(payload).post("/test/workspaces/{WORKSPACEENTITYID}/discussiongroups", workspaceEntityId);
response.then().statusCode(200);
DiscussionGroup workspaceDiscussionGroup = objectMapper.readValue(response.asString(), DiscussionGroup.class);
assertNotNull(workspaceDiscussionGroup);
assertNotNull(workspaceDiscussionGroup.getId());
return workspaceDiscussionGroup;
}
use of com.fasterxml.jackson.datatype.jsr310.JSR310Module in project muikku by otavanopisto.
the class AbstractUITest method flagStudent.
protected Long flagStudent(Long studentId, Long flagId) throws JsonParseException, JsonMappingException, IOException {
ObjectMapper objectMapper = new ObjectMapper().registerModule(new JSR310Module()).disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
Response response = asAdmin().contentType("application/json").post("/test/students/{ID}/flags/{FLAGID}", studentId, flagId);
response.then().statusCode(200);
StudentFlag result = objectMapper.readValue(response.asString(), StudentFlag.class);
return result.getId();
}
use of com.fasterxml.jackson.datatype.jsr310.JSR310Module in project muikku by otavanopisto.
the class AbstractUITest method createWorkspace.
protected Workspace createWorkspace(String name, String description, String identifier, Boolean published) throws Exception {
PyramusMocks.workspacePyramusMock(NumberUtils.createLong(identifier), name, description);
ObjectMapper objectMapper = new ObjectMapper().registerModule(new JSR310Module()).disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
Workspace payload = new Workspace(null, name, null, "PYRAMUS", identifier, published);
Response response = asAdmin().contentType("application/json").body(payload).post("/test/workspaces");
response.then().statusCode(200);
Workspace workspace = objectMapper.readValue(response.asString(), Workspace.class);
assertNotNull(workspace);
assertNotNull(workspace.getId());
return workspace;
}
Aggregations