Search in sources :

Example 1 with GetElementsWithinSet

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();
}
Also used : Element(uk.gov.gchq.gaffer.data.element.Element) ViewElementDefinition(uk.gov.gchq.gaffer.data.elementdefinition.view.ViewElementDefinition) GetElementsWithinSet(uk.gov.gchq.gaffer.accumulostore.operation.impl.GetElementsWithinSet) View(uk.gov.gchq.gaffer.data.elementdefinition.view.View)

Example 2 with GetElementsWithinSet

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();
}
Also used : Element(uk.gov.gchq.gaffer.data.element.Element) ViewElementDefinition(uk.gov.gchq.gaffer.data.elementdefinition.view.ViewElementDefinition) GetElementsWithinSet(uk.gov.gchq.gaffer.accumulostore.operation.impl.GetElementsWithinSet) View(uk.gov.gchq.gaffer.data.elementdefinition.view.View) LinkedList(java.util.LinkedList)

Aggregations

GetElementsWithinSet (uk.gov.gchq.gaffer.accumulostore.operation.impl.GetElementsWithinSet)2 Element (uk.gov.gchq.gaffer.data.element.Element)2 View (uk.gov.gchq.gaffer.data.elementdefinition.view.View)2 ViewElementDefinition (uk.gov.gchq.gaffer.data.elementdefinition.view.ViewElementDefinition)2 LinkedList (java.util.LinkedList)1