use of org.ovirt.engine.core.common.businessentities.StorageDomainStatic in project ovirt-engine by oVirt.
the class StorageDomainStaticDaoTest method generateNewEntity.
@Override
protected StorageDomainStatic generateNewEntity() {
StorageDomainStatic newStaticDomain = new StorageDomainStatic();
newStaticDomain.setStorageName("NewStorageDomain");
newStaticDomain.setStorage("fDMzhE-wx3s-zo3q-Qcxd-T0li-yoYU-QvVePl");
newStaticDomain.setStorageFormat(StorageFormatType.V1);
newStaticDomain.setWipeAfterDelete(true);
newStaticDomain.setDiscardAfterDelete(false);
newStaticDomain.setWarningLowSpaceIndicator(3);
newStaticDomain.setCriticalSpaceActionBlocker(9);
newStaticDomain.setFirstMetadataDevice(FixturesTool.LUN_ID2);
newStaticDomain.setVgMetadataDevice(FixturesTool.LUN_ID2);
newStaticDomain.setBackup(false);
return newStaticDomain;
}
use of org.ovirt.engine.core.common.businessentities.StorageDomainStatic in project ovirt-engine by oVirt.
the class StorageDomainStaticDaoTest method testGetByName.
/**
* Ensures the right instance is returned.
*/
@Test
public void testGetByName() {
StorageDomainStatic result = dao.getByName(existingEntity.getStorageName());
assertEquals(existingEntity, result);
}
use of org.ovirt.engine.core.common.businessentities.StorageDomainStatic in project ovirt-engine by oVirt.
the class GetStorageDomainsWithAttachedStoragePoolGuidQueryTest method testStoragePoolIdReturnNullStoragePool.
@Test
public void testStoragePoolIdReturnNullStoragePool() {
mockStoragePoolDao(null);
// Create parameters
List<StorageDomain> storageDomainList = new ArrayList<>();
storageDomainList.add(storageDomain);
StorageDomainsAndStoragePoolIdQueryParameters paramsMock = getQueryParameters();
when(paramsMock.getStorageDomainList()).thenReturn(storageDomainList);
when(paramsMock.isCheckStoragePoolStatus()).thenReturn(Boolean.TRUE);
// 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.StorageDomainStatic in project ovirt-engine by oVirt.
the class GetStorageDomainsWithAttachedStoragePoolGuidQueryTest method testUninitializedStoragePool.
@Test
public void testUninitializedStoragePool() {
StoragePool storagePool = new StoragePool();
storagePool.setStatus(StoragePoolStatus.Uninitialized);
mockStoragePoolDao(storagePool);
// Create parameters
List<StorageDomain> storageDomainList = new ArrayList<>();
storageDomainList.add(storageDomain);
StorageDomainsAndStoragePoolIdQueryParameters paramsMock = getQueryParameters();
when(paramsMock.getStorageDomainList()).thenReturn(storageDomainList);
when(paramsMock.isCheckStoragePoolStatus()).thenReturn(Boolean.TRUE);
// 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.StorageDomainStatic in project ovirt-engine by oVirt.
the class ImportHostedEngineStorageDomainCommandTest method failsIfImported.
@Test
public void failsIfImported() throws Exception {
when(hostedEngineHelper.getStorageDomain()).thenReturn(new StorageDomainStatic());
mockGetExistingDomain(true);
cmd.init();
cmd.validate();
ValidateTestUtils.assertValidationMessages("", cmd, EngineMessage.ACTION_TYPE_FAILED_STORAGE_DOMAIN_ALREADY_EXIST);
verify(cmd, times(0)).executeCommand();
}
Aggregations