use of uk.gov.gchq.gaffer.operation.impl.job.GetJobDetails in project Gaffer by gchq.
the class GetJobDetailsTest method builderShouldCreatePopulatedOperation.
@Test
@Override
public void builderShouldCreatePopulatedOperation() {
// When
final GetJobDetails op = new GetJobDetails.Builder().jobId("jobId").build();
// Then
assertEquals("jobId", op.getJobId());
}
use of uk.gov.gchq.gaffer.operation.impl.job.GetJobDetails in project Gaffer by gchq.
the class GetJobDetailsExample method getJobDetailsInOperationChain.
public JobDetail getJobDetailsInOperationChain() {
// ---------------------------------------------------------
final OperationChain<JobDetail> opChain = new OperationChain.Builder().first(new GetAllEdges()).then(new GetJobDetails()).build();
// ---------------------------------------------------------
final JobDetail jobDetail = runExample(opChain);
jobId = jobDetail.getJobId();
return jobDetail;
}
use of uk.gov.gchq.gaffer.operation.impl.job.GetJobDetails in project Gaffer by gchq.
the class GetJobResultsExample method runExamples.
@Override
public void runExamples() {
try {
final OperationChain<JobDetail> opChain = new OperationChain.Builder().first(new GetAllEdges()).then(new ExportToGafferResultCache()).then(new GetJobDetails()).build();
final JobDetail jobDetails = getGraph().execute(opChain, new User("user01"));
jobId = jobDetails.getJobId();
} catch (final OperationException e) {
throw new RuntimeException(e);
}
getJobResults();
}
use of uk.gov.gchq.gaffer.operation.impl.job.GetJobDetails 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);
}
use of uk.gov.gchq.gaffer.operation.impl.job.GetJobDetails in project Gaffer by gchq.
the class GetJobDetailsHandlerTest method shouldThrowExceptionIfJobTrackerIsNotConfigured.
@Test
public void shouldThrowExceptionIfJobTrackerIsNotConfigured() {
// Given
final GetJobDetailsHandler handler = new GetJobDetailsHandler();
final GetJobDetails operation = mock(GetJobDetails.class);
final Store store = mock(Store.class);
final User user = mock(User.class);
given(store.getJobTracker()).willReturn(null);
// When / Then
try {
handler.doOperation(operation, new Context(user), store);
fail("Exception expected");
} catch (final OperationException e) {
assertNotNull(e.getMessage());
}
}
Aggregations