Search in sources :

Example 76 with Snapshot

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

the class SnapshotDaoTest method getAllByVmWithConfiguration.

@Test
public void getAllByVmWithConfiguration() {
    List<Snapshot> snapshots = dao.getAllWithConfiguration(FixturesTool.VM_RHEL5_POOL_50);
    assertEquals("VM should have a snapshot", 1, snapshots.size());
    for (Snapshot snapshot : snapshots) {
        assertEquals("Snapshot should have configuration", "test!", snapshot.getVmConfiguration());
        assertTrue("Snapshot should have configuration available", snapshot.isVmConfigurationAvailable());
    }
}
Also used : Snapshot(org.ovirt.engine.core.common.businessentities.Snapshot) Test(org.junit.Test)

Example 77 with Snapshot

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

the class SnapshotDaoTest method getFilteredWithPermissionsNoPermissionsAndNoFilter.

@Test
public void getFilteredWithPermissionsNoPermissionsAndNoFilter() {
    Snapshot snapshot = dao.get(EXISTING_SNAPSHOT_ID, UNPRIVILEGED_USER_ID, false);
    assertNotNull(snapshot);
    assertEquals(existingEntity, snapshot);
}
Also used : Snapshot(org.ovirt.engine.core.common.businessentities.Snapshot) Test(org.junit.Test)

Example 78 with Snapshot

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

the class SnapshotDaoTest method updateId.

@Test
public void updateId() throws Exception {
    Snapshot snapshot = dao.get(getExistingEntityId());
    assertNotNull(snapshot);
    Guid oldId = snapshot.getId();
    snapshot.setId(Guid.Empty);
    dao.updateId(oldId, snapshot.getId());
    assertEquals(snapshot, dao.get(snapshot.getId()));
}
Also used : Snapshot(org.ovirt.engine.core.common.businessentities.Snapshot) Guid(org.ovirt.engine.core.compat.Guid) Test(org.junit.Test)

Example 79 with Snapshot

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

the class SnapshotDaoTest method getZeroSnapshotsByMemory.

@Test
public void getZeroSnapshotsByMemory() {
    Snapshot snapshot = new Snapshot();
    snapshot.setMemoryDiskId(Guid.newGuid());
    snapshot.setMetadataDiskId(Guid.newGuid());
    assertEquals(0, dao.getNumOfSnapshotsByDisks(snapshot));
}
Also used : Snapshot(org.ovirt.engine.core.common.businessentities.Snapshot) Test(org.junit.Test)

Example 80 with Snapshot

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

the class SnapshotDaoTest method assertFullGetAllByVmResult.

/**
 * Asserts the result of {@link SnapshotDao#getAll(Guid)} contains the correct snapshots.
 *
 * @param snapshots
 *            The result to check
 */
private static void assertFullGetAllByVmResult(List<Snapshot> snapshots) {
    assertEquals("VM should have a snapshot", 1, snapshots.size());
    for (Snapshot snapshot : snapshots) {
        assertFalse("Snapshot shouldn't have configuration available", snapshot.isVmConfigurationAvailable());
        assertTrue("Snapshot should have no configuration", StringUtils.isEmpty(snapshot.getVmConfiguration()));
    }
}
Also used : Snapshot(org.ovirt.engine.core.common.businessentities.Snapshot)

Aggregations

Snapshot (org.ovirt.engine.core.common.businessentities.Snapshot)96 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)33 VM (org.ovirt.engine.core.common.businessentities.VM)32 Guid (org.ovirt.engine.core.compat.Guid)30 Test (org.junit.Test)21 ArrayList (java.util.ArrayList)15 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)12 List (java.util.List)11 SnapshotStatus (org.ovirt.engine.core.common.businessentities.Snapshot.SnapshotStatus)9 Collections (java.util.Collections)8 Date (java.util.Date)8 Set (java.util.Set)8 Collectors (java.util.stream.Collectors)8 SnapshotType (org.ovirt.engine.core.common.businessentities.Snapshot.SnapshotType)8 EngineException (org.ovirt.engine.core.common.errors.EngineException)8 ActionType (org.ovirt.engine.core.common.action.ActionType)7 DiskStorageType (org.ovirt.engine.core.common.businessentities.storage.DiskStorageType)6 EngineMessage (org.ovirt.engine.core.common.errors.EngineMessage)6 HashMap (java.util.HashMap)5 HashSet (java.util.HashSet)5