use of uk.gov.gchq.gaffer.federatedstore.operation.handler.FederatedAggregateHandler in project Gaffer by gchq.
the class FederatedAggregateHandlerTest method shouldDelegateToHandler.
@Test
public void shouldDelegateToHandler() throws OperationException {
// Given
final FederatedStore store = mock(FederatedStore.class);
final AggregateHandler handler = mock(AggregateHandler.class);
final Aggregate op = mock(Aggregate.class);
final Context context = mock(Context.class);
final Iterable expectedResult = mock(Iterable.class);
final Schema schema = mock(Schema.class);
given(store.getSchema(op, context)).willReturn(schema);
given(handler.doOperation(op, schema)).willReturn(expectedResult);
final FederatedAggregateHandler federatedHandler = new FederatedAggregateHandler(handler);
// When
final Object result = federatedHandler.doOperation(op, context, store);
// Then
assertSame(expectedResult, result);
verify(handler).doOperation(op, schema);
}
use of uk.gov.gchq.gaffer.federatedstore.operation.handler.FederatedAggregateHandler in project Gaffer by gchq.
the class FederatedStore method addAdditionalOperationHandlers.
@Override
protected void addAdditionalOperationHandlers() {
// Override the Operations that don't have an output
getSupportedOperations().stream().filter(op -> !Output.class.isAssignableFrom(op) && !AddElements.class.equals(op) && !AddNamedOperation.class.equals(op) && !AddNamedView.class.equals(op)).forEach(op -> addOperationHandler(op, new FederatedOperationHandler()));
addOperationHandler(GetSchema.class, new FederatedGetSchemaHandler());
addOperationHandler(Filter.class, new FederatedFilterHandler());
addOperationHandler(Aggregate.class, new FederatedAggregateHandler());
addOperationHandler(Transform.class, new FederatedTransformHandler());
addOperationHandler(Validate.class, new FederatedValidateHandler());
addOperationHandler(GetAllGraphIds.class, new FederatedGetAllGraphIDHandler());
addOperationHandler(AddGraph.class, new FederatedAddGraphHandler());
addOperationHandler(AddGraphWithHooks.class, new FederatedAddGraphWithHooksHandler());
addOperationHandler(RemoveGraph.class, new FederatedRemoveGraphHandler());
addOperationHandler(FederatedOperationChain.class, new FederatedOperationChainHandler());
addOperationHandler(GetTraits.class, new FederatedGetTraitsHandler());
addOperationHandler(GetAllGraphInfo.class, new FederatedGetAllGraphInfoHandler());
addOperationHandler(ChangeGraphAccess.class, new FederatedChangeGraphAccessHandler());
addOperationHandler(ChangeGraphId.class, new FederatedChangeGraphIdHandler());
}
Aggregations