use of org.ovirt.engine.core.common.businessentities.Snapshot in project ovirt-engine by oVirt.
the class DiskSnapshotsValidatorTest method diskSnapshotsCannotBePreviewed.
@Test
public void diskSnapshotsCannotBePreviewed() {
Snapshot activeSnapshot = getActiveSnapshot();
when(snapshotDao.get(any())).thenReturn(activeSnapshot);
when(diskImageDao.get(disk1.getImageId())).thenReturn(disk1);
when(diskImageDao.get(disk2.getImageId())).thenReturn(disk2);
assertThat(validator.canDiskSnapshotsBePreviewed(activeSnapshot.getId()), failsWith(EngineMessage.CANNOT_PREVIEW_ACTIVE_SNAPSHOT));
}
use of org.ovirt.engine.core.common.businessentities.Snapshot in project ovirt-engine by oVirt.
the class VmStaticDaoTest method testRemoveWithoutPermissions.
@Test
public void testRemoveWithoutPermissions() {
for (Snapshot s : dbFacade.getSnapshotDao().getAll()) {
dbFacade.getSnapshotDao().remove(s.getId());
}
PermissionDao permissionsDao = dbFacade.getPermissionDao();
int numberOfPermissionsBeforeRemove = permissionsDao.getAllForEntity(getExistingEntityId()).size();
dao.remove(getExistingEntityId(), false);
VmStatic result = dao.get(getExistingEntityId());
assertNull(result);
assertEquals("vm permissions changed during remove although shouldnt have.", numberOfPermissionsBeforeRemove, permissionsDao.getAllForEntity(getExistingEntityId()).size());
}
use of org.ovirt.engine.core.common.businessentities.Snapshot in project ovirt-engine by oVirt.
the class VmStaticDaoTest method testRemove.
@Test
@Override
public void testRemove() {
for (Snapshot s : dbFacade.getSnapshotDao().getAll()) {
dbFacade.getSnapshotDao().remove(s.getId());
}
dao.remove(getExistingEntityId());
VmStatic result = dao.get(getExistingEntityId());
assertNull(result);
PermissionDao permissionsDao = dbFacade.getPermissionDao();
assertEquals("vm permissions wasn't removed", 0, permissionsDao.getAllForEntity(getExistingEntityId()).size());
}
use of org.ovirt.engine.core.common.businessentities.Snapshot in project ovirt-engine by oVirt.
the class SnapshotDaoTest method getOneSnapshotsByMemoryDump.
@Test
public void getOneSnapshotsByMemoryDump() {
Snapshot snapshot = new Snapshot();
snapshot.setMemoryDiskId(EXISTING_MEMORY_DUMP_DISK_ID);
snapshot.setMetadataDiskId(Guid.newGuid());
assertEquals(1, dao.getNumOfSnapshotsByDisks(snapshot));
}
use of org.ovirt.engine.core.common.businessentities.Snapshot in project ovirt-engine by oVirt.
the class SnapshotDaoTest method getOneSnapshotsByMemoryConf.
@Test
public void getOneSnapshotsByMemoryConf() {
Snapshot snapshot = new Snapshot();
snapshot.setMemoryDiskId(Guid.newGuid());
snapshot.setMetadataDiskId(EXISTING_MEMORY_CONF_DISK_ID);
assertEquals(1, dao.getNumOfSnapshotsByDisks(snapshot));
}
Aggregations