use of uk.gov.gchq.gaffer.operation.io.Output in project Gaffer by gchq.
the class GetElementsInRangesHandlerTest method shouldHaveNoIncomingEdges.
private void shouldHaveNoIncomingEdges(final AccumuloStore store) throws OperationException {
// Given - get everything between 0 and 1 (Note we are using strings and string serialisers, with this ordering 0999 is before 1)
final Set<Pair<ElementId, ElementId>> simpleEntityRanges = new HashSet<>();
simpleEntityRanges.add(new Pair<>(new EntitySeed("0"), new EntitySeed("1")));
final View view = new View.Builder(defaultView).entity(TestGroups.ENTITY, new ViewElementDefinition.Builder().groupBy().build()).edge(TestGroups.EDGE, new ViewElementDefinition.Builder().groupBy().build()).build();
// all Edges stored should be incoming from our provided seeds.
final Output operation = createOperation(simpleEntityRanges, view, IncludeIncomingOutgoingType.INCOMING, DirectedType.EITHER);
// When
final List<Element> results = executeOperation(operation, store);
// Then - should be no incoming edges in the provided range
assertThat(results).isEmpty();
}
use of uk.gov.gchq.gaffer.operation.io.Output in project Gaffer by gchq.
the class GetElementsInRangesHandlerTest method shouldReturnNothingWhenNoEdgesSet.
private void shouldReturnNothingWhenNoEdgesSet(final AccumuloStore store) throws OperationException {
// Given - get everything between 0 and 1 (Note we are using strings and string serialisers, with this ordering 0999 is before 1)
final Set<Pair<ElementId, ElementId>> simpleEntityRanges = new HashSet<>();
simpleEntityRanges.add(new Pair<>(new EntitySeed("0"), new EntitySeed("1")));
final View view = new View.Builder(defaultView).entity(TestGroups.ENTITY, new ViewElementDefinition.Builder().groupBy().build()).edge(TestGroups.EDGE, new ViewElementDefinition.Builder().groupBy().build()).build();
final Output operation = createOperation(simpleEntityRanges, view, IncludeIncomingOutgoingType.EITHER, DirectedType.UNDIRECTED);
// When
final List<Element> results = executeOperation(operation, store);
// Then - there should be no undirected edges in the provided range
assertThat(results).isEmpty();
}
use of uk.gov.gchq.gaffer.operation.io.Output in project Gaffer by gchq.
the class GetElementsInRangesHandlerTest method shouldReturnElementsNoSummarisation.
private void shouldReturnElementsNoSummarisation(final AccumuloStore store) throws OperationException {
// Given - everything between 0 and 1 (Note we are using strings and string serialisers, with this ordering 0999 is before 1)
final Set<Pair<ElementId, ElementId>> simpleEntityRanges = new HashSet<>();
simpleEntityRanges.add(new Pair<>(new EntitySeed("0"), new EntitySeed("1")));
final Output operation = createOperation(simpleEntityRanges, defaultView, IncludeIncomingOutgoingType.EITHER, DirectedType.EITHER);
// When
List<Element> results = executeOperation(operation, store);
// Then - each Edge was put in 3 times with different col qualifiers, without summarisation we expect this number
ElementUtil.assertElementEquals(createElements(NUM_ENTRIES), results);
// Given - this should get everything between 0 and 0799 (again being string ordering 0800 is more than 08)
simpleEntityRanges.clear();
simpleEntityRanges.add(new Pair<>(new EntitySeed("0"), new EntitySeed("08")));
// When
results = executeOperation(operation, store);
// Then - each Edge was put in 3 times with different col qualifiers, without summarisation we expect this number
ElementUtil.assertElementEquals(createElements(800), results);
}
use of uk.gov.gchq.gaffer.operation.io.Output in project Gaffer by gchq.
the class GetElementsInRangesHandlerTest method shouldSummariseOutGoingEdgesOnly.
private void shouldSummariseOutGoingEdgesOnly(final AccumuloStore store) throws OperationException {
// Given - get everything between 0 and 1 (Note we are using strings and string serialisers, with this ordering 0999 is before 1)
final Set<Pair<ElementId, ElementId>> simpleEntityRanges = new HashSet<>();
simpleEntityRanges.add(new Pair<>(new EntitySeed("0"), new EntitySeed("C")));
final View view = new View.Builder(defaultView).entity(TestGroups.ENTITY, new ViewElementDefinition.Builder().groupBy().build()).edge(TestGroups.EDGE, new ViewElementDefinition.Builder().groupBy().build()).build();
// all Edges stored should be outgoing from our provided seeds.
final Output operation = createOperation(simpleEntityRanges, view, IncludeIncomingOutgoingType.OUTGOING, DirectedType.EITHER);
// When
List<Element> results = executeOperation(operation, store);
// Then
ElementUtil.assertElementEquals(createSummarisedElements(NUM_ENTRIES), results);
// Given - this should get everything between 0 and 0799 (again being string ordering 0800 is more than 08)
simpleEntityRanges.clear();
simpleEntityRanges.add(new Pair<>(new EntitySeed("0"), new EntitySeed("08")));
// When
results = executeOperation(operation, store);
// Then
ElementUtil.assertElementEquals(createSummarisedElements(800), results);
}
use of uk.gov.gchq.gaffer.operation.io.Output 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