use of org.apache.jena.dboe.transaction.txn.journal.Journal in project jena by apache.
the class TestJournal method journal_07.
@Test
public void journal_07() {
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(JournalEntry.COMMIT);
long locn = jrnl.position();
jrnl.writeJournal(e);
assertNotEquals(0, locn);
jrnl.sync();
JournalEntry e2 = jrnl.readJournal(locn);
check(e, e2);
}
use of org.apache.jena.dboe.transaction.txn.journal.Journal in project jena by apache.
the class TestJournal method journal_02.
@Test
public void journal_02() {
Journal jrnl = Journal.create(Location.mem());
assertNotNull(jrnl);
JournalEntry e = JournalEntry.COMMIT;
jrnl.writeJournal(e);
assertFalse(jrnl.isEmpty());
assertNotEquals(0, jrnl.position());
}
use of org.apache.jena.dboe.transaction.txn.journal.Journal in project jena by apache.
the class TestJournal method journal_04.
@Test
public void journal_04() {
Journal jrnl = Journal.create(Location.mem());
jrnl.writeJournal(JournalEntry.COMMIT);
jrnl.writeJournal(JournalEntry.ABORT);
jrnl.writeJournal(JournalEntry.ABORT);
jrnl.writeJournal(JournalEntry.COMMIT);
assertFalse(jrnl.isEmpty());
Iterator<JournalEntry> iter = jrnl.entries(0);
List<JournalEntry> expected = Arrays.asList(JournalEntry.COMMIT, JournalEntry.ABORT, JournalEntry.ABORT, JournalEntry.COMMIT);
}
use of org.apache.jena.dboe.transaction.txn.journal.Journal in project jena by apache.
the class TDB2StorageBuilder method buildTransactionCoordinator.
private static TransactionCoordinator buildTransactionCoordinator(Location location) {
Journal journal = Journal.create(location);
TransactionCoordinator txnCoord = new TransactionCoordinator(journal);
return txnCoord;
}
use of org.apache.jena.dboe.transaction.txn.journal.Journal in project jena by apache.
the class TestJournal method journal_03.
@Test
public void journal_03() {
Journal jrnl = Journal.create(Location.mem());
assertNotNull(jrnl);
jrnl.writeJournal(JournalEntry.COMMIT);
assertNotEquals(0, jrnl.position());
JournalEntry e = jrnl.readJournal(0);
check(JournalEntry.COMMIT, e);
assertEquals(ComponentIds.idSystem, e.getComponentId());
assertEquals(JournalEntryType.COMMIT, e.getType());
check(JournalEntry.COMMIT, e);
}
Aggregations