use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotEntity in project ovirt-engine by oVirt.
the class GlusterVolumeSnapshotDaoTest method testSaveAndGetById.
@Test
public void testSaveAndGetById() {
GlusterVolumeSnapshotEntity snapshot = dao.getByName(VOLUME_ID, NEW_SNAPSHOT_NAME);
assertNull(snapshot);
newSnapshot = insertTestSnapshot();
snapshot = dao.getById(newSnapshot.getId());
assertNotNull(snapshot);
assertEquals(newSnapshot, snapshot);
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotEntity in project ovirt-engine by oVirt.
the class GlusterVolumeSnapshotDaoTest method testRemoveByName.
@Test
public void testRemoveByName() {
GlusterVolumeEntity volume = volumeDao.getById(VOLUME_ID);
assertEquals(2, volume.getSnapshotsCount().intValue());
dao.removeByName(VOLUME_ID, EXISTING_SNAPSHOT_NAME_1);
List<GlusterVolumeSnapshotEntity> snapshots = dao.getAllByVolumeId(VOLUME_ID);
assertEquals(1, snapshots.size());
assertTrue(snapshots.contains(existingSnapshot));
assertFalse(snapshots.contains(existingSnapshot1));
GlusterVolumeEntity volume1 = volumeDao.getById(VOLUME_ID);
assertEquals(1, volume1.getSnapshotsCount().intValue());
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotEntity in project ovirt-engine by oVirt.
the class GlusterVolumeSnapshotDaoTest method testRemove.
@Test
public void testRemove() {
GlusterVolumeEntity volume = volumeDao.getById(VOLUME_ID);
assertEquals(2, volume.getSnapshotsCount().intValue());
dao.remove(EXISTING_SNAPSHOT_ID);
List<GlusterVolumeSnapshotEntity> snapshots = dao.getAllByVolumeId(VOLUME_ID);
assertEquals(1, snapshots.size());
assertFalse(snapshots.contains(existingSnapshot));
GlusterVolumeEntity volume1 = volumeDao.getById(VOLUME_ID);
assertEquals(1, volume1.getSnapshotsCount().intValue());
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotEntity in project ovirt-engine by oVirt.
the class GlusterVolumeSnapshotDaoTest method insertTestSnapshot.
private GlusterVolumeSnapshotEntity insertTestSnapshot() {
Guid snapshotId = Guid.newGuid();
GlusterVolumeSnapshotEntity snapshot = new GlusterVolumeSnapshotEntity();
snapshot.setSnapshotId(snapshotId);
snapshot.setClusterId(CLUSTER_ID);
snapshot.setSnapshotName(NEW_SNAPSHOT_NAME);
snapshot.setVolumeId(VOLUME_ID);
snapshot.setDescription("test-description");
snapshot.setStatus(GlusterSnapshotStatus.ACTIVATED);
snapshot.setCreatedAt(new Date());
dao.save(snapshot);
return snapshot;
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotEntity in project ovirt-engine by oVirt.
the class GlusterVolumeSnapshotDaoTest method testRemoveAllByVolumeId.
@Test
public void testRemoveAllByVolumeId() {
GlusterVolumeEntity volume = volumeDao.getById(VOLUME_ID);
assertEquals(2, volume.getSnapshotsCount().intValue());
dao.removeAllByVolumeId(VOLUME_ID);
List<GlusterVolumeSnapshotEntity> snapshots = dao.getAllByVolumeId(VOLUME_ID);
assertTrue(snapshots.isEmpty());
GlusterVolumeEntity volume1 = volumeDao.getById(VOLUME_ID);
assertEquals(0, volume1.getSnapshotsCount().intValue());
}
Aggregations