[hornetq-commits] JBoss hornetq SVN: r9808 - in branches/Branch_New_Paging: tests/src/org/hornetq/tests/integration/paging and 1 other directory.

do-not-reply at jboss.org do-not-reply at jboss.org
Thu Oct 21 21:08:56 EDT 2010


Author: clebert.suconic at jboss.com
Date: 2010-10-21 21:08:55 -0400 (Thu, 21 Oct 2010)
New Revision: 9808

Modified:
   branches/Branch_New_Paging/src/main/org/hornetq/core/paging/cursor/impl/PageCursorImpl.java
   branches/Branch_New_Paging/src/main/org/hornetq/core/paging/cursor/impl/PageCursorProviderImpl.java
   branches/Branch_New_Paging/tests/src/org/hornetq/tests/integration/paging/PageCursorTest.java
Log:
few tests

Modified: branches/Branch_New_Paging/src/main/org/hornetq/core/paging/cursor/impl/PageCursorImpl.java
===================================================================
--- branches/Branch_New_Paging/src/main/org/hornetq/core/paging/cursor/impl/PageCursorImpl.java	2010-10-21 21:02:05 UTC (rev 9807)
+++ branches/Branch_New_Paging/src/main/org/hornetq/core/paging/cursor/impl/PageCursorImpl.java	2010-10-22 01:08:55 UTC (rev 9808)
@@ -111,23 +111,23 @@
    {
       return cursorProvider;
    }
-   
+
    public void bookmark(PagePosition position) throws Exception
    {
       if (lastPosition != null)
       {
          throw new RuntimeException("Bookmark can only be done at the time of the cursor's creation");
       }
-      
+
       lastPosition = position;
-      
+
       PageCursorInfo cursorInfo = getPageInfo(position);
-      
+
       if (position.getMessageNr() > 0)
       {
          cursorInfo.confirmed.addAndGet(position.getMessageNr());
       }
-      
+
       ack(position);
    }
 
@@ -358,7 +358,7 @@
             PageCursorImpl.trace("********** processing reload!!!!!!!");
          }
          Collections.sort(recoveredACK);
-         
+
          boolean first = true;
 
          PagePosition previousPos = null;
@@ -667,7 +667,7 @@
       @Override
       public String toString()
       {
-         return "PageCursorInfo::PageID=" + pageId + " numberOfMessage = " + numberOfMessages;
+         return "PageCursorInfo::PageID=" + pageId + " numberOfMessage = " + numberOfMessages + ", confirmed = " + confirmed;
       }
 
       public PageCursorInfo(final long pageId, final int numberOfMessages, final PageCache cache)

Modified: branches/Branch_New_Paging/src/main/org/hornetq/core/paging/cursor/impl/PageCursorProviderImpl.java
===================================================================
--- branches/Branch_New_Paging/src/main/org/hornetq/core/paging/cursor/impl/PageCursorProviderImpl.java	2010-10-21 21:02:05 UTC (rev 9807)
+++ branches/Branch_New_Paging/src/main/org/hornetq/core/paging/cursor/impl/PageCursorProviderImpl.java	2010-10-22 01:08:55 UTC (rev 9808)
@@ -321,6 +321,7 @@
 
    public void printDebug()
    {
+      System.out.println("Debug information for PageCursorProviderImpl:");
       for (PageCache cache : softCache.values())
       {
          System.out.println("Cache " + cache);

Modified: branches/Branch_New_Paging/tests/src/org/hornetq/tests/integration/paging/PageCursorTest.java
===================================================================
--- branches/Branch_New_Paging/tests/src/org/hornetq/tests/integration/paging/PageCursorTest.java	2010-10-21 21:02:05 UTC (rev 9807)
+++ branches/Branch_New_Paging/tests/src/org/hornetq/tests/integration/paging/PageCursorTest.java	2010-10-22 01:08:55 UTC (rev 9808)
@@ -111,10 +111,8 @@
       int numberOfPages = addMessages(NUM_MESSAGES, 1024 * 1024);
 
       System.out.println("NumberOfPages = " + numberOfPages);
-
-      PageCursorProviderImpl cursorProvider = (PageCursorProviderImpl)createNonPersistentCursor();
       
-      PageCursor cursor = cursorProvider.createNonPersistentCursor();
+      PageCursor cursor = createNonPersistentCursor();
       
       Pair<PagePosition, PagedMessage> msg;
       
@@ -129,7 +127,11 @@
       
       forceGC();
       
-      assertTrue(cursorProvider.getCacheSize() < numberOfPages);
+      assertTrue(lookupCursorProvider().getCacheSize() < numberOfPages);
+      
+      server.stop();
+      createServer();
+      assertEquals(1, lookupPageStore(ADDRESS).getNumberOfPages());
 
    }
 
@@ -214,7 +216,10 @@
       OperationContextImpl.getContext(null).waitCompletion(); 
       ((PageCursorImpl)cursor).printDebug();
       
-      
+      server.stop();
+      createServer();
+      assertEquals(1, lookupPageStore(ADDRESS).getNumberOfPages());
+
    }
    
    public void testRestartWithHoleOnAck() throws Exception
