Search in sources :

Example 61 with VmTemplate

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());
    }
}
Also used : VmTemplate(org.ovirt.engine.core.common.businessentities.VmTemplate)

Example 62 with VmTemplate

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);
}
Also used : VmTemplate(org.ovirt.engine.core.common.businessentities.VmTemplate) Test(org.junit.Test)

Example 63 with VmTemplate

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);
}
Also used : VmTemplate(org.ovirt.engine.core.common.businessentities.VmTemplate) Test(org.junit.Test)

Example 64 with VmTemplate

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);
}
Also used : VmTemplate(org.ovirt.engine.core.common.businessentities.VmTemplate) Test(org.junit.Test)

Example 65 with VmTemplate

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);
}
Also used : VmTemplate(org.ovirt.engine.core.common.businessentities.VmTemplate) Test(org.junit.Test)

Aggregations

VmTemplate (org.ovirt.engine.core.common.businessentities.VmTemplate)149 ArrayList (java.util.ArrayList)42 Guid (org.ovirt.engine.core.compat.Guid)40 Test (org.junit.Test)30 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)23 HashMap (java.util.HashMap)22 List (java.util.List)20 VM (org.ovirt.engine.core.common.businessentities.VM)19 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)16 Map (java.util.Map)13 QueryType (org.ovirt.engine.core.common.queries.QueryType)13 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)12 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)11 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)11 ConstantsManager (org.ovirt.engine.ui.uicompat.ConstantsManager)11 Frontend (org.ovirt.engine.ui.frontend.Frontend)10 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)9 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)9 Collection (java.util.Collection)8 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)8