use of org.ovirt.engine.core.common.businessentities.Snapshot in project ovirt-engine by oVirt.
the class GetAllVmSnapshotsByVmIdQueryTest method testExecuteQueryCommand.
@Test
public void testExecuteQueryCommand() {
IdQueryParameters params = getQueryParameters();
when(params.getId()).thenReturn(vmId);
GetAllVmSnapshotsByVmIdQuery<IdQueryParameters> query = getQuery();
query.executeQueryCommand();
@SuppressWarnings("unchecked") List<Snapshot> snapshots = query.getQueryReturnValue().getReturnValue();
// Assert the correct disks are returned
assertTrue("snapshot should be in the return value", snapshots.contains(snapshot));
assertEquals("there should be exactly one snapshot returned", 1, snapshots.size());
}
use of org.ovirt.engine.core.common.businessentities.Snapshot in project ovirt-engine by oVirt.
the class GetAllVmSnapshotsWithLeasesFromConfigurationByVmIdQueryTest method testExecuteQueryCommand.
@Test
public void testExecuteQueryCommand() {
IdQueryParameters params = getQueryParameters();
when(params.getId()).thenReturn(vmId);
disk1.setId(Guid.newGuid());
disk2.setId(Guid.newGuid());
VM vm = new VM();
vm.setId(vmId);
vm.setImages(new ArrayList<>(Arrays.asList(disk1, disk2)));
doReturn(vm).when(snapshotVmConfigurationHelper).getVmFromConfiguration(any(), any(), any());
getQuery().executeQueryCommand();
Map<Snapshot, Guid> snapshots = getQuery().getQueryReturnValue().getReturnValue();
// Assert the correct disks are returned
assertEquals("there should be exactly one snapshot returned", 1, snapshots.keySet().size());
assertTrue("snapshot should be in the return value", snapshots.containsKey(snapshot));
Snapshot snap = (Snapshot) snapshots.keySet().toArray()[0];
assertEquals("snapshot should contain a list of 2 diskImages", 2, snap.getDiskImages().size());
}
use of org.ovirt.engine.core.common.businessentities.Snapshot in project ovirt-engine by oVirt.
the class RestoreAllSnapshotsCommandTest method validateFailsOnSnapshotTypeRegularNotInPreview.
@Test
public void validateFailsOnSnapshotTypeRegularNotInPreview() {
mockSnapshotExists();
mockSnapshot = new Snapshot();
when(snapshotDao.exists(nullable(Guid.class), nullable(Guid.class))).thenReturn(true);
mockSnapshotFromDb();
mockSnapshot.setType(SnapshotType.REGULAR);
mockSnapshot.setStatus(SnapshotStatus.OK);
ValidateTestUtils.runAndAssertValidateFailure(spyCommand, EngineMessage.ACTION_TYPE_FAILED_VM_SNAPSHOT_NOT_IN_PREVIEW);
}
use of org.ovirt.engine.core.common.businessentities.Snapshot in project ovirt-engine by oVirt.
the class SnapshotVmConfigurationHelperTest method createSnapshot.
private Snapshot createSnapshot(Guid existingSnapshotId) {
Snapshot snapshot = new Snapshot();
snapshot.setId(existingSnapshotId);
snapshot.setVmId(existingVmId);
snapshot.setVmConfiguration(EXISTING_VM_NAME);
return snapshot;
}
use of org.ovirt.engine.core.common.businessentities.Snapshot in project ovirt-engine by oVirt.
the class SnapshotsValidatorTest method setUp.
@Before
public void setUp() {
vmId = Guid.newGuid();
snapshot = new Snapshot();
snapshot.setId(Guid.newGuid());
snapshot.setType(Snapshot.SnapshotType.REGULAR);
}
Aggregations