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);
}
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;
}
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());
}
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());
}
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);
}
Aggregations