From jbosscache-commits at lists.jboss.org Mon Jul 7 15:52:12 2008 Content-Type: multipart/mixed; boundary="===============1520898135960474566==" MIME-Version: 1.0 From: jbosscache-commits at lists.jboss.org To: jbosscache-commits at lists.jboss.org Subject: [jbosscache-commits] JBoss Cache SVN: r6196 - core/branches/2.1.X/src/test/java/org/jboss/cache/marshall. Date: Mon, 07 Jul 2008 15:52:12 -0400 Message-ID: --===============1520898135960474566== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: galder.zamarreno(a)jboss.com Date: 2008-07-07 15:52:12 -0400 (Mon, 07 Jul 2008) New Revision: 6196 Modified: core/branches/2.1.X/src/test/java/org/jboss/cache/marshall/CacheLoaderMa= rshallingTest.java Log: [JBCACHE-1357] Issue not present in 2.1.x but I still added the test case. Modified: core/branches/2.1.X/src/test/java/org/jboss/cache/marshall/CacheL= oaderMarshallingTest.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- core/branches/2.1.X/src/test/java/org/jboss/cache/marshall/CacheLoaderM= arshallingTest.java 2008-07-07 19:46:19 UTC (rev 6195) +++ core/branches/2.1.X/src/test/java/org/jboss/cache/marshall/CacheLoaderM= arshallingTest.java 2008-07-07 19:52:12 UTC (rev 6196) @@ -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.IndividualCacheLoaderConfi= g; @@ -14,6 +15,8 @@ import org.jboss.cache.loader.FileCacheLoaderConfig; import org.jboss.cache.misc.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 Brian Stansberr= y + * @author Galder Zamarren= o * @since 2.1.0 */ @Test(groups =3D "functional") @@ -65,7 +69,42 @@ { cacheLoaderMarshallingTest(true); } + = + public void testLoadNodesAtRootOfRegion() throws Exception + { + String rootRegionName =3D "/myregion"; + String hereFqn =3D rootRegionName + "/here"; + = + cache =3D createCache(true); + cache.start(); = + Region r =3D cache.getRegion(Fqn.fromString(rootRegionName), true); + r.registerContextClassLoader(Thread.currentThread().getContextClassL= oader()); + 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 =3D cache.getRegion(Fqn.fromString(rootRegionName), true); + r.registerContextClassLoader(Thread.currentThread().getContextClassL= oader()); + r.activate(); + = + Node rootRegionNode =3D cache.getNode(rootRegionName= ); + Node hereNode =3D 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 =3D createCache(useRegionBased); --===============1520898135960474566==--