Search in sources :

Example 21 with StoragePool

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

the class UpdateStoragePoolCommandTest method newPoolNameIsAlreadyTaken.

private void newPoolNameIsAlreadyTaken() {
    when(spDao.get(any())).thenReturn(new StoragePool());
    List<StoragePool> storagePoolList = new ArrayList<>();
    storagePoolList.add(createStoragePool());
    when(spDao.getByName(any(), anyBoolean())).thenReturn(new ArrayList<>(storagePoolList));
}
Also used : StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) ArrayList(java.util.ArrayList)

Example 22 with StoragePool

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

the class UpdateStoragePoolCommandTest method hasLocalDomain.

@Test
public void hasLocalDomain() {
    StorageDomainStatic sdc = new StorageDomainStatic();
    sdc.setStorageType(StorageType.LOCALFS);
    StoragePool existingSp = createStoragePool();
    existingSp.setIsLocal(true);
    when(spDao.get(any())).thenReturn(existingSp);
    when(sdDao.getAllForStoragePool(any())).thenReturn(Collections.singletonList(sdc));
    ValidateTestUtils.runAndAssertValidateFailure(cmd, EngineMessage.ERROR_CANNOT_CHANGE_STORAGE_POOL_TYPE_WITH_LOCAL);
}
Also used : StorageDomainStatic(org.ovirt.engine.core.common.businessentities.StorageDomainStatic) StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) Test(org.junit.Test) BaseCommandTest(org.ovirt.engine.core.bll.BaseCommandTest)

Example 23 with StoragePool

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

the class DiskImagesValidatorTest method testIsQcowV3SupportedForDcVersionV4.

@Test
public void testIsQcowV3SupportedForDcVersionV4() {
    disk1.setVolumeFormat(VolumeFormat.COW);
    disk1.setQcowCompat(QcowCompat.QCOW2_V3);
    StoragePool sp = new StoragePool();
    sp.setStoragePoolFormatType(StorageFormatType.V4);
    when(storagePoolDao.get(any())).thenReturn(sp);
    assertThat(validator.isQcowVersionSupportedForDcVersion(), isValid());
}
Also used : StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) Test(org.junit.Test)

Example 24 with StoragePool

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

the class DiskImagesValidatorTest method testIsQcowV2SupportedForDcVersionV3.

@Test
public void testIsQcowV2SupportedForDcVersionV3() {
    disk1.setVolumeFormat(VolumeFormat.COW);
    disk1.setQcowCompat(QcowCompat.QCOW2_V2);
    StoragePool sp = new StoragePool();
    sp.setStoragePoolFormatType(StorageFormatType.V3);
    when(storagePoolDao.get(any())).thenReturn(sp);
    assertThat(validator.isQcowVersionSupportedForDcVersion(), isValid());
}
Also used : StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) Test(org.junit.Test)

Example 25 with StoragePool

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

the class AbstractSyncLunsCommandTest method testValidateStoragePoolStoragePoolNotUp.

@Test
public void testValidateStoragePoolStoragePoolNotUp() {
    StoragePool storagePool = new StoragePool();
    storagePool.setId(Guid.newGuid());
    when(storagePoolDao.get(storagePool.getId())).thenReturn(storagePool);
    command.setStoragePoolId(storagePool.getId());
    assertFalse(command.validate());
    ValidateTestUtils.assertValidationMessages("", command, EngineMessage.ACTION_TYPE_FAILED_STORAGE_POOL_STATUS_ILLEGAL);
}
Also used : StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) 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