[jboss-cvs] JBoss Messaging SVN: r7505 - in branches/clebert_temp_expirement: tests/src/org/jboss/messaging/tests/integration/journal and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Jun 30 22:06:26 EDT 2009


Author: clebert.suconic at jboss.com
Date: 2009-06-30 22:06:26 -0400 (Tue, 30 Jun 2009)
New Revision: 7505

Modified:
   branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/impl/JournalImpl.java
   branches/clebert_temp_expirement/tests/src/org/jboss/messaging/tests/integration/journal/NIOJournalCompactTest.java
Log:
tweaks: Adding tests

Modified: branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/impl/JournalImpl.java
===================================================================
--- branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/impl/JournalImpl.java	2009-06-30 22:30:18 UTC (rev 7504)
+++ branches/clebert_temp_expirement/src/main/org/jboss/messaging/core/journal/impl/JournalImpl.java	2009-07-01 02:06:26 UTC (rev 7505)
@@ -94,6 +94,7 @@
 
    // private static final boolean trace = log.isTraceEnabled();
 
+   /** This is to be set to true at DEBUG & development only */
    private static final boolean LOAD_TRACE = false;
 
    private static final boolean trace = true;
@@ -1541,6 +1542,7 @@
          
          for (String fileToDelete : leftFiles)
          {
+            log.warn("Deleting unnatended file " + fileToDelete);
             SequentialFile file = fileFactory.createSequentialFile(fileToDelete, 1);
             file.delete();
          }

Modified: branches/clebert_temp_expirement/tests/src/org/jboss/messaging/tests/integration/journal/NIOJournalCompactTest.java
===================================================================
--- branches/clebert_temp_expirement/tests/src/org/jboss/messaging/tests/integration/journal/NIOJournalCompactTest.java	2009-06-30 22:30:18 UTC (rev 7504)
+++ branches/clebert_temp_expirement/tests/src/org/jboss/messaging/tests/integration/journal/NIOJournalCompactTest.java	2009-07-01 02:06:26 UTC (rev 7505)
@@ -37,6 +37,7 @@
 import org.jboss.messaging.core.journal.impl.NIOSequentialFileFactory;
 import org.jboss.messaging.core.logging.Logger;
 import org.jboss.messaging.tests.unit.core.journal.impl.JournalImplTestBase;
+import org.jboss.messaging.tests.unit.core.journal.impl.fakes.SimpleEncoding;
 import org.jboss.messaging.utils.IDGenerator;
 import org.jboss.messaging.utils.Pair;
 import org.jboss.messaging.utils.TimeAndCounterIDGenerator;
@@ -107,63 +108,73 @@
 
    public void testCrashRenamingFiles() throws Exception
    {
-      internalCompactTest(true, false, false, false, false, false, false, false, true, false, false);
+      internalCompactTest(false, false, true, false, false, false, false, false, false, false, true, false, false);
    }
 
    public void testCrashDuringCompacting() throws Exception
    {
+      internalCompactTest(false, false, true, false, false, false, false, false, false, false, false, false, false);
    }
 
    public void testCompactwithPendingXACommit() throws Exception
    {
+      internalCompactTest(true, false, false, false, false, false, false, true, false, false, true, true, true);
    }
 
    public void testCompactwithPendingXAPrepareAndCommit() throws Exception
    {
+      internalCompactTest(false, true, false, false, false, false, false, true, false, false, true, true, true);
    }
 
