Search in sources :

Example 96 with VmTemplate

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

the class VmTemplateDaoTest method testGetWithPermissionsDisabledForUnpriviligedUser.

/**
 * Asserts that the right template is returned for a non privileged user with filtering disabled
 */
@Test
public void testGetWithPermissionsDisabledForUnpriviligedUser() {
    VmTemplate result = dao.get(FixturesTool.VM_TEMPLATE_RHEL5, UNPRIVILEGED_USER_ID, false);
    assertGetResult(result);
}
Also used : VmTemplate(org.ovirt.engine.core.common.businessentities.VmTemplate) Test(org.junit.Test)

Example 97 with VmTemplate

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

the class VmTemplateDaoTest method testGetAllForCluster.

/**
 * Ensures that the templates for the given vds group are returned.
 */
@Test
public void testGetAllForCluster() {
    List<VmTemplate> result = dao.getAllForCluster(FixturesTool.CLUSTER);
    assertGetAllResult(result);
    for (VmTemplate template : result) {
        assertEquals(FixturesTool.CLUSTER, template.getClusterId());
    }
}
Also used : VmTemplate(org.ovirt.engine.core.common.businessentities.VmTemplate) Test(org.junit.Test)

Example 98 with VmTemplate

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

the class VmTemplateDaoTest method testGetWithPermissionsForPriviligedUser.

/**
 * Asserts that the right template is returned for a privileged user with filtering enabled
 */
@Test
public void testGetWithPermissionsForPriviligedUser() {
    VmTemplate result = dao.get(FixturesTool.VM_TEMPLATE_RHEL5, PRIVILEGED_USER_ID, true);
    assertGetResult(result);
}
Also used : VmTemplate(org.ovirt.engine.core.common.businessentities.VmTemplate) Test(org.junit.Test)

Example 99 with VmTemplate

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

the class VmTemplateDaoTest method generateNewEntity.

@Override
protected VmTemplate generateNewEntity() {
    VmTemplate newVmTemplate = new VmTemplate();
    newVmTemplate.setId(Guid.newGuid());
    newVmTemplate.setName("NewVmTemplate");
    newVmTemplate.setClusterId(FixturesTool.CLUSTER);
    newVmTemplate.setClusterArch(ArchitectureType.x86_64);
    newVmTemplate.setCpuProfileId(FixturesTool.CPU_PROFILE_2);
    newVmTemplate.setSmallIconId(FixturesTool.SMALL_ICON_ID);
    newVmTemplate.setLargeIconId(FixturesTool.LARGE_ICON_ID);
    return newVmTemplate;
}
Also used : VmTemplate(org.ovirt.engine.core.common.businessentities.VmTemplate)

Example 100 with VmTemplate

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

the class VmDaoTest method setUp.

@Override
public void setUp() throws Exception {
    super.setUp();
    dao = dbFacade.getVmDao();
    existingVm = dao.get(FixturesTool.VM_RHEL5_POOL_57);
    existingVm.setStatus(VMStatus.Up);
    VmTemplate vmtemplate = dbFacade.getVmTemplateDao().get(FixturesTool.VM_TEMPLATE_RHEL5);
    existingTemplate = dbFacade.getVmTemplateDao().get(FixturesTool.VM_TEMPLATE_RHEL5);
    VM newVm = new VM();
    newVm.setId(Guid.newGuid());
    newVm.setClusterId(FixturesTool.CLUSTER_RHEL6_ISCSI);
    newVm.setVmtGuid(vmtemplate.getId());
    VmStatic newVmStatic = new VmStatic();
    newVmStatic.setName("New Virtual Machine");
    newVmStatic.setClusterId(FixturesTool.CLUSTER_RHEL6_ISCSI);
    newVmStatic.setVmtGuid(vmtemplate.getId());
}
Also used : VmTemplate(org.ovirt.engine.core.common.businessentities.VmTemplate) VM(org.ovirt.engine.core.common.businessentities.VM) VmStatic(org.ovirt.engine.core.common.businessentities.VmStatic)

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