GetElementsHandler implements OutputOperationHandler<GetElements, CloseableIterable<? extends Element>> { @Override public CloseableIterable<? extends Element> doOperation(final GetElements operation, final Context context, final Store store) throws OperationException { return doOperation(operation, context.getUser(), (AccumuloStore) store); }  @Override CloseableIterable<? extends Element> doOperation(final GetElements operation,
                                                            final Context context, final Store store); CloseableIterable<? extends Element> doOperation(final GetElements operation,
                                                            final User user,
                                                            final AccumuloStore store);  }
@Test public void shouldThrowExceptionIfAnOldOperationOptionIsUsed() throws OperationException, StoreException { final Iterable<EntityId> ids = mock(Iterable.class); final GetElementsHandler handler = new GetElementsHandler(); final GetElements getElements = new GetElements.Builder() .input(ids) .option("accumulostore.operation.return_matched_id_as_edge_source", "true") .build(); try { handler.doOperation(getElements, new Context(), null); fail("Exception expected"); } catch (final IllegalArgumentException e) { assertTrue(e.getMessage().contains("return_matched_id_as_edge_source")); } }
@Test public void shouldFailIfOperationInputIsUndefined() { final GetElementsHandler handler = new GetElementsHandler(); final GetElements op = new GetElements.Builder() .build(); try { handler.doOperation(op, new Context(), null); fail("Exception expected"); } catch (final OperationException e) { assertTrue(e.getMessage().equals("Operation input is undefined - please specify an input.")); } }
@Test public void shouldNotReturnDeletedElements() { final GetElementsHandler handler = new GetElementsHandler(); final GetElements op = new GetElements.Builder() .build(); try { handler.doOperation(op, new Context(), null); fail("Exception expected"); } catch (final OperationException e) { assertTrue(e.getMessage().equals("Operation input is undefined - please specify an input.")); } }