use of org.ovirt.engine.core.common.businessentities.VmStatic in project ovirt-engine by oVirt.
the class VmHandlerTest method testValidUpdateOfHotSetEditableFieldOnRunningVm.
@Test
public void testValidUpdateOfHotSetEditableFieldOnRunningVm() {
// Given
int srcNumOfSockets = 2;
int destNumOfSockets = 4;
VmStatic src = new VmStatic();
src.setNumOfSockets(srcNumOfSockets);
VmStatic dest = new VmStatic();
dest.setNumOfSockets(destNumOfSockets);
// When
boolean updateIsValid = vmHandler.isUpdateValid(src, dest, VMStatus.Up, true);
// Then
assertTrue("Update should be valid for different number of sockets on a running VM", updateIsValid);
}
use of org.ovirt.engine.core.common.businessentities.VmStatic in project ovirt-engine by oVirt.
the class VmHandlerTest method testInvalidUpdateOfNonEditableFieldOnRunningVm.
@Test
public void testInvalidUpdateOfNonEditableFieldOnRunningVm() {
// Given
VmStatic src = new VmStatic();
src.setId(Guid.newGuid());
VmStatic dest = new VmStatic();
dest.setId(Guid.newGuid());
// When
boolean updateIsValid = vmHandler.isUpdateValid(src, dest);
// Then
assertFalse("Update should be invalid for different IDs", updateIsValid);
}
use of org.ovirt.engine.core.common.businessentities.VmStatic in project ovirt-engine by oVirt.
the class VmHandlerTest method testInvalidUpdateOfHostedEngineNonEditableFieldOnRunningVm.
@Test
public void testInvalidUpdateOfHostedEngineNonEditableFieldOnRunningVm() {
// Given
VmStatic src = new VmStatic();
src.setOrigin(OriginType.MANAGED_HOSTED_ENGINE);
src.setName(RandomUtils.instance().nextString(10));
VmStatic dest = new VmStatic();
dest.setOrigin(OriginType.MANAGED_HOSTED_ENGINE);
dest.setName(RandomUtils.instance().nextString(10));
// When
boolean updateIsValid = vmHandler.isUpdateValid(src, dest, VMStatus.Up, false);
// Then
assertFalse("Update should be invalid for different names on a running, hosted engine VM", updateIsValid);
}
use of org.ovirt.engine.core.common.businessentities.VmStatic in project ovirt-engine by oVirt.
the class VmHandlerTest method testUpdateFieldsNameInStatusUp.
@Test
public void testUpdateFieldsNameInStatusUp() {
VmStatic src = new VmStatic();
src.setName(RandomUtils.instance().nextString(10));
src.setInterfaces(new ArrayList<>(2));
VmStatic dest = new VmStatic();
dest.setName(RandomUtils.instance().nextString(10));
assertFalse("Update should not be valid for different names", vmHandler.isUpdateValid(src, dest));
}
use of org.ovirt.engine.core.common.businessentities.VmStatic in project ovirt-engine by oVirt.
the class UpdateClusterCommandTest method vmsAreUpdatedByTheOrderOfTheirIds.
@Test
public void vmsAreUpdatedByTheOrderOfTheirIds() {
final Cluster newerCluster = createDefaultCluster();
newerCluster.setCompatibilityVersion(new Version(1, 2));
createCommand(newerCluster);
cmd.init();
VmStatic vm1 = new VmStatic();
vm1.setId(VM_ID1);
VmStatic vm2 = new VmStatic();
vm2.setId(VM_ID2);
VmStatic vm3 = new VmStatic();
vm3.setId(VM_ID3);
when(vmStaticDao.getAllByCluster(any())).thenReturn(Arrays.asList(vm1, vm2, vm3));
// the VMs ordered by Guids: v2, v3, v1
assertEquals(Arrays.asList(vm2, vm3, vm1), cmd.filterVmsInClusterNeedUpdate());
}
Aggregations