[jboss-cvs] JBossCache/tests/functional/org/jboss/cache/marshall ...
Manik Surtani
manik at jboss.org
Mon Apr 2 20:43:52 EDT 2007
User: msurtani
Date: 07/04/02 20:43:52
Modified: tests/functional/org/jboss/cache/marshall
ActiveInactiveTest.java
ReplicateToInactiveRegionTest.java
Log:
JBCACHE-876
Revision Changes Path
1.16 +21 -17 JBossCache/tests/functional/org/jboss/cache/marshall/ActiveInactiveTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ActiveInactiveTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/marshall/ActiveInactiveTest.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- ActiveInactiveTest.java 19 Jan 2007 16:00:32 -0000 1.15
+++ ActiveInactiveTest.java 3 Apr 2007 00:43:52 -0000 1.16
@@ -153,6 +153,10 @@
MethodCall replicate = MethodCallFactory.create(MethodDeclarations.replicateMethod, put);
rman.setDefaultInactive(true);
+ // register A as an inactive marshalling region
+ Region region_A = rman.getRegion(A, true);
+ region_A.registerContextClassLoader(this.getClass().getClassLoader());
+ assertFalse("New regions created should be inactive by default", region_A.isActive());
VersionAwareMarshaller testee = new VersionAwareMarshaller(rman, true, true, Version.getVersionString(Version.getVersionShort()));
byte[] callBytes = testee.objectToByteBuffer(replicate);
@@ -167,7 +171,7 @@
}
rman.activate(A);
- assertTrue(rman.hasRegion(A, Region.Type.ANY));
+ assertTrue(rman.hasRegion(A, Region.Type.MARSHALLING));
MethodCall result = (MethodCall) testee.objectFromByteBuffer(callBytes);
Method method = result.getMethod();
1.5 +18 -2 JBossCache/tests/functional/org/jboss/cache/marshall/ReplicateToInactiveRegionTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ReplicateToInactiveRegionTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/marshall/ReplicateToInactiveRegionTest.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- ReplicateToInactiveRegionTest.java 17 Jan 2007 16:24:07 -0000 1.4
+++ ReplicateToInactiveRegionTest.java 3 Apr 2007 00:43:52 -0000 1.5
@@ -4,6 +4,7 @@
import org.jboss.cache.CacheImpl;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
+import org.jboss.cache.Region;
import org.jboss.cache.misc.TestingUtil;
public class ReplicateToInactiveRegionTest extends TestCase
@@ -48,8 +49,23 @@
assertEquals("v", caches[0].get(f, "k"));
assertEquals("v", caches[1].get(f, "k"));
- // now deactvate the region on cache 2
- caches[1].getRegionManager().getRegion(f, true).deactivate();
+ // create the region on cache 0, make sure it is marked as a MARSHALLING region by attaching a class loader to it.
+ Region region0 = caches[0].getRegionManager().getRegion(f, true);
+ region0.registerContextClassLoader(this.getClass().getClassLoader()); // just to make sure this is recognised as a marshalling region.
+ assertTrue("Should be active by default", region0.isActive());
+ // make sure this newly created region is "recognised" as a marshalling region.
+ assertTrue(caches[0].getRegionManager().getAllRegions(Region.Type.MARSHALLING).contains(region0));
+
+ // now create a region on cache 1, as above.
+ Region region1 = caches[1].getRegionManager().getRegion(f, true);
+ region1.registerContextClassLoader(this.getClass().getClassLoader()); // just to make sure this is recognised as a marshalling region.
+ assertTrue("Should be active by default", region1.isActive());
+ // make sure this newly created region is "recognised" as a marshalling region.
+ assertTrue(caches[1].getRegionManager().getAllRegions(Region.Type.MARSHALLING).contains(region1));
+
+ // now deactivate the region on cache 1.
+ region1.deactivate();
+ assertFalse("Should be have deactivated", region1.isActive());
caches[0].put(f, "k", "v2");
assertEquals("v2", caches[0].get(f, "k"));
More information about the jboss-cvs-commits
mailing list