Search in sources :

Example 6 with UserProfile

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

the class BackendSSHPublicKeyResource method remove.

@Override
public Response remove() {
    // we cannot just remove UserProfile, because we'll wipe out unrelated fields.
    // Instead, we just clear the public key fields.
    UserProfile entity = getEntity(UserProfile.class, QueryType.GetUserProfile, new IdQueryParameters(userId), userId.toString(), true);
    entity.setSshPublicKeyId(Guid.Empty);
    entity.setSshPublicKey("");
    UserProfileParameters parameters = new UserProfileParameters();
    parameters.setUserProfile(entity);
    return performAction(ActionType.UpdateUserProfile, parameters);
}
Also used : IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) UserProfileParameters(org.ovirt.engine.core.common.action.UserProfileParameters) UserProfile(org.ovirt.engine.core.common.businessentities.UserProfile)

Example 7 with UserProfile

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

the class UserProfileDaoTest method testGet.

/**
 * Ensures that retrieving an user profile by id works as expected.
 */
@Test
public void testGet() {
    UserProfile result = dao.get(existingProfile.getId());
    assertNotNull(result);
    assertEquals(existingProfile, result);
}
Also used : UserProfile(org.ovirt.engine.core.common.businessentities.UserProfile) Test(org.junit.Test)

Example 8 with UserProfile

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

the class UserProfileDaoTest method testSave.

/**
 * Ensures that saving a user profile works as expected.
 */
@Test
public void testSave() {
    dao.save(newProfile);
    UserProfile result = dao.get(newProfile.getId());
    assertEquals(newProfile, result);
}
Also used : UserProfile(org.ovirt.engine.core.common.businessentities.UserProfile) Test(org.junit.Test)

Example 9 with UserProfile

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

the class UserProfileDaoTest method testGetWithInvalidId.

/**
 * Ensures that trying to get a user profile using an invalid id fails.
 */
@Test
public void testGetWithInvalidId() {
    UserProfile result = dao.get(Guid.newGuid());
    assertNull(result);
}
Also used : UserProfile(org.ovirt.engine.core.common.businessentities.UserProfile) Test(org.junit.Test)

Example 10 with UserProfile

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

the class UserProfileDaoTest method testUpdate.

/**
 * Ensures that updating a user profile works as expected.
 */
@Test
public void testUpdate() {
    existingProfile.setSshPublicKey("key4");
    dao.update(existingProfile);
    UserProfile result = dao.get(existingProfile.getId());
    assertEquals(existingProfile, result);
}
Also used : UserProfile(org.ovirt.engine.core.common.businessentities.UserProfile) Test(org.junit.Test)

Aggregations

UserProfile (org.ovirt.engine.core.common.businessentities.UserProfile)16 Test (org.junit.Test)6 UserProfileParameters (org.ovirt.engine.core.common.action.UserProfileParameters)3 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Before (org.junit.Before)1 ActionType (org.ovirt.engine.core.common.action.ActionType)1 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)1 QueryParametersBase (org.ovirt.engine.core.common.queries.QueryParametersBase)1 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)1 Guid (org.ovirt.engine.core.compat.Guid)1 Frontend (org.ovirt.engine.ui.frontend.Frontend)1 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)1 AsyncDataProvider (org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider)1 ConstantsManager (org.ovirt.engine.ui.uicompat.ConstantsManager)1 UIConstants (org.ovirt.engine.ui.uicompat.UIConstants)1