use of org.ovirt.engine.core.common.scheduling.AffinityGroup in project ovirt-engine by oVirt.
the class AffinityGroupDaoTest method testRemoveVdsFromAffinityGroups.
@Test
public void testRemoveVdsFromAffinityGroups() {
AffinityGroup existing = dao.get(FixturesTool.EXISTING_AFFINITY_GROUP_ID);
assertFalse(existing.getVdsIds().isEmpty());
dao.removeVdsFromAffinityGroups(FixturesTool.VDS_RHEL6_NFS_SPM);
assertTrue(dao.get(FixturesTool.EXISTING_AFFINITY_GROUP_ID).getVdsIds().isEmpty());
}
use of org.ovirt.engine.core.common.scheduling.AffinityGroup in project ovirt-engine by oVirt.
the class AffinityGroupDaoTest method testAddVmsForExistingAffinityGroup.
@Test
public void testAddVmsForExistingAffinityGroup() {
AffinityGroup existing = dao.get(FixturesTool.EXISTING_AFFINITY_GROUP_ID);
assertEquals(NUM_OF_VMS_IN_EXISTING_AFFINITY_GROUP, existing.getVmEntityNames().size());
existing.getVmIds().add(FixturesTool.VM_RHEL5_POOL_51);
dao.update(existing);
AffinityGroup fetched = dao.get(existing.getId());
assertEquals(NUM_OF_VMS_IN_EXISTING_AFFINITY_GROUP + 1, fetched.getVmEntityNames().size());
}
use of org.ovirt.engine.core.common.scheduling.AffinityGroup in project ovirt-engine by oVirt.
the class AffinityGroupDaoTest method testRemoveVmsFromExistingAffinityGroup.
@Test
public void testRemoveVmsFromExistingAffinityGroup() {
AffinityGroup existing = dao.get(FixturesTool.EXISTING_AFFINITY_GROUP_ID);
assertFalse(existing.getVmEntityNames().isEmpty());
existing.getVmIds().clear();
dao.update(existing);
AffinityGroup fetched = dao.get(existing.getId());
assertTrue(fetched.getVmEntityNames().isEmpty());
}
use of org.ovirt.engine.core.common.scheduling.AffinityGroup in project ovirt-engine by oVirt.
the class AffinityGroupDaoTest method testGetById.
@Test
public void testGetById() {
AffinityGroup affinityGroup = dao.get(FixturesTool.EXISTING_AFFINITY_GROUP_ID);
assertNotNull(affinityGroup);
assertEquals(FixturesTool.EXISTING_AFFINITY_GROUP_ID, affinityGroup.getId());
// empty
affinityGroup = dao.get(null);
assertNull(affinityGroup);
affinityGroup = dao.get(Guid.Empty);
assertNull(affinityGroup);
affinityGroup = dao.get(Guid.newGuid());
assertNull(affinityGroup);
}
use of org.ovirt.engine.core.common.scheduling.AffinityGroup in project ovirt-engine by oVirt.
the class AffinityGroupDaoTest method testSimpleUpdate.
@Test
public void testSimpleUpdate() {
AffinityGroup existing = dao.get(FixturesTool.EXISTING_AFFINITY_GROUP_ID);
existing.setName("my_new_name");
existing.setVmAffinityRule(EntityAffinityRule.NEGATIVE);
existing.setVmEnforcing(true);
dao.update(existing);
AffinityGroup fetched = dao.get(existing.getId());
assertTrue(equals(existing, fetched));
}
Aggregations