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