[jboss-cvs] JBossCache/tests-50/functional/org/jboss/cache/pojo ...
Ben Wang
bwang at jboss.com
Wed Jul 26 12:58:25 EDT 2006
User: bwang
Date: 06/07/26 12:58:25
Modified: tests-50/functional/org/jboss/cache/pojo
NewReplicatedTest.java
Log:
upd
Revision Changes Path
1.3 +33 -1 JBossCache/tests-50/functional/org/jboss/cache/pojo/NewReplicatedTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: NewReplicatedTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests-50/functional/org/jboss/cache/pojo/NewReplicatedTest.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- NewReplicatedTest.java 27 Jun 2006 09:19:31 -0000 1.2
+++ NewReplicatedTest.java 26 Jul 2006 16:58:24 -0000 1.3
@@ -97,7 +97,7 @@
assertEquals("Age should be ", 10, remote.getAge());
// Remote remove
- cache_.detach("/a");
+ cache1_.detach("/a");
assertNull("Object should be null ", cache_.find("/a"));
assertNull("Object should be null ", cache1_.find("/a"));
@@ -105,6 +105,34 @@
assertEquals("Age should be ", 0, remote.getAge());
}
+ public void testRemoteRemove2() throws Exception
+ {
+ log_.info("testRemoteRemove() ....");
+ Person test = new Person();
+ test.setName("Ben");
+ test.setAge(10);
+ cache_.attach("/a", test);
+ Person result = (Person) cache_.find("/a");
+ assertEquals(" ", test, result);
+
+ Person remote = (Person) cache1_.find("/a");
+ assertEquals("Age should be ", 10, remote.getAge());
+
+ // Remote remove
+ cache_.detach("/a");
+ assertNull("Object should be null ", cache_.find("/a"));
+
+ assertNull("Object should be null ", cache1_.find("/a"));
+ // this will trigger the PojoCacheAlreadyDetachedException
+ try
+ {
+ remote.getAge();
+ fail("Should throw out exception here.");
+ } catch (PojoCacheAlreadyDetachedException pe)
+ {
+ }
+ }
+
/**
* Test for pojo detachment and then serialization.
*
@@ -117,6 +145,10 @@
addr.setZip(95123);
addr.addResidents("Ben");
addr.addResidents("Joe");
+ // Test serialization first
+ cache_.getCache().put("/plain", "test", addr);
+ cache_.getCache().remove("/plain", "test");
+
cache_.attach("/a", addr);
SpecialSerializedAddress result = (SpecialSerializedAddress) cache_.find("/a");
assertEquals(" ", addr, result);
More information about the jboss-cvs-commits
mailing list