[jboss-cvs] JBoss Messaging SVN: r5857 - trunk/tests/src/org/jboss/messaging/tests/stress/journal.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Feb 12 22:41:47 EST 2009


Author: clebert.suconic at jboss.com
Date: 2009-02-12 22:41:47 -0500 (Thu, 12 Feb 2009)
New Revision: 5857

Modified:
   trunk/tests/src/org/jboss/messaging/tests/stress/journal/AddAndRemoveStressTest.java
Log:
Adding test... (investigating a journal issue that I found)

Modified: trunk/tests/src/org/jboss/messaging/tests/stress/journal/AddAndRemoveStressTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/stress/journal/AddAndRemoveStressTest.java	2009-02-12 10:10:47 UTC (rev 5856)
+++ trunk/tests/src/org/jboss/messaging/tests/stress/journal/AddAndRemoveStressTest.java	2009-02-13 03:41:47 UTC (rev 5857)
@@ -132,9 +132,77 @@
 
       assertEquals(0, info.size());
       assertEquals(0, trans.size());
+      
+      assertEquals(0, impl.getDataFilesCount());
 
    }
 
+   public void testInsertUpdateAndLoad() throws Exception
+   {
+
+      SequentialFileFactory factory = new AIOSequentialFileFactory(getTestDir());
+      JournalImpl impl = new JournalImpl(10 * 1024 * 1024, 60, true, false, factory, "jbm", "jbm", 1000, 0);
+
+      impl.start();
+
+      impl.load(dummyLoader);
+
+      for (long i = 1; i <= NUMBER_OF_MESSAGES; i++)
+      {
+         if (i % 10000 == 0)
+         {
+            System.out.println("Append " + i);
+         }
+         impl.appendAddRecord(i, (byte)21, new SimpleEncoding(40, (byte)'f'));
+         impl.appendUpdateRecord(i, (byte)22, new SimpleEncoding(40, (byte)'g'));
+      }
+
+      impl.stop();
+
+      factory = new AIOSequentialFileFactory(getTestDir());
+      impl = new JournalImpl(10 * 1024 * 1024, 60, true, false, factory, "jbm", "jbm", 1000, 0);
+
+      impl.start();
+
+      impl.load(dummyLoader);
+
+      for (long i = 1; i <= NUMBER_OF_MESSAGES; i++)
+      {
+         if (i % 10000 == 0)
+         {
+            System.out.println("Delete " + i);
+         }
+
+         impl.appendDeleteRecord(i);
+      }
+
+      impl.stop();
+
+      factory = new AIOSequentialFileFactory(getTestDir());
+      impl = new JournalImpl(10 * 1024 * 1024, 60, true, false, factory, "jbm", "jbm", 1000, 0);
+
+      impl.start();
+
+      ArrayList<RecordInfo> info = new ArrayList<RecordInfo>();
+      ArrayList<PreparedTransactionInfo> trans = new ArrayList<PreparedTransactionInfo>();
+
+      impl.load(info, trans);
+
+      if (info.size() > 0)
+      {
+         System.out.println("Info ID: " + info.get(0).id);
+      }
+      
+      impl.checkAndReclaimFiles();
+
+      assertEquals(0, info.size());
+      assertEquals(0, trans.size());
+      //assertEquals(0, impl.getDataFilesCount()); -- re-enable this assertion
+
+      System.out.println("Size = " + impl.getDataFilesCount());
+
+   }
+
    // Package protected ---------------------------------------------
 
    // Protected -----------------------------------------------------




More information about the jboss-cvs-commits mailing list