use of uk.gov.gchq.gaffer.operation.impl.job.CancelScheduledJob in project Gaffer by gchq.
the class CancelScheduledJobTest method builderShouldCreatePopulatedOperation.
@Test
@Override
public void builderShouldCreatePopulatedOperation() {
// Given
CancelScheduledJob op = new CancelScheduledJob.Builder().jobId(testJobId).option("testOp", "testOpVal").build();
// Then
assertEquals(testJobId, op.getJobId());
assertEquals(Collections.singletonMap("testOp", "testOpVal"), op.getOptions());
}
use of uk.gov.gchq.gaffer.operation.impl.job.CancelScheduledJob in project Gaffer by gchq.
the class CancelScheduledJobTest method shouldShallowCloneOperation.
@Test
@Override
public void shouldShallowCloneOperation() {
// Given
CancelScheduledJob op = new CancelScheduledJob.Builder().jobId(testJobId).option("testOp", "testOpVal").build();
// When
CancelScheduledJob clonedOp = op.shallowClone();
// Then
assertNotSame(clonedOp, op);
assertEquals(clonedOp.getJobId(), op.getJobId());
assertEquals(clonedOp.getOptions(), op.getOptions());
}
use of uk.gov.gchq.gaffer.operation.impl.job.CancelScheduledJob in project Gaffer by gchq.
the class CancelScheduledJobHandlerTest method shouldThrowExceptionIfJobTrackerIsNotConfigured.
@Test
public void shouldThrowExceptionIfJobTrackerIsNotConfigured() {
// Given
final CancelScheduledJobHandler handler = new CancelScheduledJobHandler();
final CancelScheduledJob operation = mock(CancelScheduledJob.class);
final Store store = mock(Store.class);
final User user = mock(User.class);
given(store.getJobTracker()).willReturn(null);
// When / Then
assertThatExceptionOfType(OperationException.class).isThrownBy(() -> handler.doOperation(operation, new Context(user), store)).withMessage("JobTracker not enabled");
}
use of uk.gov.gchq.gaffer.operation.impl.job.CancelScheduledJob 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");
}
Aggregations