use of org.ovirt.engine.core.bll.ValidationResult in project ovirt-engine by oVirt.
the class LiveMigrateDiskCommandTest method validateVmHavingDeviceSnapshotsPluggedToOtherVmsThatAreNotDown.
@Test
public void validateVmHavingDeviceSnapshotsPluggedToOtherVmsThatAreNotDown() {
initStorageDomain(srcStorageId);
initStorageDomain(dstStorageId);
initDiskImage(diskImageGroupId, diskImageId);
initVm(VMStatus.Up, Guid.newGuid(), diskImageGroupId);
doReturn(new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_VM_IS_NOT_DOWN)).when(diskValidator).isDiskPluggedToAnyNonDownVm(anyBoolean());
ValidateTestUtils.runAndAssertValidateFailure(command, EngineMessage.ACTION_TYPE_FAILED_VM_IS_NOT_DOWN);
}
use of org.ovirt.engine.core.bll.ValidationResult in project ovirt-engine by oVirt.
the class AddDiskCommandTest method mockStorageDomainValidatorWithoutSpace.
private static StorageDomainValidator mockStorageDomainValidatorWithoutSpace() {
StorageDomainValidator storageDomainValidator = mockStorageDomainValidator();
when(storageDomainValidator.hasSpaceForNewDisk(any())).thenReturn(new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_DISK_SPACE_LOW_ON_STORAGE_DOMAIN));
return storageDomainValidator;
}
use of org.ovirt.engine.core.bll.ValidationResult in project ovirt-engine by oVirt.
the class CreateSnapshotForVmCommandTest method testAllDomainsHaveSpaceForNewDisksFailure.
@Test
public void testAllDomainsHaveSpaceForNewDisksFailure() {
List<DiskImage> disksList = Collections.emptyList();
doReturn(disksList).when(cmd).getDisksList();
doReturn(new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_DISK_SPACE_LOW_ON_STORAGE_DOMAIN)).when(multipleStorageDomainsValidator).allDomainsHaveSpaceForNewDisks(disksList);
ValidateTestUtils.runAndAssertValidateFailure(cmd, EngineMessage.ACTION_TYPE_FAILED_DISK_SPACE_LOW_ON_STORAGE_DOMAIN);
verify(multipleStorageDomainsValidator).allDomainsHaveSpaceForNewDisks(disksList);
}
use of org.ovirt.engine.core.bll.ValidationResult in project ovirt-engine by oVirt.
the class VmMacsValidationTest method testValidateInvalid.
@Test
public void testValidateInvalid() {
final List<String> invalidMacs = Arrays.asList("mac1", "mac2");
when(mockProblematicVmMacsFinder.findProblematicMacs(mockVM)).thenReturn(invalidMacs);
final ValidationResult actual = underTest.validate(mockVM);
assertThat(actual, failsWith(EngineMessage.Unassigned, ReplacementUtils.getListVariableAssignmentString(EngineMessage.Unassigned, invalidMacs)));
}
use of org.ovirt.engine.core.bll.ValidationResult in project ovirt-engine by oVirt.
the class VmMacsValidationTest method testValidateValid.
@Test
public void testValidateValid() {
final ValidationResult actual = underTest.validate(mockVM);
assertThat(actual, isValid());
}
Aggregations