use of org.ovirt.engine.core.common.businessentities.VmDevice in project ovirt-engine by oVirt.
the class UpdateRngDeviceTest method mockCommand.
private UpdateRngDeviceCommand mockCommand() {
final VmStatic vmMock = mock(VmStatic.class);
when(vmMock.getClusterId()).thenReturn(clusterId);
when(vmDaoMock.get(vmId)).thenReturn(vmMock);
when(vmDeviceDaoMock.getVmDeviceByVmIdAndType(vmId, VmDeviceGeneralType.RNG)).thenReturn(Collections.singletonList(new VmDevice()));
final Cluster cluster = mock(Cluster.class);
when(cluster.getRequiredRngSources()).thenReturn(Collections.singleton(VmRngDevice.Source.RANDOM));
when(clusterMock.get(clusterId)).thenReturn(cluster);
cmd.init();
return cmd;
}
use of org.ovirt.engine.core.common.businessentities.VmDevice in project ovirt-engine by oVirt.
the class UpdateVmCommandTest method mockGraphicsDevice.
private void mockGraphicsDevice() {
VmDevice graphicsDevice = new GraphicsDevice(VmDeviceType.SPICE);
graphicsDevice.setDeviceId(Guid.Empty);
graphicsDevice.setVmId(vm.getId());
mockVmDevice(graphicsDevice);
}
use of org.ovirt.engine.core.common.businessentities.VmDevice in project ovirt-engine by oVirt.
the class UpdateWatchdogCommandTest method testValidate.
@Test
public void testValidate() {
Guid vmGuid = new Guid("a09f57b1-5739-4352-bf88-a6f834ed46db");
command.getParameters().setId(vmGuid);
command.getParameters().setAction(VmWatchdogAction.PAUSE);
command.getParameters().setModel(vmWatchdogType);
when(vmDaoMock.get(vmGuid)).thenReturn(new VM());
when(vmDeviceDaoMock.getVmDeviceByVmIdAndType(vmGuid, VmDeviceGeneralType.WATCHDOG)).thenReturn(Collections.singletonList(new VmDevice()));
VmWatchdog vmWatchdog = spy(new VmWatchdog());
when(vmWatchdog.getModel()).thenReturn(vmWatchdogType);
assertTrue(command.validate());
}
use of org.ovirt.engine.core.common.businessentities.VmDevice in project ovirt-engine by oVirt.
the class ImportVmCommandTest method addSoundDeviceToVm.
private void addSoundDeviceToVm(VM vm) {
Guid deviceId = Guid.newGuid();
Map<String, Object> specParams = new HashMap<>();
VmDevice sound = new VmDevice(new VmDeviceId(deviceId, vm.getId()), VmDeviceGeneralType.SOUND, "", null, specParams, true, true, true, null, null, null, null);
vm.getManagedVmDeviceMap().put(deviceId, sound);
}
use of org.ovirt.engine.core.common.businessentities.VmDevice in project ovirt-engine by oVirt.
the class ImportVmCommandTest method addBalloonToVm.
void addBalloonToVm(VM vm) {
Guid deviceId = Guid.newGuid();
Map<String, Object> specParams = new HashMap<>();
specParams.put(VdsProperties.Model, VdsProperties.Virtio);
VmDevice balloon = new VmDevice(new VmDeviceId(deviceId, vm.getId()), VmDeviceGeneralType.BALLOON, VmDeviceType.MEMBALLOON.toString(), null, specParams, true, true, true, null, null, null, null);
vm.getManagedVmDeviceMap().put(deviceId, balloon);
}
Aggregations