use of uk.gov.gchq.gaffer.operation.OperationChain.Builder in project Gaffer by gchq.
the class CountGroupsIT method shouldCountGroupsOfElementsWhenLessElementsThanLimit.
@Test
public void shouldCountGroupsOfElementsWhenLessElementsThanLimit() throws OperationException, InterruptedException {
// Given
final User user = new User();
final Integer limit = getEntities().size() + getEdges().size() + 1;
final Entity entity = new Entity(TestGroups.ENTITY_2, VERTEX);
entity.putProperty(TestPropertyNames.INT, 100);
// When
final GroupCounts counts = graph.execute(new Builder().first(new GetAllElements<>()).then(new CountGroups(limit)).build(), user);
// Then
assertEquals(1, counts.getEntityGroups().size());
assertEquals(getEntities().size(), (int) counts.getEntityGroups().get(TestGroups.ENTITY));
assertEquals(1, counts.getEdgeGroups().size());
assertEquals(getEdges().size(), (int) counts.getEdgeGroups().get(TestGroups.EDGE));
assertFalse(counts.isLimitHit());
}
use of uk.gov.gchq.gaffer.operation.OperationChain.Builder in project Gaffer by gchq.
the class CountGroupsIT method shouldCountGroupsOfElements.
@Test
public void shouldCountGroupsOfElements() throws OperationException, InterruptedException {
// Given
final User user = new User();
final Entity entity = new Entity(TestGroups.ENTITY_2, VERTEX);
entity.putProperty(TestPropertyNames.INT, 100);
// When
final GroupCounts counts = graph.execute(new Builder().first(new GetAllElements<>()).then(new CountGroups()).build(), user);
// Then
assertEquals(1, counts.getEntityGroups().size());
assertEquals(getEntities().size(), (int) counts.getEntityGroups().get(TestGroups.ENTITY));
assertEquals(1, counts.getEdgeGroups().size());
assertEquals(getEdges().size(), (int) counts.getEdgeGroups().get(TestGroups.EDGE));
assertFalse(counts.isLimitHit());
}
Aggregations