use of org.apache.openmeetings.db.dto.calendar.AppointmentDTO in project openmeetings by apache.
the class TestCalendarService method actualTest.
private void actualTest(Room r) throws Exception {
String uuid = UUID.randomUUID().toString();
User u = getUser(uuid);
u.getGroupUsers().add(new GroupUser(getBean(GroupDao.class).get(1L), u));
webCreateUser(u);
ServiceResult sr = login(u.getLogin(), createPass());
u = getBean(UserDao.class).get(u.getId());
Date start = new Date();
Appointment a = AbstractJUnitDefaults.createAppointment(getBean(AppointmentDao.class), getAppointment(u, r, start, new Date(start.getTime() + ONE_HOUR)));
AppointmentDTO app = getClient(getCalendarUrl()).path("/room/" + a.getRoom().getId()).query("sid", sr.getMessage()).get(AppointmentDTO.class);
assertNotNull("Valid DTO should be returned", app);
}
use of org.apache.openmeetings.db.dto.calendar.AppointmentDTO in project openmeetings by apache.
the class TestCalendarService method testCreateWithOmMm.
@Test
public void testCreateWithOmMm() throws Exception {
JSONObject o = createAppointment("test").put("meetingMembers", new JSONArray().put(new JSONObject().put("user", new JSONObject().put("id", 1))));
String uuid = UUID.randomUUID().toString();
User u = getUser(uuid);
u.getGroupUsers().add(new GroupUser(getBean(GroupDao.class).get(1L), u));
u = createUser(getBean(UserDao.class), u);
ServiceResult sr = login(u.getLogin(), createPass());
Response resp = getClient(getCalendarUrl()).path("/").query("sid", sr.getMessage()).form(new Form().param("appointment", o.toString()));
assertNotNull("Valid AppointmentDTO should be returned", resp);
assertEquals("Call should be successful", Response.Status.OK.getStatusCode(), resp.getStatus());
AppointmentDTO dto = resp.readEntity(AppointmentDTO.class);
assertNotNull("Valid DTO should be returned", dto);
assertNotNull("DTO id should be valid", dto.getId());
}
use of org.apache.openmeetings.db.dto.calendar.AppointmentDTO in project openmeetings by apache.
the class TestCalendarService method createApp.
private String createApp(String title) throws Exception {
JSONObject o = createAppointment(title);
String sid = loginNewUser();
Response resp = getClient(getCalendarUrl()).path("/").query("sid", sid).form(new Form().param("appointment", o.toString()));
assertNotNull("Valid AppointmentDTO should be returned", resp);
assertEquals("Call should be successful", Response.Status.OK.getStatusCode(), resp.getStatus());
AppointmentDTO dto = resp.readEntity(AppointmentDTO.class);
assertNotNull("Valid DTO should be returned", dto);
assertNotNull("DTO id should be valid", dto.getId());
return sid;
}
use of org.apache.openmeetings.db.dto.calendar.AppointmentDTO in project openmeetings by apache.
the class AppointmentParamConverter method fromString.
@Override
public AppointmentDTO fromString(String val) {
JSONObject o = new JSONObject(val);
if (o.has(ROOT)) {
o = o.getJSONObject(ROOT);
}
AppointmentDTO a = new AppointmentDTO();
a.setId(optLong(o, "id"));
a.setTitle(o.optString("title"));
a.setLocation(o.optString("location"));
a.setOwner(UserDTO.get(o.optJSONObject("owner")));
String tzId = a.getOwner() == null ? null : a.getOwner().getTimeZoneId();
a.setStart(CalendarParamConverter.get(o.optString("start"), tzId));
a.setEnd(CalendarParamConverter.get(o.optString("end"), tzId));
a.setDescription(o.optString("description"));
a.setInserted(DateParamConverter.get(o.optString("inserted")));
a.setUpdated(DateParamConverter.get(o.optString("updated")));
a.setDeleted(o.optBoolean("deleted"));
a.setReminder(optEnum(Reminder.class, o, "reminder"));
a.setRoom(RoomDTO.get(o.optJSONObject("room")));
a.setIcalId(o.optString("icalId"));
JSONArray mm = o.optJSONArray("meetingMembers");
if (mm != null) {
for (int i = 0; i < mm.length(); ++i) {
a.getMeetingMembers().add(MeetingMemberDTO.get(mm.getJSONObject(i)));
}
}
a.setLanguageId(o.optLong("languageId"));
a.setPassword(o.optString("password"));
a.setPasswordProtected(o.optBoolean("passwordProtected"));
a.setConnectedEvent(o.optBoolean("connectedEvent"));
a.setReminderEmailSend(o.optBoolean("reminderEmailSend"));
return a;
}
use of org.apache.openmeetings.db.dto.calendar.AppointmentDTO in project openmeetings by apache.
the class TestCalendarService method testCreateWithGuests.
@Test
public void testCreateWithGuests() throws Exception {
String sid = loginNewUser();
AppointmentDTO dto = createEventWithGuests(sid);
// try to change MM list
JSONObject o1 = AppointmentParamConverter.json(dto).put("meetingMembers", new JSONArray().put(new JSONObject().put("user", new JSONObject().put("id", 1))));
Response resp = getClient(getCalendarUrl()).path("/").query("sid", sid).form(new Form().param("appointment", o1.toString()));
assertNotNull("Valid AppointmentDTO should be returned", resp);
assertEquals("Call should be successful", Response.Status.OK.getStatusCode(), resp.getStatus());
dto = resp.readEntity(AppointmentDTO.class);
assertNotNull("Valid DTO should be returned", dto);
assertNotNull("DTO id should be valid", dto.getId());
assertEquals("DTO should have 1 attendees", 1, dto.getMeetingMembers().size());
}
Aggregations