Search in sources :

Example 66 with DbUser

use of org.ovirt.engine.core.common.businessentities.aaa.DbUser in project ovirt-engine by oVirt.

the class DbUserDaoTest method setUp.

@Override
@Before
public void setUp() throws Exception {
    super.setUp();
    dao = dbFacade.getDbUserDao();
    vm = FixturesTool.VM_RHEL5_POOL_50;
    existingUser = dao.get(new Guid("9bf7c640-b620-456f-a550-0348f366544a"));
    deletableUser = dao.get(new Guid("9bf7c640-b620-456f-a550-0348f366544b"));
    newUser = new DbUser();
    newUser.setExternalId("0");
    newUser.setId(Guid.newGuid());
    newUser.setFirstName("Bob");
    newUser.setLastName("Milqtoste");
    newUser.setLoginName("newuser");
    newUser.setEmail("newuser@redhat.com");
    newUser.setDomain("domain");
    newUser.setGroupNames(new LinkedList<>(Collections.singletonList("groups")));
    newUser.setNamespace("*");
}
Also used : Guid(org.ovirt.engine.core.compat.Guid) DbUser(org.ovirt.engine.core.common.businessentities.aaa.DbUser) Before(org.junit.Before)

Example 67 with DbUser

use of org.ovirt.engine.core.common.businessentities.aaa.DbUser in project ovirt-engine by oVirt.

the class DbUserDaoTest method testRemove.

/**
 * Ensures that removing users works as expected.
 */
@Test
public void testRemove() {
    dao.remove(deletableUser.getId());
    DbUser result = dao.get(deletableUser.getId());
    assertNull(result);
}
Also used : DbUser(org.ovirt.engine.core.common.businessentities.aaa.DbUser) Test(org.junit.Test)

Example 68 with DbUser

use of org.ovirt.engine.core.common.businessentities.aaa.DbUser in project ovirt-engine by oVirt.

the class DbUserDaoTest method testGetByExternalId.

/**
 * Ensures that retrieving an user by external id works as expected.
 */
@Test
public void testGetByExternalId() {
    DbUser result = dao.getByExternalId("testportal.redhat.com", "a");
    assertNotNull(result);
}
Also used : DbUser(org.ovirt.engine.core.common.businessentities.aaa.DbUser) Test(org.junit.Test)

Example 69 with DbUser

use of org.ovirt.engine.core.common.businessentities.aaa.DbUser in project ovirt-engine by oVirt.

the class DbUserDaoTest method testUpdateDoesntChangeExternalId.

/**
 * Ensures that update cycle doesn't change the external identifier.
 */
@Test
public void testUpdateDoesntChangeExternalId() {
    DbUser userBefore = dao.get(existingUser.getId());
    dao.update(userBefore);
    DbUser userAfter = dao.get(existingUser.getId());
    assertEquals(userBefore.getExternalId(), userAfter.getExternalId());
}
Also used : DbUser(org.ovirt.engine.core.common.businessentities.aaa.DbUser) Test(org.junit.Test)

Example 70 with DbUser

use of org.ovirt.engine.core.common.businessentities.aaa.DbUser in project ovirt-engine by oVirt.

the class EntityDaoImplTest method testGetEntityNameByIdAndTypeForUser.

@Test
public void testGetEntityNameByIdAndTypeForUser() {
    DbUser dbUser = dbUserDao.get(USER_ID);
    assertNotNull(dbUser);
    String name = dbUser.getLoginName();
    assertEquals(name, underTest.getEntityNameByIdAndType(USER_ID, VdcObjectType.User));
}
Also used : DbUser(org.ovirt.engine.core.common.businessentities.aaa.DbUser) Test(org.junit.Test)

Aggregations

DbUser (org.ovirt.engine.core.common.businessentities.aaa.DbUser)109 Test (org.junit.Test)26 ArrayList (java.util.ArrayList)18 Guid (org.ovirt.engine.core.compat.Guid)18 DbGroup (org.ovirt.engine.core.common.businessentities.aaa.DbGroup)13 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)10 HashSet (java.util.HashSet)9 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)9 HashMap (java.util.HashMap)8 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)8 Collection (java.util.Collection)7 Before (org.junit.Before)7 Permission (org.ovirt.engine.core.common.businessentities.Permission)7 List (java.util.List)5 Map (java.util.Map)5 AttachEntityToTagParameters (org.ovirt.engine.core.common.action.AttachEntityToTagParameters)5 PermissionsOperationsParameters (org.ovirt.engine.core.common.action.PermissionsOperationsParameters)5 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)5 ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)5 TagListModel (org.ovirt.engine.ui.uicommonweb.models.tags.TagListModel)5