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());
}
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());
}
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());
}
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());
}
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());
}
Aggregations