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