Search in sources :

Example 31 with GetWalks

use of uk.gov.gchq.gaffer.operation.impl.GetWalks in project Gaffer by gchq.

the class GetWalksIT method shouldGetPathsWithSimpleGraphHook_1.

@Test
public void shouldGetPathsWithSimpleGraphHook_1() throws Exception {
    // Given
    final AddOperationsToChain graphHook = new AddOperationsToChain();
    graphHook.setEnd(Lists.newArrayList(new Limit.Builder<>().resultLimit(1).build()));
    final GraphConfig config = new GraphConfig.Builder().addHook(graphHook).graphId("integrationTest").build();
    createGraph(config);
    addDefaultElements();
    final GetElements operation = new GetElements.Builder().directedType(DirectedType.DIRECTED).view(new View.Builder().edge(TestGroups.EDGE, new ViewElementDefinition.Builder().properties(TestPropertyNames.COUNT).build()).build()).inOutType(SeededGraphFilters.IncludeIncomingOutgoingType.OUTGOING).build();
    final GetWalks op = new GetWalks.Builder().input(seedA).operations(operation, operation).build();
    // When
    final Iterable<Walk> results = graph.execute(op, getUser());
    // Then
    assertThat(Lists.newArrayList(results)).hasSize(1);
}
Also used : Walk(uk.gov.gchq.gaffer.data.graph.Walk) GetWalks(uk.gov.gchq.gaffer.operation.impl.GetWalks) Builder(uk.gov.gchq.gaffer.operation.impl.GetWalks.Builder) GetElements(uk.gov.gchq.gaffer.operation.impl.get.GetElements) ViewElementDefinition(uk.gov.gchq.gaffer.data.elementdefinition.view.ViewElementDefinition) View(uk.gov.gchq.gaffer.data.elementdefinition.view.View) GraphConfig(uk.gov.gchq.gaffer.graph.GraphConfig) Builder(uk.gov.gchq.gaffer.operation.impl.GetWalks.Builder) AddOperationsToChain(uk.gov.gchq.gaffer.graph.hook.AddOperationsToChain) Test(org.junit.Test)

Aggregations

GetWalks (uk.gov.gchq.gaffer.operation.impl.GetWalks)31 GetElements (uk.gov.gchq.gaffer.operation.impl.get.GetElements)27 Test (org.junit.Test)19 Walk (uk.gov.gchq.gaffer.data.graph.Walk)19 Builder (uk.gov.gchq.gaffer.operation.impl.GetWalks.Builder)19 ViewElementDefinition (uk.gov.gchq.gaffer.data.elementdefinition.view.ViewElementDefinition)17 View (uk.gov.gchq.gaffer.data.elementdefinition.view.View)15 Test (org.junit.jupiter.api.Test)11 OperationChain (uk.gov.gchq.gaffer.operation.OperationChain)9 Conditional (uk.gov.gchq.gaffer.operation.util.Conditional)8 HashMap (java.util.HashMap)5 Operation (uk.gov.gchq.gaffer.operation.Operation)5 If (uk.gov.gchq.gaffer.operation.impl.If)5 IsMoreThan (uk.gov.gchq.koryphe.impl.predicate.IsMoreThan)5 List (java.util.List)4 EntitySeed (uk.gov.gchq.gaffer.operation.data.EntitySeed)4 Limit (uk.gov.gchq.gaffer.operation.impl.Limit)4 LinkedHashMap (java.util.LinkedHashMap)3 GraphConfig (uk.gov.gchq.gaffer.graph.GraphConfig)3 AddOperationsToChain (uk.gov.gchq.gaffer.graph.hook.AddOperationsToChain)3