use of uk.gov.gchq.gaffer.operation.impl.GetElementsOperationImpl 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.impl.GetElementsOperationImpl 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());
}
Aggregations