use of uk.gov.gchq.gaffer.accumulostore.operation.impl.GetElementsWithinSet in project Gaffer by gchq.
the class GetElementsWithinSetHandlerTest method shouldSummarise.
private void shouldSummarise(final AccumuloStore store) throws OperationException {
final View view = new View.Builder(defaultView).entity(TestGroups.ENTITY, new ViewElementDefinition.Builder().groupBy().build()).edge(TestGroups.EDGE, new ViewElementDefinition.Builder().groupBy().build()).edge(TestGroups.EDGE_2, new ViewElementDefinition.Builder().groupBy().build()).build();
final GetElementsWithinSet<Element> operation = new GetElementsWithinSet<>(view, seeds);
final GetElementsWithinSetHandler handler = new GetElementsWithinSetHandler();
final CloseableIterable<Element> elements = handler.doOperation(operation, user, store);
//After query compaction the result size should be 3
assertEquals(3, Iterables.size(elements));
assertThat(elements, IsCollectionContaining.hasItems(expectedSummarisedEdge, expectedEntity1, expectedEntity2));
elements.close();
}
use of uk.gov.gchq.gaffer.accumulostore.operation.impl.GetElementsWithinSet in project Gaffer by gchq.
the class GetElementsWithinSetHandlerTest method shouldReturnOnlyEdgesWhenOptionSet.
private void shouldReturnOnlyEdgesWhenOptionSet(final AccumuloStore store) throws OperationException {
final View view = new View.Builder(defaultView).entity(TestGroups.ENTITY, new ViewElementDefinition.Builder().groupBy().build()).edge(TestGroups.EDGE, new ViewElementDefinition.Builder().groupBy().build()).edge(TestGroups.EDGE_2, new ViewElementDefinition.Builder().groupBy().build()).build();
final GetElementsWithinSet<Element> operation = new GetElementsWithinSet<>(view, seeds);
operation.setIncludeEntities(false);
final GetElementsWithinSetHandler handler = new GetElementsWithinSetHandler();
final CloseableIterable<Element> elements = handler.doOperation(operation, user, store);
final Collection<Element> forTest = new LinkedList<>();
Iterables.addAll(forTest, elements);
//After query compaction the result size should be 1
assertEquals(1, Iterables.size(elements));
assertThat(elements, IsCollectionContaining.hasItem(expectedSummarisedEdge));
elements.close();
}
Aggregations