Search in sources :

Example 21 with AffinityGroup

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

the class BackendAffinityGroupResourceTest method getModel.

static AffinityGroup getModel(int index) {
    AffinityGroup model = new AffinityGroup();
    model.setId(GUIDS[0].toString());
    model.setName(NAMES[index]);
    model.setDescription(DESCRIPTIONS[index]);
    model.setCluster(new Cluster());
    model.getCluster().setId(CLUSTER_ID.toString());
    model.setEnforcing((GUIDS[index].hashCode() & 1) == 0);
    model.setPositive((GUIDS[index].hashCode() & 1) == 1);
    return model;
}
Also used : Cluster(org.ovirt.engine.api.model.Cluster) AffinityGroup(org.ovirt.engine.api.model.AffinityGroup)

Example 22 with AffinityGroup

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

the class BackendAffinityGroupsResourceTest method testAdd.

@Test
public void testAdd() {
    setUriInfo(setUpBasicUriExpectations());
    setUpCreationExpectations(ActionType.AddAffinityGroup, AffinityGroupCRUDParameters.class, new String[] {}, new Object[] {}, true, true, GUIDS[0], QueryType.GetAffinityGroupById, IdQueryParameters.class, new String[] { "Id" }, new Object[] { GUIDS[0] }, getEntity(0));
    Response response = collection.add(new AffinityGroup());
    assertEquals(201, response.getStatus());
    assertTrue(response.getEntity() instanceof AffinityGroup);
    verifyModel((AffinityGroup) response.getEntity(), 0);
}
Also used : Response(javax.ws.rs.core.Response) AffinityGroup(org.ovirt.engine.api.model.AffinityGroup) Test(org.junit.Test)

Aggregations

AffinityGroup (org.ovirt.engine.api.model.AffinityGroup)22 Test (org.junit.Test)19 AffinityRule (org.ovirt.engine.api.model.AffinityRule)7 EntityAffinityRule (org.ovirt.engine.core.common.scheduling.EntityAffinityRule)7 Guid (org.ovirt.engine.core.compat.Guid)6 Host (org.ovirt.engine.api.model.Host)3 Hosts (org.ovirt.engine.api.model.Hosts)3 Vm (org.ovirt.engine.api.model.Vm)3 Vms (org.ovirt.engine.api.model.Vms)3 Cluster (org.ovirt.engine.api.model.Cluster)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Response (javax.ws.rs.core.Response)1 GuidUtils (org.ovirt.engine.api.restapi.utils.GuidUtils)1 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)1 AffinityGroupCRUDParameters (org.ovirt.engine.core.common.scheduling.parameters.AffinityGroupCRUDParameters)1