use of org.exist.storage.index.BFile in project exist by eXist-db.
the class BFileRecoverTest method read.
@Test
public void read() throws EXistException, IOException, BTreeException {
final BrokerPool pool = existEmbeddedServer.getBrokerPool();
BrokerPool.FORCE_CORRUPTION = false;
try (final DBBroker broker = pool.get(Optional.of(pool.getSecurityManager().getSystemSubject()))) {
BFile collectionsDb = (BFile) ((NativeBroker) broker).getStorage(NativeBroker.COLLECTIONS_DBX_ID);
Writer writer = new StringWriter();
collectionsDb.dump(writer);
for (int i = 1; i < 1001; i++) {
String key = "test" + i;
byte[] data = key.getBytes(UTF_8);
Value value = collectionsDb.get(new Value(data));
}
}
}
Aggregations