Search in sources :

Example 61 with GlusterBrickEntity

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

the class GetGlusterVolumeAdvancedDetailsQueryTest method getBrick.

private GlusterBrickEntity getBrick() {
    GlusterBrickEntity brick = new GlusterBrickEntity();
    brick.setId(BRICK_ID);
    brick.setServerId(SERVER_ID);
    return brick;
}
Also used : GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity)

Example 62 with GlusterBrickEntity

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

the class StartRebalanceGlusterVolumeCommandTest method getBricks.

private List<GlusterBrickEntity> getBricks(Guid volumeId, int n) {
    List<GlusterBrickEntity> bricks = new ArrayList<>();
    GlusterBrickEntity brick;
    for (Integer i = 0; i < n; i++) {
        brick = new GlusterBrickEntity();
        brick.setVolumeId(volumeId);
        brick.setBrickDirectory("/tmp/test-vol" + i.toString());
        brick.setStatus(GlusterStatus.UP);
        bricks.add(brick);
    }
    return bricks;
}
Also used : GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) ArrayList(java.util.ArrayList)

Example 63 with GlusterBrickEntity

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

the class GlusterCoreUtilTest method createBrick.

private static GlusterBrickEntity createBrick(Guid serverId, String serverName, String brickDir) {
    GlusterBrickEntity brick = new GlusterBrickEntity();
    brick.setId(Guid.newGuid());
    brick.setServerId(serverId);
    brick.setServerName(serverName);
    brick.setBrickDirectory(brickDir);
    return brick;
}
Also used : GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity)

Example 64 with GlusterBrickEntity

use of org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity 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 65 with GlusterBrickEntity

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

the class GlusterBrickDaoTest method testRemove.

@Test
public void testRemove() {
    GlusterBrickEntity existingBrick = dao.getById(FixturesTool.GLUSTER_BRICK_UUID1);
    assertNotNull(existingBrick);
    dao.removeBrick(FixturesTool.GLUSTER_BRICK_UUID1);
    assertNull(dao.getById(FixturesTool.GLUSTER_BRICK_UUID1));
}
Also used : GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) Test(org.junit.Test)

Aggregations

GlusterBrickEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity)132 ArrayList (java.util.ArrayList)63 GlusterVolumeEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity)43 Test (org.junit.Test)28 Guid (org.ovirt.engine.core.compat.Guid)19 GlusterAsyncTask (org.ovirt.engine.core.common.asynctasks.gluster.GlusterAsyncTask)14 ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)13 VDS (org.ovirt.engine.core.common.businessentities.VDS)11 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)11 List (java.util.List)10 HashMap (java.util.HashMap)9 Map (java.util.Map)9 ValidationResult (org.ovirt.engine.core.bll.ValidationResult)9 BrickProperties (org.ovirt.engine.core.common.businessentities.gluster.BrickProperties)9 GlusterVolumeRemoveBricksParameters (org.ovirt.engine.core.common.action.gluster.GlusterVolumeRemoveBricksParameters)7 BrickDetails (org.ovirt.engine.core.common.businessentities.gluster.BrickDetails)7 GlusterVolumeAdvancedDetails (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeAdvancedDetails)7 GlusterVolumeType (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeType)7 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)7 Iterator (java.util.Iterator)5