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;
}
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());
}
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();
}
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());
}
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();
}
Aggregations