use of org.ovirt.engine.core.common.businessentities.Snapshot in project ovirt-engine by oVirt.
the class ImportVmCommandTest method createVmWithSnapshots.
protected VM createVmWithSnapshots() {
final VM v = new VM();
v.setId(Guid.newGuid());
Snapshot baseSnapshot = new Snapshot();
baseSnapshot.setVmId(v.getId());
Snapshot activeSnapshot = new Snapshot();
activeSnapshot.setVmId(v.getId());
DiskImage baseImage = createDiskImage(Guid.newGuid(), Guid.newGuid(), baseSnapshot.getId(), false);
DiskImage activeImage = createDiskImage(baseImage.getId(), baseImage.getImageId(), activeSnapshot.getId(), true);
baseSnapshot.setDiskImages(Collections.singletonList(baseImage));
activeSnapshot.setDiskImages(Collections.singletonList(activeImage));
v.setDiskMap(Collections.singletonMap(activeImage.getId(), activeImage));
v.setImages(new ArrayList<>(Arrays.asList(baseImage, activeImage)));
v.setSnapshots(new ArrayList<>(Arrays.asList(baseSnapshot, activeSnapshot)));
v.setClusterId(Guid.Empty);
return v;
}
use of org.ovirt.engine.core.common.businessentities.Snapshot in project ovirt-engine by oVirt.
the class SnapshotDaoTest method updateStatus.
@Test
public void updateStatus() throws Exception {
Snapshot snapshot = dao.get(getExistingEntityId());
snapshot.setStatus(SnapshotStatus.LOCKED);
dao.updateStatus(snapshot.getId(), snapshot.getStatus());
assertEquals(snapshot, dao.get(snapshot.getId()));
}
use of org.ovirt.engine.core.common.businessentities.Snapshot in project ovirt-engine by oVirt.
the class SnapshotDaoTest method getFilteredWithPermissions.
@Test
public void getFilteredWithPermissions() {
Snapshot snapshot = dao.get(EXISTING_SNAPSHOT_ID, PRIVILEGED_USER_ID, true);
assertNotNull(snapshot);
assertEquals(existingEntity, snapshot);
}
use of org.ovirt.engine.core.common.businessentities.Snapshot in project ovirt-engine by oVirt.
the class SnapshotDaoTest method getFilteredWithPermissionsNoPermissions.
@Test
public void getFilteredWithPermissionsNoPermissions() {
Snapshot snapshot = dao.get(EXISTING_SNAPSHOT_ID, UNPRIVILEGED_USER_ID, true);
assertNull(snapshot);
}
use of org.ovirt.engine.core.common.businessentities.Snapshot in project ovirt-engine by oVirt.
the class SnapshotDaoTest method removeMemoryFromActiveSnapshot.
@Test
public void removeMemoryFromActiveSnapshot() throws Exception {
Snapshot snapshot = dao.get(EXISTING_SNAPSHOT_ID2);
assertEquals(EXISTING_MEMORY_DUMP_DISK_ID, snapshot.getMemoryDiskId());
assertEquals(EXISTING_MEMORY_CONF_DISK_ID, snapshot.getMetadataDiskId());
dao.removeMemoryFromActiveSnapshot(EXISTING_VM_ID2);
snapshot = dao.get(EXISTING_SNAPSHOT_ID2);
assertNull(snapshot.getMemoryDiskId());
assertNull(snapshot.getMetadataDiskId());
}
Aggregations