Search in sources :

Example 11 with GlusterVolumeAdvancedDetails

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

the class GlusterBrickDetailMapperTest method testWithAllDetails.

@Test
public void testWithAllDetails() {
    GlusterVolumeAdvancedDetails volDetailsEntity = new GlusterVolumeAdvancedDetails();
    volDetailsEntity.setBrickDetails(getBrickDetails(1, 2, 4));
    GlusterBrickAdvancedDetails model = GlusterBrickDetailMapper.map(volDetailsEntity, null);
    assertNotNull(model);
    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 12 with GlusterVolumeAdvancedDetails

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

the class GetGlusterVolumeAdvancedDetailsQueryTest method setupExpectedVolume.

private void setupExpectedVolume() {
    expectedVolumeAdvancedDetails = new GlusterVolumeAdvancedDetails();
    expectedVolumeAdvancedDetails.setVolumeId(VOLUME_ID);
    expectedVolumeAdvancedDetails.setBrickDetails(getBrickDetails());
}
Also used : GlusterVolumeAdvancedDetails(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeAdvancedDetails)

Example 13 with GlusterVolumeAdvancedDetails

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

the class GetGlusterVolumeAdvancedDetailsQueryTest method testQueryForNullBrickId.

@Test
public void testQueryForNullBrickId() {
    doReturn(VOLUME_ID).when(getQueryParameters()).getVolumeId();
    doReturn(null).when(getQueryParameters()).getBrickId();
    doReturn(getVds(VDSStatus.Up)).when(glusterUtils).getRandomUpServer(CLUSTER_ID);
    getQuery().executeQueryCommand();
    GlusterVolumeAdvancedDetails volumeAdvancedDetails = getQuery().getQueryReturnValue().getReturnValue();
    assertNotNull(volumeAdvancedDetails);
    assertEquals(expectedVolumeAdvancedDetails, volumeAdvancedDetails);
    // Brick's server is not fetched, rather clusterUtil is used to fetch a random UP server
    verifyZeroInteractions(vdsDao);
    verify(glusterUtils, times(1)).getRandomUpServer(CLUSTER_ID);
}
Also used : GlusterVolumeAdvancedDetails(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeAdvancedDetails) Test(org.junit.Test) AbstractQueryTest(org.ovirt.engine.core.bll.AbstractQueryTest)

Example 14 with GlusterVolumeAdvancedDetails

use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeAdvancedDetails 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;
}
Also used : GlusterVolumeAdvancedDetails(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeAdvancedDetails) BrickDetails(org.ovirt.engine.core.common.businessentities.gluster.BrickDetails) BrickProperties(org.ovirt.engine.core.common.businessentities.gluster.BrickProperties)

Example 15 with GlusterVolumeAdvancedDetails

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

the class GetGlusterVolumeAdvancedDetailsVDSCommand method executeVdsBrokerCommand.

@Override
protected void executeVdsBrokerCommand() {
    executeVolumeStatusInfo("");
    GlusterVolumeAdvancedDetails volumeAdvancedDetails = result.getVolumeAdvancedDetails();
    if (getParameters().isCapacityInfoRequired() || getParameters().isDetailRequired()) {
        if (getSucceeded()) {
            executeVolumeStatusInfo(GlusterVolumeStatusOption.DETAIL.name().toLowerCase());
            if (getSucceeded()) {
                volumeAdvancedDetails.copyDetailsFrom(result.getVolumeAdvancedDetails());
            }
        }
    }
    if (getParameters().isDetailRequired()) {
        if (getSucceeded()) {
            executeVolumeStatusInfo(GlusterVolumeStatusOption.CLIENTS.name().toLowerCase());
            if (getSucceeded()) {
                volumeAdvancedDetails.copyClientsFrom(result.getVolumeAdvancedDetails());
                executeVolumeStatusInfo(GlusterVolumeStatusOption.MEM.name().toLowerCase());
                if (getSucceeded()) {
                    volumeAdvancedDetails.copyMemoryFrom(result.getVolumeAdvancedDetails());
                }
            }
        }
    }
    setReturnValue(volumeAdvancedDetails);
}
Also used : GlusterVolumeAdvancedDetails(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeAdvancedDetails)

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