use of uk.gov.gchq.gaffer.jobtracker.JobTracker in project Gaffer by gchq.
the class CancelScheduledJobHandlerTest method shouldThrowExceptionWithNoJobId.
@Test
public void shouldThrowExceptionWithNoJobId() {
// Given
CancelScheduledJob operation = new CancelScheduledJob.Builder().jobId(null).build();
CancelScheduledJobHandler handler = new CancelScheduledJobHandler();
final Store store = mock(Store.class);
final User user = mock(User.class);
given(store.getJobTracker()).willReturn(new JobTracker());
// When / Then
assertThatExceptionOfType(OperationException.class).isThrownBy(() -> handler.doOperation(operation, new Context(user), store)).withMessage("job id must be specified");
}
use of uk.gov.gchq.gaffer.jobtracker.JobTracker in project Gaffer by gchq.
the class GetJobDetailsHandlerTest method shouldGetJobDetailsByDelegatingToJobTrackerWithOperationJobId.
@Test
public void shouldGetJobDetailsByDelegatingToJobTrackerWithOperationJobId() throws OperationException {
// Given
final String jobId = "jobId";
final GetJobDetailsHandler handler = new GetJobDetailsHandler();
final GetJobDetails operation = new GetJobDetails.Builder().jobId(jobId).build();
final Store store = mock(Store.class);
final JobTracker jobTracker = mock(JobTracker.class);
final User user = mock(User.class);
final JobDetail jobsDetail = mock(JobDetail.class);
final Context context = new Context(user);
given(store.getJobTracker()).willReturn(jobTracker);
given(jobTracker.getJob(jobId, user)).willReturn(jobsDetail);
// When
final JobDetail result = handler.doOperation(operation, context, store);
// Then
assertSame(jobsDetail, result);
}
Aggregations