use of cz.o2.proxima.direct.bulk.FileSystem in project proxima-platform by O2-Czech-Republic.
the class BlobStorageAccessorTest method testBlobPathSerializable.
@Test
public void testBlobPathSerializable() throws IOException, ClassNotFoundException {
TestBlobStorageAccessor accessor = new TestBlobStorageAccessor(TestUtils.createTestFamily(entity, URI.create("blob-test://bucket")));
FileSystem fs = accessor.new TestBlobFileSystem();
TestBlob blob = accessor.new TestBlob("test");
TestBlobPath path = accessor.new TestBlobPath(fs, blob);
TestBlobPath path2 = TestUtils.assertSerializable(path);
TestUtils.assertHashCodeAndEquals(path, path2);
TestUtils.assertHashCodeAndEquals(fs, path.getFileSystem());
}
use of cz.o2.proxima.direct.bulk.FileSystem in project proxima-platform by O2-Czech-Republic.
the class ComplexWriteTest method initWriter.
AbstractBulkFileSystemAttributeWriter initWriter() throws IOException {
FileFormat format = FileFormatUtils.getFileFormatFromName("binary", false);
NamingConvention naming = new DefaultNamingConvention(Duration.ofMillis(rollPeriod), "prefix", "suffix");
FileSystem fs = FileSystem.local(new File(tempFolder.newFolder(), UUID.randomUUID().toString()), naming);
return new AbstractBulkFileSystemAttributeWriter(entity, uri, fs, naming, format, direct.getContext(), rollPeriod, allowedLateness) {
@Override
public BulkAttributeWriter.Factory<?> asFactory() {
return repo -> ExceptionUtils.uncheckedFactory(() -> initWriter());
}
@Override
protected void flush(Bulk v) {
try {
List<StreamElement> elements = Lists.newArrayList(format.openReader(v.getPath(), entity));
flushed.addAndGet(elements.size());
log.info("Written {} elements to stamp {}", elements.size(), v.getMaxTs());
} catch (IOException ex) {
throw new RuntimeException(ex);
}
}
};
}
Aggregations