Search in sources :

Example 66 with VM

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));
}
Also used : VM(org.ovirt.engine.core.common.businessentities.VM) Test(org.junit.Test)

Example 67 with VM

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;
}
Also used : VM(org.ovirt.engine.core.common.businessentities.VM)

Example 68 with 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());
}
Also used : VM(org.ovirt.engine.core.common.businessentities.VM) Test(org.junit.Test)

Example 69 with VM

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;
}
Also used : VM(org.ovirt.engine.core.common.businessentities.VM) GraphicsInfo(org.ovirt.engine.core.common.businessentities.GraphicsInfo)

Example 70 with 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));
}
Also used : IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) VM(org.ovirt.engine.core.common.businessentities.VM) Guid(org.ovirt.engine.core.compat.Guid) Test(org.junit.Test)

Aggregations

VM (org.ovirt.engine.core.common.businessentities.VM)591 Test (org.junit.Test)178 Guid (org.ovirt.engine.core.compat.Guid)150 ArrayList (java.util.ArrayList)130 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)82 HashMap (java.util.HashMap)69 List (java.util.List)65 VDS (org.ovirt.engine.core.common.businessentities.VDS)63 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)56 Map (java.util.Map)53 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)53 Disk (org.ovirt.engine.core.common.businessentities.storage.Disk)41 QueryType (org.ovirt.engine.core.common.queries.QueryType)36 Snapshot (org.ovirt.engine.core.common.businessentities.Snapshot)34 Frontend (org.ovirt.engine.ui.frontend.Frontend)34 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)33 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)32 ConstantsManager (org.ovirt.engine.ui.uicompat.ConstantsManager)32 Collectors (java.util.stream.Collectors)31 HelpTag (org.ovirt.engine.ui.uicommonweb.help.HelpTag)31