use of uk.gov.gchq.gaffer.operation.data.ElementSeed in project Gaffer by gchq.
the class ExamplesService method getEntities.
@Override
public GetEntities getEntities() {
final GetEntities op = new GetEntities();
final List<ElementSeed> seeds = new ArrayList<>();
if (hasEntities()) {
seeds.add(getEntitySeed(1));
}
if (hasEdges()) {
seeds.add(getEdgeSeed(1, 2));
}
op.setSeeds(seeds);
populateOperation(op);
return op;
}
use of uk.gov.gchq.gaffer.operation.data.ElementSeed in project Gaffer by gchq.
the class AbstractGetElementsOperationTest method shouldSerialiseAndDeserialiseOperation.
@Test
@Override
public void shouldSerialiseAndDeserialiseOperation() throws SerialisationException {
// Given
final String identifier = "identifier";
final ElementSeed input = new EntitySeed(identifier);
final GetElementsOperationImpl<ElementSeed, Element> op = new GetElementsOperationImpl<>(Collections.singletonList(input));
// When
byte[] json = serialiser.serialise(op, true);
final GetElementsOperationImpl<ElementSeed, Element> deserialisedOp = serialiser.deserialise(json, GetElementsOperationImpl.class);
// Then
assertNotNull(deserialisedOp);
assertEquals(identifier, ((EntitySeed) deserialisedOp.getInput().iterator().next()).getVertex());
}
use of uk.gov.gchq.gaffer.operation.data.ElementSeed in project Gaffer by gchq.
the class AbstractGetElementsOperationTest method shouldCopyFieldsFromGivenOperationWhenConstructing.
@Test
public void shouldCopyFieldsFromGivenOperationWhenConstructing() {
// Given
final GetIterableElementsOperation<ElementSeed, ?> operationToCopy = mock(GetIterableElementsOperation.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.getIncludeEdges()).willReturn(includeEdges);
given(operationToCopy.isIncludeEntities()).willReturn(includeEntities);
given(operationToCopy.isPopulateProperties()).willReturn(populateProperties);
given(operationToCopy.getInput()).willReturn(input);
// When
final GetElementsOperationImpl<ElementSeed, Element> operation = new GetElementsOperationImpl<>(operationToCopy);
// Then
assertSame(view, operation.getView());
assertSame(includeEdges, operation.getIncludeEdges());
assertEquals(includeEntities, operation.isIncludeEntities());
assertSame(input, operation.getInput());
assertEquals(populateProperties, operation.isPopulateProperties());
}
use of uk.gov.gchq.gaffer.operation.data.ElementSeed in project Gaffer by gchq.
the class AbstractGetOperationTest method shouldCopyFieldsFromGivenOperationWhenConstructing.
@Test
public void shouldCopyFieldsFromGivenOperationWhenConstructing() {
// Given
final GetOperation<ElementSeed, ?> operationToCopy = mock(GetOperation.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 GetOperation<ElementSeed, Element> operation = new GetOperationImpl<>(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 BloomFilter18IT method seek.
private void seek(final FileSKVIterator reader, final EntitySeed seed, final RangeFactory rangeFactory) throws IOException, RangeFactoryException {
final View view = new View.Builder().edge(TestGroups.EDGE).entity(TestGroups.ENTITY).build();
final GetElements<ElementSeed, ?> operation = new GetElements<>(view);
final List<Range> range = rangeFactory.getRange(seed, operation);
for (final Range ran : range) {
reader.seek(ran, new ArrayList<ByteSequence>(), false);
}
}
Aggregations