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

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Fri Feb 13 10:55:55 EST 2009


Author: jason.greene at jboss.com
Date: 2009-02-13 10:55:55 -0500 (Fri, 13 Feb 2009)
New Revision: 7691

Modified:
   core/trunk/src/test/java/org/jboss/cache/statetransfer/NonBlockingStateTransferTest.java
Log:
Add region test


Modified: core/trunk/src/test/java/org/jboss/cache/statetransfer/NonBlockingStateTransferTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/statetransfer/NonBlockingStateTransferTest.java	2009-02-13 15:55:43 UTC (rev 7690)
+++ core/trunk/src/test/java/org/jboss/cache/statetransfer/NonBlockingStateTransferTest.java	2009-02-13 15:55:55 UTC (rev 7691)
@@ -20,6 +20,7 @@
 import org.jboss.cache.Cache;
 import org.jboss.cache.CacheSPI;
 import org.jboss.cache.Fqn;
+import org.jboss.cache.Region;
 import org.jboss.cache.UnitTestCacheFactory;
 import org.jboss.cache.config.Configuration;
 import org.jboss.cache.config.Configuration.CacheMode;
@@ -169,6 +170,51 @@
       log.info("testInitialStateTransfer end - " + testCount);
    }
 
+   public void testActivateRegionTransfer() throws Exception
+   {
+      testCount++;
+      log.info("testActivateRegionTransfer start - " + testCount);
+      CacheSPI<Object, Object> cache1 = null, cache2 = null;
+      try
+      {
+         cache1 = createCache("nbst", false);
+         cache1.getConfiguration().setUseRegionBasedMarshalling(true);
+         Region region = cache1.getRegion(Fqn.fromString("/region1"), true);
+         region.registerContextClassLoader(getClass().getClassLoader());
+         cache1.start();
+
+         writeInitialData(cache1);
+
+         cache2 = createCache("nbst", false);
+         cache2.getConfiguration().setUseRegionBasedMarshalling(true);
+         region = cache2.getRegion(Fqn.fromString("/region1"), true);
+         region.registerContextClassLoader(getClass().getClassLoader());
+         cache2.start();
+         region.deactivate();
+
+         // Pause to give caches time to see each other
+         TestingUtil.blockUntilViewsReceived(new CacheSPI[] { cache1, cache2 }, 60000);
+
+         cache1.put("/region1/blah", "blah", "blah");
+         cache1.put("/region1/blah2", "blah", "blah");
+
+         assertEquals(null, cache2.get("/region1/blah", "blah"));
+         assertEquals(null, cache2.get("/region1/blah2", "blah"));
+
+         region.activate();
+
+         assertEquals("blah", cache2.get("/region1/blah", "blah"));
+         assertEquals("blah", cache2.get("/region1/blah2", "blah"));
+
+         verifyInitialData(cache2);
+      }
+      finally
+      {
+         TestingUtil.killCaches(cache1, cache2);
+      }
+      log.info("testActivateRegionTransfer end - " + testCount);
+   }
+
    public void testConcurrentStateTransfer() throws Exception
    {
       testCount++;




More information about the jbosscache-commits mailing list