Search in sources :

Example 26 with Cluster

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

the class RunVmCommandTest method mockVm.

/**
 * Mock a VM.
 */
private VM mockVm() {
    VM vm = new VM();
    vm.setStatus(VMStatus.Down);
    when(vmDao.get(command.getParameters().getVmId())).thenReturn(vm);
    command.setCluster(new Cluster());
    // Avoid referencing the unmockable static VmHandler.updateCurrentCd
    doNothing().when(command).updateCurrentCd(any());
    doReturn(false).when(command).shouldRestoreMemory();
    when(snapshotDAO.exists(any(Guid.class), any(SnapshotStatus.class))).thenReturn(false);
    return vm;
}
Also used : SnapshotStatus(org.ovirt.engine.core.common.businessentities.Snapshot.SnapshotStatus) VM(org.ovirt.engine.core.common.businessentities.VM) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) Guid(org.ovirt.engine.core.compat.Guid)

Example 27 with Cluster

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

the class RunVmCommandTest method testValidate.

@Test
public void testValidate() {
    final VM vm = new VM();
    vm.setStatus(VMStatus.Down);
    command.setVm(vm);
    command.setStoragePool(new StoragePool());
    doReturn(true).when(command).checkRngDeviceClusterCompatibility();
    doReturn(true).when(command).checkPayload(any());
    doReturn(ValidationResult.VALID).when(command).checkDisksInBackupStorage();
    command.setCluster(new Cluster());
    ValidateTestUtils.runAndAssertValidateSuccess(command);
}
Also used : StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) VM(org.ovirt.engine.core.common.businessentities.VM) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) Test(org.junit.Test)

Example 28 with Cluster

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

the class UpdateClusterCommandTest method createDetachedDefaultCluster.

private static Cluster createDetachedDefaultCluster() {
    Cluster group = createDefaultCluster();
    group.setStoragePoolId(null);
    return group;
}
Also used : Cluster(org.ovirt.engine.core.common.businessentities.Cluster)

Example 29 with Cluster

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

the class UpdateClusterCommandTest method memoryOptimizationWithKsmAndBallooning.

@Test
public void memoryOptimizationWithKsmAndBallooning() {
    final Cluster cluster = createDefaultCluster();
    cluster.setMaxVdsMemoryOverCommit(200);
    cluster.setEnableKsm(true);
    cluster.setEnableBallooning(true);
    createCommand(cluster);
    cpuExists();
    initAndAssertValidation(true);
}
Also used : Cluster(org.ovirt.engine.core.common.businessentities.Cluster) Test(org.junit.Test)

Example 30 with Cluster

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

the class UpdateClusterCommandTest method createClusterWithBadVersion.

private static Cluster createClusterWithBadVersion() {
    Cluster group = createNewCluster();
    group.setCompatibilityVersion(new Version(5, 0));
    return group;
}
Also used : Version(org.ovirt.engine.core.compat.Version) Cluster(org.ovirt.engine.core.common.businessentities.Cluster)

Aggregations

Cluster (org.ovirt.engine.core.common.businessentities.Cluster)346 Test (org.junit.Test)83 ArrayList (java.util.ArrayList)80 Guid (org.ovirt.engine.core.compat.Guid)77 VDS (org.ovirt.engine.core.common.businessentities.VDS)54 List (java.util.List)50 VM (org.ovirt.engine.core.common.businessentities.VM)36 HashMap (java.util.HashMap)35 Map (java.util.Map)33 HashSet (java.util.HashSet)30 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)30 AsyncDataProvider (org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider)28 Version (org.ovirt.engine.core.compat.Version)27 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)26 ConstantsManager (org.ovirt.engine.ui.uicompat.ConstantsManager)26 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)25 Set (java.util.Set)24 QueryType (org.ovirt.engine.core.common.queries.QueryType)23 Collections (java.util.Collections)22 Frontend (org.ovirt.engine.ui.frontend.Frontend)22