Search in sources :

Example 1 with Builder

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

the class GetWalksIT method shouldGetPathsWithWhile.

@Test
public void shouldGetPathsWithWhile() throws Exception {
    // Given
    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 Builder().input(seedA).operations(new While.Builder<>().conditional(new Conditional(// This will always be true
    new Exists(), new Map.Builder<>().first(new AssertEntityIdsUnwrapped()).build())).operation(operation).maxRepeats(2).build()).build();
    // When
    final Iterable<Walk> results = graph.execute(op, getUser());
    // Then
    assertThat(getPaths(results)).isEqualTo("AED,ABC");
}
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) Conditional(uk.gov.gchq.gaffer.operation.util.Conditional) View(uk.gov.gchq.gaffer.data.elementdefinition.view.View) Exists(uk.gov.gchq.koryphe.impl.predicate.Exists) HashMap(java.util.HashMap) Map(uk.gov.gchq.gaffer.operation.impl.Map) Test(org.junit.Test)

Aggregations

HashMap (java.util.HashMap)1 Test (org.junit.Test)1 View (uk.gov.gchq.gaffer.data.elementdefinition.view.View)1 ViewElementDefinition (uk.gov.gchq.gaffer.data.elementdefinition.view.ViewElementDefinition)1 Walk (uk.gov.gchq.gaffer.data.graph.Walk)1 GetWalks (uk.gov.gchq.gaffer.operation.impl.GetWalks)1 Builder (uk.gov.gchq.gaffer.operation.impl.GetWalks.Builder)1 Map (uk.gov.gchq.gaffer.operation.impl.Map)1 GetElements (uk.gov.gchq.gaffer.operation.impl.get.GetElements)1 Conditional (uk.gov.gchq.gaffer.operation.util.Conditional)1 Exists (uk.gov.gchq.koryphe.impl.predicate.Exists)1