use of org.apache.openmeetings.db.entity.user.User in project openmeetings by apache.
the class TestUserCount method testCountUnfilteredUsers.
@Test
public void testCountUnfilteredUsers() throws Exception {
User u = createUser();
createUserContact(u.getId());
assertTrue("Account of unfiltered should be more then one", userDao.count("firstname", false, getUserId()) > 1);
}
use of org.apache.openmeetings.db.entity.user.User in project openmeetings by apache.
the class TestUserGroup method addUserWithoutGroup.
@Test
public void addUserWithoutGroup() throws Exception {
String uuid = UUID.randomUUID().toString();
User u = getUser(uuid);
u = userDao.update(u, null);
assertNotNull("User successfully created", u.getId());
checkEmptyGroup("dao.get()", userDao.get(u.getId()));
try {
checkEmptyGroup("dao.login()", userDao.login(u.getAddress().getEmail(), createPass()));
fail("User with no Group is unable to login");
} catch (OmException e) {
assertTrue("Expected Om Exception", "error.nogroup".equals(e.getKey()));
}
checkEmptyGroup("dao.getByLogin(user)", userDao.getByLogin(u.getLogin(), u.getType(), u.getDomainId()));
}
use of org.apache.openmeetings.db.entity.user.User in project openmeetings by apache.
the class TestUserGroup method getUsersByGroupId.
@Test
public void getUsersByGroupId() {
User u = getValidUser();
Long groupId = u.getGroupUsers().get(0).getGroup().getId();
List<GroupUser> ul = groupUserDao.get(groupId, 0, 9999);
assertTrue("Default Group should contain at least 1 user: " + ul.size(), ul.size() > 0);
GroupUser ou = groupUserDao.getByGroupAndUser(groupId, u.getId());
assertNotNull("Unable to find [group, user] pair - [" + groupId + "," + u.getId() + "]", ou);
}
use of org.apache.openmeetings.db.entity.user.User 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.user.User in project openmeetings by apache.
the class TestOmCalendar method saveCalendar.
@Test
public void saveCalendar() {
OmCalendar calendar = new OmCalendar();
Long userId = 1L;
User owner = userDao.get(userId);
String title = "Calendar Title", href = "http://caldav.example.com/principals/user";
calendar.setOwner(owner);
calendar.setTitle(title);
calendar.setHref(href);
calendar.setSyncType(OmCalendar.SyncType.ETAG);
calendar = calendarDao.update(calendar);
assertTrue("Saved calendar should have valid id: " + calendar.getId(), calendar.getId() != null && calendar.getId() > 0);
OmCalendar c = calendarDao.get(calendar.getId());
assertNotNull("Failed to find Calendar by id", c);
}
Aggregations