Search in sources :

Example 51 with StorageDomainStatic

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;
}
Also used : StorageDomainStatic(org.ovirt.engine.core.common.businessentities.StorageDomainStatic)

Example 52 with StorageDomainStatic

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);
}
Also used : StorageDomainStatic(org.ovirt.engine.core.common.businessentities.StorageDomainStatic) Test(org.junit.Test)

Example 53 with StorageDomainStatic

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());
}
Also used : StorageDomainStatic(org.ovirt.engine.core.common.businessentities.StorageDomainStatic) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) ArrayList(java.util.ArrayList) Guid(org.ovirt.engine.core.compat.Guid) StorageDomainsAndStoragePoolIdQueryParameters(org.ovirt.engine.core.common.queries.StorageDomainsAndStoragePoolIdQueryParameters) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue) Pair(org.ovirt.engine.core.common.utils.Pair) Test(org.junit.Test)

Example 54 with StorageDomainStatic

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());
}
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) ArrayList(java.util.ArrayList) Guid(org.ovirt.engine.core.compat.Guid) StorageDomainsAndStoragePoolIdQueryParameters(org.ovirt.engine.core.common.queries.StorageDomainsAndStoragePoolIdQueryParameters) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue) Pair(org.ovirt.engine.core.common.utils.Pair) Test(org.junit.Test)

Example 55 with StorageDomainStatic

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();
}
Also used : StorageDomainStatic(org.ovirt.engine.core.common.businessentities.StorageDomainStatic) Test(org.junit.Test) BaseCommandTest(org.ovirt.engine.core.bll.BaseCommandTest)

Aggregations

StorageDomainStatic (org.ovirt.engine.core.common.businessentities.StorageDomainStatic)92 Guid (org.ovirt.engine.core.compat.Guid)39 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)35 ArrayList (java.util.ArrayList)33 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)31 Test (org.junit.Test)23 Pair (org.ovirt.engine.core.common.utils.Pair)19 StorageServerConnections (org.ovirt.engine.core.common.businessentities.StorageServerConnections)18 StorageDomainType (org.ovirt.engine.core.common.businessentities.StorageDomainType)15 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)15 VDSReturnValue (org.ovirt.engine.core.common.vdscommands.VDSReturnValue)14 List (java.util.List)13 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)13 StorageDomainManagementParameter (org.ovirt.engine.core.common.action.StorageDomainManagementParameter)13 StorageType (org.ovirt.engine.core.common.businessentities.storage.StorageType)13 VDS (org.ovirt.engine.core.common.businessentities.VDS)12 HashSet (java.util.HashSet)11 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)11 ActionType (org.ovirt.engine.core.common.action.ActionType)11 AttachStorageDomainToPoolParameters (org.ovirt.engine.core.common.action.AttachStorageDomainToPoolParameters)10