Search in sources :

Example 11 with GetAllElements

use of uk.gov.gchq.gaffer.operation.impl.get.GetAllElements 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());
}
Also used : Entity(uk.gov.gchq.gaffer.data.element.Entity) User(uk.gov.gchq.gaffer.user.User) CountGroups(uk.gov.gchq.gaffer.operation.impl.CountGroups) Builder(uk.gov.gchq.gaffer.operation.OperationChain.Builder) GetAllElements(uk.gov.gchq.gaffer.operation.impl.get.GetAllElements) GroupCounts(uk.gov.gchq.gaffer.data.GroupCounts) Test(org.junit.Test)

Aggregations

GetAllElements (uk.gov.gchq.gaffer.operation.impl.get.GetAllElements)11 Test (org.junit.Test)8 GroupCounts (uk.gov.gchq.gaffer.data.GroupCounts)5 CountGroups (uk.gov.gchq.gaffer.operation.impl.CountGroups)5 Response (javax.ws.rs.core.Response)4 Element (uk.gov.gchq.gaffer.data.element.Element)4 Entity (uk.gov.gchq.gaffer.data.element.Entity)4 Builder (uk.gov.gchq.gaffer.operation.OperationChain.Builder)3 User (uk.gov.gchq.gaffer.user.User)3 IteratorSettingBuilder (uk.gov.gchq.gaffer.accumulostore.utils.IteratorSettingBuilder)2 IncludeEdgeType (uk.gov.gchq.gaffer.operation.GetOperation.IncludeEdgeType)2 IncludeIncomingOutgoingType (uk.gov.gchq.gaffer.operation.GetOperation.IncludeIncomingOutgoingType)2 ArrayList (java.util.ArrayList)1 ChunkedInput (org.glassfish.jersey.client.ChunkedInput)1 Edge (uk.gov.gchq.gaffer.data.element.Edge)1 View (uk.gov.gchq.gaffer.data.elementdefinition.view.View)1 TraitRequirement (uk.gov.gchq.gaffer.integration.TraitRequirement)1 ElementSeed (uk.gov.gchq.gaffer.operation.data.ElementSeed)1