Search in sources :

Example 31 with ValidationResult

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

the class StorageDomainToPoolRelationValidatorTest method testAttachFailDomainTypeIncorrect.

@Test
public void testAttachFailDomainTypeIncorrect() {
    storageDomain.setStorageType(StorageType.LOCALFS);
    ValidationResult attachIncorrectTypeResult = validator.validateDomainCanBeAttachedToPool();
    assertThat(attachIncorrectTypeResult, failsWith(EngineMessage.ERROR_CANNOT_ATTACH_STORAGE_DOMAIN_STORAGE_TYPE_NOT_MATCH));
}
Also used : ValidationResult(org.ovirt.engine.core.bll.ValidationResult) Test(org.junit.Test)

Example 32 with ValidationResult

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

the class StorageDomainValidatorTest method discardAfterDeleteNotSupportedByUnderlyingStorage.

@Test
public void discardAfterDeleteNotSupportedByUnderlyingStorage() {
    ValidationResult result = new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_DISCARD_AFTER_DELETE_NOT_SUPPORTED_BY_UNDERLYING_STORAGE, String.format("$storageDomainName %s", domain.getName()));
    assertDiscardAfterDeleteUpdate(true, StorageType.ISCSI, false, result);
}
Also used : ValidationResult(org.ovirt.engine.core.bll.ValidationResult) Test(org.junit.Test)

Example 33 with ValidationResult

use of org.ovirt.engine.core.bll.ValidationResult 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 34 with ValidationResult

use of org.ovirt.engine.core.bll.ValidationResult 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 35 with ValidationResult

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

the class VmNicMacsUtilsTest method testValidateThereIsEnoughOfFreeMacsNoAllocations.

@Test
public void testValidateThereIsEnoughOfFreeMacsNoAllocations() {
    final ValidationResult actual = underTest.validateThereIsEnoughOfFreeMacs(singletonList(vmNetworkInterfaceMock), macPoolMock, ALWAYS_FALSE);
    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