Search in sources :

Example 1 with TransportType

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

the class VolumeTransportTypeRenderer method render.

@Override
public String render(Set<TransportType> transportTypes) {
    Translator transportTypeTranslator = EnumTranslator.getInstance();
    StringBuilder transportTypesBuilder = new StringBuilder();
    Iterator<TransportType> iterator = transportTypes.iterator();
    while (iterator.hasNext()) {
        TransportType transportType = iterator.next();
        transportTypesBuilder.append(transportTypeTranslator.translate(transportType));
        if (iterator.hasNext()) {
            // $NON-NLS-1$
            transportTypesBuilder.append(", ");
        }
    }
    return transportTypesBuilder.toString();
}
Also used : EnumTranslator(org.ovirt.engine.ui.uicompat.EnumTranslator) Translator(org.ovirt.engine.ui.uicompat.Translator) TransportType(org.ovirt.engine.core.common.businessentities.gluster.TransportType)

Example 2 with TransportType

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

the class GlusterVolumeDaoTest method testAddTransportType.

@Test
public void testAddTransportType() {
    Set<TransportType> transportTypes = existingDistVol.getTransportTypes();
    assertEquals(1, transportTypes.size());
    assertFalse(transportTypes.contains(TransportType.RDMA));
    dao.addTransportType(EXISTING_VOL_DIST_ID, TransportType.RDMA);
    GlusterVolumeEntity volumeAfter = dao.getById(EXISTING_VOL_DIST_ID);
    assertNotNull(volumeAfter);
    transportTypes = volumeAfter.getTransportTypes();
    assertEquals(2, transportTypes.size());
    assertTrue(transportTypes.contains(TransportType.RDMA));
    assertFalse(volumeAfter.equals(existingDistVol));
    existingDistVol.addTransportType(TransportType.RDMA);
    assertEquals(volumeAfter, existingDistVol);
}
Also used : GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) TransportType(org.ovirt.engine.core.common.businessentities.gluster.TransportType) Test(org.junit.Test)

Example 3 with TransportType

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

the class GlusterVolumeDaoTest method testRemoveTransportType.

@Test
public void testRemoveTransportType() {
    Set<TransportType> transportTypes = existingReplVol.getTransportTypes();
    assertEquals(2, transportTypes.size());
    assertTrue(transportTypes.contains(TransportType.RDMA));
    dao.removeTransportType(EXISTING_VOL_REPL_ID, TransportType.RDMA);
    GlusterVolumeEntity volumeAfter = dao.getById(EXISTING_VOL_REPL_ID);
    assertNotNull(volumeAfter);
    transportTypes = volumeAfter.getTransportTypes();
    assertEquals(1, transportTypes.size());
    assertFalse(transportTypes.contains(TransportType.RDMA));
    assertFalse(volumeAfter.equals(existingReplVol));
    existingReplVol.removeTransportType(TransportType.RDMA);
    assertEquals(volumeAfter, existingReplVol);
}
Also used : GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) TransportType(org.ovirt.engine.core.common.businessentities.gluster.TransportType) Test(org.junit.Test)

Example 4 with TransportType

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

the class CreateGlusterVolumeVDSCommand method getTransportTypeArr.

private String[] getTransportTypeArr(GlusterVolumeEntity volume) {
    Set<TransportType> transportTypes = volume.getTransportTypes();
    if (transportTypes == null) {
        return null;
    }
    String[] transportTypeArr = new String[transportTypes.size()];
    int index = 0;
    for (TransportType transportType : transportTypes) {
        transportTypeArr[index++] = transportType.name();
    }
    return transportTypeArr;
}
Also used : TransportType(org.ovirt.engine.core.common.businessentities.gluster.TransportType)

Example 5 with TransportType

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

the class GlusterVolumeDaoTest method testAddTransportTypes.

@Test
public void testAddTransportTypes() {
    Set<TransportType> transportTypes = existingDistVol.getTransportTypes();
    assertEquals(1, transportTypes.size());
    dao.removeTransportType(EXISTING_VOL_DIST_ID, TransportType.TCP);
    transportTypes = dao.getById(EXISTING_VOL_DIST_ID).getTransportTypes();
    assertEquals(0, transportTypes.size());
    List<TransportType> types = new ArrayList<>();
    types.add(TransportType.TCP);
    types.add(TransportType.RDMA);
    dao.addTransportTypes(EXISTING_VOL_DIST_ID, types);
    GlusterVolumeEntity volumeAfter = dao.getById(EXISTING_VOL_DIST_ID);
    assertNotNull(volumeAfter);
    transportTypes = volumeAfter.getTransportTypes();
    assertEquals(2, transportTypes.size());
    assertTrue(transportTypes.contains(TransportType.TCP));
    assertTrue(transportTypes.contains(TransportType.RDMA));
    assertFalse(volumeAfter.equals(existingDistVol));
    existingDistVol.addTransportType(TransportType.TCP);
    existingDistVol.addTransportType(TransportType.RDMA);
    assertEquals(volumeAfter, existingDistVol);
}
Also used : GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) ArrayList(java.util.ArrayList) TransportType(org.ovirt.engine.core.common.businessentities.gluster.TransportType) Test(org.junit.Test)

Aggregations

TransportType (org.ovirt.engine.core.common.businessentities.gluster.TransportType)6 Test (org.junit.Test)4 GlusterVolumeEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity)4 ArrayList (java.util.ArrayList)2 EnumTranslator (org.ovirt.engine.ui.uicompat.EnumTranslator)1 Translator (org.ovirt.engine.ui.uicompat.Translator)1