Search in sources :

Example 6 with GlusterVolumeAdvancedDetails

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);
}
Also used : GlusterVolumeAdvancedDetails(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeAdvancedDetails) Test(org.junit.Test) AbstractQueryTest(org.ovirt.engine.core.bll.AbstractQueryTest)

Example 7 with GlusterVolumeAdvancedDetails

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());
}
Also used : GlusterVolumeAdvancedDetails(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeAdvancedDetails) GlusterBrickAdvancedDetails(org.ovirt.engine.api.model.GlusterBrickAdvancedDetails) Test(org.junit.Test)

Example 8 with GlusterVolumeAdvancedDetails

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());
}
Also used : GlusterVolumeAdvancedDetails(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeAdvancedDetails) GlusterBrickAdvancedDetails(org.ovirt.engine.api.model.GlusterBrickAdvancedDetails) Test(org.junit.Test)

Example 9 with GlusterVolumeAdvancedDetails

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);
    }
}
Also used : GlusterServerService(org.ovirt.engine.core.common.businessentities.gluster.GlusterServerService) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) GlusterVolumeAdvancedDetails(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeAdvancedDetails) Guid(org.ovirt.engine.core.compat.Guid)

Example 10 with GlusterVolumeAdvancedDetails

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());
}
Also used : GlusterVolumeAdvancedDetails(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeAdvancedDetails) GlusterBrickAdvancedDetails(org.ovirt.engine.api.model.GlusterBrickAdvancedDetails) Test(org.junit.Test)

Aggregations

GlusterVolumeAdvancedDetails (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeAdvancedDetails)18 Test (org.junit.Test)6 GlusterVolumeEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity)6 GlusterBrickEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity)5 GlusterBrickAdvancedDetails (org.ovirt.engine.api.model.GlusterBrickAdvancedDetails)4 BrickDetails (org.ovirt.engine.core.common.businessentities.gluster.BrickDetails)4 Guid (org.ovirt.engine.core.compat.Guid)4 ArrayList (java.util.ArrayList)3 BrickProperties (org.ovirt.engine.core.common.businessentities.gluster.BrickProperties)3 GlusterVolumeSizeInfo (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSizeInfo)3 List (java.util.List)2 AbstractQueryTest (org.ovirt.engine.core.bll.AbstractQueryTest)2 GlusterAsyncTask (org.ovirt.engine.core.common.asynctasks.gluster.GlusterAsyncTask)2 GlusterTaskType (org.ovirt.engine.core.common.asynctasks.gluster.GlusterTaskType)2 GlusterVolumeType (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeType)2 JobExecutionStatus (org.ovirt.engine.core.common.job.JobExecutionStatus)2 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)2 GlusterVolumeAdvancedDetailsParameters (org.ovirt.engine.core.common.queries.gluster.GlusterVolumeAdvancedDetailsParameters)2 Collection (java.util.Collection)1 HashMap (java.util.HashMap)1