Search in sources :

Example 91 with ValidationResult

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);
}
Also used : ValidationResult(org.ovirt.engine.core.bll.ValidationResult) Test(org.junit.Test) BaseCommandTest(org.ovirt.engine.core.bll.BaseCommandTest)

Example 92 with ValidationResult

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;
}
Also used : StorageDomainValidator(org.ovirt.engine.core.bll.validator.storage.StorageDomainValidator) ValidationResult(org.ovirt.engine.core.bll.ValidationResult)

Example 93 with ValidationResult

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);
}
Also used : ValidationResult(org.ovirt.engine.core.bll.ValidationResult) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage) Test(org.junit.Test) BaseCommandTest(org.ovirt.engine.core.bll.BaseCommandTest)

Example 94 with ValidationResult

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)));
}
Also used : ValidationResult(org.ovirt.engine.core.bll.ValidationResult) Test(org.junit.Test)

Example 95 with ValidationResult

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());
}
Also used : ValidationResult(org.ovirt.engine.core.bll.ValidationResult) Test(org.junit.Test)

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