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

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Mon Jul 7 15:46:19 EDT 2008


Author: galder.zamarreno at jboss.com
Date: 2008-07-07 15:46:19 -0400 (Mon, 07 Jul 2008)
New Revision: 6195

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

Modified: core/trunk/src/test/java/org/jboss/cache/marshall/CacheLoaderMarshallingTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/marshall/CacheLoaderMarshallingTest.java	2008-07-07 19:41:29 UTC (rev 6194)
+++ core/trunk/src/test/java/org/jboss/cache/marshall/CacheLoaderMarshallingTest.java	2008-07-07 19:46:19 UTC (rev 6195)
@@ -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,8 @@
 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;
@@ -28,6 +31,7 @@
  * not visible to the cache's default classloader.
  *
  * @author <a href="mailto:brian.stansberry at jboss.org">Brian Stansberry</a>
+ * @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
  * @since 2.1.0
  */
 @Test(groups = "functional")
@@ -65,7 +69,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