use of org.apache.openmeetings.db.dao.calendar.MeetingMemberDao 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());
}
Aggregations