use of uk.gov.gchq.gaffer.operation.impl.OperationImpl in project Gaffer by gchq.
the class AbstractOperationTest method shouldSerialiseAndDeserialiseOperation.
@Test
@Override
public void shouldSerialiseAndDeserialiseOperation() throws SerialisationException {
// Given
final String input = "some input";
final OperationImpl<String, String> op = new OperationImpl<>(input);
// When
byte[] json = serialiser.serialise(op, true);
final OperationImpl deserialisedOp = serialiser.deserialise(json, OperationImpl.class);
// Then
assertNotNull(deserialisedOp);
assertEquals(input, deserialisedOp.getInput());
}
use of uk.gov.gchq.gaffer.operation.impl.OperationImpl in project Gaffer by gchq.
the class AbstractOperationTest method shouldCopyFieldsFromGivenOperationWhenConstructing.
@Test
public void shouldCopyFieldsFromGivenOperationWhenConstructing() {
// Given
final Operation<String, ?> operationToCopy = mock(Operation.class);
final View view = mock(View.class);
final String input = "input value";
given(operationToCopy.getView()).willReturn(view);
given(operationToCopy.getInput()).willReturn(input);
// When
final Operation<String, String> operation = new OperationImpl<>(operationToCopy);
// Then
assertSame(view, operation.getView());
assertSame(input, operation.getInput());
}
use of uk.gov.gchq.gaffer.operation.impl.OperationImpl in project Gaffer by gchq.
the class OperationChainTest method shouldSerialiseAndDeserialiseOperationChain.
@Test
public void shouldSerialiseAndDeserialiseOperationChain() throws SerialisationException {
// Given
final OperationChain<Object> opChain = new Builder().first(new OperationImpl<>()).then(new OperationImpl<>()).build();
// When
byte[] json = serialiser.serialise(opChain, true);
final OperationChain deserialisedOp = serialiser.deserialise(json, OperationChain.class);
// Then
assertNotNull(deserialisedOp);
assertEquals(2, deserialisedOp.getOperations().size());
assertEquals(OperationImpl.class, deserialisedOp.getOperations().get(0).getClass());
assertEquals(OperationImpl.class, deserialisedOp.getOperations().get(1).getClass());
}
Aggregations