Search in sources :

Example 76 with ValidationResult

use of org.ovirt.engine.core.bll.ValidationResult in project ovirt-engine by oVirt.

the class HotPlugDiskToVmCommandTest method validateFailedDiscardNotSupported.

@Test
public void validateFailedDiscardNotSupported() {
    mockVmStatusUp();
    mockInterfaceList();
    createVirtIODisk();
    initStorageDomain();
    doReturn(new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_PASS_DISCARD_NOT_SUPPORTED_BY_DISK_INTERFACE)).when(diskVmElementValidator).isPassDiscardSupported(any());
    ValidateTestUtils.runAndAssertValidateFailure(command, EngineMessage.ACTION_TYPE_FAILED_PASS_DISCARD_NOT_SUPPORTED_BY_DISK_INTERFACE);
}
Also used : ValidationResult(org.ovirt.engine.core.bll.ValidationResult) Test(org.junit.Test) BaseCommandTest(org.ovirt.engine.core.bll.BaseCommandTest)

Example 77 with ValidationResult

use of org.ovirt.engine.core.bll.ValidationResult in project ovirt-engine by oVirt.

the class CreateSnapshotForVmCommandTest method testVmInPreview.

@Test
public void testVmInPreview() {
    doReturn(new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_VM_IN_PREVIEW)).when(snapshotsValidator).vmNotInPreview(any());
    doReturn(getEmptyDiskList()).when(cmd).getDisksList();
    ValidateTestUtils.runAndAssertValidateFailure(cmd, EngineMessage.ACTION_TYPE_FAILED_VM_IN_PREVIEW);
}
Also used : ValidationResult(org.ovirt.engine.core.bll.ValidationResult) Test(org.junit.Test) BaseCommandTest(org.ovirt.engine.core.bll.BaseCommandTest)

Example 78 with ValidationResult

use of org.ovirt.engine.core.bll.ValidationResult in project ovirt-engine by oVirt.

the class CreateSnapshotForVmCommandTest method testVmDuringMigration.

@Test
public void testVmDuringMigration() {
    doReturn(new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_MIGRATION_IN_PROGRESS)).when(vmValidator).vmNotDuringMigration();
    doReturn(getEmptyDiskList()).when(cmd).getDisksList();
    ValidateTestUtils.runAndAssertValidateFailure(cmd, EngineMessage.ACTION_TYPE_FAILED_MIGRATION_IN_PROGRESS);
}
Also used : ValidationResult(org.ovirt.engine.core.bll.ValidationResult) Test(org.junit.Test) BaseCommandTest(org.ovirt.engine.core.bll.BaseCommandTest)

Example 79 with ValidationResult

use of org.ovirt.engine.core.bll.ValidationResult in project ovirt-engine by oVirt.

the class CreateSnapshotForVmCommandTest method testAllDomainsHaveSpaceForAllDisksFailure.

@Test
public void testAllDomainsHaveSpaceForAllDisksFailure() {
    doReturn(Collections.emptyList()).when(cmd).getDisksList();
    cmd.getParameters().setSaveMemory(true);
    doReturn(Guid.newGuid()).when(cmd).getStorageDomainIdForVmMemory(eq(Collections.emptyList()));
    doReturn(new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_DISK_SPACE_LOW_ON_STORAGE_DOMAIN)).when(multipleStorageDomainsValidator).allDomainsHaveSpaceForAllDisks(eq(Collections.emptyList()), any());
    ValidateTestUtils.runAndAssertValidateFailure(cmd, EngineMessage.ACTION_TYPE_FAILED_DISK_SPACE_LOW_ON_STORAGE_DOMAIN);
    verify(multipleStorageDomainsValidator).allDomainsHaveSpaceForAllDisks(eq(Collections.emptyList()), any());
}
Also used : ValidationResult(org.ovirt.engine.core.bll.ValidationResult) Test(org.junit.Test) BaseCommandTest(org.ovirt.engine.core.bll.BaseCommandTest)

Example 80 with ValidationResult

use of org.ovirt.engine.core.bll.ValidationResult in project ovirt-engine by oVirt.

the class CreateSnapshotForVmCommandTest method testVmRunningStateless.

@Test
public void testVmRunningStateless() {
    doReturn(new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_VM_RUNNING_STATELESS)).when(vmValidator).vmNotRunningStateless();
    doReturn(getEmptyDiskList()).when(cmd).getDisksList();
    ValidateTestUtils.runAndAssertValidateFailure(cmd, EngineMessage.ACTION_TYPE_FAILED_VM_RUNNING_STATELESS);
}
Also used : ValidationResult(org.ovirt.engine.core.bll.ValidationResult) Test(org.junit.Test) BaseCommandTest(org.ovirt.engine.core.bll.BaseCommandTest)

Aggregations

ValidationResult (org.ovirt.engine.core.bll.ValidationResult)239 Test (org.junit.Test)132 BaseCommandTest (org.ovirt.engine.core.bll.BaseCommandTest)49 Guid (org.ovirt.engine.core.compat.Guid)40 ArrayList (java.util.ArrayList)31 EngineMessage (org.ovirt.engine.core.common.errors.EngineMessage)31 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)30 Network (org.ovirt.engine.core.common.businessentities.network.Network)21 NetworkAttachment (org.ovirt.engine.core.common.businessentities.network.NetworkAttachment)19 VdsNetworkInterface (org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface)16 GlusterVolumeEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity)15 CreateOrUpdateBond (org.ovirt.engine.core.common.action.CreateOrUpdateBond)13 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)12 List (java.util.List)11 VM (org.ovirt.engine.core.common.businessentities.VM)11 HashSet (java.util.HashSet)10 FindActiveVmsUsingNetwork (org.ovirt.engine.core.bll.network.FindActiveVmsUsingNetwork)10 GlusterBrickEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity)9 StorageDomainValidator (org.ovirt.engine.core.bll.validator.storage.StorageDomainValidator)7 Disk (org.ovirt.engine.core.common.businessentities.storage.Disk)7