Search in sources :

Example 11 with Appointment

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);
}
Also used : AbstractJUnitDefaults.getAppointment(org.apache.openmeetings.AbstractJUnitDefaults.getAppointment) Appointment(org.apache.openmeetings.db.entity.calendar.Appointment) User(org.apache.openmeetings.db.entity.user.User) AbstractJUnitDefaults.createUser(org.apache.openmeetings.AbstractJUnitDefaults.createUser) GroupUser(org.apache.openmeetings.db.entity.user.GroupUser) AbstractJUnitDefaults.getUser(org.apache.openmeetings.AbstractJUnitDefaults.getUser) ServiceResult(org.apache.openmeetings.db.dto.basic.ServiceResult) GroupUser(org.apache.openmeetings.db.entity.user.GroupUser) AppointmentDTO(org.apache.openmeetings.db.dto.calendar.AppointmentDTO) GroupDao(org.apache.openmeetings.db.dao.user.GroupDao) AppointmentDao(org.apache.openmeetings.db.dao.calendar.AppointmentDao) Date(java.util.Date)

Example 12 with Appointment

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());
}
Also used : Appointment(org.apache.openmeetings.db.entity.calendar.Appointment) User(org.apache.openmeetings.db.entity.user.User) WebSession(org.apache.openmeetings.web.app.WebSession) MeetingMember(org.apache.openmeetings.db.entity.calendar.MeetingMember) Room(org.apache.openmeetings.db.entity.room.Room) Test(org.junit.Test)

Example 13 with Appointment

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());
}
Also used : Appointment(org.apache.openmeetings.db.entity.calendar.Appointment) Calendar(java.util.Calendar) MeetingMember(org.apache.openmeetings.db.entity.calendar.MeetingMember) Room(org.apache.openmeetings.db.entity.room.Room) Test(org.junit.Test)

Example 14 with Appointment

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);
    }
}
Also used : Appointment(org.apache.openmeetings.db.entity.calendar.Appointment) Calendar(java.util.Calendar) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date) Test(org.junit.Test)

Example 15 with Appointment

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());
}
Also used : Appointment(org.apache.openmeetings.db.entity.calendar.Appointment) Calendar(java.util.Calendar) Test(org.junit.Test)

Aggregations

Appointment (org.apache.openmeetings.db.entity.calendar.Appointment)34 User (org.apache.openmeetings.db.entity.user.User)10 ArrayList (java.util.ArrayList)9 MeetingMember (org.apache.openmeetings.db.entity.calendar.MeetingMember)9 Test (org.junit.Test)9 Date (java.util.Date)7 Calendar (java.util.Calendar)6 Room (org.apache.openmeetings.db.entity.room.Room)5 OmCalendar (org.apache.openmeetings.db.entity.calendar.OmCalendar)4 Calendar (net.fortuna.ical4j.model.Calendar)3 MultiStatusResponse (org.apache.jackrabbit.webdav.MultiStatusResponse)3 JSONObject (com.github.openjson.JSONObject)2 Map (java.util.Map)2 TimeZone (java.util.TimeZone)2 DavPropertyNameSet (org.apache.jackrabbit.webdav.property.DavPropertyNameSet)2 AppointmentDTO (org.apache.openmeetings.db.dto.calendar.AppointmentDTO)2 Invitation (org.apache.openmeetings.db.entity.room.Invitation)2 GroupUser (org.apache.openmeetings.db.entity.user.GroupUser)2 PrivateMessage (org.apache.openmeetings.db.entity.user.PrivateMessage)2 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)2