Search in sources :

Example 1 with CpuProfile

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

the class AbstractBackendCpuProfilesResourceTest method testAddCpuProfile.

@Test
public void testAddCpuProfile() throws Exception {
    setUriInfo(setUpBasicUriExpectations());
    setUpClusterQueryExpectations();
    setUpCreationExpectations(ActionType.AddCpuProfile, CpuProfileParameters.class, new String[] {}, new Object[] {}, true, true, GUIDS[0], QueryType.GetCpuProfileById, IdQueryParameters.class, new String[] { "Id" }, new Object[] { Guid.Empty }, getEntity(0));
    CpuProfile model = getModel(0);
    model.setCluster(new Cluster());
    model.getCluster().setId(CLUSTER_ID.toString());
    Response response = collection.add(model);
    assertEquals(201, response.getStatus());
    assertTrue(response.getEntity() instanceof CpuProfile);
    verifyModel((CpuProfile) response.getEntity(), 0);
}
Also used : Response(javax.ws.rs.core.Response) CpuProfile(org.ovirt.engine.api.model.CpuProfile) Cluster(org.ovirt.engine.api.model.Cluster) Test(org.junit.Test)

Example 2 with CpuProfile

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

the class AbstractBackendCpuProfilesResourceTest method testAddIncompleteParameters.

@Test
public void testAddIncompleteParameters() throws Exception {
    CpuProfile model = createIncompleteCpuProfile();
    setUriInfo(setUpBasicUriExpectations());
    try {
        collection.add(model);
        fail("expected WebApplicationException on incomplete parameters");
    } catch (WebApplicationException wae) {
        verifyIncompleteException(wae, "CpuProfile", "validateParameters", getIncompleteFields());
    }
}
Also used : WebApplicationException(javax.ws.rs.WebApplicationException) CpuProfile(org.ovirt.engine.api.model.CpuProfile) Test(org.junit.Test)

Example 3 with CpuProfile

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

the class BackendCpuProfileResourceTest method getModel.

static CpuProfile getModel(int index) {
    CpuProfile model = new CpuProfile();
    model.setId(GUIDS[index].toString());
    model.setName(NAMES[index]);
    model.setDescription(DESCRIPTIONS[index]);
    return model;
}
Also used : CpuProfile(org.ovirt.engine.api.model.CpuProfile)

Example 4 with CpuProfile

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

the class BackendCpuProfileResourceTest method testConflictedUpdate.

@Test
public void testConflictedUpdate() throws Exception {
    setUriInfo(setUpBasicUriExpectations());
    setUpEntityQueryExpectations(1, 0, false);
    CpuProfile model = getModel(1);
    model.setId(GUIDS[1].toString());
    try {
        resource.update(model);
        fail("expected WebApplicationException");
    } catch (WebApplicationException wae) {
        verifyImmutabilityConstraint(wae);
    }
}
Also used : WebApplicationException(javax.ws.rs.WebApplicationException) CpuProfile(org.ovirt.engine.api.model.CpuProfile) Test(org.junit.Test)

Example 5 with CpuProfile

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

the class BackendCpuProfilesResourceTest method createIncompleteCpuProfile.

@Override
protected CpuProfile createIncompleteCpuProfile() {
    CpuProfile cpuProfile = super.createIncompleteCpuProfile();
    cpuProfile.setName(NAMES[0]);
    return cpuProfile;
}
Also used : CpuProfile(org.ovirt.engine.api.model.CpuProfile)

Aggregations

CpuProfile (org.ovirt.engine.api.model.CpuProfile)10 Cluster (org.ovirt.engine.api.model.Cluster)4 WebApplicationException (javax.ws.rs.WebApplicationException)3 Test (org.junit.Test)3 Qos (org.ovirt.engine.api.model.Qos)2 HashMap (java.util.HashMap)1 Response (javax.ws.rs.core.Response)1 Bios (org.ovirt.engine.api.model.Bios)1 BootMenu (org.ovirt.engine.api.model.BootMenu)1 CpuProfiles (org.ovirt.engine.api.model.CpuProfiles)1 CustomProperties (org.ovirt.engine.api.model.CustomProperties)1 Domain (org.ovirt.engine.api.model.Domain)1 Icon (org.ovirt.engine.api.model.Icon)1 Quota (org.ovirt.engine.api.model.Quota)1 TimeZone (org.ovirt.engine.api.model.TimeZone)1 CpuProfileParameters (org.ovirt.engine.core.common.action.CpuProfileParameters)1 CpuQos (org.ovirt.engine.core.common.businessentities.qos.CpuQos)1 Guid (org.ovirt.engine.core.compat.Guid)1