use of org.ovirt.engine.core.common.businessentities.StorageDomain in project ovirt-engine by oVirt.
the class AbstractGetStorageDomainsWithAttachedStoragePoolGuidQueryTestCase method setUp.
@Override
@Before
public void setUp() throws Exception {
super.setUp();
storageDomain = new StorageDomain();
storageDomain.setStorageName("Name of Storage");
storageDomain.setStorageType(getStorageType());
VDS vds = new VDS();
vds.setId(Guid.newGuid());
List<VDS> listVds = new ArrayList<>();
listVds.add(vds);
when(vdsDaoMock.getAllForStoragePoolAndStatus(any(), eq(VDSStatus.Up))).thenReturn(listVds);
}
use of org.ovirt.engine.core.common.businessentities.StorageDomain in project ovirt-engine by oVirt.
the class AbstractGetStorageDomainsWithAttachedStoragePoolGuidQueryTestCase method testEmptyStorageDomainListQuery.
@Test
public void testEmptyStorageDomainListQuery() {
StoragePool storagePool = new StoragePool();
storagePool.setStatus(StoragePoolStatus.Up);
mockStoragePoolDao(storagePool);
// Create parameters
List<StorageDomain> storageDomainList = new ArrayList<>();
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(), 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.businessentities.StorageDomain in project ovirt-engine by oVirt.
the class AbstractGetStorageDomainsWithAttachedStoragePoolGuidQueryTestCase method testAttachedStorageDomainWithStorageDomainsParameterQuery.
@Test
public void testAttachedStorageDomainWithStorageDomainsParameterQuery() {
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(), 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<>();
returnedStorageDomainList.add(storageDomain.getStorageStaticData());
assertEquals(returnedStorageDomainList, getQuery().getQueryReturnValue().getReturnValue());
}
use of org.ovirt.engine.core.common.businessentities.StorageDomain in project ovirt-engine by oVirt.
the class HotPlugDiskToVmCommandTest method initStorageDomain.
private void initStorageDomain() {
StorageDomain storageDomain = new StorageDomain();
storageDomain.setId(storageDomainId);
storageDomain.setStoragePoolId(storagePoolId);
when(storageDomainDao.get(any())).thenReturn(storageDomain);
when(storageDomainDao.getForStoragePool(storageDomainId, storagePoolId)).thenReturn(storageDomain);
}
use of org.ovirt.engine.core.common.businessentities.StorageDomain in project ovirt-engine by oVirt.
the class GetStorageDomainsByStoragePoolIdQueryTest method testExecuteQuery.
@Test
public void testExecuteQuery() {
Guid storagePoolID = Guid.newGuid();
when(getQueryParameters().getId()).thenReturn(storagePoolID);
StorageDomain domain = new StorageDomain();
when(storageDomainDaoMock.getAllForStoragePool(storagePoolID, getUser().getId(), getQueryParameters().isFiltered())).thenReturn(Collections.singletonList(domain));
getQuery().executeQueryCommand();
List<StorageDomain> result = getQuery().getQueryReturnValue().getReturnValue();
assertEquals("Wrong number of domains returned", 1, result.size());
assertEquals("Wrong domain returned", domain, result.get(0));
}
Aggregations