Search in sources :

Example 1 with DataAccessorFactory

use of cz.o2.proxima.direct.core.DataAccessorFactory in project proxima-platform by O2-Czech-Republic.

the class GCloudStorageAccessorTest method testReaderAsFactorySerializable.

@Test
public void testReaderAsFactorySerializable() throws IOException, ClassNotFoundException {
    DataAccessorFactory descriptor = new GCloudStorageDescriptor();
    DataAccessor accessor = descriptor.createAccessor(direct, TestUtils.createTestFamily(entity, URI.create("gs://bucket")));
    Optional<BatchLogReader> reader = accessor.getBatchLogReader(direct.getContext());
    assertTrue(reader.isPresent());
    byte[] bytes = TestUtils.serializeObject(reader.get().asFactory());
    BatchLogReader.Factory<?> factory = TestUtils.deserializeObject(bytes);
    assertEquals(accessor.getUri(), ((GCloudLogReader) factory.apply(repo)).getAccessor().getUri());
}
Also used : BatchLogReader(cz.o2.proxima.direct.batch.BatchLogReader) DataAccessor(cz.o2.proxima.direct.core.DataAccessor) DataAccessorFactory(cz.o2.proxima.direct.core.DataAccessorFactory) Test(org.junit.Test)

Aggregations

BatchLogReader (cz.o2.proxima.direct.batch.BatchLogReader)1 DataAccessor (cz.o2.proxima.direct.core.DataAccessor)1 DataAccessorFactory (cz.o2.proxima.direct.core.DataAccessorFactory)1 Test (org.junit.Test)1