use of org.ovirt.engine.core.common.queries.StorageDomainsAndStoragePoolIdQueryParameters in project ovirt-engine by oVirt.
the class GetFileStorageDomainsWithAttachedStoragePoolGuidQueryTest method testFetchUsingStorageServerConnectionWithUnattachedStorageDomain.
@Test
public void testFetchUsingStorageServerConnectionWithUnattachedStorageDomain() {
StoragePool storagePool = new StoragePool();
storagePool.setStatus(StoragePoolStatus.Up);
mockStoragePoolDao(storagePool);
// Create parameters
StorageDomainsAndStoragePoolIdQueryParameters paramsMock = getQueryParameters();
when(paramsMock.getStorageDomainList()).thenReturn(null);
StorageServerConnections storageServerConnections = new StorageServerConnections();
when(paramsMock.getStorageServerConnection()).thenReturn(storageServerConnections);
StorageDomain mockedStorageDomain = new StorageDomain();
mockedStorageDomain.setStorageStaticData(new StorageDomainStatic());
List<StorageDomain> storageDomains = new ArrayList<>();
storageDomains.add(mockedStorageDomain);
QueryReturnValue vdcReturnValue = new QueryReturnValue();
vdcReturnValue.setSucceeded(true);
vdcReturnValue.setReturnValue(storageDomains);
doReturn(vdcReturnValue).when(getQuery()).getExistingStorageDomainList(eq(storageServerConnections));
// Execute command
getQuery().executeQueryCommand();
// Assert the query's results
List<StorageDomainStatic> returnedStorageDomainList = new ArrayList<>();
assertEquals(returnedStorageDomainList, getQuery().getQueryReturnValue().getReturnValue());
}
use of org.ovirt.engine.core.common.queries.StorageDomainsAndStoragePoolIdQueryParameters in project ovirt-engine by oVirt.
the class GetFileStorageDomainsWithAttachedStoragePoolGuidQueryTest method testNullStorageDomainListQuery.
@Test
public void testNullStorageDomainListQuery() {
StoragePool storagePool = new StoragePool();
storagePool.setStatus(StoragePoolStatus.Up);
mockStoragePoolDao(storagePool);
// Create parameters
StorageDomainsAndStoragePoolIdQueryParameters paramsMock = getQueryParameters();
when(paramsMock.getStorageDomainList()).thenReturn(null);
// Run 'HSMGetStorageDomainInfo' command
VDSReturnValue returnValue = new VDSReturnValue();
returnValue.setSucceeded(true);
Pair<StorageDomainStatic, Guid> storageDomainToPoolId = new Pair<>(storageDomain.getStorageStaticData(), Guid.newGuid());
returnValue.setReturnValue(storageDomainToPoolId);
when(vdsBrokerFrontendMock.runVdsCommand(eq(VDSCommandType.HSMGetStorageDomainInfo), any())).thenReturn(returnValue);
// Execute command
getQuery().executeQueryCommand();
// Assert the query's results
List<StorageDomainStatic> returnedStorageDomainList = new ArrayList<>();
assertEquals(returnedStorageDomainList, getQuery().getQueryReturnValue().getReturnValue());
}
use of org.ovirt.engine.core.common.queries.StorageDomainsAndStoragePoolIdQueryParameters in project ovirt-engine by oVirt.
the class AbstractGetStorageDomainsWithAttachedStoragePoolGuidQueryTestCase method testUnattachedStorageDomainWithStorageDomainsParameterQuery.
@Test
public void testUnattachedStorageDomainWithStorageDomainsParameterQuery() {
StoragePool storagePool = new StoragePool();
storagePool.setStatus(StoragePoolStatus.Up);
mockStoragePoolDao(storagePool);
// Create parameters
List<StorageDomain> storageDomainList = new ArrayList<>();
storageDomainList.add(storageDomain);
StorageDomainsAndStoragePoolIdQueryParameters paramsMock = getQueryParameters();
when(paramsMock.getStorageDomainList()).thenReturn(storageDomainList);
// Run 'HSMGetStorageDomainInfo' command
VDSReturnValue returnValue = new VDSReturnValue();
returnValue.setSucceeded(true);
Pair<StorageDomainStatic, Guid> storageDomainToPoolId = new Pair<>(storageDomain.getStorageStaticData(), null);
returnValue.setReturnValue(storageDomainToPoolId);
when(vdsBrokerFrontendMock.runVdsCommand(eq(VDSCommandType.HSMGetStorageDomainInfo), any())).thenReturn(returnValue);
// Execute command
getQuery().executeQueryCommand();
// Assert the query's results
List<StorageDomainStatic> returnedStorageDomainList = new ArrayList<>();
assertEquals(returnedStorageDomainList, getQuery().getQueryReturnValue().getReturnValue());
}
use of org.ovirt.engine.core.common.queries.StorageDomainsAndStoragePoolIdQueryParameters in project ovirt-engine by oVirt.
the class AsyncDataProvider method getStorageDomainsWithAttachedStoragePoolGuid.
public void getStorageDomainsWithAttachedStoragePoolGuid(AsyncQuery<List<StorageDomainStatic>> aQuery, StoragePool storagePool, List<StorageDomain> storageDomains, StorageServerConnections storageServerConnection, Guid vdsId) {
aQuery.converterCallback = new ListConverter<>();
if (storageDomains != null) {
// Get file storage domains
StorageDomainsAndStoragePoolIdQueryParameters parameters = new StorageDomainsAndStoragePoolIdQueryParameters(storageDomains, storagePool.getId(), vdsId);
Frontend.getInstance().runQuery(QueryType.GetBlockStorageDomainsWithAttachedStoragePoolGuid, parameters, aQuery);
} else {
// Get block storage domains
StorageDomainsAndStoragePoolIdQueryParameters parameters = new StorageDomainsAndStoragePoolIdQueryParameters(storageServerConnection, storagePool.getId(), vdsId);
Frontend.getInstance().runQuery(QueryType.GetFileStorageDomainsWithAttachedStoragePoolGuid, parameters, aQuery);
}
}
Aggregations