Search in sources :

Example 91 with StoragePool

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

the class StorageDomainCommandBaseTest method prepareSharedStorageDomainForElection.

private StorageDomain prepareSharedStorageDomainForElection(StorageDomainStatus status) {
    final StorageDomain sharedDomain = createDataStorageDomain(status, "shared domain name", SHARED_SD_ID);
    when(storageDomainDao.getAllForStoragePool(any())).thenReturn(Collections.singletonList(sharedDomain));
    cmd.setStoragePool(new StoragePool());
    return sharedDomain;
}
Also used : StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool)

Example 92 with StoragePool

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

the class StorageDomainCommandBaseTest method shouldElectStorageTypeAfterLastUsedAsMasterDataDomain.

@Test
public void shouldElectStorageTypeAfterLastUsedAsMasterDataDomain() {
    StorageDomain localDomain = createDataStorageDomain(StorageDomainStatus.Active, "local domain name", LOCAL_SD_ID);
    localDomain.setLastTimeUsedAsMaster(System.currentTimeMillis() - 1000);
    localDomain.setStorageType(StorageType.LOCALFS);
    StorageDomain sharedDomain = createDataStorageDomain(StorageDomainStatus.Active, "shared domain name", SHARED_SD_ID);
    sharedDomain.setLastTimeUsedAsMaster(System.currentTimeMillis());
    when(storageDomainDao.getAllForStoragePool(any())).thenReturn(Arrays.asList(sharedDomain, localDomain));
    cmd.setStoragePool(new StoragePool());
    assertEquals(localDomain, cmd.electNewMaster());
}
Also used : StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) Test(org.junit.Test) BaseCommandTest(org.ovirt.engine.core.bll.BaseCommandTest)

Example 93 with StoragePool

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

the class RemoveSnapshotCommandTest method prepareForVmValidatorTests.

private void prepareForVmValidatorTests() {
    StoragePool sp = new StoragePool();
    sp.setId(STORAGE_POOL_ID);
    sp.setStatus(StoragePoolStatus.Up);
    cmd.setSnapshotName("someSnapshot");
    doReturn(ValidationResult.VALID).when(snapshotValidator).vmNotDuringSnapshot(any());
    doReturn(ValidationResult.VALID).when(snapshotValidator).vmNotInPreview(any());
    doReturn(ValidationResult.VALID).when(snapshotValidator).snapshotExists(any(), any());
    doReturn(true).when(cmd).validateImages();
    doReturn(sp).when(spDao).get(STORAGE_POOL_ID);
    doReturn(Collections.emptyList()).when(cmd).getSourceImages();
}
Also used : StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool)

Example 94 with StoragePool

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

the class UpdateOvfStoreForStorageDomainCommandTest method storageAndPoolExists.

@Test
public void storageAndPoolExists() {
    StorageDomain sd = new StorageDomain();
    Guid storagePoolId = Guid.newGuid();
    sd.setStoragePoolId(storagePoolId);
    when(storageDomainDao.getAllForStorageDomain(any())).thenReturn(Collections.singletonList(sd));
    when(storagePoolDao.get(storagePoolId)).thenReturn(new StoragePool());
    assertTrue(cmd.validate());
}
Also used : StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) Guid(org.ovirt.engine.core.compat.Guid) Test(org.junit.Test) BaseCommandTest(org.ovirt.engine.core.bll.BaseCommandTest)

Example 95 with StoragePool

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

the class UpdateStorageDomainCommandTest method setUp.

@Before
public void setUp() {
    StorageDomainStatic oldSdStatic = createStorageDomain();
    Guid spId = Guid.newGuid();
    sd = new StorageDomain();
    sd.setId(sdId);
    sd.setStorageStaticData(cmd.getParameters().getStorageDomain());
    sd.setStatus(StorageDomainStatus.Active);
    sd.setStoragePoolId(spId);
    sp = new StoragePool();
    sp.setId(spId);
    sp.setStatus(StoragePoolStatus.Up);
    sp.setIsLocal(false);
    doReturn(sd).when(cmd).getStorageDomain();
    doReturn(sp).when(cmd).getStoragePool();
    when(sdsDao.get(sdId)).thenReturn(oldSdStatic);
    mockStorageDomainValidator();
}
Also used : StorageDomainStatic(org.ovirt.engine.core.common.businessentities.StorageDomainStatic) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) Guid(org.ovirt.engine.core.compat.Guid) Before(org.junit.Before)

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