Search in sources :

Example 16 with StoragePool

use of org.ovirt.engine.core.common.businessentities.StoragePool in project ovirt-engine by oVirt.

the class RunVmCommandTest method testValidate.

@Test
public void testValidate() {
    final VM vm = new VM();
    vm.setStatus(VMStatus.Down);
    command.setVm(vm);
    command.setStoragePool(new StoragePool());
    doReturn(true).when(command).checkRngDeviceClusterCompatibility();
    doReturn(true).when(command).checkPayload(any());
    doReturn(ValidationResult.VALID).when(command).checkDisksInBackupStorage();
    command.setCluster(new Cluster());
    ValidateTestUtils.runAndAssertValidateSuccess(command);
}
Also used : StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) VM(org.ovirt.engine.core.common.businessentities.VM) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) Test(org.junit.Test)

Example 17 with StoragePool

use of org.ovirt.engine.core.common.businessentities.StoragePool in project ovirt-engine by oVirt.

the class CommonVmPoolCommandTestAbstract method mockStoragePool.

/**
 * Mock Storage Pool
 */
private StoragePool mockStoragePool() {
    StoragePool storagePool = new StoragePool();
    storagePool.setStatus(StoragePoolStatus.Up);
    return storagePool;
}
Also used : StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool)

Example 18 with StoragePool

use of org.ovirt.engine.core.common.businessentities.StoragePool in project ovirt-engine by oVirt.

the class ClusterValidatorTest method dataCenterVersionMismatches.

@Test
public void dataCenterVersionMismatches() {
    when(cluster.getStoragePoolId()).thenReturn(mock(Guid.class));
    when(cluster.getCompatibilityVersion()).thenReturn(mock(Version.class));
    StoragePool dataCenter = mock(StoragePool.class);
    when(dataCenter.getCompatibilityVersion()).thenReturn(SUPPORTED_VERSION);
    when(dataCenterDao.get(any())).thenReturn(dataCenter);
    when(dbFacade.getStoragePoolDao()).thenReturn(dataCenterDao);
    when(cluster.supportsVirtService()).thenReturn(true);
    validator = new ClusterValidator(dbFacade, cluster, cpuFlagsManagerHandler);
    assertThat(validator.dataCenterVersionMismatch(), failsWith(EngineMessage.CLUSTER_CANNOT_ADD_COMPATIBILITY_VERSION_WITH_LOWER_STORAGE_POOL));
}
Also used : StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) Version(org.ovirt.engine.core.compat.Version) Guid(org.ovirt.engine.core.compat.Guid) Test(org.junit.Test)

Example 19 with StoragePool

use of org.ovirt.engine.core.common.businessentities.StoragePool in project ovirt-engine by oVirt.

the class ClusterValidatorTest method localStoragePoolAttachedToMultipleClusters.

@Test
public void localStoragePoolAttachedToMultipleClusters() {
    when(cluster.getStoragePoolId()).thenReturn(mock(Guid.class));
    StoragePool dataCenter = mock(StoragePool.class);
    when(dataCenter.isLocal()).thenReturn(true);
    when(dataCenterDao.get(any())).thenReturn(dataCenter);
    when(dbFacade.getStoragePoolDao()).thenReturn(dataCenterDao);
    when(clusterDao.getAllForStoragePool(any())).thenReturn(Collections.singletonList(mock(Cluster.class)));
    when(dbFacade.getClusterDao()).thenReturn(clusterDao);
    validator = new ClusterValidator(dbFacade, cluster, cpuFlagsManagerHandler);
    assertThat(validator.localStoragePoolAttachedToSingleCluster(), failsWith(EngineMessage.CLUSTER_CANNOT_ADD_MORE_THEN_ONE_HOST_TO_LOCAL_STORAGE));
}
Also used : StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) Guid(org.ovirt.engine.core.compat.Guid) Test(org.junit.Test)

Example 20 with StoragePool

use of org.ovirt.engine.core.common.businessentities.StoragePool in project ovirt-engine by oVirt.

the class ClusterValidatorTest method localStoragePoolAttachedToSingleCluster.

@Test
public void localStoragePoolAttachedToSingleCluster() {
    when(cluster.getStoragePoolId()).thenReturn(mock(Guid.class));
    StoragePool dataCenter = mock(StoragePool.class);
    when(dataCenter.isLocal()).thenReturn(true);
    when(dataCenterDao.get(any())).thenReturn(dataCenter);
    when(dbFacade.getStoragePoolDao()).thenReturn(dataCenterDao);
    when(dbFacade.getClusterDao()).thenReturn(clusterDao);
    validator = new ClusterValidator(dbFacade, cluster, cpuFlagsManagerHandler);
    assertThat(validator.localStoragePoolAttachedToSingleCluster(), isValid());
}
Also used : StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) Guid(org.ovirt.engine.core.compat.Guid) Test(org.junit.Test)

Aggregations

StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)239 Guid (org.ovirt.engine.core.compat.Guid)83 ArrayList (java.util.ArrayList)78 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)60 Test (org.junit.Test)59 List (java.util.List)46 AsyncDataProvider (org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider)39 ConstantsManager (org.ovirt.engine.ui.uicompat.ConstantsManager)35 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)34 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)33 VDS (org.ovirt.engine.core.common.businessentities.VDS)31 QueryType (org.ovirt.engine.core.common.queries.QueryType)31 Frontend (org.ovirt.engine.ui.frontend.Frontend)31 StorageDomainStatic (org.ovirt.engine.core.common.businessentities.StorageDomainStatic)28 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)28 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)27 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)27 Linq (org.ovirt.engine.ui.uicommonweb.Linq)26 Arrays (java.util.Arrays)25 ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)25