Search in sources :

Example 31 with LUNs

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

the class SyncLunsInfoForBlockStorageDomainCommandTest method setUp.

@Before
public void setUp() {
    doReturn(hostValidator).when(command).getHostValidator();
    lunFromVg = new LUNs();
    lunFromDb = new LUNs();
}
Also used : LUNs(org.ovirt.engine.core.common.businessentities.storage.LUNs) Before(org.junit.Before)

Example 32 with LUNs

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

the class SyncLunsInfoForBlockStorageDomainCommandTest method testGetLunsToRemoveFromDb.

@Test
public void testGetLunsToRemoveFromDb() {
    lunFromVg.setLUNId(Guid.newGuid().toString());
    lunFromDb.setLUNId(Guid.newGuid().toString());
    LUNs dummyLun = new LUNs();
    dummyLun.setId(BusinessEntitiesDefinitions.DUMMY_LUN_ID_PREFIX + Guid.newGuid().toString());
    List<LUNs> lunsFromVgInfo = Collections.singletonList(lunFromVg);
    List<LUNs> lunsFromDb = Arrays.asList(lunFromDb, dummyLun);
    assertEquals(command.getLunsToRemoveFromDb(lunsFromVgInfo, lunsFromDb), Collections.singletonList(lunFromDb));
}
Also used : LUNs(org.ovirt.engine.core.common.businessentities.storage.LUNs) Test(org.junit.Test) BaseCommandTest(org.ovirt.engine.core.bll.BaseCommandTest)

Example 33 with LUNs

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

the class SyncLunsInfoForBlockStorageDomainCommandTest method testGetLunsToUpdateInDbDiffLunIdDiffPvId.

@Test
public void testGetLunsToUpdateInDbDiffLunIdDiffPvId() {
    Guid lunFromVgLunId = Guid.newGuid();
    Map<LunHandler, List<LUNs>> lunsToUpdateInDb = getLunsToUpdateInDb(lunFromVgLunId, Guid.newGuid(), Guid.newGuid(), Guid.newGuid());
    List<LUNs> newLunsToSaveInDb = lunsToUpdateInDb.get(command.saveLunsHandler);
    assertEquals(Stream.of(command.saveLunsHandler, command.removeLunsHandler).collect(Collectors.toSet()), lunsToUpdateInDb.keySet());
    assertLunIdInList(newLunsToSaveInDb, lunFromVgLunId);
}
Also used : List(java.util.List) Guid(org.ovirt.engine.core.compat.Guid) LunHandler(org.ovirt.engine.core.bll.storage.domain.SyncLunsInfoForBlockStorageDomainCommand.LunHandler) LUNs(org.ovirt.engine.core.common.businessentities.storage.LUNs) Test(org.junit.Test) BaseCommandTest(org.ovirt.engine.core.bll.BaseCommandTest)

Example 34 with LUNs

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

the class SyncLunsInfoForBlockStorageDomainCommandTest method testGetLunsToUpdateInDbDiffLunIdSamePvId.

@Test
public void testGetLunsToUpdateInDbDiffLunIdSamePvId() {
    Guid pvID = Guid.newGuid();
    Guid lunFromVgLunId = Guid.newGuid();
    Map<LunHandler, List<LUNs>> lunsToUpdateInDb = getLunsToUpdateInDb(lunFromVgLunId, Guid.newGuid(), pvID, pvID);
    List<LUNs> newLunsToSaveInDb = lunsToUpdateInDb.get(command.saveLunsHandler);
    assertEquals(Stream.of(command.saveLunsHandler, command.removeLunsHandler).collect(Collectors.toSet()), lunsToUpdateInDb.keySet());
    assertLunIdInList(newLunsToSaveInDb, lunFromVgLunId);
}
Also used : List(java.util.List) Guid(org.ovirt.engine.core.compat.Guid) LunHandler(org.ovirt.engine.core.bll.storage.domain.SyncLunsInfoForBlockStorageDomainCommand.LunHandler) LUNs(org.ovirt.engine.core.common.businessentities.storage.LUNs) Test(org.junit.Test) BaseCommandTest(org.ovirt.engine.core.bll.BaseCommandTest)

Example 35 with LUNs

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

the class AddExistingBlockStorageDomainCommandTest method getLUNs.

private static List<LUNs> getLUNs() {
    LUNs lun = new LUNs();
    lun.setId(Guid.newGuid().toString());
    return Collections.singletonList(lun);
}
Also used : LUNs(org.ovirt.engine.core.common.businessentities.storage.LUNs)

Aggregations

LUNs (org.ovirt.engine.core.common.businessentities.storage.LUNs)105 ArrayList (java.util.ArrayList)40 Test (org.junit.Test)33 StorageServerConnections (org.ovirt.engine.core.common.businessentities.StorageServerConnections)26 Guid (org.ovirt.engine.core.compat.Guid)18 BaseCommandTest (org.ovirt.engine.core.bll.BaseCommandTest)17 List (java.util.List)16 HashMap (java.util.HashMap)14 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)13 LunDisk (org.ovirt.engine.core.common.businessentities.storage.LunDisk)13 VDS (org.ovirt.engine.core.common.businessentities.VDS)12 VM (org.ovirt.engine.core.common.businessentities.VM)7 StorageType (org.ovirt.engine.core.common.businessentities.storage.StorageType)7 VDSReturnValue (org.ovirt.engine.core.common.vdscommands.VDSReturnValue)7 Map (java.util.Map)6 LUNStorageServerConnectionMap (org.ovirt.engine.core.common.businessentities.storage.LUNStorageServerConnectionMap)6 LogicalUnit (org.ovirt.engine.api.model.LogicalUnit)5 Pair (org.ovirt.engine.core.common.utils.Pair)5 GetDeviceListVDSCommandParameters (org.ovirt.engine.core.common.vdscommands.GetDeviceListVDSCommandParameters)5 HashSet (java.util.HashSet)4