Search in sources :

Example 56 with StorageDomainStatic

use of org.ovirt.engine.core.common.businessentities.StorageDomainStatic in project ovirt-engine by oVirt.

the class RefreshLunsSizeCommandTest method setUp.

@Before
public void setUp() {
    StorageDomainStatic sdStatic = createStorageDomain();
    spId = Guid.newGuid();
    sd = new StorageDomain();
    sd.setStorageStaticData(sdStatic);
    sd.setStatus(StorageDomainStatus.Active);
    sd.setStoragePoolId(spId);
    StoragePool sp = new StoragePool();
    sp.setId(spId);
    sp.setStatus(StoragePoolStatus.Up);
    sp.setIsLocal(false);
    sp.setCompatibilityVersion(Version.v3_6);
    doReturn(sd).when(cmd).getStorageDomain();
    doReturn(sp).when(cmd).getStoragePool();
    when(sdsDao.get(sdId)).thenReturn(sdStatic);
    LUNs lun1 = new LUNs();
    lun1.setLUNId("1");
    lun1.setStorageDomainId(sdId);
    LUNs lun2 = new LUNs();
    lun2.setLUNId("2");
    lun2.setStorageDomainId(sdId);
    when(lunsDao.getAll()).thenReturn(Arrays.asList(lun1, lun2));
}
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) LUNs(org.ovirt.engine.core.common.businessentities.storage.LUNs) Before(org.junit.Before)

Example 57 with StorageDomainStatic

use of org.ovirt.engine.core.common.businessentities.StorageDomainStatic in project ovirt-engine by oVirt.

the class RefreshLunsSizeCommandTest method validateWrongStorage.

@Test
public void validateWrongStorage() {
    StorageDomainStatic nfsStatic = createStorageDomain();
    nfsStatic.setStorageType(StorageType.NFS);
    StorageDomain sd = new StorageDomain();
    sd.setStorageStaticData(nfsStatic);
    sd.setStatus(StorageDomainStatus.Active);
    sd.setStoragePoolId(spId);
    doReturn(sd).when(cmd).getStorageDomain();
    ValidateTestUtils.runAndAssertValidateFailure(cmd, EngineMessage.ACTION_TYPE_FAILED_STORAGE_DOMAIN_TYPE_ILLEGAL);
}
Also used : StorageDomainStatic(org.ovirt.engine.core.common.businessentities.StorageDomainStatic) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) Test(org.junit.Test) BaseCommandTest(org.ovirt.engine.core.bll.BaseCommandTest)

Example 58 with StorageDomainStatic

use of org.ovirt.engine.core.common.businessentities.StorageDomainStatic in project ovirt-engine by oVirt.

the class AddExistingFileStorageDomainCommandTest method testSwitchStorageDomainType.

@Test
public void testSwitchStorageDomainType() {
    StorageDomainStatic sdStatic = command.getStorageDomain().getStorageStaticData();
    doReturn(new Pair<>(sdStatic, sdStatic.getId())).when(command).executeHSMGetStorageDomainInfo(any());
    ValidateTestUtils.runAndAssertValidateSuccess(command);
}
Also used : StorageDomainStatic(org.ovirt.engine.core.common.businessentities.StorageDomainStatic) Test(org.junit.Test) BaseCommandTest(org.ovirt.engine.core.bll.BaseCommandTest)

Example 59 with StorageDomainStatic

use of org.ovirt.engine.core.common.businessentities.StorageDomainStatic in project ovirt-engine by oVirt.

the class AddStorageDomainCommonTest method validateFailsNameExists.

@Test
public void validateFailsNameExists() {
    when(sdsDao.getByName(sd.getName())).thenReturn(new StorageDomainStatic());
    ValidateTestUtils.runAndAssertValidateFailure(cmd, EngineMessage.ACTION_TYPE_FAILED_STORAGE_DOMAIN_NAME_ALREADY_EXIST);
}
Also used : StorageDomainStatic(org.ovirt.engine.core.common.businessentities.StorageDomainStatic) Test(org.junit.Test) BaseCommandTest(org.ovirt.engine.core.bll.BaseCommandTest)

Example 60 with StorageDomainStatic

use of org.ovirt.engine.core.common.businessentities.StorageDomainStatic in project ovirt-engine by oVirt.

the class AttachStorageDomainToPoolCommandTest method mockGetStorageDomainInfoVdsCommand.

private void mockGetStorageDomainInfoVdsCommand(StorageDomainStatic storageDomain) {
    Pair<StorageDomainStatic, Guid> pairResult = new Pair<>(storageDomain, null);
    VDSReturnValue returnValueForGetStorageDomainInfo = new VDSReturnValue();
    returnValueForGetStorageDomainInfo.setSucceeded(true);
    returnValueForGetStorageDomainInfo.setReturnValue(pairResult);
    when(vdsBrokerFrontend.runVdsCommand(eq(VDSCommandType.HSMGetStorageDomainInfo), any())).thenReturn(returnValueForGetStorageDomainInfo);
}
Also used : StorageDomainStatic(org.ovirt.engine.core.common.businessentities.StorageDomainStatic) Guid(org.ovirt.engine.core.compat.Guid) Pair(org.ovirt.engine.core.common.utils.Pair) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue)

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