use of uk.gov.gchq.gaffer.operation.data.ElementSeed in project Gaffer by gchq.
the class GetElementsTest method shouldSetSeedMatchingTypeToEquals.
@Test
public void shouldSetSeedMatchingTypeToEquals() {
// Given
final ElementSeed elementSeed1 = new EntitySeed("identifier");
// When
final GetElements op = new GetElements.Builder<>().seeds(Collections.singletonList(elementSeed1)).seedMatching(SeedMatchingType.EQUAL).build();
// Then
assertEquals(GetOperation.SeedMatchingType.EQUAL, op.getSeedMatching());
}
use of uk.gov.gchq.gaffer.operation.data.ElementSeed 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());
}
use of uk.gov.gchq.gaffer.operation.data.ElementSeed in project Gaffer by gchq.
the class GetElementsTest method builderShouldCreatePopulatedOperationIncoming.
private void builderShouldCreatePopulatedOperationIncoming() {
ElementSeed seed = new EntitySeed("A");
GetElements op = new GetElements.Builder<>().addSeed(seed).includeEdges(GetOperation.IncludeEdgeType.UNDIRECTED).includeEntities(false).inOutType(GetOperation.IncludeIncomingOutgoingType.INCOMING).option("testOption", "true").populateProperties(false).view(new View.Builder().edge("testEdgeGroup").build()).build();
assertEquals("true", op.getOption("testOption"));
assertFalse(op.isPopulateProperties());
assertFalse(op.isIncludeEntities());
assertEquals(GetOperation.IncludeIncomingOutgoingType.INCOMING, op.getIncludeIncomingOutGoing());
assertEquals(GetOperation.IncludeEdgeType.UNDIRECTED, op.getIncludeEdges());
assertNotNull(op.getView());
assertEquals(seed, op.getSeeds().iterator().next());
}
use of uk.gov.gchq.gaffer.operation.data.ElementSeed in project Gaffer by gchq.
the class AbstractGetIterableOperationTest method shouldCopyFieldsFromGivenOperationWhenConstructing.
@Test
public void shouldCopyFieldsFromGivenOperationWhenConstructing() {
// Given
final GetIterableOperation<ElementSeed, ?> operationToCopy = mock(GetIterableOperation.class);
final View view = mock(View.class);
final GetOperation.IncludeEdgeType includeEdges = GetOperation.IncludeEdgeType.ALL;
final boolean includeEntities = true;
final boolean populateProperties = true;
final CloseableIterable<ElementSeed> input = mock(CloseableIterable.class);
given(operationToCopy.getView()).willReturn(view);
given(operationToCopy.getInput()).willReturn(input);
// When
final GetIterableOperationImpl<ElementSeed, Element> operation = new GetIterableOperationImpl<>(operationToCopy);
// Then
assertSame(view, operation.getView());
assertSame(input, operation.getInput());
}
use of uk.gov.gchq.gaffer.operation.data.ElementSeed in project Gaffer by gchq.
the class AbstractGetIterableOperationTest method shouldSerialiseAndDeserialiseOperation.
@Test
@Override
public void shouldSerialiseAndDeserialiseOperation() throws SerialisationException {
// Given
final String identifier = "identifier";
final ElementSeed input = new EntitySeed(identifier);
final GetIterableOperationImpl<ElementSeed, Element> op = new GetIterableOperationImpl<>(Collections.singletonList(input));
// When
byte[] json = serialiser.serialise(op, true);
final GetIterableOperationImpl<ElementSeed, Element> deserialisedOp = serialiser.deserialise(json, GetIterableOperationImpl.class);
// Then
assertNotNull(deserialisedOp);
assertEquals(identifier, ((EntitySeed) deserialisedOp.getInput().iterator().next()).getVertex());
}
Aggregations