Search in sources :

Example 11 with BrickProperties

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

the class GlusterBrickDaoTest method testUpdateBrickProperties.

@Test
public void testUpdateBrickProperties() {
    GlusterBrickEntity existingBrick = dao.getById(FixturesTool.GLUSTER_BRICK_UUID3);
    assertNotNull(existingBrick);
    assertNotNull(existingBrick.getBrickProperties());
    BrickProperties brickProperties = existingBrick.getBrickProperties();
    brickProperties.setBrickId(FixturesTool.GLUSTER_BRICK_UUID3);
    brickProperties.setFreeSize(100000);
    brickProperties.setTotalSize(200000);
    dao.updateBrickProperties(brickProperties);
    existingBrick = dao.getById(FixturesTool.GLUSTER_BRICK_UUID3);
    assertNotNull(existingBrick);
    assertNotNull(existingBrick.getBrickProperties());
    assertEquals(100000, existingBrick.getBrickProperties().getFreeSize(), 0.0);
    assertEquals(200000, existingBrick.getBrickProperties().getTotalSize(), 0.0);
}
Also used : GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) BrickProperties(org.ovirt.engine.core.common.businessentities.gluster.BrickProperties) Test(org.junit.Test)

Example 12 with BrickProperties

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

the class GlusterBrickDaoTest method testAddBrickProperties.

@Test
public void testAddBrickProperties() {
    Guid brickId = FixturesTool.GLUSTER_BRICK_UUID1;
    GlusterBrickEntity brickBefore = dao.getById(brickId);
    assertNotNull(brickBefore);
    assertNull(brickBefore.getBrickProperties());
    BrickProperties brickProperties = new BrickProperties();
    brickProperties.setBrickId(brickId);
    brickProperties.setFreeSize(Long.valueOf("75000"));
    brickProperties.setTotalSize(Long.valueOf("250000"));
    dao.addBrickProperties(brickProperties);
    GlusterBrickEntity brickAfter = dao.getById(brickId);
    assertNotNull(brickAfter);
    assertNotNull(brickAfter.getBrickProperties());
    assertEquals(250000, brickAfter.getBrickProperties().getTotalSize(), 0.0);
    assertEquals(75000, brickAfter.getBrickProperties().getFreeSize(), 0.0);
}
Also used : GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) Guid(org.ovirt.engine.core.compat.Guid) BrickProperties(org.ovirt.engine.core.common.businessentities.gluster.BrickProperties) Test(org.junit.Test)

Example 13 with BrickProperties

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

the class GlusterBrickDaoTest method testUpdateMultiBrickProperties.

@Test
public void testUpdateMultiBrickProperties() {
    Guid GLUSTER_BRICK_UUID2 = new Guid("65d327f8-5864-4330-be04-fe27e1ffb553");
    GlusterBrickEntity existingBrick1 = dao.getById(FixturesTool.GLUSTER_BRICK_UUID3);
    assertNotNull(existingBrick1);
    assertNotNull(existingBrick1.getBrickProperties());
    GlusterBrickEntity existingBrick2 = dao.getById(GLUSTER_BRICK_UUID2);
    assertNotNull(existingBrick2);
    assertNotNull(existingBrick2.getBrickProperties());
    BrickProperties brickProperties1 = existingBrick1.getBrickProperties();
    brickProperties1.setBrickId(FixturesTool.GLUSTER_BRICK_UUID3);
    brickProperties1.setFreeSize(1000);
    brickProperties1.setTotalSize(2000);
    BrickProperties brickProperties2 = existingBrick2.getBrickProperties();
    brickProperties2.setBrickId(GLUSTER_BRICK_UUID2);
    brickProperties2.setFreeSize(1000);
    brickProperties2.setTotalSize(3000);
    List<GlusterBrickEntity> bricksList = new ArrayList<>();
    bricksList.add(existingBrick1);
    bricksList.add(existingBrick2);
    dao.updateBrickProperties(bricksList);
    existingBrick1 = dao.getById(FixturesTool.GLUSTER_BRICK_UUID3);
    assertNotNull(existingBrick1);
    assertNotNull(existingBrick1.getBrickProperties());
    assertEquals(1000, existingBrick1.getBrickProperties().getFreeSize(), 0.0);
    assertEquals(2000, existingBrick1.getBrickProperties().getTotalSize(), 0.0);
    existingBrick2 = dao.getById(GLUSTER_BRICK_UUID2);
    assertNotNull(existingBrick2);
    assertNotNull(existingBrick2.getBrickProperties());
    assertEquals(1000, existingBrick2.getBrickProperties().getFreeSize(), 0.0);
    assertEquals(3000, existingBrick2.getBrickProperties().getTotalSize(), 0.0);
}
Also used : GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) 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 14 with BrickProperties

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

the class GlusterBrickDaoImpl method populateBrickDetails.

private void populateBrickDetails(GlusterBrickEntity brick) {
    if (brick != null) {
        BrickProperties brickProperties = fetchBrickProperties(brick.getId());
        if (brickProperties != null) {
            BrickDetails brickDetails = new BrickDetails();
            brickDetails.setBrickProperties(brickProperties);
            brick.setBrickDetails(brickDetails);
        }
    }
}
Also used : BrickDetails(org.ovirt.engine.core.common.businessentities.gluster.BrickDetails) BrickProperties(org.ovirt.engine.core.common.businessentities.gluster.BrickProperties)

Aggregations

BrickProperties (org.ovirt.engine.core.common.businessentities.gluster.BrickProperties)14 GlusterBrickEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity)9 BrickDetails (org.ovirt.engine.core.common.businessentities.gluster.BrickDetails)7 ArrayList (java.util.ArrayList)5 Test (org.junit.Test)4 Guid (org.ovirt.engine.core.compat.Guid)4 GlusterVolumeAdvancedDetails (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeAdvancedDetails)3 GlusterVolumeSizeInfo (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSizeInfo)1 MallInfo (org.ovirt.engine.core.common.businessentities.gluster.MallInfo)1 MemoryStatus (org.ovirt.engine.core.common.businessentities.gluster.MemoryStatus)1 AbstractTextColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn)1 BrickCapacityCell (org.ovirt.engine.ui.webadmin.widget.table.column.BrickCapacityCell)1 BrickHealInfoColumn (org.ovirt.engine.ui.webadmin.widget.table.column.BrickHealInfoColumn)1 BrickStatusColumn (org.ovirt.engine.ui.webadmin.widget.table.column.BrickStatusColumn)1