Search in sources :

Example 16 with GlusterVolumeSnapshotEntity

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);
}
Also used : GlusterVolumeSnapshotEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotEntity) Test(org.junit.Test)

Example 17 with GlusterVolumeSnapshotEntity

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());
}
Also used : GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) GlusterVolumeSnapshotEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotEntity) Test(org.junit.Test)

Example 18 with GlusterVolumeSnapshotEntity

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());
}
Also used : GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) GlusterVolumeSnapshotEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotEntity) Test(org.junit.Test)

Example 19 with GlusterVolumeSnapshotEntity

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;
}
Also used : GlusterVolumeSnapshotEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotEntity) Guid(org.ovirt.engine.core.compat.Guid) Date(java.util.Date)

Example 20 with GlusterVolumeSnapshotEntity

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());
}
Also used : GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) GlusterVolumeSnapshotEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotEntity) Test(org.junit.Test)

Aggregations

GlusterVolumeSnapshotEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotEntity)25 GlusterVolumeEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity)12 Test (org.junit.Test)9 ArrayList (java.util.ArrayList)8 Guid (org.ovirt.engine.core.compat.Guid)6 Date (java.util.Date)5 VDSReturnValue (org.ovirt.engine.core.common.vdscommands.VDSReturnValue)4 EngineLock (org.ovirt.engine.core.utils.lock.EngineLock)4 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)3 VDS (org.ovirt.engine.core.common.businessentities.VDS)3 GlusterGeoRepSession (org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession)3 HashMap (java.util.HashMap)2 CreateGlusterVolumeSnapshotParameters (org.ovirt.engine.core.common.action.gluster.CreateGlusterVolumeSnapshotParameters)2 GlusterVolumeGeoRepSessionParameters (org.ovirt.engine.core.common.action.gluster.GlusterVolumeGeoRepSessionParameters)2 CreateGlusterVolumeSnapshotVDSParameters (org.ovirt.engine.core.common.vdscommands.gluster.CreateGlusterVolumeSnapshotVDSParameters)2 ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)2 DateTimeFormat (com.google.gwt.i18n.client.DateTimeFormat)1 DateFormat (java.text.DateFormat)1 SimpleDateFormat (java.text.SimpleDateFormat)1 Map (java.util.Map)1