Search in sources :

Example 71 with VM

use of org.ovirt.engine.core.common.businessentities.VM in project ovirt-engine by oVirt.

the class MigrateVmCommandTest method setUp.

@Before
public void setUp() {
    VM vm = new VM();
    vm.setId(vmId);
    command.setVm(vm);
}
Also used : VM(org.ovirt.engine.core.common.businessentities.VM) Before(org.junit.Before)

Example 72 with VM

use of org.ovirt.engine.core.common.businessentities.VM in project ovirt-engine by oVirt.

the class GetVmChangedFieldsForNextRunQueryTest method createEmptyVm.

private VM createEmptyVm() {
    VM vm = new VM();
    vm.setCustomProperties(StringUtils.EMPTY);
    vm.setPredefinedProperties(StringUtils.EMPTY);
    vm.setUserDefinedProperties(StringUtils.EMPTY);
    vm.setClusterCompatibilityVersion(Version.getLast());
    vm.setClusterArch(ArchitectureType.x86_64);
    return vm;
}
Also used : VM(org.ovirt.engine.core.common.businessentities.VM)

Example 73 with VM

use of org.ovirt.engine.core.common.businessentities.VM in project ovirt-engine by oVirt.

the class GetVmChangedFieldsForNextRunQueryTest method testSameVms.

@Test
public void testSameVms() {
    VM srcVm = createEmptyVm();
    VM dstVm = createEmptyVm();
    // field that should not count
    srcVm.setUseLatestVersion(false);
    dstVm.setUseLatestVersion(true);
    // some equal fields
    srcVm.setName("a");
    dstVm.setName("a");
    srcVm.setComment("my comment..");
    dstVm.setComment("my comment..");
    srcVm.setOriginalTemplateName("template4");
    dstVm.setOriginalTemplateName("template4");
    srcVm.setVmMemSizeMb(128);
    dstVm.setVmMemSizeMb(128);
    // changes for next run
    srcVm.setCustomProperties("prop=value");
    dstVm.setCustomProperties("prop=value");
    srcVm.setUsbPolicy(UsbPolicy.ENABLED_NATIVE);
    dstVm.setUsbPolicy(UsbPolicy.ENABLED_NATIVE);
    srcVm.setStateless(true);
    dstVm.setStateless(true);
    srcVm.setUseHostCpuFlags(true);
    dstVm.setUseHostCpuFlags(true);
    when(getQueryParameters().getOriginal()).thenReturn(srcVm);
    when(getQueryParameters().getUpdated()).thenReturn(dstVm);
    getQuery().executeQueryCommand();
    assertTrue(((List<String>) getQuery().getQueryReturnValue().getReturnValue()).isEmpty());
}
Also used : VM(org.ovirt.engine.core.common.businessentities.VM) Test(org.junit.Test)

Example 74 with VM

use of org.ovirt.engine.core.common.businessentities.VM in project ovirt-engine by oVirt.

the class GetVmChangedFieldsForNextRunQueryTest method testDifferentVms.

@Test
public void testDifferentVms() {
    VM srcVm = createEmptyVm();
    VM dstVm = createEmptyVm();
    // field that should not count
    srcVm.setUseLatestVersion(false);
    dstVm.setUseLatestVersion(true);
    srcVm.setName("a");
    dstVm.setName("b");
    // some equal fields
    srcVm.setComment("my comment..");
    dstVm.setComment("my comment..");
    srcVm.setOriginalTemplateName("template4");
    dstVm.setOriginalTemplateName("template4");
    srcVm.setVmMemSizeMb(128);
    dstVm.setVmMemSizeMb(128);
    // changes for next run
    srcVm.setCustomProperties("prop=value");
    dstVm.setCustomProperties("prop=value2");
    srcVm.setUsbPolicy(UsbPolicy.DISABLED);
    dstVm.setUsbPolicy(UsbPolicy.ENABLED_NATIVE);
    srcVm.setStateless(true);
    dstVm.setStateless(false);
    srcVm.setUseHostCpuFlags(true);
    dstVm.setUseHostCpuFlags(false);
    when(getQueryParameters().getOriginal()).thenReturn(srcVm);
    when(getQueryParameters().getUpdated()).thenReturn(dstVm);
    getQuery().executeQueryCommand();
    assertFalse(((List<String>) getQuery().getQueryReturnValue().getReturnValue()).isEmpty());
}
Also used : VM(org.ovirt.engine.core.common.businessentities.VM) Test(org.junit.Test)

Example 75 with VM

use of org.ovirt.engine.core.common.businessentities.VM in project ovirt-engine by oVirt.

the class GetVmConfigurationBySnapshotQueryTest method testQuery.

@Test
public void testQuery() throws Exception {
    GetVmConfigurationBySnapshotQuery<IdQueryParameters> query = setupQueryBySnapshotId(existingSnapshotId);
    VM vm = new VM();
    doReturn(vm).when(snapshotVmConfigurationHelper).getVmFromConfiguration(any(), any(), any());
    query.execute();
    QueryReturnValue returnValue = query.getQueryReturnValue();
    assertNotNull("Return value from query cannot be null", returnValue);
    VM returnedVm = returnValue.getReturnValue();
    assertEquals(vm, returnedVm);
}
Also used : QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) VM(org.ovirt.engine.core.common.businessentities.VM) 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