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);
}
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);
}
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);
}
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);
}
}
}
Aggregations