Search in sources :

Example 46 with User

use of org.apache.openmeetings.db.entity.user.User in project openmeetings by apache.

the class TestAddGroup method testAddingGroup.

@Test
public void testAddingGroup() {
    Group o = new Group();
    o.setName("default");
    o = groupDao.update(o, null);
    assertNotNull("Id of group created should not be null", o.getId());
    User us = userDao.get(1L);
    assertNotNull("User should exist", us);
    assertNotNull("Group User list should exist", us.getGroupUsers());
    us.getGroupUsers().add(new GroupUser(o, us));
    us = userDao.update(us, null);
    log.error(us.getLastname());
    log.error(us.getAddress().getTown());
}
Also used : Group(org.apache.openmeetings.db.entity.user.Group) User(org.apache.openmeetings.db.entity.user.User) GroupUser(org.apache.openmeetings.db.entity.user.GroupUser) GroupUser(org.apache.openmeetings.db.entity.user.GroupUser) Test(org.junit.Test)

Example 47 with User

use of org.apache.openmeetings.db.entity.user.User in project openmeetings by apache.

the class TestEmailTemplate method testTemplateGeneration.

@Test
public void testTemplateGeneration() {
    User u = new User();
    u.setLanguageId(rnd.nextInt(30));
    UserContact uc = new UserContact();
    uc.setOwner(u);
    uc.setContact(new User());
    checkTemplate(FeedbackTemplate.getEmail("testuser", "email", "message"));
    checkTemplate(InvitationTemplate.getEmail(u, "testuser", "email", "message"));
    checkTemplate(RegisterUserTemplate.getEmail("testuser", "email", "message"));
    checkTemplate(RequestContactConfirmTemplate.getEmail(uc));
    checkTemplate(RequestContactTemplate.getEmail(u, new User()));
    checkTemplate(ResetPasswordTemplate.getEmail("link"));
}
Also used : User(org.apache.openmeetings.db.entity.user.User) UserContact(org.apache.openmeetings.db.entity.user.UserContact) Test(org.junit.Test)

Example 48 with User

use of org.apache.openmeetings.db.entity.user.User in project openmeetings by apache.

the class TestUserContact method createUserWithGroup.

@Test
public void createUserWithGroup() throws Exception {
    String uuid = UUID.randomUUID().toString();
    User u = getUser(uuid);
    u.getGroupUsers().add(new GroupUser(groupDao.get(1L), u));
    u = userDao.update(u, null);
    assertTrue("Password should be set as expected", userDao.verifyPassword(u.getId(), createPass()));
    User u1 = userDao.get(u.getId());
    assertNotNull("Just created user should not be null", u1);
    assertNotNull("Just created user should have non null org-users", u1.getGroupUsers());
    assertFalse("Just created user should have not empty org-users", u1.getGroupUsers().isEmpty());
}
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 49 with User

use of org.apache.openmeetings.db.entity.user.User in project openmeetings by apache.

the class TestUserContact method addContactByOwner.

@Test
public void addContactByOwner() throws Exception {
    login(null, null);
    List<User> users = userDao.getAllUsers();
    assertNotNull("User list should not be null ", users);
    assertFalse("User list should not be empty ", users.isEmpty());
    User contact = createUserContact(getUserId());
    String email = contact.getAddress().getEmail();
    List<User> l = userDao.get(email, false, 0, 9999);
    // check that contact is visible for admin
    assertNotNull("Contact list should not be null for admin ", l);
    assertFalse("Contact list should not be empty for admin ", l.isEmpty());
    // check that contact is visible for owner
    l = userDao.get(email, 0, 9999, null, true, getUserId());
    assertTrue("Contact list should not be empty for owner ", !l.isEmpty());
    // delete contact
    userDao.delete(contact, getUserId());
    l = userDao.get(email, false, 0, 9999);
    assertTrue("Contact list should be empty after deletion", l.isEmpty());
    User u = createUser();
    User u1 = createUser();
    contact = createUserContact(u.getId());
    email = contact.getAddress().getEmail();
    // check that contact is not visible for user that is not owner of this contact
    l = userDao.get(email, 0, 9999, null, true, u1.getId());
    assertTrue("Contact list should be empty for another user", l.isEmpty());
    // delete contact
    userDao.delete(contact, u.getId());
    l = userDao.get(email, false, 0, 9999);
    assertTrue("Contact list should be empty after deletion", l.isEmpty());
}
Also used : GroupUser(org.apache.openmeetings.db.entity.user.GroupUser) User(org.apache.openmeetings.db.entity.user.User) Test(org.junit.Test)

Example 50 with User

use of org.apache.openmeetings.db.entity.user.User in project openmeetings by apache.

the class TestUserContact method testCreateUser.

@Test
public void testCreateUser() throws Exception {
    String uuid = UUID.randomUUID().toString();
    User u = createUser(uuid);
    assertTrue("Password should be set as expected", userDao.verifyPassword(u.getId(), createPass()));
}
Also used : GroupUser(org.apache.openmeetings.db.entity.user.GroupUser) User(org.apache.openmeetings.db.entity.user.User) 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