Search in sources :

Example 11 with IsIn

use of uk.gov.gchq.koryphe.impl.predicate.IsIn in project Gaffer by gchq.

the class GetAllElementsIT method shouldGetAllElementsWithFilterWithoutSummarisation.

@Test
@TraitRequirement(StoreTrait.PRE_AGGREGATION_FILTERING)
public void shouldGetAllElementsWithFilterWithoutSummarisation() throws Exception {
    final Edge edge1 = getEdges().get(new EdgeSeed(SOURCE_1, DEST_1, false)).emptyClone();
    edge1.putProperty(TestPropertyNames.INT, 100);
    edge1.putProperty(TestPropertyNames.COUNT, 1L);
    final Edge edge2 = edge1.emptyClone();
    edge2.putProperty(TestPropertyNames.INT, 101);
    edge2.putProperty(TestPropertyNames.COUNT, 1L);
    graph.execute(new AddElements.Builder().input(edge1, edge2).build(), getUser());
    final GetAllElements op = new GetAllElements.Builder().view(new View.Builder().edge(TestGroups.EDGE, new ViewElementDefinition.Builder().preAggregationFilter(new ElementFilter.Builder().select(TestPropertyNames.INT).execute(new IsIn(Arrays.asList((Object) 100, 101))).build()).build()).build()).build();
    // When
    final CloseableIterable<? extends Element> results = graph.execute(op, getUser());
    // Then
    final List<Element> resultList = Lists.newArrayList(results);
    assertThat(resultList).hasSize(2).contains((Element) edge1, edge2);
}
Also used : AddElements(uk.gov.gchq.gaffer.operation.impl.add.AddElements) Element(uk.gov.gchq.gaffer.data.element.Element) IsIn(uk.gov.gchq.koryphe.impl.predicate.IsIn) EdgeSeed(uk.gov.gchq.gaffer.operation.data.EdgeSeed) ElementFilter(uk.gov.gchq.gaffer.data.element.function.ElementFilter) GetAllElements(uk.gov.gchq.gaffer.operation.impl.get.GetAllElements) Edge(uk.gov.gchq.gaffer.data.element.Edge) Test(org.junit.Test) TraitRequirement(uk.gov.gchq.gaffer.integration.TraitRequirement)

Aggregations

IsIn (uk.gov.gchq.koryphe.impl.predicate.IsIn)11 ElementFilter (uk.gov.gchq.gaffer.data.element.function.ElementFilter)8 Edge (uk.gov.gchq.gaffer.data.element.Edge)6 Test (org.junit.Test)5 Element (uk.gov.gchq.gaffer.data.element.Element)4 ViewElementDefinition (uk.gov.gchq.gaffer.data.elementdefinition.view.ViewElementDefinition)4 TraitRequirement (uk.gov.gchq.gaffer.integration.TraitRequirement)4 AddElements (uk.gov.gchq.gaffer.operation.impl.add.AddElements)4 Test (org.junit.jupiter.api.Test)3 EntitySeed (uk.gov.gchq.gaffer.operation.data.EntitySeed)3 GetAllElements (uk.gov.gchq.gaffer.operation.impl.get.GetAllElements)3 Schema (uk.gov.gchq.gaffer.store.schema.Schema)3 ArrayList (java.util.ArrayList)2 List (java.util.List)2 CloseableIterable (uk.gov.gchq.gaffer.commonutil.iterable.CloseableIterable)2 View (uk.gov.gchq.gaffer.data.elementdefinition.view.View)2 EdgeSeed (uk.gov.gchq.gaffer.operation.data.EdgeSeed)2 GetElements (uk.gov.gchq.gaffer.operation.impl.get.GetElements)2 Builder (uk.gov.gchq.gaffer.user.User.Builder)2 IsEqual (uk.gov.gchq.koryphe.impl.predicate.IsEqual)2