Search in sources :

Example 6 with BFile

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));
        }
    }
}
Also used : StringWriter(java.io.StringWriter) Value(org.exist.storage.btree.Value) BFile(org.exist.storage.index.BFile) StringWriter(java.io.StringWriter) Writer(java.io.Writer) Test(org.junit.Test)

Aggregations

BFile (org.exist.storage.index.BFile)6 Value (org.exist.storage.btree.Value)4 Test (org.junit.Test)4 StringWriter (java.io.StringWriter)2 Writer (java.io.Writer)2 DOMFile (org.exist.storage.dom.DOMFile)2 TransactionManager (org.exist.storage.txn.TransactionManager)2 Txn (org.exist.storage.txn.Txn)2 FixedByteArray (org.exist.util.FixedByteArray)2 IndexStats (org.exist.storage.IndexStats)1 Configuration (org.exist.util.Configuration)1 AttributesImpl (org.xml.sax.helpers.AttributesImpl)1