use of org.apache.jena.dboe.transaction.txn.journal.Journal in project jena by apache.
the class TestTransactionLifecycle2 method setup.
@Before
public void setup() {
Journal jrnl = Journal.create(Location.mem());
txnMgr = new TransactionCoordinator(jrnl);
txnMgr.start();
}
use of org.apache.jena.dboe.transaction.txn.journal.Journal in project jena by apache.
the class TestJournal method journal_06.
@Test
public void journal_06() {
ByteBuffer bb = ByteBuffer.allocateDirect(100);
ByteBufferLib.fill(bb, (byte) 0XA5);
Journal jrnl = Journal.create(Location.mem());
JournalEntry e = new JournalEntry(JournalEntryType.REDO, ComponentId.allocLocal(), bb);
jrnl.writeJournal(e);
jrnl.sync();
JournalEntry e2 = jrnl.readJournal(0);
check(e, e2);
}
use of org.apache.jena.dboe.transaction.txn.journal.Journal in project jena by apache.
the class TestJournal method journal_01.
// For testing recovery, we need something to recover!
// See tests in TestRecovery in dboe-trans-data
@Test
public void journal_01() {
Journal jrnl = Journal.create(Location.mem());
assertNotNull(jrnl);
assertTrue(jrnl.isEmpty());
}
use of org.apache.jena.dboe.transaction.txn.journal.Journal in project jena by apache.
the class TestRecovery method recoverBlobFile_1.
// Fake journal recovery.
@Test
public void recoverBlobFile_1() throws Exception {
String str = "Hello Journal";
ComponentId cid = ComponentId.allocLocal();
// ComponentIdRegistry registry = new ComponentIdRegistry();
// registry.register(cid, "Blob", 1);
// Write out a journal.
{
Journal journal = Journal.create(Location.create(dir.getRoot().getAbsolutePath()));
journal.write(JournalEntryType.REDO, cid, IO.stringToByteBuffer(str));
journal.writeJournal(JournalEntry.COMMIT);
journal.close();
}
TransactionCoordinator coord = new TransactionCoordinator(Location.create(dir.getRoot().getAbsolutePath()));
BufferChannel chan = BufferChannelFile.create(data);
TransBlob tBlob = new TransBlob(cid, chan);
coord.add(tBlob);
coord.start();
ByteBuffer blob = tBlob.getBlob();
assertNotNull(blob);
String s = IO.byteBufferToString(blob);
assertEquals(str, s);
coord.shutdown();
}
Aggregations