use of org.ovirt.engine.core.common.businessentities.VmTemplate in project ovirt-engine by oVirt.
the class VmTemplateDaoTest method assertGetAllResult.
private static void assertGetAllResult(List<VmTemplate> result) {
assertNotNull(result);
assertFalse(result.isEmpty());
for (VmTemplate template : result) {
assertEquals("Template generation wasn't loaded as expected", 1, template.getDbGeneration());
}
}
use of org.ovirt.engine.core.common.businessentities.VmTemplate in project ovirt-engine by oVirt.
the class VmTemplateDaoTest method testGetAllInstanceTypesWithPermissionsForPriviligedUser.
/**
* Asserts that the right collection containing the instnace types is returned for a privileged user with filtering enabled
*/
@Test
public void testGetAllInstanceTypesWithPermissionsForPriviligedUser() {
VmTemplate existingInstanceType = dao.get(FixturesTool.INSTANCE_TYPE);
List<VmTemplate> result = dao.getAll(PRIVILEGED_USER_ID, true, VmEntityType.INSTANCE_TYPE);
assertNotNull(result);
assertEquals(NUMBER_OF_INSTANCE_TYPES_FOR_PRIVELEGED_USER, result.size());
assertEquals(result.iterator().next(), existingInstanceType);
}
use of org.ovirt.engine.core.common.businessentities.VmTemplate in project ovirt-engine by oVirt.
the class VmTemplateDaoTest method testGetWithPermissionsForUnpriviligedUser.
/**
* Asserts that no result is returned for a non privileged user with filtering enabled
*/
@Test
public void testGetWithPermissionsForUnpriviligedUser() {
VmTemplate result = dao.get(FixturesTool.VM_TEMPLATE_RHEL5, UNPRIVILEGED_USER_ID, true);
assertNull(result);
}
use of org.ovirt.engine.core.common.businessentities.VmTemplate in project ovirt-engine by oVirt.
the class VmTemplateDaoTest method testRemove.
/**
* Ensures that removing a template works as expected.
*/
@Test
public void testRemove() {
VmTemplate before = dao.get(FixturesTool.VM_TEMPLATE_RHEL5_2);
assertNotNull(before);
dao.remove(FixturesTool.VM_TEMPLATE_RHEL5_2);
VmTemplate after = dao.get(FixturesTool.VM_TEMPLATE_RHEL5_2);
assertNull(after);
}
use of org.ovirt.engine.core.common.businessentities.VmTemplate in project ovirt-engine by oVirt.
the class VmTemplateDaoTest method testUpdateStatus.
/**
* Ensures updating the status aspect of the VM Template works.
*/
@Test
public void testUpdateStatus() {
VmTemplate before = dao.get(existingEntity.getId());
before.setStatus(VmTemplateStatus.Locked);
dao.updateStatus(existingEntity.getId(), VmTemplateStatus.Locked);
VmTemplate after = dao.get(existingEntity.getId());
assertEquals(before, after);
}
Aggregations