Search in sources :

Example 1 with GlusterBrickAdvancedDetails

use of org.ovirt.engine.api.model.GlusterBrickAdvancedDetails in project ovirt-engine by oVirt.

the class V3GlusterBrickAdvancedDetailsInAdapter method adapt.

@Override
public GlusterBrickAdvancedDetails adapt(V3GlusterBrickAdvancedDetails from) {
    GlusterBrickAdvancedDetails to = new GlusterBrickAdvancedDetails();
    if (from.isSetLinks()) {
        to.getLinks().addAll(adaptIn(from.getLinks()));
    }
    if (from.isSetActions()) {
        to.setActions(adaptIn(from.getActions()));
    }
    if (from.isSetComment()) {
        to.setComment(from.getComment());
    }
    if (from.isSetDescription()) {
        to.setDescription(from.getDescription());
    }
    if (from.isSetDevice()) {
        to.setDevice(from.getDevice());
    }
    if (from.isSetFsName()) {
        to.setFsName(from.getFsName());
    }
    if (from.isSetGlusterClients()) {
        to.setGlusterClients(new GlusterClients());
        to.getGlusterClients().getGlusterClients().addAll(adaptIn(from.getGlusterClients().getGlusterClients()));
    }
    if (from.isSetId()) {
        to.setId(from.getId());
    }
    if (from.isSetHref()) {
        to.setHref(from.getHref());
    }
    if (from.isSetMemoryPools()) {
        to.setMemoryPools(new GlusterMemoryPools());
        to.getMemoryPools().getGlusterMemoryPools().addAll(adaptIn(from.getMemoryPools().getGlusterMemoryPools()));
    }
    if (from.isSetMntOptions()) {
        to.setMntOptions(from.getMntOptions());
    }
    if (from.isSetName()) {
        to.setName(from.getName());
    }
    if (from.isSetPid()) {
        to.setPid(from.getPid());
    }
    if (from.isSetPort()) {
        to.setPort(from.getPort());
    }
    return to;
}
Also used : GlusterMemoryPools(org.ovirt.engine.api.model.GlusterMemoryPools) V3GlusterBrickAdvancedDetails(org.ovirt.engine.api.v3.types.V3GlusterBrickAdvancedDetails) GlusterBrickAdvancedDetails(org.ovirt.engine.api.model.GlusterBrickAdvancedDetails) GlusterClients(org.ovirt.engine.api.model.GlusterClients)

Example 2 with GlusterBrickAdvancedDetails

use of org.ovirt.engine.api.model.GlusterBrickAdvancedDetails 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 3 with GlusterBrickAdvancedDetails

use of org.ovirt.engine.api.model.GlusterBrickAdvancedDetails 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 4 with GlusterBrickAdvancedDetails

use of org.ovirt.engine.api.model.GlusterBrickAdvancedDetails 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)

Example 5 with GlusterBrickAdvancedDetails

use of org.ovirt.engine.api.model.GlusterBrickAdvancedDetails 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)

Aggregations

GlusterBrickAdvancedDetails (org.ovirt.engine.api.model.GlusterBrickAdvancedDetails)5 Test (org.junit.Test)4 GlusterVolumeAdvancedDetails (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeAdvancedDetails)4 GlusterClients (org.ovirt.engine.api.model.GlusterClients)1 GlusterMemoryPools (org.ovirt.engine.api.model.GlusterMemoryPools)1 V3GlusterBrickAdvancedDetails (org.ovirt.engine.api.v3.types.V3GlusterBrickAdvancedDetails)1