use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeAdvancedDetails in project ovirt-engine by oVirt.
the class GetGlusterVolumeAdvancedDetailsQueryTest method testQueryForBrickDetails.
@Test
public void testQueryForBrickDetails() {
doReturn(VOLUME_ID).when(getQueryParameters()).getVolumeId();
doReturn(BRICK_ID).when(getQueryParameters()).getBrickId();
when(vdsDao.get(SERVER_ID)).thenReturn(getVds(VDSStatus.Up));
getQuery().executeQueryCommand();
GlusterVolumeAdvancedDetails volumeAdvancedDetails = getQuery().getQueryReturnValue().getReturnValue();
assertNotNull(volumeAdvancedDetails);
assertEquals(expectedVolumeAdvancedDetails, volumeAdvancedDetails);
// Server is fetched directly from the brick's server,
// and clusterUtils is not used to fetch a random UP server
verify(vdsDao, times(1)).get(SERVER_ID);
verifyZeroInteractions(glusterUtils);
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeAdvancedDetails in project ovirt-engine by oVirt.
the class GlusterBrickDetailMapperTest method testWithMultipleClientLists.
@Test
public void testWithMultipleClientLists() {
GlusterVolumeAdvancedDetails volDetailsEntity = new GlusterVolumeAdvancedDetails();
volDetailsEntity.setBrickDetails(getBrickDetails(2, 2, 2));
GlusterBrickAdvancedDetails model = GlusterBrickDetailMapper.map(volDetailsEntity, null);
assertEquals(2, model.getGlusterClients().getGlusterClients().size());
assertEquals(model.getMntOptions(), volDetailsEntity.getBrickDetails().get(0).getBrickProperties().getMntOptions());
assertEquals(model.getMemoryPools().getGlusterMemoryPools().size(), volDetailsEntity.getBrickDetails().get(0).getMemoryStatus().getMemPools().size());
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeAdvancedDetails in project ovirt-engine by oVirt.
the class GlusterBrickDetailMapperTest method testWithNoLists.
@Test
public void testWithNoLists() {
GlusterVolumeAdvancedDetails volDetailsEntity = new GlusterVolumeAdvancedDetails();
volDetailsEntity.setBrickDetails(getBrickDetails(0, 0, 0));
GlusterBrickAdvancedDetails model = GlusterBrickDetailMapper.map(volDetailsEntity, null);
assertNotNull(model);
assertNull(model.getGlusterClients());
assertNull(model.getMntOptions());
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeAdvancedDetails in project ovirt-engine by oVirt.
the class GetGlusterVolumeAdvancedDetailsQuery method executeQueryCommand.
@Override
protected void executeQueryCommand() {
clusterId = getParameters().getClusterId();
detailRequired = getParameters().isDetailRequired();
Guid volumeId = getParameters().getVolumeId();
if (volumeId != null) {
GlusterVolumeEntity volume = glusterVolumeDao.getById(volumeId);
if (volume == null) {
throw new RuntimeException(EngineMessage.GLUSTER_VOLUME_ID_INVALID.toString());
}
brick = getBrick(getParameters().getBrickId());
getQueryReturnValue().setReturnValue(fetchAdvancedDetails(volume.getName()));
} else {
GlusterVolumeAdvancedDetails advancedDetails = getServiceInfo();
if (advancedDetails != null) {
List<GlusterServerService> serviceList = advancedDetails.getServiceInfo();
if (serviceList != null) {
for (GlusterServerService service : serviceList) {
String hostName = glusterDBUtils.getHostNameOrIP(service.getGlusterHostUuid());
if (hostName != null) {
service.setHostName(hostName);
}
}
}
}
getQueryReturnValue().setReturnValue(advancedDetails);
}
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeAdvancedDetails in project ovirt-engine by oVirt.
the class GlusterBrickDetailMapperTest method testWithNullChildObjects.
@Test
public void testWithNullChildObjects() {
GlusterVolumeAdvancedDetails volDetailsEntity = new GlusterVolumeAdvancedDetails();
volDetailsEntity.setBrickDetails(getBrickDetails(1, 0, 0));
volDetailsEntity.getBrickDetails().get(0).setClients(null);
volDetailsEntity.getBrickDetails().get(0).setMemoryStatus(null);
GlusterBrickAdvancedDetails model = GlusterBrickDetailMapper.map(volDetailsEntity, null);
assertNotNull(model);
assertNull(model.getGlusterClients());
assertEquals(model.getMntOptions(), volDetailsEntity.getBrickDetails().get(0).getBrickProperties().getMntOptions());
assertNull(model.getMemoryPools());
}
Aggregations