use of uk.gov.gchq.gaffer.operation.OperationException 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());
}
}
use of uk.gov.gchq.gaffer.operation.OperationException in project Gaffer by gchq.
the class GetElementsinRangesHandlerTest method setupGraph.
private static void setupGraph(final AccumuloStore store, final int numEntries) {
final List<Element> elements = new ArrayList<>();
for (int i = 0; i < numEntries; i++) {
String s = "" + i;
while (s.length() < 4) {
s = "0" + s;
}
final Edge edge = new Edge(TestGroups.EDGE);
edge.setSource(s);
edge.putProperty(AccumuloPropertyNames.COLUMN_QUALIFIER, 1);
edge.setDestination("B");
edge.setDirected(true);
elements.add(edge);
final Edge edge2 = new Edge(TestGroups.EDGE);
edge2.setSource(s);
edge2.putProperty(AccumuloPropertyNames.COLUMN_QUALIFIER, 3);
edge2.setDestination("B");
edge2.setDirected(true);
elements.add(edge2);
final Edge edge3 = new Edge(TestGroups.EDGE);
edge3.setSource(s);
edge3.putProperty(AccumuloPropertyNames.COLUMN_QUALIFIER, 5);
edge3.setDestination("B");
edge3.setDirected(true);
elements.add(edge3);
}
try {
store.execute(new AddElements(elements), user);
} catch (OperationException e) {
fail("Couldn't add element: " + e);
}
}
use of uk.gov.gchq.gaffer.operation.OperationException in project Gaffer by gchq.
the class AccumuloSingleIDRetrieverTest method setupGraph.
private static void setupGraph(final AccumuloStore store, final int numEntries) {
final List<Element> elements = new ArrayList<>();
for (int i = 0; i < numEntries; i++) {
final Entity entity = new Entity(TestGroups.ENTITY);
entity.setVertex("" + i);
final Edge edge = new Edge(TestGroups.EDGE);
edge.setSource("" + i);
edge.setDestination("B");
edge.setDirected(false);
final Edge edge2 = new Edge(TestGroups.EDGE);
edge2.setSource("" + i);
edge2.setDestination("C");
edge2.setDirected(true);
elements.add(edge);
elements.add(edge2);
elements.add(entity);
}
try {
store.execute(new AddElements(elements), new User());
} catch (OperationException e) {
fail("Couldn't add element: " + e);
}
}
Aggregations