Search in sources :

Example 51 with User

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);
}
Also used : User(org.apache.openmeetings.db.entity.user.User) Test(org.junit.Test)

Example 52 with User

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()));
}
Also used : GroupUser(org.apache.openmeetings.db.entity.user.GroupUser) User(org.apache.openmeetings.db.entity.user.User) OmException(org.apache.openmeetings.util.OmException) Test(org.junit.Test)

Example 53 with User

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);
}
Also used : GroupUser(org.apache.openmeetings.db.entity.user.GroupUser) User(org.apache.openmeetings.db.entity.user.User) GroupUser(org.apache.openmeetings.db.entity.user.GroupUser) Test(org.junit.Test)

Example 54 with User

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());
}
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 55 with User

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);
}
Also used : User(org.apache.openmeetings.db.entity.user.User) OmCalendar(org.apache.openmeetings.db.entity.calendar.OmCalendar) Test(org.junit.Test)

Aggregations

User (org.apache.openmeetings.db.entity.user.User)101 GroupUser (org.apache.openmeetings.db.entity.user.GroupUser)29 Test (org.junit.Test)25 Date (java.util.Date)11 Appointment (org.apache.openmeetings.db.entity.calendar.Appointment)10 ArrayList (java.util.ArrayList)8 ServiceResult (org.apache.openmeetings.db.dto.basic.ServiceResult)8 OmException (org.apache.openmeetings.util.OmException)8 Path (javax.ws.rs.Path)7 MeetingMember (org.apache.openmeetings.db.entity.calendar.MeetingMember)7 Room (org.apache.openmeetings.db.entity.room.Room)7 AbstractJUnitDefaults.getUser (org.apache.openmeetings.AbstractJUnitDefaults.getUser)6 Client (org.apache.openmeetings.db.entity.basic.Client)6 Address (org.apache.openmeetings.db.entity.user.Address)5 Group (org.apache.openmeetings.db.entity.user.Group)5 GroupDao (org.apache.openmeetings.db.dao.user.GroupDao)4 AppointmentDTO (org.apache.openmeetings.db.dto.calendar.AppointmentDTO)4 OAuthUser (org.apache.openmeetings.db.dto.user.OAuthUser)4 Recording (org.apache.openmeetings.db.entity.record.Recording)4 AbstractJUnitDefaults.createUser (org.apache.openmeetings.AbstractJUnitDefaults.createUser)3