Search in sources :

Example 6 with EdgeSeed

use of uk.gov.gchq.gaffer.operation.data.EdgeSeed in project Gaffer by gchq.

the class GetEdgesTest method shouldSerialiseAndDeserialiseOperationWithEdgeSeed.

private void shouldSerialiseAndDeserialiseOperationWithEdgeSeed() throws SerialisationException {
    // Given
    final EdgeSeed seed1 = new EdgeSeed("source1", "destination1", true);
    final EdgeSeed seed2 = new EdgeSeed("source2", "destination2", true);
    final GetEdges op = new GetEdges(Arrays.asList(seed1, seed2));
    // When
    byte[] json = serialiser.serialise(op, true);
    final GetEdges deserialisedOp = serialiser.deserialise(json, GetEdges.class);
    // Then
    final Iterator itr = deserialisedOp.getSeeds().iterator();
    assertEquals(seed1, itr.next());
    assertEquals(seed2, itr.next());
    assertFalse(itr.hasNext());
}
Also used : EdgeSeed(uk.gov.gchq.gaffer.operation.data.EdgeSeed) Iterator(java.util.Iterator)

Example 7 with EdgeSeed

use of uk.gov.gchq.gaffer.operation.data.EdgeSeed in project Gaffer by gchq.

the class GetEdgesTest method shouldSetSeedMatchingTypeToEquals.

@Test
public void shouldSetSeedMatchingTypeToEquals() {
    // Given
    final EdgeSeed seed1 = new EdgeSeed("source1", "destination1", true);
    // When
    final GetEdges op = new GetEdges.Builder<EdgeSeed>().seeds(Collections.singletonList(seed1)).seedMatching(SeedMatchingType.EQUAL).build();
    // Then
    assertEquals(GetOperation.SeedMatchingType.EQUAL, op.getSeedMatching());
}
Also used : EdgeSeed(uk.gov.gchq.gaffer.operation.data.EdgeSeed) OperationTest(uk.gov.gchq.gaffer.operation.OperationTest) Test(org.junit.Test)

Example 8 with EdgeSeed

use of uk.gov.gchq.gaffer.operation.data.EdgeSeed in project Gaffer by gchq.

the class GetEdgesTest method builderShouldCreatePopulatedOperationWithEdgeSeed.

private void builderShouldCreatePopulatedOperationWithEdgeSeed() {
    EdgeSeed seed = new EdgeSeed("A", "B", true);
    GetEdges op = new GetEdges.Builder<>().addSeed(seed).includeEdges(GetOperation.IncludeEdgeType.DIRECTED).inOutType(GetOperation.IncludeIncomingOutgoingType.OUTGOING).option("testOption", "true").populateProperties(true).view(new View.Builder().edge("testEdgeGroup").build()).build();
    assertTrue(op.isPopulateProperties());
    assertNotNull(op.getView());
    assertEquals("true", op.getOption("testOption"));
    assertEquals(GetOperation.IncludeEdgeType.DIRECTED, op.getIncludeEdges());
    assertEquals(GetOperation.IncludeIncomingOutgoingType.OUTGOING, op.getIncludeIncomingOutGoing());
    assertEquals(seed, op.getInput().iterator().next());
}
Also used : EdgeSeed(uk.gov.gchq.gaffer.operation.data.EdgeSeed)

Example 9 with EdgeSeed

use of uk.gov.gchq.gaffer.operation.data.EdgeSeed in project Gaffer by gchq.

the class GetElementsTest method shouldSerialiseAndDeserialiseOperationWithElementSeeds.

private void shouldSerialiseAndDeserialiseOperationWithElementSeeds() throws SerialisationException {
    // Given
    final ElementSeed elementSeed1 = new EntitySeed("identifier");
    final ElementSeed elementSeed2 = new EdgeSeed("source2", "destination2", true);
    final GetElements op = new GetElements(Arrays.asList(elementSeed1, elementSeed2));
    // When
    byte[] json = serialiser.serialise(op, true);
    final GetElements deserialisedOp = serialiser.deserialise(json, GetElements.class);
    // Then
    final Iterator itr = deserialisedOp.getSeeds().iterator();
    assertEquals(elementSeed1, itr.next());
    assertEquals(elementSeed2, itr.next());
    assertFalse(itr.hasNext());
}
Also used : EdgeSeed(uk.gov.gchq.gaffer.operation.data.EdgeSeed) EntitySeed(uk.gov.gchq.gaffer.operation.data.EntitySeed) Iterator(java.util.Iterator) ElementSeed(uk.gov.gchq.gaffer.operation.data.ElementSeed)

Example 10 with EdgeSeed

use of uk.gov.gchq.gaffer.operation.data.EdgeSeed in project Gaffer by gchq.

the class GetElementsTest method shouldSetSeedMatchingTypeToRelated.

@Test
public void shouldSetSeedMatchingTypeToRelated() {
    final ElementSeed elementSeed1 = new EntitySeed("identifier");
    final ElementSeed elementSeed2 = new EdgeSeed("source2", "destination2", true);
    // When
    final GetElements op = new GetElements(Arrays.asList(elementSeed1, elementSeed2));
    // Then
    assertEquals(GetOperation.SeedMatchingType.RELATED, op.getSeedMatching());
}
Also used : EdgeSeed(uk.gov.gchq.gaffer.operation.data.EdgeSeed) EntitySeed(uk.gov.gchq.gaffer.operation.data.EntitySeed) ElementSeed(uk.gov.gchq.gaffer.operation.data.ElementSeed) OperationTest(uk.gov.gchq.gaffer.operation.OperationTest) Test(org.junit.Test)

Aggregations

EdgeSeed (uk.gov.gchq.gaffer.operation.data.EdgeSeed)31 Edge (uk.gov.gchq.gaffer.data.element.Edge)16 Test (org.junit.Test)14 Element (uk.gov.gchq.gaffer.data.element.Element)12 User (uk.gov.gchq.gaffer.user.User)11 ElementSeed (uk.gov.gchq.gaffer.operation.data.ElementSeed)9 View (uk.gov.gchq.gaffer.data.elementdefinition.view.View)8 EntitySeed (uk.gov.gchq.gaffer.operation.data.EntitySeed)8 AddElements (uk.gov.gchq.gaffer.operation.impl.add.AddElements)8 Graph (uk.gov.gchq.gaffer.graph.Graph)7 ViewElementDefinition (uk.gov.gchq.gaffer.data.elementdefinition.view.ViewElementDefinition)6 OperationChain (uk.gov.gchq.gaffer.operation.OperationChain)6 ElementFilter (uk.gov.gchq.gaffer.data.element.function.ElementFilter)5 TraitRequirement (uk.gov.gchq.gaffer.integration.TraitRequirement)5 GetElements (uk.gov.gchq.gaffer.operation.impl.get.GetElements)5 HashSet (java.util.HashSet)4 Entity (uk.gov.gchq.gaffer.data.element.Entity)4 IsLessThan (uk.gov.gchq.gaffer.function.filter.IsLessThan)4 ArrayList (java.util.ArrayList)3 Iterator (java.util.Iterator)3