use of org.apache.openmeetings.db.entity.calendar.Appointment 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.entity.calendar.Appointment in project openmeetings by apache.
the class TestAppointmentAddAppointment method testCreate.
@Test
public void testCreate() {
Appointment a = new Appointment();
a.setTitle("Test title");
setTime(a);
a.setReminder(Reminder.ical);
a.setMeetingMembers(new ArrayList<>());
User owner = userDao.get(1L);
a.setOwner(owner);
a.setRoom(new Room());
a.getRoom().setAppointment(true);
a.getRoom().setType(Room.Type.conference);
for (int i = 0; i < 3; ++i) {
MeetingMember mm = new MeetingMember();
mm.setUser(getContact(UUID.randomUUID().toString(), owner.getId()));
a.getMeetingMembers().add(mm);
}
a = appointmentDao.update(a, owner.getId());
assertNotNull("Saved appointment should have valid id: " + a.getId(), a.getId());
assertEquals("Saved appointment should have corect count of guests: ", 3, a.getMeetingMembers().size());
for (MeetingMember mm : a.getMeetingMembers()) {
assertNotNull("Saved guest should have valid id: ", mm.getId());
assertNotNull("Saved guest should have valid invitation: ", mm.getInvitation());
assertNotNull("Saved guest should have invitation with ID: ", mm.getInvitation().getId());
}
WebSession ws = WebSession.get();
Appointment a1 = appointmentDao.get(a.getId());
ws.checkHashes(StringValue.valueOf(""), StringValue.valueOf(a1.getMeetingMembers().get(0).getInvitation().getHash()));
assertTrue("Login via secure hash should be successful", ws.isSignedIn());
}
use of org.apache.openmeetings.db.entity.calendar.Appointment in project openmeetings by apache.
the class TestAppointmentAddAppointment method saveAppointment.
@Test
public void saveAppointment() throws Exception {
log.debug("- saveAppointment");
Calendar start = Calendar.getInstance();
start.setTimeInMillis(start.getTimeInMillis() + 600000);
Calendar end = Calendar.getInstance();
end.setTimeInMillis(start.getTimeInMillis() + 600000);
String appointmentName = "Test 01";
String appointmentDescription = "Descr";
Long userId = 1L;
String appointmentLocation = "office";
Boolean isMonthly = false;
Boolean isDaily = false;
Boolean isWeekly = false;
String remind = Appointment.Reminder.ical.name();
Boolean isYearly = false;
String[] mmClient = new String[1];
for (int i = 0; i < 1; i++) {
mmClient[0] = createClientObj("firstname" + i, "lastname" + i, "first" + i + ".last" + i + "@webbase-design.de", "Etc/GMT+1");
}
Long languageId = 1L;
Long roomType = 1L;
Appointment a = new Appointment();
a.setTitle(appointmentName);
a.setLocation(appointmentLocation);
a.setDescription(appointmentDescription);
a.setStart(start.getTime());
a.setEnd(end.getTime());
a.setIsDaily(isDaily);
a.setIsWeekly(isWeekly);
a.setIsMonthly(isMonthly);
a.setIsYearly(isYearly);
a.setReminder(Reminder.valueOf(remind));
a.setRoom(new Room());
a.getRoom().setComment(appointmentDescription);
a.getRoom().setName(appointmentName);
a.getRoom().setType(Room.Type.get(roomType));
a.getRoom().setAppointment(true);
a.setOwner(userDao.get(userId));
a.setPasswordProtected(false);
a.setPassword("");
a.setMeetingMembers(new ArrayList<MeetingMember>());
for (String singleClient : mmClient) {
if (Strings.isEmpty(singleClient)) {
continue;
}
MeetingMember mm = getMeetingMember(userId, languageId, singleClient);
mm.setAppointment(a);
a.getMeetingMembers().add(mm);
}
a = appointmentDao.update(a, userId);
Thread.sleep(3000);
appointmentLogic.doScheduledMeetingReminder();
Thread.sleep(3000);
assertNotNull("Saved appointment should have valid id: " + a.getId(), a.getId());
}
use of org.apache.openmeetings.db.entity.calendar.Appointment in project openmeetings by apache.
the class TestDatabaseStructureAppointment method testAddingGroup.
@Test
public void testAddingGroup() {
try {
Calendar cal = Calendar.getInstance();
cal.set(2008, 9, 2);
cal.get(Calendar.DAY_OF_MONTH);
cal.getTime();
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
Date date = format.parse("2008-17-08");
Date date2 = format.parse("2008-18-08");
List<Appointment> listAppoints = appointmentDao.getInRange(1L, date, date2);
// List<Appointment> listAppoints = appointmentDao.searchAppointmentsByName("%");
// appointmentDao.getNextAppointmentById(1L);
// appointmentDao.addAppointment("mezo", 1L, "Pforzheim", "zweiter", Calendar.getInstance().getTime(),
// date, null, true, null, null, 1L,1L);
// appointmentDao.addAppointment("testap", "erster Test",Calendar.getInstance().getTime(),
// Calendar.getInstance().getTime(), true, false, false, false, new Long(1), 1L);
log.debug("Anzahl: " + listAppoints.size());
for (Appointment appoints : listAppoints) {
log.debug("Termin: " + appoints.getTitle() + " startDate: " + appoints.getStart() + " endDate: " + appoints.getEnd());
log.debug("MeetingMembers: " + appoints.getMeetingMembers().size());
}
for (Iterator<Appointment> iter = listAppoints.iterator(); iter.hasNext(); ) {
log.debug("" + iter.next());
}
} catch (Exception err) {
log.error("[testAddingGroup]", err);
}
}
use of org.apache.openmeetings.db.entity.calendar.Appointment in project openmeetings by apache.
the class TestGetAppointment method getAppoinment.
@Test
public void getAppoinment() {
log.debug("getAppoinment enter");
Long userId = 1L;
Calendar now = Calendar.getInstance();
Calendar a1End = Calendar.getInstance();
a1End.setTime(now.getTime());
a1End.add(Calendar.HOUR_OF_DAY, 1);
Appointment a1 = getAppointment(now.getTime(), a1End.getTime());
a1.setTitle("GetAppointment");
a1 = appointmentDao.update(a1, userId);
Appointment a = appointmentDao.get(a1.getId());
assertNotNull("Failed to get Appointment By id", a);
assertEquals("Inapropriate MeetingMembers count", 0, a.getMeetingMembers() == null ? 0 : a.getMeetingMembers().size());
}
Aggregations