Search in sources :

Example 1 with Job

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

the class BackendJobResourceTest method getEntity.

@Override
protected org.ovirt.engine.core.common.job.Job getEntity(int index) {
    org.ovirt.engine.core.common.job.Job job = new org.ovirt.engine.core.common.job.Job();
    job.setId(GUIDS[index]);
    job.setDescription(DESCRIPTIONS[index]);
    job.setExternal(true);
    job.setAutoCleared(true);
    job.setStartTime(new Date());
    return job;
}
Also used : Job(org.ovirt.engine.api.model.Job) Date(java.util.Date)

Example 2 with Job

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

the class BackendJobsResourceTest method testAddJob.

@Test
public void testAddJob() throws Exception {
    setUriInfo(setUpBasicUriExpectations());
    setUpCreationExpectations(ActionType.AddExternalJob, AddExternalJobParameters.class, new String[] { "Description" }, new Object[] { DESCRIPTIONS[0] }, true, true, GUIDS[0], QueryType.GetJobByJobId, IdQueryParameters.class, new String[] { "Id" }, new Object[] { GUIDS[0] }, getEntity(0));
    Job model = new Job();
    model.setDescription(DESCRIPTIONS[0]);
    Response response = collection.add(model);
    assertEquals(201, response.getStatus());
    assertTrue(response.getEntity() instanceof Job);
    verifyModel((Job) response.getEntity(), 0);
}
Also used : Response(javax.ws.rs.core.Response) Job(org.ovirt.engine.api.model.Job) Test(org.junit.Test)

Example 3 with Job

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

the class BackendResource method setJobLink.

protected void setJobLink(final Action action, ActionReturnValue actionResult) {
    Job job = new Job();
    job.setId(actionResult.getJobId().toString());
    LinkHelper.addLinks(job, null, false);
    action.setJob(job);
}
Also used : Job(org.ovirt.engine.api.model.Job)

Example 4 with Job

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

the class GlusterTaskStatisticalQueryTest method getParent.

private Step getParent() {
    Step step = new Step();
    step.setId(Guid.Empty.toString());
    step.setJob(new Job());
    step.getJob().setId(Guid.Empty.toString());
    return step;
}
Also used : Step(org.ovirt.engine.api.model.Step) Job(org.ovirt.engine.api.model.Job)

Example 5 with Job

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

the class StepStatisticalQuery method clone.

private Step clone(Step step) {
    // Needed to avoid NPE in LinkHelper due to unsetting of grandparent in LinkHelper#addLinks.
    Step cloned = new Step();
    cloned.setId(step.getId());
    cloned.setJob(new Job());
    cloned.getJob().setId(step.getJob().getId());
    return cloned;
}
Also used : Step(org.ovirt.engine.api.model.Step) Job(org.ovirt.engine.api.model.Job)

Aggregations

Job (org.ovirt.engine.api.model.Job)10 Step (org.ovirt.engine.api.model.Step)4 Date (java.util.Date)2 Response (javax.ws.rs.core.Response)2 Test (org.junit.Test)2 User (org.ovirt.engine.api.model.User)1