@@ -265,6 +270,10 @@
          cursor.ack(msg.a);
       }
       
+      server.stop();
+      createServer();
+      assertEquals(1, lookupPageStore(ADDRESS).getNumberOfPages());
+
    }
    
    
@@ -322,6 +331,10 @@
       
       tx.commit();
       
+      server.stop();
+      createServer();
+      assertEquals(1, lookupPageStore(ADDRESS).getNumberOfPages());
+      
    }
    
    public void testConsumeLivePage() throws Exception
@@ -435,7 +448,10 @@
          assertEquals(i, readMessage.b.getMessage().getIntProperty("key").intValue());
       }
 
-      
+      server.stop();
+      createServer();
+      assertEquals(1, lookupPageStore(ADDRESS).getNumberOfPages());
+ 
    }
    
    
@@ -447,7 +463,7 @@
 
       final int NUM_MESSAGES = 100;
       
-      final int messageSize = 10 * 1024;
+      final int messageSize = 100 * 1024;
       
       
       PageCursorProvider cursorProvider = this.server.getPagingManager().getPageStore(ADDRESS).getCursorProvier();
@@ -476,7 +492,8 @@
       pageStore.forceAnotherPage();
       
       addMessages(300, NUM_MESSAGES, messageSize);
-      pageStore.forceAnotherPage();
+      
+      System.out.println("Number of pages - " + pageStore.getNumberOfPages());
 
 
       // First consume what's already there without any tx as nothing was committed
@@ -490,9 +507,12 @@
 
       assertNull(cursor.moveNext());
       
+      cursor.printDebug();
       pgtxRollback.rollback();
+      
       this.server.getPagingManager().removeTransaction(pgtxRollback.getTransactionID());
       pgtxCommit.commit();
+
       // Second:after pgtxCommit was done
       for (int i = 200; i < 300; i++)
       {
@@ -502,16 +522,15 @@
          cursor.ack(pos.a);
       }
       
+      assertNull(cursor.moveNext());
       
+      server.stop();
+      createServer();
+      assertEquals(1, lookupPageStore(ADDRESS).getNumberOfPages());
+   
+      
    }
-
-
-   public void testCleanupScenarios() throws Exception
-   {
-      // Validate the pages are being cleared (with multiple cursors)
-   }
    
-   
    public void testCloseNonPersistentConsumer() throws Exception
    {
 
@@ -550,8 +569,10 @@
       assertSame(cursor2.getProvider(), cursorProvider);
 
       cursor2.close();
-      
+
       server.stop();
+      createServer();
+      assertEquals(1, lookupPageStore(ADDRESS).getNumberOfPages());
 
    }
   
@@ -560,12 +581,7 @@
    {
       // Validate the cursor are working fine when all the pages are gone, and then paging being restarted   
    }
-   
-   public void testRedeliveryWithCleanup() throws Exception
-   {
-      
-   }
-   
+    
    public void testFirstMessageInTheMiddle() throws Exception
    {
 
@@ -604,14 +620,8 @@
       assertTrue(cursorProvider.getCacheSize() < numberOfPages);
       
       server.stop();
-      
-      server.start();
-      
-      Thread.sleep(1000);
+      createServer();
       assertEquals(1, lookupPageStore(ADDRESS).getNumberOfPages());
-      
-      
-
    }
    
    
@@ -668,12 +678,8 @@
       
       assertTrue(cursorProvider.getCacheSize() < numberOfPages);
       
-      // This is to make sure all the pending files will be deleted
       server.stop();
-      OperationContextImpl.clearContext();
-
       createServer();
-      
       assertEquals(1, lookupPageStore(ADDRESS).getNumberOfPages());
 
    }
@@ -740,6 +746,8 @@
     */
    private void createServer() throws Exception
    {
+      OperationContextImpl.clearContext();
+      
       Configuration config = createDefaultConfig();
       
       config.setJournalSyncNonTransactional(true);



More information about the hornetq-commits mailing list