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);
}
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());
}
}
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;
}
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);
}
}
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;
}
Aggregations