Search in sources :

Example 16 with MeetingMember

use of org.apache.openmeetings.db.entity.calendar.MeetingMember in project openmeetings by apache.

the class TestCalendarService method testCreateWithGuestsCleanOne.

@Test
public void testCreateWithGuestsCleanOne() throws Exception {
    String sid = loginNewUser();
    AppointmentDTO dto = createEventWithGuests(sid);
    List<MeetingMemberDTO> initialList = new ArrayList<>(dto.getMeetingMembers());
    MeetingMemberDao mmDao = getBean(MeetingMemberDao.class);
    MeetingMember mm = mmDao.get(initialList.get(initialList.size() - 1).getId());
    Long mmId = mm.getId(), mmUserId = mm.getUser().getId();
    String hash = mm.getInvitation().getHash();
    dto.getMeetingMembers().remove(initialList.size() - 1);
    // try to change MM list
    JSONObject o = AppointmentParamConverter.json(dto);
    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());
    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());
    assertNull("Meeting member should deleted", mmDao.get(mmId));
    assertNull("Invitation should deleted", getBean(InvitationDao.class).getByHash(hash, true, false));
    User uc = getBean(UserDao.class).get(mmUserId);
    assertNotNull("Meeting member user should not be deleted", uc);
    assertFalse("Meeting member user should not be deleted", uc.isDeleted());
}
Also used : 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) Form(javax.ws.rs.core.Form) ArrayList(java.util.ArrayList) MeetingMember(org.apache.openmeetings.db.entity.calendar.MeetingMember) MeetingMemberDao(org.apache.openmeetings.db.dao.calendar.MeetingMemberDao) Response(javax.ws.rs.core.Response) JSONObject(com.github.openjson.JSONObject) UserDao(org.apache.openmeetings.db.dao.user.UserDao) AppointmentDTO(org.apache.openmeetings.db.dto.calendar.AppointmentDTO) MeetingMemberDTO(org.apache.openmeetings.db.dto.calendar.MeetingMemberDTO) Test(org.junit.Test)

Aggregations

MeetingMember (org.apache.openmeetings.db.entity.calendar.MeetingMember)16 Appointment (org.apache.openmeetings.db.entity.calendar.Appointment)9 User (org.apache.openmeetings.db.entity.user.User)7 ArrayList (java.util.ArrayList)4 Calendar (java.util.Calendar)4 Room (org.apache.openmeetings.db.entity.room.Room)4 Test (org.junit.Test)4 Date (java.util.Date)3 GroupUser (org.apache.openmeetings.db.entity.user.GroupUser)3 JSONObject (com.github.openjson.JSONObject)2 URI (java.net.URI)2 Attendee (net.fortuna.ical4j.model.property.Attendee)2 Invitation (org.apache.openmeetings.db.entity.room.Invitation)2 JQueryBehavior (com.googlecode.wicket.jquery.core.JQueryBehavior)1 Droppable (com.googlecode.wicket.jquery.ui.interaction.droppable.Droppable)1 DialogButton (com.googlecode.wicket.jquery.ui.widget.dialog.DialogButton)1 MessageDialog (com.googlecode.wicket.jquery.ui.widget.dialog.MessageDialog)1 HashSet (java.util.HashSet)1 TimeZone (java.util.TimeZone)1 UUID (java.util.UUID)1