use of uk.gov.gchq.gaffer.commonutil.iterable.EmptyClosableIterable in project Gaffer by gchq.
the class AbstractOperationsTest method shouldThrowUnsupportedTraitExceptionWithPostAggregationFiltering.
@Test
public void shouldThrowUnsupportedTraitExceptionWithPostAggregationFiltering() throws OperationException {
// Given
final Graph graph = createGraph();
final List<Element> elements = getInputDataForGetAllElementsTest();
graph.execute(new AddElements.Builder().input(elements).build(), user);
final View view = new View.Builder().edge(TestGroups.EDGE, new ViewElementDefinition.Builder().postAggregationFilter(new ElementFilter.Builder().select("double").execute(new IsEqual(2.0)).build()).build()).build();
// When / Then
assertThatIllegalArgumentException().isThrownBy(() -> graph.execute(new GetElements.Builder().input(new EmptyClosableIterable<>()).view(view).build(), user)).withMessageContaining("POST_AGGREGATION_FILTERING");
}
use of uk.gov.gchq.gaffer.commonutil.iterable.EmptyClosableIterable in project Gaffer by gchq.
the class AbstractOperationsTest method shouldThrowUnsupportedTraitExceptionWithPostTransformFiltering.
@Test
public void shouldThrowUnsupportedTraitExceptionWithPostTransformFiltering() throws OperationException {
// Given
final Graph graph = createGraph();
final List<Element> elements = getInputDataForGetAllElementsTest();
graph.execute(new AddElements.Builder().input(elements).build(), user);
final View view = new View.Builder().edge(TestGroups.EDGE, new ViewElementDefinition.Builder().postTransformFilter(new ElementFilter.Builder().select("double").execute(new IsEqual(2.0)).build()).build()).build();
// When / Then
assertThatIllegalArgumentException().isThrownBy(() -> graph.execute(new GetElements.Builder().input(new EmptyClosableIterable<>()).view(view).build(), user)).withMessageContaining("POST_TRANSFORMATION_FILTERING");
}
use of uk.gov.gchq.gaffer.commonutil.iterable.EmptyClosableIterable in project Gaffer by gchq.
the class GetElementsHandlerTest method testGetElementsWhenNoEntityIdsProvided.
@Test
public void testGetElementsWhenNoEntityIdsProvided() throws OperationException {
// Given
final Graph graph = GetAllElementsHandlerTest.getGraph();
final AddElements addElements = new AddElements.Builder().input(getElements()).build();
graph.execute(addElements, new User());
// When
final GetElements getElements = new GetElements.Builder().input(new EmptyClosableIterable<>()).build();
final CloseableIterable<? extends Element> results = graph.execute(getElements, new User());
// Then
final Set<Element> resultsSet = new HashSet<>();
Streams.toStream(results).forEach(resultsSet::add);
assertEquals(Collections.emptySet(), resultsSet);
}
Aggregations