use of org.ovirt.engine.core.common.scheduling.AffinityGroup in project ovirt-engine by oVirt.
the class EditAffinityGroupCommandTest method validate_testNameChange_Test.
@Test
public void validate_testNameChange_Test() {
doReturn(new AffinityGroup()).when(affinityGroupDao).getByName(affinityGroup.getName());
ValidateTestUtils.runAndAssertValidateFailure(command, EngineMessage.ACTION_TYPE_FAILED_AFFINITY_GROUP_NAME_EXISTS);
}
use of org.ovirt.engine.core.common.scheduling.AffinityGroup in project ovirt-engine by oVirt.
the class EditAffinityGroupCommandTest method setup.
@Before
public void setup() {
AffinityGroup affinityGroup2 = new AffinityGroup();
affinityGroup2.setClusterId(clusterId);
affinityGroup2.setName(AFFINITY_GROUP_NAME + "##");
doReturn(affinityGroup2).when(command).getAffinityGroup();
doReturn(new Cluster()).when(command).getCluster();
VmStatic vmStatic = new VmStatic();
vmStatic.setClusterId(clusterId);
doReturn(Collections.singletonList(vmStatic)).when(vmStaticDao).getByIds(any());
doReturn(clusterId).when(command).getClusterId();
}
use of org.ovirt.engine.core.common.scheduling.AffinityGroup in project ovirt-engine by oVirt.
the class VmToHostAffinityFilterPolicyUnitTest method testNoAffinityGroups.
@Test
public void testNoAffinityGroups() {
hosts = Arrays.asList(host_positive_enforcing, host_negative_enforcing, host_not_in_affinity_group);
List<AffinityGroup> affinityGroups = new ArrayList<>();
doReturn(affinityGroups).when(affinityGroupDao).getAllAffinityGroupsByVmId(any());
assertThat(unit.filter(cluster, hosts, vm, new HashMap<>(), new PerHostMessages())).contains(host_positive_enforcing, host_negative_enforcing, host_not_in_affinity_group);
}
use of org.ovirt.engine.core.common.scheduling.AffinityGroup in project ovirt-engine by oVirt.
the class VmToHostAffinityFilterPolicyUnitTest method testNegativeAffinity.
@Test
public void testNegativeAffinity() throws Exception {
hosts = Arrays.asList(host_negative_enforcing, host_not_in_affinity_group);
List<AffinityGroup> affinityGroups = Arrays.asList(negative_enforcing_group);
doReturn(affinityGroups).when(affinityGroupDao).getAllAffinityGroupsByVmId(any());
assertThat(unit.filter(cluster, hosts, vm, new HashMap<>(), new PerHostMessages())).contains(host_not_in_affinity_group);
}
Aggregations