use of com.fasterxml.jackson.datatype.jsr310.JSR310Module in project muikku by otavanopisto.
the class AbstractUITest method createAnnouncement.
protected Long createAnnouncement(Long publisherUserEntityId, String caption, String content, Date startDate, Date endDate, Boolean archived, Boolean publiclyVisible, List<Long> userGroupIds) throws Exception {
ObjectMapper objectMapper = new ObjectMapper().registerModule(new JSR310Module()).disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
Announcement payload = new Announcement(null, publisherUserEntityId, userGroupIds, caption, content, new Date(), startDate, endDate, archived, publiclyVisible);
Response response = asAdmin().contentType("application/json").body(payload).post("/test/announcements");
response.then().statusCode(200);
Long result = objectMapper.readValue(response.asString(), Long.class);
return result;
}
use of com.fasterxml.jackson.datatype.jsr310.JSR310Module in project muikku by otavanopisto.
the class AbstractUITest method createWorkspaceDiscussionThread.
protected DiscussionThread createWorkspaceDiscussionThread(Long workspaceEntityId, Long groupId, Long discussionId, String title, String message, Boolean sticky, Boolean locked) throws IOException {
ObjectMapper objectMapper = new ObjectMapper().registerModule(new JSR310Module()).disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
DiscussionThread payload = new DiscussionThread(null, title, message, sticky, locked);
Response response = asAdmin().contentType("application/json").body(payload).post("/test/workspaces/{WORKSPACEENTITYID}/discussiongroups/{GROUPID}/discussions/{DISCUSSIONID}/threads", workspaceEntityId, groupId, discussionId);
response.then().statusCode(200);
DiscussionThread workspaceDiscussionThread = objectMapper.readValue(response.asString(), DiscussionThread.class);
assertNotNull(workspaceDiscussionThread);
assertNotNull(workspaceDiscussionThread.getId());
return workspaceDiscussionThread;
}
use of com.fasterxml.jackson.datatype.jsr310.JSR310Module in project muikku by otavanopisto.
the class AbstractUITest method createDiscussionThread.
protected DiscussionThread createDiscussionThread(Long groupId, Long discussionId, String title, String message, Boolean sticky, Boolean locked) throws IOException {
ObjectMapper objectMapper = new ObjectMapper().registerModule(new JSR310Module()).disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
DiscussionThread payload = new DiscussionThread(null, title, message, sticky, locked);
Response response = asAdmin().contentType("application/json").body(payload).post("/test/discussiongroups/{GROUPID}/discussions/{DISCUSSIONID}/threads", groupId, discussionId);
response.then().statusCode(200);
DiscussionThread discussionThread = objectMapper.readValue(response.asString(), DiscussionThread.class);
assertNotNull(discussionThread);
assertNotNull(discussionThread.getId());
return discussionThread;
}
use of com.fasterxml.jackson.datatype.jsr310.JSR310Module in project muikku by otavanopisto.
the class AbstractUITest method loginStudent1.
protected void loginStudent1() throws JsonProcessingException, Exception {
PyramusMocks.student1LoginMock();
PyramusMocks.personsPyramusMocks();
ObjectMapper objectMapper = new ObjectMapper().registerModule(new JSR310Module()).disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
String payload = objectMapper.writeValueAsString(new WebhookStudentCreatePayload((long) 1));
TestUtilities.webhookCall("http://dev.muikku.fi:" + getPortHttp() + "/pyramus/webhook", payload);
payload = objectMapper.writeValueAsString(new WebhookPersonCreatePayload((long) 1));
TestUtilities.webhookCall("http://dev.muikku.fi:" + getPortHttp() + "/pyramus/webhook", payload);
navigate("/login?authSourceId=1", true);
waitForPresent(".index");
}
use of com.fasterxml.jackson.datatype.jsr310.JSR310Module in project muikku by otavanopisto.
the class AbstractUITest method createCommunicatorMesssage.
protected void createCommunicatorMesssage(String caption, String content, Long sender, Long recipient) throws JsonParseException, JsonMappingException, IOException {
ObjectMapper objectMapper = new ObjectMapper().registerModule(new JSR310Module()).disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
Date created = new Date();
Set<String> tags = new HashSet<>();
List<Long> recipientIds = new ArrayList<>();
recipientIds.add(recipient);
CommunicatorMessage payload = new CommunicatorMessage(null, null, sender, "test", caption, content, created, tags, recipientIds, new ArrayList<Long>(), new ArrayList<Long>(), new ArrayList<Long>());
Response response = asAdmin().contentType("application/json").body(payload).post("test/communicator/messages");
response.then().statusCode(200);
CommunicatorMessage result = objectMapper.readValue(response.asString(), CommunicatorMessage.class);
assertNotNull(result);
assertNotNull(result.getId());
}
Aggregations