use of org.ovirt.engine.core.bll.ValidationResult in project ovirt-engine by oVirt.
the class TransferDiskImageCommandTest method validateCantUploadDiskNotExists.
@Test
public void validateCantUploadDiskNotExists() {
initializeSuppliedImage();
doReturn(new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_DISK_NOT_EXIST, "")).when(diskValidator).isDiskExists();
getCommand().validate();
ValidateTestUtils.assertValidationMessages("Can't start a transfer for image that doesn't exist.", getCommand(), EngineMessage.ACTION_TYPE_FAILED_DISK_NOT_EXIST);
}
use of org.ovirt.engine.core.bll.ValidationResult in project ovirt-engine by oVirt.
the class AddDiskCommandTest method testValidateFailReadOnlyOnInterface.
@Test
public void testValidateFailReadOnlyOnInterface() {
command.getParameters().setStorageDomainId(Guid.newGuid());
mockVm();
doReturn(true).when(command).isDiskPassPciAndIdeLimit();
doReturn(new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_INTERFACE_DOES_NOT_SUPPORT_READ_ONLY_ATTR)).when(diskVmElementValidator).isReadOnlyPropertyCompatibleWithInterface();
ValidateTestUtils.runAndAssertValidateFailure(command, EngineMessage.ACTION_TYPE_FAILED_INTERFACE_DOES_NOT_SUPPORT_READ_ONLY_ATTR);
}
use of org.ovirt.engine.core.bll.ValidationResult in project ovirt-engine by oVirt.
the class AddDiskCommandTest method testValidateFailsForPassDiscard.
@Test
public void testValidateFailsForPassDiscard() {
initializeCommand(Guid.newGuid());
mockVm();
StoragePool storagePool = new StoragePool();
storagePool.setCompatibilityVersion(Version.v4_1);
command.setStoragePool(storagePool);
command.getParameters().getDiskVmElement().setPassDiscard(true);
doReturn(new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_PASS_DISCARD_NOT_SUPPORTED_BY_DISK_INTERFACE)).when(diskVmElementValidator).isPassDiscardSupported(any());
mcr.mockConfigValue(ConfigValues.PassDiscardSupported, command.getStoragePool().getCompatibilityVersion(), true);
ValidateTestUtils.runAndAssertValidateFailure(command, EngineMessage.ACTION_TYPE_FAILED_PASS_DISCARD_NOT_SUPPORTED_BY_DISK_INTERFACE);
}
use of org.ovirt.engine.core.bll.ValidationResult in project ovirt-engine by oVirt.
the class AttachDiskToVmCommandTest method testValidateFailsWhenDiscardIsNotSupported.
@Test
public void testValidateFailsWhenDiscardIsNotSupported() {
when(diskVmElementValidator.isPassDiscardSupported(any())).thenReturn(new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_PASS_DISCARD_NOT_SUPPORTED_BY_DISK_INTERFACE));
ValidateTestUtils.runAndAssertValidateFailure(command, EngineMessage.ACTION_TYPE_FAILED_PASS_DISCARD_NOT_SUPPORTED_BY_DISK_INTERFACE);
}
use of org.ovirt.engine.core.bll.ValidationResult in project ovirt-engine by oVirt.
the class HotPlugDiskToVmCommandTest method validateBackupStorageDomain.
@Test
public void validateBackupStorageDomain() {
mockVmStatusUp();
mockInterfaceList();
createVirtIODisk();
initStorageDomain();
doReturn(new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_VM_DISKS_ON_BACKUP_STORAGE)).when(storageDomainValidator).isNotBackupDomain();
ValidateTestUtils.runAndAssertValidateFailure(command, EngineMessage.ACTION_TYPE_FAILED_VM_DISKS_ON_BACKUP_STORAGE);
}
Aggregations