[jboss-cvs] JBoss Messaging SVN: r4690 - in trunk: tests/src/org/jboss/messaging/tests/unit/core/journal/impl and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Jul 17 12:02:03 EDT 2008


Author: clebert.suconic at jboss.com
Date: 2008-07-17 12:02:03 -0400 (Thu, 17 Jul 2008)
New Revision: 4690

Modified:
   trunk/src/main/org/jboss/messaging/core/journal/impl/JournalImpl.java
   trunk/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/AlignedJournalImplTest.java
   trunk/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/EasyMockJournalTest.java
Log:
Few Tweaks on Journal tests (tearDown)

Modified: trunk/src/main/org/jboss/messaging/core/journal/impl/JournalImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/journal/impl/JournalImpl.java	2008-07-17 15:34:33 UTC (rev 4689)
+++ trunk/src/main/org/jboss/messaging/core/journal/impl/JournalImpl.java	2008-07-17 16:02:03 UTC (rev 4690)
@@ -1341,7 +1341,7 @@
                
                sf.open();
                
-               ByteBuffer bb = fileFactory.newBuffer(SIZE_LONG); 
+               ByteBuffer bb = fileFactory.newBuffer(SIZE_INT); 
                
                bb.putInt(newOrderingID);
                

Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/AlignedJournalImplTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/AlignedJournalImplTest.java	2008-07-17 15:34:33 UTC (rev 4689)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/AlignedJournalImplTest.java	2008-07-17 16:02:03 UTC (rev 4690)
@@ -504,6 +504,34 @@
    }
    
    
+   public void testReloadInvalidVariableSize() throws Exception
+   {
+      // Test to be written
+   }
+   
+   public void testReloadIncompleteTransaction() throws Exception
+   {
+      // We should miss one record (hole) on the transaction
+   }
+   
+   public void testAsynchronousCommit() throws Exception
+   {
+      // We should miss one record (hole) on the transaction
+   }
+   
+   public void testAsynchronousRollback() throws Exception
+   {
+      // We should miss one record (hole) on the transaction
+   }
+   
+   public void testGarbageBetweenRecords() throws Exception
+   {
+      // We should miss one record (hole) on the transaction
+   }
+   
+   
+   
+   
    public void testReloadWithPreparedTransaction() throws Exception
    {
       final int JOURNAL_SIZE = 3 * 1024;
@@ -598,6 +626,17 @@
    protected void tearDown() throws Exception
    {
       super.tearDown();
+      
+      if (journalImpl != null)
+      {
+         try
+         {
+            journalImpl.stop();
+         }
+         catch (Throwable ignored)
+         {
+         }
+      }
    }
    
   

Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/EasyMockJournalTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/EasyMockJournalTest.java	2008-07-17 15:34:33 UTC (rev 4689)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/EasyMockJournalTest.java	2008-07-17 16:02:03 UTC (rev 4690)
@@ -46,6 +46,7 @@
    SequentialFileFactory mockFactory = null;
    SequentialFile file1 = null;
    SequentialFile file2 = null;
+   JournalImpl journalImpl = null;
    
    // Static --------------------------------------------------------
 
@@ -57,8 +58,6 @@
 
    public void testAppendRecord() throws Exception
    {
-      JournalImpl journalImpl = newJournal();
-
       EasyMock.expect(file1.write(compareByteBuffer(autoEncode(JournalImpl.ADD_RECORD, 
                                                /*FileID*/1, 
                                                /*RecordLength*/1, 
@@ -97,8 +96,6 @@
 
    public void testDeleteRecord() throws Exception
    {
-      JournalImpl journalImpl = newJournal();
-
       EasyMock.expect(file1.write(compareByteBuffer(autoEncode(JournalImpl.ADD_RECORD, 
                                                /*FileID*/1, 
                                                /*RecordLength*/1, 
@@ -124,8 +121,6 @@
    
    public void testDeleteTransRecord() throws Exception
    {
-      JournalImpl journalImpl = newJournal();
-
       EasyMock.expect(file1.write(compareByteBuffer(autoEncode(JournalImpl.ADD_RECORD, 
             /*FileID*/1, 
             /*RecordLength*/1, 
@@ -164,16 +159,10 @@
       journalImpl.appendCommitRecord(100l);
       
       EasyMock.verify(mockFactory, file1, file2);
-      
-
-
-
    }
 
    public void testAppendAndCommitRecord() throws Exception
    {
-      JournalImpl journalImpl = newJournal();
-
       EasyMock.expect(
             file1.write(compareByteBuffer(autoEncode(JournalImpl.ADD_RECORD_TX,
             /* FileID */1,
@@ -223,8 +212,6 @@
 
    public void testAppendAndRollbacktRecord() throws Exception
    {
-      JournalImpl journalImpl = newJournal();
-
       EasyMock.expect(
             file1.write(compareByteBuffer(autoEncode(JournalImpl.ADD_RECORD_TX,
             /* FileID */1,
@@ -253,8 +240,6 @@
    
    public void testupdateRecordNonTrans() throws Exception
    {
-      JournalImpl journalImpl = newJournal();
-
       EasyMock.expect(file1.write(compareByteBuffer(autoEncode(JournalImpl.ADD_RECORD, 
             /* FileID */1, 
             /* RecordLength */1, 
@@ -294,8 +279,6 @@
    
    public void testupdateRecordTrans() throws Exception
    {
-      JournalImpl journalImpl = newJournal();
-
       EasyMock.expect(file1.write(compareByteBuffer(autoEncode(JournalImpl.ADD_RECORD, 
             /* FileID */1, 
             /* RecordLength */1, 
@@ -342,6 +325,26 @@
 
    }
 
+   // Protected -----------------------------------------------------
+   
+   protected void tearDown() throws Exception
+   {
+      super.tearDown();
+      
+      if (journalImpl != null)
+      {
+         EasyMock.reset(mockFactory, file1, file2);
+         stubValues();
+         try {journalImpl.stop();} catch (Throwable ignored) {}
+      }
+      
+   }
+   
+   protected void setUp() throws Exception
+   {
+      journalImpl = newJournal();
+   }
+   
    // Private -------------------------------------------------------
    
    private JournalImpl newJournal() throws Exception
@@ -493,8 +496,6 @@
 
    // Package protected ---------------------------------------------
    
-   // Protected -----------------------------------------------------
-   
    // Inner classes -------------------------------------------------
    
    




More information about the jboss-cvs-commits mailing list