Search in sources :

Example 46 with SimpleEncoding

use of org.apache.activemq.artemis.tests.unit.core.journal.impl.fakes.SimpleEncoding in project activemq-artemis by apache.

the class NIOImportExportTest method testExportImport3.

@Test
public void testExportImport3() throws Exception {
    setup(10, 10 * 4096, true);
    createJournal();
    startJournal();
    load();
    add(1, 2);
    journal.forceMoveNextFile();
    delete(1, 2);
    add(3, 4);
    journal.forceMoveNextFile();
    addTx(5, 6, 7, 8);
    journal.forceMoveNextFile();
    addTx(5, 9);
    commit(5);
    journal.forceMoveNextFile();
    deleteTx(10, 6, 7, 8, 9);
    commit(10);
    addTx(11, 12, 13);
    EncodingSupport xid = new SimpleEncoding(10, (byte) 0);
    prepare(11, xid);
    stopJournal();
    exportImportJournal();
    createJournal();
    startJournal();
    loadAndCheck();
    commit(11);
    stopJournal();
    exportImportJournal();
    createJournal();
    startJournal();
    loadAndCheck();
}
Also used : SimpleEncoding(org.apache.activemq.artemis.tests.unit.core.journal.impl.fakes.SimpleEncoding) EncodingSupport(org.apache.activemq.artemis.core.journal.EncodingSupport) Test(org.junit.Test)

Example 47 with SimpleEncoding

use of org.apache.activemq.artemis.tests.unit.core.journal.impl.fakes.SimpleEncoding in project activemq-artemis by apache.

the class NIOJournalCompactTest method testCompactPrepareRestart2.

@Test
public void testCompactPrepareRestart2() throws Exception {
    setup(2, 60 * 1024, false);
    createJournal();
    startJournal();
    load();
    addTx(1, 2);
    prepare(1, new SimpleEncoding(10, (byte) 0));
    stopJournal();
    createJournal();
    startJournal();
    loadAndCheck();
    startCompact();
    commit(1);
    finishCompact();
    journal.testCompact();
    stopJournal();
    createJournal();
    startJournal();
    loadAndCheck();
}
Also used : SimpleEncoding(org.apache.activemq.artemis.tests.unit.core.journal.impl.fakes.SimpleEncoding) Test(org.junit.Test)

Aggregations

SimpleEncoding (org.apache.activemq.artemis.tests.unit.core.journal.impl.fakes.SimpleEncoding)47 Test (org.junit.Test)43 EncodingSupport (org.apache.activemq.artemis.core.journal.EncodingSupport)13 RecordInfo (org.apache.activemq.artemis.core.journal.RecordInfo)7 JournalImpl (org.apache.activemq.artemis.core.journal.impl.JournalImpl)6 SequentialFile (org.apache.activemq.artemis.core.io.SequentialFile)5 ByteBuffer (java.nio.ByteBuffer)4 ArrayList (java.util.ArrayList)4 CountDownLatch (java.util.concurrent.CountDownLatch)3 PreparedTransactionInfo (org.apache.activemq.artemis.core.journal.PreparedTransactionInfo)3 SequentialFileFactory (org.apache.activemq.artemis.core.io.SequentialFileFactory)2 AIOSequentialFileFactory (org.apache.activemq.artemis.core.io.aio.AIOSequentialFileFactory)2 Journal (org.apache.activemq.artemis.core.journal.Journal)2 LinkedBlockingQueue (java.util.concurrent.LinkedBlockingQueue)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 AtomicLong (java.util.concurrent.atomic.AtomicLong)1 Pair (org.apache.activemq.artemis.api.core.Pair)1 JournalFile (org.apache.activemq.artemis.core.journal.impl.JournalFile)1 FakeSequentialFileFactory (org.apache.activemq.artemis.tests.unit.core.journal.impl.fakes.FakeSequentialFileFactory)1