Search in sources :

Example 96 with VM

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

the class RunVmValidatorTest method testVmWithDisks.

@Test
public void testVmWithDisks() {
    List<Disk> disks = new ArrayList<>();
    disks.add(new DiskImage());
    validateResult(runVmValidator.validateBootSequence(new VM(), disks), true, null);
}
Also used : VM(org.ovirt.engine.core.common.businessentities.VM) ArrayList(java.util.ArrayList) Disk(org.ovirt.engine.core.common.businessentities.storage.Disk) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage) Test(org.junit.Test)

Example 97 with VM

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

the class RunVmValidatorTest method testNoIsoDomainIsoOnIsoDomain.

@Test
public void testNoIsoDomainIsoOnIsoDomain() {
    VM vm = new VM();
    vm.setBootSequence(BootSequence.CD);
    validateResult(runVmValidator.validateIsoPath(vm, "Iso_name.iso", null, null), false, EngineMessage.VM_CANNOT_RUN_FROM_CD_WITHOUT_ACTIVE_STORAGE_DOMAIN_ISO);
}
Also used : VM(org.ovirt.engine.core.common.businessentities.VM) Test(org.junit.Test)

Example 98 with VM

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

the class RunVmValidatorTest method validateDisksPassDiscardFails.

@Test
public void validateDisksPassDiscardFails() {
    EngineMessage failureEngineMessage = EngineMessage.ACTION_TYPE_FAILED_PASS_DISCARD_NOT_SUPPORTED_BY_DISK_INTERFACE;
    mockPassDiscardSupport(new ValidationResult(failureEngineMessage));
    VM vm = new VM();
    vm.setId(Guid.newGuid());
    assertThat(runVmValidator.validateDisksPassDiscard(vm), failsWith(failureEngineMessage));
}
Also used : VM(org.ovirt.engine.core.common.businessentities.VM) ValidationResult(org.ovirt.engine.core.bll.ValidationResult) EngineMessage(org.ovirt.engine.core.common.errors.EngineMessage) Test(org.junit.Test)

Example 99 with VM

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

the class RunVmValidatorTest method canRunVmAsStateless.

private void canRunVmAsStateless(boolean autoStartUp, final boolean vmInPreview, boolean isVmStateless, Boolean isStatelessParam, boolean shouldPass, EngineMessage message) {
    Guid vmId = Guid.newGuid();
    when(snapshotValidator.vmNotInPreview(vmId)).thenReturn(vmInPreview ? new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_VM_IN_PREVIEW) : ValidationResult.VALID);
    VM vm = new VM();
    vm.setId(vmId);
    vm.setAutoStartup(autoStartUp);
    vm.setStateless(isVmStateless);
    validateResult(runVmValidator.validateStatelessVm(vm, isStatelessParam), shouldPass, message);
}
Also used : VM(org.ovirt.engine.core.common.businessentities.VM) Guid(org.ovirt.engine.core.compat.Guid) ValidationResult(org.ovirt.engine.core.bll.ValidationResult)

Example 100 with VM

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

the class RunVmValidatorTest method testIsoOnDataDomainNotExists.

@Test
public void testIsoOnDataDomainNotExists() {
    VM vm = new VM();
    vm.setBootSequence(BootSequence.CD);
    when(diskDao.get(any(Guid.class))).thenReturn(null);
    validateResult(runVmValidator.validateIsoPath(vm, Guid.newGuid().toString(), null, null), false, EngineMessage.ERROR_CANNOT_FIND_ISO_IMAGE_PATH);
}
Also used : VM(org.ovirt.engine.core.common.businessentities.VM) Guid(org.ovirt.engine.core.compat.Guid) Test(org.junit.Test)

Aggregations

VM (org.ovirt.engine.core.common.businessentities.VM)591 Test (org.junit.Test)178 Guid (org.ovirt.engine.core.compat.Guid)150 ArrayList (java.util.ArrayList)130 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)82 HashMap (java.util.HashMap)69 List (java.util.List)65 VDS (org.ovirt.engine.core.common.businessentities.VDS)63 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)56 Map (java.util.Map)53 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)53 Disk (org.ovirt.engine.core.common.businessentities.storage.Disk)41 QueryType (org.ovirt.engine.core.common.queries.QueryType)36 Snapshot (org.ovirt.engine.core.common.businessentities.Snapshot)34 Frontend (org.ovirt.engine.ui.frontend.Frontend)34 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)33 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)32 ConstantsManager (org.ovirt.engine.ui.uicompat.ConstantsManager)32 Collectors (java.util.stream.Collectors)31 HelpTag (org.ovirt.engine.ui.uicommonweb.help.HelpTag)31