Search in sources :

Example 6 with AffinityRule

use of org.ovirt.engine.api.model.AffinityRule in project ovirt-engine by oVirt.

the class AffinityGroupMapperTest method testVmsRuleStructureDisabled.

@Test
public void testVmsRuleStructureDisabled() throws Exception {
    AffinityGroup model = new AffinityGroup();
    AffinityRule rule = new AffinityRule();
    rule.setEnforcing(true);
    rule.setPositive(false);
    rule.setEnabled(false);
    model.setVmsRule(rule);
    org.ovirt.engine.core.common.scheduling.AffinityGroup entity = new org.ovirt.engine.core.common.scheduling.AffinityGroup();
    AffinityGroupMapper.map(model, entity);
    assertEquals(EntityAffinityRule.DISABLED, entity.getVmAffinityRule());
    assertEquals(true, entity.isVmEnforcing());
    assertEquals(false, entity.isVmAffinityEnabled());
}
Also used : AffinityRule(org.ovirt.engine.api.model.AffinityRule) EntityAffinityRule(org.ovirt.engine.core.common.scheduling.EntityAffinityRule) AffinityGroup(org.ovirt.engine.api.model.AffinityGroup) Test(org.junit.Test)

Example 7 with AffinityRule

use of org.ovirt.engine.api.model.AffinityRule in project ovirt-engine by oVirt.

the class AffinityGroupMapperTest method testHostsRuleStructure.

@Test
public void testHostsRuleStructure() throws Exception {
    AffinityGroup model = new AffinityGroup();
    AffinityRule rule = new AffinityRule();
    rule.setEnabled(true);
    rule.setEnforcing(true);
    rule.setPositive(false);
    model.setHostsRule(rule);
    org.ovirt.engine.core.common.scheduling.AffinityGroup entity = new org.ovirt.engine.core.common.scheduling.AffinityGroup();
    AffinityGroupMapper.map(model, entity);
    assertEquals(EntityAffinityRule.NEGATIVE, entity.getVdsAffinityRule());
    assertEquals(true, entity.isVdsEnforcing());
}
Also used : AffinityRule(org.ovirt.engine.api.model.AffinityRule) EntityAffinityRule(org.ovirt.engine.core.common.scheduling.EntityAffinityRule) AffinityGroup(org.ovirt.engine.api.model.AffinityGroup) Test(org.junit.Test)

Aggregations

AffinityGroup (org.ovirt.engine.api.model.AffinityGroup)7 AffinityRule (org.ovirt.engine.api.model.AffinityRule)7 EntityAffinityRule (org.ovirt.engine.core.common.scheduling.EntityAffinityRule)7 Test (org.junit.Test)6 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Cluster (org.ovirt.engine.api.model.Cluster)1 Host (org.ovirt.engine.api.model.Host)1 Hosts (org.ovirt.engine.api.model.Hosts)1 Vm (org.ovirt.engine.api.model.Vm)1 Vms (org.ovirt.engine.api.model.Vms)1 GuidUtils (org.ovirt.engine.api.restapi.utils.GuidUtils)1 Guid (org.ovirt.engine.core.compat.Guid)1