Search in sources :

Example 1 with LunHandler

use of org.ovirt.engine.core.bll.storage.domain.SyncLunsInfoForBlockStorageDomainCommand.LunHandler in project ovirt-engine by oVirt.

the class SyncLunsInfoForBlockStorageDomainCommandTest method testGetLunsToUpdateInDbLunExistsInDbButNotInVgInfo.

@Test
public void testGetLunsToUpdateInDbLunExistsInDbButNotInVgInfo() {
    Guid lunFromDbId = Guid.newGuid();
    Map<LunHandler, List<LUNs>> lunsToUpdateInDb = getLunsToUpdateInDb(Guid.newGuid(), lunFromDbId, Guid.newGuid(), Guid.newGuid());
    List<LUNs> lunsToRemoveFromDb = lunsToUpdateInDb.get(command.removeLunsHandler);
    assertEquals(Stream.of(command.saveLunsHandler, command.removeLunsHandler).collect(Collectors.toSet()), lunsToUpdateInDb.keySet());
    assertLunIdInList(lunsToRemoveFromDb, lunFromDbId);
}
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 2 with LunHandler

use of org.ovirt.engine.core.bll.storage.domain.SyncLunsInfoForBlockStorageDomainCommand.LunHandler 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 3 with LunHandler

use of org.ovirt.engine.core.bll.storage.domain.SyncLunsInfoForBlockStorageDomainCommand.LunHandler 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 4 with LunHandler

use of org.ovirt.engine.core.bll.storage.domain.SyncLunsInfoForBlockStorageDomainCommand.LunHandler in project ovirt-engine by oVirt.

the class SyncLunsInfoForBlockStorageDomainCommandTest method testGetLunsToUpdateInDbSameLunIdDiffPvId.

@Test
public void testGetLunsToUpdateInDbSameLunIdDiffPvId() {
    Guid lunId = Guid.newGuid();
    Map<LunHandler, List<LUNs>> lunsToUpdateInDb = getLunsToUpdateInDb(lunId, lunId, Guid.newGuid(), Guid.newGuid());
    List<LUNs> existingLunsToUpdateInDb = lunsToUpdateInDb.get(command.updateLunsHandler);
    assertEquals(Collections.singleton(command.updateLunsHandler), lunsToUpdateInDb.keySet());
    assertLunIdInList(existingLunsToUpdateInDb, lunId);
}
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)

Aggregations

List (java.util.List)4 Test (org.junit.Test)4 BaseCommandTest (org.ovirt.engine.core.bll.BaseCommandTest)4 LunHandler (org.ovirt.engine.core.bll.storage.domain.SyncLunsInfoForBlockStorageDomainCommand.LunHandler)4 LUNs (org.ovirt.engine.core.common.businessentities.storage.LUNs)4 Guid (org.ovirt.engine.core.compat.Guid)4