+   public void testCompactwithPendingXAPrepareAndDelayedCommit() throws Exception
+   {
+      internalCompactTest(false, true, false, false, false, false, false, true, false, true, true, true, true);
+   }
+
    public void testCompactwithPendingCommit() throws Exception
    {
-      internalCompactTest(false, false, false, false, false, true, false, false, true, true, true);
+      internalCompactTest(true, false, false, false, false, false, false, true, false, false, true, true, true);
    }
 
    public void testCompactwithDelayedCommit() throws Exception
    {
-      internalCompactTest(false, false, false, false, false, true, false, true, true, true, true);
+      internalCompactTest(false, true, false, false, false, false, false, true, false, true, true, true, true);
    }
 
    public void testCompactwithPendingCommitFollowedByDelete() throws Exception
    {
-      internalCompactTest(false, false, false, false, false, true, true, false, true, true, true);
+      internalCompactTest(false, false, false, false, false, false, false, true, true, false, true, true, true);
    }
 
    public void testCompactwithConcurrentUpdateAndDeletes() throws Exception
    {
-      internalCompactTest(true, false, true, true, false, false, false, false, true, true, true);
+      internalCompactTest(false, false, true, false, true, true, false, false, false, false, true, true, true);
       tearDown();
       setUp();
-      internalCompactTest(true, false, true, false, true, false, false, false, true, true, true);
+      internalCompactTest(false, false, true, false, true, false, true, false, false, false, true, true, true);
    }
 
    public void testCompactwithConcurrentDeletes() throws Exception
    {
-      internalCompactTest(true, false, false, true, false, false, false, false, true, true, true);
+      internalCompactTest(false, false, true, false, false, true, false, false, false, false, true, true, true);
       tearDown();
       setUp();
-      internalCompactTest(true, false, false, false, true, false, false, false, true, true, true);
+      internalCompactTest(false, false, true, false, false, false, true, false, false, false, true, true, true);
    }
 
    public void testCompactwithConcurrentUpdates() throws Exception
    {
-      internalCompactTest(true, false, true, false, false, false, false, false, true, true, true);
+      internalCompactTest(false, false, true, false, true, false, false, false, false, false, true, true, true);
    }
 
    public void testCompactWithConcurrentAppend() throws Exception
    {
-      internalCompactTest(true, true, false, false, false, false, false, false, true, true, true);
+      internalCompactTest(false, false, true, true, false, false, false, false, false, false, true, true, true);
    }
 
-   private void internalCompactTest(final boolean regularAdd,
+   private void internalCompactTest(final boolean preXA, // prepare before compact
+                                    final boolean postXA, // prepare after compact
+                                    final boolean regularAdd,
                                     final boolean performAppend,
                                     final boolean performUpdate,
                                     boolean performDelete,
@@ -204,7 +215,7 @@
             }
             else
             {
-               throw new IllegalStateException("Error creating control file");
+               throw new IllegalStateException("Simulating a crash during compact creation");
             }
          }
 
@@ -281,6 +292,10 @@
             long recordID = idGenerator.generateID();
             addTx(transactionID, recordID);
             updateTx(transactionID, recordID);
+            if (preXA)
+            {
+               prepare(transactionID, new SimpleEncoding(10, (byte)0));
+            }
             transactedRecords.add(new Pair<Long, Long>(transactionID++, recordID));
          }
       }
@@ -404,6 +419,10 @@
       {
          for (Pair<Long, Long> tx : transactedRecords)
          {
+            if (postXA)
+            {
+               prepare(tx.a, new SimpleEncoding(10, (byte)0));
+            }
             if (tx.a % 2 == 0)
             {
                commit(tx.a);
@@ -442,6 +461,10 @@
       {
          for (Pair<Long, Long> tx : transactedRecords)
          {
+            if (postXA)
+            {
+               prepare(tx.a, new SimpleEncoding(10, (byte)0));
+            }
             if (tx.a % 2 == 0)
             {
                commit(tx.a);
@@ -472,19 +495,6 @@
 
    }
 
-   public void testCompactwithConcurrentAppendAndUpdate() throws Exception
-   {
-   }
-
-   public void testCompactWithPendingTransactionAndDelete() throws Exception
-   {
-   }
-
-   public void testCompactingWithPendingTransaction() throws Exception
-   {
-
-   }
-
    public void testSimpleCompacting() throws Exception
    {
       setup(2, 60 * 1024, true);




More information about the jboss-cvs-commits mailing list