[jbosscache-commits] JBoss Cache SVN: r6190 - core/branches/2.2.X/src/test/java/org/jboss/cache/marshall.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Mon Jul 7 15:24:30 EDT 2008


Author: galder.zamarreno at jboss.com
Date: 2008-07-07 15:24:30 -0400 (Mon, 07 Jul 2008)
New Revision: 6190

Modified:
   core/branches/2.2.X/src/test/java/org/jboss/cache/marshall/CacheLoaderMarshallingTest.java
Log:
[JBCACHE-1357] Issue not present in 2.2.x but I still added the test case.

Modified: core/branches/2.2.X/src/test/java/org/jboss/cache/marshall/CacheLoaderMarshallingTest.java
===================================================================
--- core/branches/2.2.X/src/test/java/org/jboss/cache/marshall/CacheLoaderMarshallingTest.java	2008-07-07 18:28:33 UTC (rev 6189)
+++ core/branches/2.2.X/src/test/java/org/jboss/cache/marshall/CacheLoaderMarshallingTest.java	2008-07-07 19:24:30 UTC (rev 6190)
@@ -3,6 +3,7 @@
 import org.jboss.cache.Cache;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
+import org.jboss.cache.Node;
 import org.jboss.cache.Region;
 import org.jboss.cache.config.CacheLoaderConfig;
 import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
@@ -14,6 +15,7 @@
 import org.jboss.cache.loader.FileCacheLoaderConfig;
 import org.jboss.cache.util.TestingUtil;
 import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertNotNull;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
@@ -65,7 +67,42 @@
    {
       cacheLoaderMarshallingTest(true);
    }
+   
+   public void testLoadNodesAtRootOfRegion() throws Exception
+   {
+      String rootRegionName = "/myregion";
+      String hereFqn = rootRegionName + "/here";
+      
+      cache = createCache(true);
+      cache.start();
 
+      Region r = cache.getRegion(Fqn.fromString(rootRegionName), true);
+      r.registerContextClassLoader(Thread.currentThread().getContextClassLoader());
+      r.activate();
+      
+      cache.put(rootRegionName, "a key", "a value");
+      cache.put(hereFqn, "another key", "another value");
+
+      r.deactivate();
+      r.unregisterContextClassLoader();
+      
+      cache.stop();
+      
+      cache.start();
+      
+      r = cache.getRegion(Fqn.fromString(rootRegionName), true);
+      r.registerContextClassLoader(Thread.currentThread().getContextClassLoader());
+      r.activate();
+      
+      Node<Object, Object> rootRegionNode = cache.getNode(rootRegionName);
+      Node<Object, Object> hereNode = cache.getNode(hereFqn);
+      assertNotNull(rootRegionNode);
+      assertNotNull(hereNode);
+      
+      assertEquals(hereNode.get("another key"), "another value");
+      assertEquals(rootRegionNode.get("a key"), "a value");
+   }
+
    private void cacheLoaderMarshallingTest(boolean useRegionBased) throws Exception
    {
       cache = createCache(useRegionBased);




More information about the jbosscache-commits mailing list