Search in sources :

Example 1 with GetExport

use of uk.gov.gchq.gaffer.operation.impl.export.GetExport in project Gaffer by gchq.

the class GetSetExportTest method shouldSerialiseAndDeserialiseOperation.

@Test
@Override
public void shouldSerialiseAndDeserialiseOperation() throws SerialisationException {
    // Given
    final GetExport operation = new GetSetExport.Builder().key("key").jobId("jobId").start(0).end(5).build();
    // When
    byte[] json = serialiser.serialise(operation, true);
    final GetSetExport deserialisedOp = serialiser.deserialise(json, GetSetExport.class);
    // Then
    assertEquals("key", deserialisedOp.getKey());
    assertEquals("jobId", deserialisedOp.getJobId());
    assertEquals(0, deserialisedOp.getStart());
    assertEquals(5, (int) deserialisedOp.getEnd());
}
Also used : GetExport(uk.gov.gchq.gaffer.operation.impl.export.GetExport) GetSetExport(uk.gov.gchq.gaffer.operation.impl.export.set.GetSetExport) OperationTest(uk.gov.gchq.gaffer.operation.OperationTest) Test(org.junit.Test)

Example 2 with GetExport

use of uk.gov.gchq.gaffer.operation.impl.export.GetExport in project Gaffer by gchq.

the class GetExportsHandler method doOperation.

@Override
public Map<String, CloseableIterable<?>> doOperation(final GetExports getExports, final Context context, final Store store) throws OperationException {
    final Map<String, CloseableIterable<?>> exports = new LinkedHashMap<>();
    for (final GetExport getExport : getExports.getGetExports()) {
        final CloseableIterable<?> export = store._execute(new OperationChain<>(getExport), context);
        exports.put(getExport.getClass().getName() + ": " + getExport.getKey(), export);
    }
    return exports;
}
Also used : CloseableIterable(uk.gov.gchq.gaffer.commonutil.iterable.CloseableIterable) GetExport(uk.gov.gchq.gaffer.operation.impl.export.GetExport) LinkedHashMap(java.util.LinkedHashMap)

Aggregations

GetExport (uk.gov.gchq.gaffer.operation.impl.export.GetExport)2 LinkedHashMap (java.util.LinkedHashMap)1 Test (org.junit.Test)1 CloseableIterable (uk.gov.gchq.gaffer.commonutil.iterable.CloseableIterable)1 OperationTest (uk.gov.gchq.gaffer.operation.OperationTest)1 GetSetExport (uk.gov.gchq.gaffer.operation.impl.export.set.GetSetExport)1