Search in sources :

Example 1 with JournalEntry

use of org.apache.jena.dboe.transaction.txn.journal.JournalEntry in project jena by apache.

the class TestJournal method journal_05.

@Test
public void journal_05() {
    Journal jrnl = Journal.create(Location.mem());
    jrnl.writeJournal(JournalEntry.COMMIT);
    jrnl.writeJournal(JournalEntry.ABORT);
    long x = jrnl.writeJournal(JournalEntry.COMMIT);
    jrnl.writeJournal(JournalEntry.COMMIT);
    assertFalse(jrnl.isEmpty());
    Iterator<JournalEntry> iter = jrnl.entries(x);
    List<JournalEntry> expected = Arrays.asList(JournalEntry.COMMIT, JournalEntry.COMMIT);
}
Also used : Journal(org.apache.jena.dboe.transaction.txn.journal.Journal) JournalEntry(org.apache.jena.dboe.transaction.txn.journal.JournalEntry) Test(org.junit.Test)

Example 2 with JournalEntry

use of org.apache.jena.dboe.transaction.txn.journal.JournalEntry 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);
}
Also used : Journal(org.apache.jena.dboe.transaction.txn.journal.Journal) ByteBuffer(java.nio.ByteBuffer) JournalEntry(org.apache.jena.dboe.transaction.txn.journal.JournalEntry) Test(org.junit.Test)

Example 3 with JournalEntry

use of org.apache.jena.dboe.transaction.txn.journal.JournalEntry 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());
}
Also used : Journal(org.apache.jena.dboe.transaction.txn.journal.Journal) JournalEntry(org.apache.jena.dboe.transaction.txn.journal.JournalEntry) Test(org.junit.Test)

Example 4 with JournalEntry

use of org.apache.jena.dboe.transaction.txn.journal.JournalEntry 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);
}
Also used : Journal(org.apache.jena.dboe.transaction.txn.journal.Journal) JournalEntry(org.apache.jena.dboe.transaction.txn.journal.JournalEntry) Test(org.junit.Test)

Example 5 with JournalEntry

use of org.apache.jena.dboe.transaction.txn.journal.JournalEntry 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);
}
Also used : Journal(org.apache.jena.dboe.transaction.txn.journal.Journal) JournalEntry(org.apache.jena.dboe.transaction.txn.journal.JournalEntry) Test(org.junit.Test)

Aggregations

Journal (org.apache.jena.dboe.transaction.txn.journal.Journal)6 JournalEntry (org.apache.jena.dboe.transaction.txn.journal.JournalEntry)6 Test (org.junit.Test)6 ByteBuffer (java.nio.ByteBuffer)2