use of org.ovirt.engine.core.common.businessentities.VM in project ovirt-engine by oVirt.
the class ChangeVMClusterCommandTest method canRunForHostedEngine.
@Test
public void canRunForHostedEngine() throws Exception {
// given hosted engine VM
VM hostedEngine = new VM();
hostedEngine.setOrigin(OriginType.MANAGED_HOSTED_ENGINE);
underTest.setVm(hostedEngine);
underTest.init();
assertThat(underTest.canRunActionOnNonManagedVm(), is(true));
}
use of org.ovirt.engine.core.common.businessentities.VM in project ovirt-engine by oVirt.
the class CommonVmPoolCommandTestAbstract method mockVm.
/**
* Mock a VM.
*/
private VM mockVm() {
VM vm = new VM();
vm.setStatus(VMStatus.Down);
vm.setVmtGuid(vmTemplateId);
vm.setStaticData(getVmStatic());
vm.setClusterArch(ArchitectureType.x86_64);
vm.setName("my_vm");
return vm;
}
use of org.ovirt.engine.core.common.businessentities.VM in project ovirt-engine by oVirt.
the class ConfigureConsoleOptionsQueryTest method failOnStoppedVm.
@Test
public void failOnStoppedVm() {
when(getQueryParameters().getOptions()).thenReturn(getValidOptions(GraphicsType.SPICE));
VM mockVm = mockVm(GraphicsType.SPICE);
mockVm.setStatus(VMStatus.Down);
doReturn(mockVm).when(getQuery()).getCachedVm();
getQuery().validateInputs();
assertFalse(getQuery().getQueryReturnValue().getSucceeded());
}
use of org.ovirt.engine.core.common.businessentities.VM in project ovirt-engine by oVirt.
the class ConfigureConsoleOptionsQueryTest method mockVm.
private VM mockVm(GraphicsType graphicsType) {
VM vm = new VM();
vm.setId(Guid.Empty);
vm.getGraphicsInfos().put(graphicsType, new GraphicsInfo().setIp("host").setPort(5901));
vm.setStatus(VMStatus.Up);
return vm;
}
use of org.ovirt.engine.core.common.businessentities.VM in project ovirt-engine by oVirt.
the class GetVmsPinnedToHostQueryTest method testExecuteQuery.
@Test
public void testExecuteQuery() {
VM expectedResult = new VM();
expectedResult.setId(Guid.newGuid());
IdQueryParameters paramsMock = getQueryParameters();
when(paramsMock.getId()).thenReturn(Guid.newGuid());
when(vmDao.getAllPinnedToHost(any(Guid.class))).thenReturn(Collections.singletonList(expectedResult));
getQuery().executeQueryCommand();
List<VM> result = getQuery().getQueryReturnValue().getReturnValue();
assertNotNull(result);
assertEquals(1, result.size());
assertEquals("Wrong VM returned", expectedResult, result.get(0));
}
Aggregations