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);
}
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);
}
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);
}
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);
}
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);
}
Aggregations