use of org.ovirt.engine.api.model.AffinityGroup in project ovirt-engine by oVirt.
the class AffinityGroupMapperTest method testVmIds.
@Test
public void testVmIds() throws Exception {
AffinityGroup model = new AffinityGroup();
Vm vm = new Vm();
final Guid vmGuid = Guid.newGuid();
vm.setId(vmGuid.toString());
model.setVms(new Vms());
model.getVms().getVms().add(vm);
org.ovirt.engine.core.common.scheduling.AffinityGroup entity = new org.ovirt.engine.core.common.scheduling.AffinityGroup();
AffinityGroupMapper.map(model, entity);
assertEquals(vmGuid, entity.getVmIds().get(0));
}
use of org.ovirt.engine.api.model.AffinityGroup in project ovirt-engine by oVirt.
the class AffinityGroupMapperTest method testVmsRule.
@Test
public void testVmsRule() throws Exception {
AffinityGroup model = new AffinityGroup();
model.setEnforcing(true);
model.setPositive(false);
org.ovirt.engine.core.common.scheduling.AffinityGroup entity = new org.ovirt.engine.core.common.scheduling.AffinityGroup();
AffinityGroupMapper.map(model, entity);
assertEquals(EntityAffinityRule.NEGATIVE, entity.getVmAffinityRule());
assertEquals(true, entity.isVmEnforcing());
assertEquals(true, entity.isVmAffinityEnabled());
}
use of org.ovirt.engine.api.model.AffinityGroup in project ovirt-engine by oVirt.
the class AffinityGroupMapperTest method testHostIdsReplacement.
@Test
public void testHostIdsReplacement() throws Exception {
AffinityGroup model = new AffinityGroup();
Host host = new Host();
final Guid hostGuid = Guid.newGuid();
host.setId(hostGuid.toString());
model.setHosts(new Hosts());
model.getHosts().getHosts().add(host);
org.ovirt.engine.core.common.scheduling.AffinityGroup entity = new org.ovirt.engine.core.common.scheduling.AffinityGroup();
entity.getVdsIds().add(Guid.newGuid());
AffinityGroupMapper.map(model, entity);
assertEquals(1, entity.getVdsIds().size());
assertEquals(hostGuid, entity.getVdsIds().get(0));
}
use of org.ovirt.engine.api.model.AffinityGroup in project ovirt-engine by oVirt.
the class AffinityGroupMapperTest method testVmAffinityRestOutput.
@Test
public void testVmAffinityRestOutput() 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(false);
entity.setVmAffinityRule(EntityAffinityRule.POSITIVE);
AffinityGroup model = new AffinityGroup();
AffinityGroupMapper.map(entity, model);
assertNotNull(model.getVmsRule());
assertEquals(true, model.getVmsRule().isEnabled());
assertEquals(true, model.getVmsRule().isPositive());
assertEquals(false, model.getVmsRule().isEnforcing());
assertEquals(true, model.isPositive());
assertEquals(false, model.isEnforcing());
}
use of org.ovirt.engine.api.model.AffinityGroup in project ovirt-engine by oVirt.
the class AffinityGroupMapperTest method testHostAffinityNegRestOutput.
@Test
public void testHostAffinityNegRestOutput() 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(true);
entity.setVdsAffinityRule(EntityAffinityRule.NEGATIVE);
AffinityGroup model = new AffinityGroup();
AffinityGroupMapper.map(entity, model);
assertNotNull(model.getHostsRule());
assertEquals(true, model.getHostsRule().isEnabled());
assertEquals(false, model.getHostsRule().isPositive());
assertEquals(true, model.getHostsRule().isEnforcing());
}
Aggregations