use of org.apache.samza.rest.model.Job in project samza by apache.
the class AbstractJobProxy method getAllJobStatuses.
@Override
public List<Job> getAllJobStatuses() throws IOException, InterruptedException {
List<Job> allJobs = new ArrayList<>();
Collection<JobInstance> jobInstances = getAllJobInstances();
for (JobInstance jobInstance : jobInstances) {
allJobs.add(new Job(jobInstance.getJobName(), jobInstance.getJobId()));
}
getJobStatusProvider().getJobStatuses(allJobs);
return allJobs;
}
use of org.apache.samza.rest.model.Job in project samza by apache.
the class MockJobStatusProvider method getJobStatus.
@Override
public Job getJobStatus(JobInstance jobInstance) throws IOException, InterruptedException {
Job info = new Job(jobInstance.getJobName(), jobInstance.getJobId());
setStatusStarted(info);
return info;
}
use of org.apache.samza.rest.model.Job in project samza by apache.
the class TestJobsResource method testGetJob.
@Test
public void testGetJob() throws IOException {
Response resp = target(String.format("v1/jobs/%s/%s", MockJobProxy.JOB_INSTANCE_2_NAME, MockJobProxy.JOB_INSTANCE_2_ID)).request().get();
assertEquals(200, resp.getStatus());
final Job job2 = objectMapper.readValue(resp.readEntity(String.class), Job.class);
assertEquals(MockJobProxy.JOB_INSTANCE_2_NAME, job2.getJobName());
assertEquals(MockJobProxy.JOB_INSTANCE_2_ID, job2.getJobId());
assertStatusNotDefault(job2);
resp.close();
}
use of org.apache.samza.rest.model.Job in project samza by apache.
the class TestJobsResource method testStartJob.
@Test
public void testStartJob() throws IOException {
Response resp = target(String.format("v1/jobs/%s/%s", MockJobProxy.JOB_INSTANCE_2_NAME, MockJobProxy.JOB_INSTANCE_2_ID)).queryParam("status", "started").request().put(Entity.form(new Form()));
assertEquals(202, resp.getStatus());
final Job job2 = objectMapper.readValue(resp.readEntity(String.class), Job.class);
assertEquals(MockJobProxy.JOB_INSTANCE_2_NAME, job2.getJobName());
assertEquals(MockJobProxy.JOB_INSTANCE_2_ID, job2.getJobId());
assertStatusNotDefault(job2);
resp.close();
}
Aggregations