Search in sources :

Example 6 with BrickDetails

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

the class GetGlusterVolumeAdvancedDetailsQueryTest method getBrickDetails.

private List<BrickDetails> getBrickDetails() {
    BrickDetails brickDetails = new BrickDetails();
    brickDetails.setBrickProperties(getBrickProperties());
    brickDetails.setClients(getClientInfo());
    brickDetails.setMemoryStatus(getMemoryStatus());
    return Collections.singletonList(brickDetails);
}
Also used : BrickDetails(org.ovirt.engine.core.common.businessentities.gluster.BrickDetails)

Example 7 with BrickDetails

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

the class GlusterBrickDaoTest method testAddAllBrickProperties.

@Test
public void testAddAllBrickProperties() {
    Guid brickId1 = FixturesTool.GLUSTER_BRICK_UUID1;
    Guid brickId2 = FixturesTool.GLUSTER_BRICK_UUID2;
    GlusterBrickEntity brick1 = dao.getById(brickId1);
    GlusterBrickEntity brick2 = dao.getById(brickId2);
    brick1.setBrickDetails(new BrickDetails());
    BrickProperties brickProperties1 = new BrickProperties();
    brickProperties1.setBrickId(brickId1);
    brickProperties1.setFreeSize(Long.valueOf("75000"));
    brickProperties1.setTotalSize(Long.valueOf("250000"));
    brick1.getBrickDetails().setBrickProperties(brickProperties1);
    brick2.setBrickDetails(new BrickDetails());
    BrickProperties brickProperties2 = new BrickProperties();
    brickProperties2.setBrickId(brickId2);
    brickProperties2.setFreeSize(Long.valueOf("175000"));
    brickProperties2.setTotalSize(Long.valueOf("275000"));
    brick2.getBrickDetails().setBrickProperties(brickProperties2);
    List<GlusterBrickEntity> bricksToAdd = new ArrayList<>();
    bricksToAdd.add(brick1);
    bricksToAdd.add(brick2);
    dao.addBrickProperties(bricksToAdd);
    brick1 = dao.getById(brickId1);
    assertNotNull(brick1);
    assertNotNull(brick1.getBrickProperties());
    assertEquals(250000, brick1.getBrickProperties().getTotalSize(), 0.0);
    assertEquals(75000, brick1.getBrickProperties().getFreeSize(), 0.0);
    brick2 = dao.getById(brickId2);
    assertNotNull(brick2);
    assertNotNull(brick2.getBrickProperties());
    assertEquals(275000, brick2.getBrickProperties().getTotalSize(), 0.0);
    assertEquals(175000, brick2.getBrickProperties().getFreeSize(), 0.0);
}
Also used : GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) BrickDetails(org.ovirt.engine.core.common.businessentities.gluster.BrickDetails) ArrayList(java.util.ArrayList) Guid(org.ovirt.engine.core.compat.Guid) BrickProperties(org.ovirt.engine.core.common.businessentities.gluster.BrickProperties) Test(org.junit.Test)

Example 8 with BrickDetails

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

the class GlusterBrickDetailMapperTest method getBrickDetails.

private List<BrickDetails> getBrickDetails(int size, int clientListSize, int memPoolSize) {
    ArrayList<BrickDetails> list = new ArrayList<>();
    for (int i = 0; i < size; i++) {
        BrickDetails details = new BrickDetails();
        BrickProperties props = new BrickProperties();
        props.setBlockSize(14556);
        props.setPid(88888);
        props.setMntOptions("rw");
        details.setBrickProperties(props);
        details.setClients(getClientList(clientListSize));
        details.setMemoryStatus(getMemoryStatus(memPoolSize));
        list.add(details);
    }
    return list;
}
Also used : BrickDetails(org.ovirt.engine.core.common.businessentities.gluster.BrickDetails) ArrayList(java.util.ArrayList) BrickProperties(org.ovirt.engine.core.common.businessentities.gluster.BrickProperties)

Example 9 with BrickDetails

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

the class GlusterTestHelper method getBrickEntity.

