Search in sources :

Example 1 with GetIterableOperationImpl

use of uk.gov.gchq.gaffer.operation.impl.GetIterableOperationImpl 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());
}
Also used : Element(uk.gov.gchq.gaffer.data.element.Element) ElementSeed(uk.gov.gchq.gaffer.operation.data.ElementSeed) GetIterableOperationImpl(uk.gov.gchq.gaffer.operation.impl.GetIterableOperationImpl) View(uk.gov.gchq.gaffer.data.elementdefinition.view.View) Test(org.junit.Test)

Example 2 with GetIterableOperationImpl

use of uk.gov.gchq.gaffer.operation.impl.GetIterableOperationImpl 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());
}
Also used : Element(uk.gov.gchq.gaffer.data.element.Element) EntitySeed(uk.gov.gchq.gaffer.operation.data.EntitySeed) ElementSeed(uk.gov.gchq.gaffer.operation.data.ElementSeed) GetIterableOperationImpl(uk.gov.gchq.gaffer.operation.impl.GetIterableOperationImpl) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 Element (uk.gov.gchq.gaffer.data.element.Element)2 ElementSeed (uk.gov.gchq.gaffer.operation.data.ElementSeed)2 GetIterableOperationImpl (uk.gov.gchq.gaffer.operation.impl.GetIterableOperationImpl)2 View (uk.gov.gchq.gaffer.data.elementdefinition.view.View)1 EntitySeed (uk.gov.gchq.gaffer.operation.data.EntitySeed)1