use of org.ovirt.engine.api.model.AffinityGroup in project ovirt-engine by oVirt.
the class AffinityGroupMapperTest method testVmAffinityNegRestOutput.
@Test
public void testVmAffinityNegRestOutput() throws Exception {
org.ovirt.engine.core.common.scheduling.AffinityGroup entity = new org.ovirt.engine.core.common.scheduling.AffinityGroup();
entity.setId(Guid.Empty);
entity.setClusterId(Guid.Empty);
entity.setVmEnforcing(true);
entity.setVmAffinityRule(EntityAffinityRule.NEGATIVE);
AffinityGroup model = new AffinityGroup();
AffinityGroupMapper.map(entity, model);
assertNotNull(model.getVmsRule());
assertEquals(true, model.getVmsRule().isEnabled());
assertEquals(false, model.getVmsRule().isPositive());
assertEquals(true, model.getVmsRule().isEnforcing());
assertEquals(false, model.isPositive());
assertEquals(true, model.isEnforcing());
}
use of org.ovirt.engine.api.model.AffinityGroup in project ovirt-engine by oVirt.
the class AffinityGroupMapperTest method testHostsRuleStructureNeg.
@Test
public void testHostsRuleStructureNeg() throws Exception {
AffinityGroup model = new AffinityGroup();
AffinityRule rule = new AffinityRule();
rule.setEnabled(true);
rule.setEnforcing(false);
rule.setPositive(true);
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.POSITIVE, entity.getVdsAffinityRule());
assertEquals(false, entity.isVdsEnforcing());
}
use of org.ovirt.engine.api.model.AffinityGroup in project ovirt-engine by oVirt.
the class AffinityGroupMapperTest method testHostAffinityRestOutput.
@Test
public void testHostAffinityRestOutput() throws Exception {
org.ovirt.engine.core.common.scheduling.AffinityGroup entity = new org.ovirt.engine.core.common.scheduling.AffinityGroup();
entity.setId(Guid.Empty);
entity.setClusterId(Guid.Empty);
entity.setVdsEnforcing(false);
entity.setVdsAffinityRule(EntityAffinityRule.POSITIVE);
AffinityGroup model = new AffinityGroup();
AffinityGroupMapper.map(entity, model);
assertNotNull(model.getHostsRule());
assertEquals(true, model.getHostsRule().isEnabled());
assertEquals(true, model.getHostsRule().isPositive());
assertEquals(false, model.getHostsRule().isEnforcing());
}
use of org.ovirt.engine.api.model.AffinityGroup in project ovirt-engine by oVirt.
the class AffinityGroupMapperTest method testVmsRuleNeg.
@Test
public void testVmsRuleNeg() throws Exception {
AffinityGroup model = new AffinityGroup();
model.setEnforcing(false);
model.setPositive(true);
org.ovirt.engine.core.common.scheduling.AffinityGroup entity = new org.ovirt.engine.core.common.scheduling.AffinityGroup();
AffinityGroupMapper.map(model, entity);
assertEquals(EntityAffinityRule.POSITIVE, entity.getVmAffinityRule());
assertEquals(false, entity.isVmEnforcing());
assertEquals(true, entity.isVmAffinityEnabled());
}
use of org.ovirt.engine.api.model.AffinityGroup in project ovirt-engine by oVirt.
the class AffinityGroupMapperTest method testVmsRuleStructureWins.
@Test
public void testVmsRuleStructureWins() throws Exception {
AffinityGroup model = new AffinityGroup();
model.setEnforcing(false);
model.setPositive(false);
AffinityRule rule = new AffinityRule();
rule.setEnforcing(true);
rule.setPositive(true);
rule.setEnabled(true);
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.POSITIVE, entity.getVmAffinityRule());
assertEquals(true, entity.isVmEnforcing());
assertEquals(true, entity.isVmAffinityEnabled());
}
Aggregations