[jbosscache-commits] JBoss Cache SVN: r4674 - core/trunk/src/test/java/org/jboss/cache/buddyreplication.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Tue Oct 23 13:28:23 EDT 2007


Author: manik.surtani at jboss.com
Date: 2007-10-23 13:28:23 -0400 (Tue, 23 Oct 2007)
New Revision: 4674

Modified:
   core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationContentTest.java
Log:
Improved test

Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationContentTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationContentTest.java	2007-10-23 17:02:47 UTC (rev 4673)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/BuddyReplicationContentTest.java	2007-10-23 17:28:23 UTC (rev 4674)
@@ -15,6 +15,7 @@
 import org.jboss.cache.notifications.annotation.CacheListener;
 import org.jboss.cache.notifications.annotation.CacheUnblocked;
 import org.jboss.cache.notifications.event.Event;
+import org.jboss.cache.util.CachePrinter;
 import static org.testng.AssertJUnit.*;
 import org.testng.annotations.Test;
 
@@ -236,6 +237,7 @@
       }
    }
 
+   @Test (invocationCount = 25)
    public void testCompleteStateSurvival() throws Exception
    {
       log.debug("Running testCompleteStateSurvival");
@@ -254,7 +256,7 @@
 
 //      TestingUtil.sleepThread(getSleepTimeout());
       //TestingUtil.sleepThread(caches.get(0).getConfiguration().getStateRetrievalTimeout() * 3);
-      blockListener.blockUntilAllCachesAreUnblocked(60000);
+      blockListener.blockUntilAllCachesAreUnblocked(caches.get(0).getConfiguration().getStateRetrievalTimeout() * 3);
 
       log.info("stopping 2");
       caches.get(2).stop();
@@ -265,7 +267,7 @@
 
 //      TestingUtil.sleepThread(getSleepTimeout());
 //      TestingUtil.sleepThread(caches.get(0).getConfiguration().getStateRetrievalTimeout() * 3);
-      blockListener.blockUntilAllCachesAreUnblocked(60000);
+      blockListener.blockUntilAllCachesAreUnblocked(caches.get(0).getConfiguration().getStateRetrievalTimeout() * 3);
 
       assertEquals("value", caches.get(0).get("/2", "key"));
 
@@ -275,7 +277,7 @@
 
 //      TestingUtil.sleepThread(getSleepTimeout());
 //      TestingUtil.sleepThread(caches.get(0).getConfiguration().getStateRetrievalTimeout() * 3);
-      blockListener.blockUntilAllCachesAreUnblocked(60000);
+      blockListener.blockUntilAllCachesAreUnblocked(caches.get(0).getConfiguration().getStateRetrievalTimeout() * 3);
 
       caches.get(1).stop();
       log.info("0 ** " + caches.get(0).printLockInfo());
@@ -297,6 +299,9 @@
       }
 
       // now try the assertion again since the local gravitation would have worked.
+
+      System.out.println("Cache contents " + CachePrinter.printCacheDetails(caches.get(0)));
+
       assertEquals("value", caches.get(0).get("/1", "key"));
       assertEquals("value", caches.get(0).get("/2", "key"));
    }
@@ -337,12 +342,13 @@
       {
          synchronized (this)
          {
-            if (blocks != 0)
+            if (blocks > 1)
             {
                wait(maxWait);
             }
-            if (blocks != 0)
+            if (blocks > 1)
                throw new RuntimeException("Timed out waiting for unblocks.  Number of blocks = " + blocks);
+            if (blocks == 1) blocks = 0;
          }
       }
    }




More information about the jbosscache-commits mailing list