protected GlusterBrickEntity getBrickEntity(int index, boolean hasDetails) {
    GlusterBrickEntity entity = mock(GlusterBrickEntity.class);
    when(entity.getId()).thenReturn(GUIDS[index]);
    when(entity.getServerId()).thenReturn(serverId);
    when(entity.getBrickDirectory()).thenReturn(GlusterTestHelper.brickDir);
    when(entity.getQualifiedName()).thenReturn(GlusterTestHelper.brickName);
    when(entity.getVolumeId()).thenReturn(volumeId);
    if (hasDetails) {
        BrickDetails brickDetails = mock(BrickDetails.class);
        BrickProperties brickProps = mock(BrickProperties.class);
        MemoryStatus memStatus = mock(MemoryStatus.class);
        MallInfo mallInfo = mock(MallInfo.class);
        when(mallInfo.getArena()).thenReturn(888);
        when(brickProps.getMntOptions()).thenReturn(GlusterTestHelper.BRICK_MNT_OPT);
        when(brickProps.getPort()).thenReturn(GlusterTestHelper.BRICK_PORT);
        when(brickDetails.getMemoryStatus()).thenReturn(memStatus);
        when(memStatus.getMallInfo()).thenReturn(mallInfo);
        when(brickDetails.getBrickProperties()).thenReturn(brickProps);
        when(entity.getBrickDetails()).thenReturn(brickDetails);
    }
    return entity;
}
Also used : GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) MallInfo(org.ovirt.engine.core.common.businessentities.gluster.MallInfo) MemoryStatus(org.ovirt.engine.core.common.businessentities.gluster.MemoryStatus) BrickDetails(org.ovirt.engine.core.common.businessentities.gluster.BrickDetails) BrickProperties(org.ovirt.engine.core.common.businessentities.gluster.BrickProperties)

Example 10 with BrickDetails

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

the class GlusterTestHelper method getVolumeAdvancedDetailsEntity.

protected GlusterVolumeAdvancedDetails getVolumeAdvancedDetailsEntity() {
    GlusterVolumeAdvancedDetails entity = mock(GlusterVolumeAdvancedDetails.class);
    BrickDetails brickDetails = mock(BrickDetails.class);
    BrickProperties brickProps = mock(BrickProperties.class);
    when(brickProps.getMntOptions()).thenReturn(BRICK_MNT_OPT);
    when(brickProps.getPort()).thenReturn(BRICK_PORT);
    when(brickDetails.getBrickProperties()).thenReturn(brickProps);
    List<BrickDetails> brickDetailsList = Collections.singletonList(brickDetails);
    when(entity.getBrickDetails()).thenReturn(brickDetailsList);
    return entity;
}
Also used : GlusterVolumeAdvancedDetails(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeAdvancedDetails) BrickDetails(org.ovirt.engine.core.common.businessentities.gluster.BrickDetails) BrickProperties(org.ovirt.engine.core.common.businessentities.gluster.BrickProperties)

Aggregations

BrickDetails (org.ovirt.engine.core.common.businessentities.gluster.BrickDetails)12 BrickProperties (org.ovirt.engine.core.common.businessentities.gluster.BrickProperties)7 ArrayList (java.util.ArrayList)6 GlusterBrickEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity)5 GlusterVolumeAdvancedDetails (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeAdvancedDetails)4 Map (java.util.Map)2 GlusterClientInfo (org.ovirt.engine.core.common.businessentities.gluster.GlusterClientInfo)2 MallInfo (org.ovirt.engine.core.common.businessentities.gluster.MallInfo)2 MemoryStatus (org.ovirt.engine.core.common.businessentities.gluster.MemoryStatus)2 Mempool (org.ovirt.engine.core.common.businessentities.gluster.Mempool)2 Guid (org.ovirt.engine.core.compat.Guid)2 HashMap (java.util.HashMap)1 Iterator (java.util.Iterator)1 List (java.util.List)1 Test (org.junit.Test)1 GlusterBrick (org.ovirt.engine.api.model.GlusterBrick)1 GlusterClients (org.ovirt.engine.api.model.GlusterClients)1 GlusterMemoryPools (org.ovirt.engine.api.model.GlusterMemoryPools)1 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)1 ActionType (org.ovirt.engine.core.common.action.ActionType)1