use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity in project ovirt-engine by oVirt.
the class GlusterVolumeDaoTest method testUpdateAsyncTaskId.
@Test
public void testUpdateAsyncTaskId() {
assertNotNull(existingDistVol.getAsyncTask());
assertNull(existingDistVol.getAsyncTask().getTaskId());
dao.updateVolumeTask(existingDistVol.getId(), REBALANCING_VOLUME_TASKID);
GlusterVolumeEntity volume = dao.getAllWithQuery("select * from gluster_volumes_view where id = '" + existingDistVol.getId() + "'").get(0);
assertNotNull("Volume : " + existingDistVol.getId() + " doesn't exists", volume);
assertEquals("Task ID is not getting updated", REBALANCING_VOLUME_TASKID, volume.getAsyncTask().getTaskId());
assertEquals("Invalid Task status", JobExecutionStatus.STARTED, volume.getAsyncTask().getStatus());
assertEquals("Invalid Task type", GlusterTaskType.REBALANCE, volume.getAsyncTask().getType());
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity in project ovirt-engine by oVirt.
the class GlusterVolumeDaoTest method testGetVolumesByStatusAndTypes.
@Test
public void testGetVolumesByStatusAndTypes() {
List<GlusterVolumeEntity> volumes = dao.getVolumesByStatusAndTypes(CLUSTER_ID, GlusterStatus.UP, Collections.singletonList(GlusterVolumeType.DISTRIBUTE));
assertNotNull(volumes);
assertTrue(volumes.contains(existingDistVol));
for (GlusterVolumeEntity volume : volumes) {
assertEquals(GlusterVolumeType.DISTRIBUTE, volume.getVolumeType());
}
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity 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);
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity 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);
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity in project ovirt-engine by oVirt.
the class GlusterVolumeDaoTest method insertTestVolume.
private GlusterVolumeEntity insertTestVolume() {
Guid volumeId = Guid.newGuid();
GlusterVolumeEntity volume = new GlusterVolumeEntity();
volume.setName(NEW_VOL_NAME);
volume.setClusterId(CLUSTER_ID);
volume.setId(volumeId);
volume.setVolumeType(GlusterVolumeType.DISTRIBUTE);
volume.addTransportType(TransportType.TCP);
volume.setReplicaCount(0);
volume.setStripeCount(0);
volume.setStatus(GlusterStatus.UP);
volume.setOption("auth.allow", "*");
volume.addAccessProtocol(AccessProtocol.GLUSTER);
volume.addAccessProtocol(AccessProtocol.NFS);
GlusterBrickEntity brick = new GlusterBrickEntity();
brick.setVolumeId(volumeId);
brick.setServerId(server.getId());
brick.setServerName(server.getHostName());
brick.setBrickDirectory("/export/testVol1");
brick.setStatus(GlusterStatus.UP);
brick.setBrickOrder(0);
volume.addBrick(brick);
volume.setSnapshotsCount(0);
volume.setSnapMaxLimit(0);
dao.save(volume);
return volume;
}
Aggregations