Author: clebert.suconic(a)jboss.com
Date: 2010-09-02 19:59:03 -0400 (Thu, 02 Sep 2010)
New Revision: 9633
Modified:
branches/Branch_2_1/tests/src/org/hornetq/tests/integration/journal/NIOJournalCompactTest.java
Log:
HORNETQ-485 - adding new tests on compacting
Modified:
branches/Branch_2_1/tests/src/org/hornetq/tests/integration/journal/NIOJournalCompactTest.java
===================================================================
---
branches/Branch_2_1/tests/src/org/hornetq/tests/integration/journal/NIOJournalCompactTest.java 2010-09-02
23:53:00 UTC (rev 9632)
+++
branches/Branch_2_1/tests/src/org/hornetq/tests/integration/journal/NIOJournalCompactTest.java 2010-09-02
23:59:03 UTC (rev 9633)
@@ -23,6 +23,7 @@
import junit.framework.Assert;
import org.hornetq.api.core.Pair;
+import org.hornetq.core.journal.EncodingSupport;
import org.hornetq.core.journal.PreparedTransactionInfo;
import org.hornetq.core.journal.RecordInfo;
import org.hornetq.core.journal.SequentialFile;
@@ -232,6 +233,119 @@
}
+ public void testCompactPrepareRestart() throws Exception
+ {
+ setup(2, 60 * 1024, false);
+
+ createJournal();
+
+ startJournal();
+
+ load();
+
+ startCompact();
+
+ addTx(1, 2);
+
+ prepare(1, new SimpleEncoding(10, (byte)0));
+
+ finishCompact();
+
+ stopJournal();
+
+ createJournal();
+
+ startJournal();
+
+ loadAndCheck();
+
+ startCompact();
+
+ commit(1);
+
+ finishCompact();
+
+ journal.compact();
+
+ stopJournal();
+
+ createJournal();
+
+ startJournal();
+
+ loadAndCheck();
+ }
+
+ 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.compact();
+
+ stopJournal();
+
+ createJournal();
+
+ startJournal();
+
+ loadAndCheck();
+ }
+
+ public void testCompactPrepareRestart3() throws Exception
+ {
+ setup(2, 60 * 1024, false);
+
+ createJournal();
+
+ startJournal();
+
+ load();
+
+ addTx(1, 2, 3);
+
+ prepare(1, new SimpleEncoding(10, (byte)0));
+
+ startCompact();
+
+ commit(1);
+
+ finishCompact();
+
+ journal.compact();
+
+ stopJournal();
+
+ createJournal();
+
+ startJournal();
+
+ loadAndCheck();
+ }
+
public void testOnRollback() throws Exception
{
Show replies by date