use of uk.gov.gchq.gaffer.operation.impl.get.GetElements in project Gaffer by gchq.
the class BloomFilterIT method seek.
private void seek(final FileSKVIterator reader, final EntityId seed, final RangeFactory rangeFactory) throws IOException, RangeFactoryException {
final GetElements operation = new GetElements.Builder().view(new View.Builder().edge(TestGroups.EDGE).entity(TestGroups.ENTITY).build()).build();
final List<Range> range = rangeFactory.getRange(seed, operation);
for (final Range ran : range) {
reader.seek(ran, new ArrayList<>(), false);
}
}
use of uk.gov.gchq.gaffer.operation.impl.get.GetElements in project Gaffer by gchq.
the class GetElementsHandlerTest method shouldNotReturnDeletedElements.
@Test
public void shouldNotReturnDeletedElements() {
// Given
final GetElementsHandler handler = new GetElementsHandler();
final GetElements op = new GetElements.Builder().build();
// When / Then
assertThatExceptionOfType(OperationException.class).isThrownBy(() -> handler.doOperation(op, new Context(), null)).withMessageContaining("Operation input is undefined - please specify an input.");
}
use of uk.gov.gchq.gaffer.operation.impl.get.GetElements in project Gaffer by gchq.
the class AccumuloAggregationIT method shouldHandleAggregationWhenAllColumnQualifierPropertiesAreGroupByProperties.
@Test
public void shouldHandleAggregationWhenAllColumnQualifierPropertiesAreGroupByProperties() throws OperationException, UnsupportedEncodingException {
final Graph graph = createGraphNoVisibility();
final Entity entity1 = new Entity.Builder().vertex(VERTEX).group(TestGroups.ENTITY).property(AccumuloPropertyNames.COLUMN_QUALIFIER, "test 3").property(AccumuloPropertyNames.COLUMN_QUALIFIER_2, "test 4").build();
final Entity entity2 = new Entity.Builder().vertex(VERTEX).group(TestGroups.ENTITY).property(AccumuloPropertyNames.COLUMN_QUALIFIER, "test 3").property(AccumuloPropertyNames.COLUMN_QUALIFIER_2, "test 4").build();
graph.execute(new AddElements.Builder().input(entity1, entity2).build(), user);
// Given
final GetElements getElements = new GetElements.Builder().input(new EntitySeed(VERTEX)).view(new View.Builder().entity(TestGroups.ENTITY, new ViewElementDefinition.Builder().groupBy(AccumuloPropertyNames.COLUMN_QUALIFIER, AccumuloPropertyNames.COLUMN_QUALIFIER_2).build()).build()).build();
// When
final List<Element> results = Lists.newArrayList(graph.execute(getElements, user));
// Then
assertThat(results).hasSize(1);
final Entity expectedEntity = new Entity.Builder().vertex(VERTEX).group(TestGroups.ENTITY).property(AccumuloPropertyNames.COLUMN_QUALIFIER, "test 3").property(AccumuloPropertyNames.COLUMN_QUALIFIER_2, "test 4").property(AccumuloPropertyNames.COLUMN_QUALIFIER_3, "").property(AccumuloPropertyNames.COLUMN_QUALIFIER_4, "").build();
assertThat(results.get(0)).isEqualTo(expectedEntity);
}
use of uk.gov.gchq.gaffer.operation.impl.get.GetElements in project Gaffer by gchq.
the class AccumuloAggregationIT method shouldHandleAggregationWhenGroupByPropertiesAreNull.
@Test
public void shouldHandleAggregationWhenGroupByPropertiesAreNull() throws OperationException, UnsupportedEncodingException {
final Graph graph = createGraphNoVisibility();
final Entity entity1 = new Entity.Builder().vertex(VERTEX).group(TestGroups.ENTITY).property(AccumuloPropertyNames.COLUMN_QUALIFIER, null).property(AccumuloPropertyNames.COLUMN_QUALIFIER_2, null).property(AccumuloPropertyNames.COLUMN_QUALIFIER_3, null).property(AccumuloPropertyNames.COLUMN_QUALIFIER_4, null).build();
final Entity entity2 = new Entity.Builder().vertex(VERTEX).group(TestGroups.ENTITY).property(AccumuloPropertyNames.COLUMN_QUALIFIER_3, "test 3").property(AccumuloPropertyNames.COLUMN_QUALIFIER_4, "test 4").build();
graph.execute(new AddElements.Builder().input(entity1, entity2).build(), user);
// Given
final GetElements getElements = new GetElements.Builder().input(new EntitySeed(VERTEX)).view(new View.Builder().entity(TestGroups.ENTITY, new ViewElementDefinition.Builder().groupBy().build()).build()).build();
// When
final List<Element> results = Lists.newArrayList(graph.execute(getElements, user));
// Then
assertThat(results).hasSize(1);
final Entity expectedEntity = new Entity.Builder().vertex(VERTEX).group(TestGroups.ENTITY).property(AccumuloPropertyNames.COLUMN_QUALIFIER, // String Aggregation is combining two empty strings -> "",""
",").property(AccumuloPropertyNames.COLUMN_QUALIFIER_2, // String Aggregation is combining two empty strings -> "",""
",").property(AccumuloPropertyNames.COLUMN_QUALIFIER_3, // String Aggregation is combining one empty strings -> "","test 3"
",test 3").property(AccumuloPropertyNames.COLUMN_QUALIFIER_4, // String Aggregation is combining one empty strings -> "","test 4"
",test 4").build();
assertThat(results.get(0)).isEqualTo(expectedEntity);
}
use of uk.gov.gchq.gaffer.operation.impl.get.GetElements in project Gaffer by gchq.
the class AccumuloAggregationIT method shouldHandleAggregationWhenGroupByPropertiesAreNotSet.
@Test
public void shouldHandleAggregationWhenGroupByPropertiesAreNotSet() throws OperationException, UnsupportedEncodingException {
final Graph graph = createGraphNoVisibility();
final Entity entity1 = new Entity.Builder().vertex(VERTEX).group(TestGroups.ENTITY).property(AccumuloPropertyNames.COLUMN_QUALIFIER_3, "test 3").property(AccumuloPropertyNames.COLUMN_QUALIFIER_4, "test 4").build();
final Entity entity2 = new Entity.Builder().vertex(VERTEX).group(TestGroups.ENTITY).property(AccumuloPropertyNames.COLUMN_QUALIFIER_3, "test 3").property(AccumuloPropertyNames.COLUMN_QUALIFIER_4, "test 4").build();
graph.execute(new AddElements.Builder().input(entity1, entity2).build(), user);
// Given
final GetElements getElements = new GetElements.Builder().input(new EntitySeed(VERTEX)).view(new View.Builder().entity(TestGroups.ENTITY, new ViewElementDefinition.Builder().groupBy(AccumuloPropertyNames.COLUMN_QUALIFIER, AccumuloPropertyNames.COLUMN_QUALIFIER_2).build()).build()).build();
// When
final List<Element> results = Lists.newArrayList(graph.execute(getElements, user));
// Then
assertThat(results).hasSize(1);
final Entity expectedEntity = new Entity.Builder().vertex(VERTEX).group(TestGroups.ENTITY).property(AccumuloPropertyNames.COLUMN_QUALIFIER, "").property(AccumuloPropertyNames.COLUMN_QUALIFIER_2, "").property(AccumuloPropertyNames.COLUMN_QUALIFIER_3, "test 3").property(AccumuloPropertyNames.COLUMN_QUALIFIER_4, "test 4").build();
assertThat(results.get(0)).isEqualTo(expectedEntity);
}
Aggregations