[jboss-cvs] JBossCache/tests/functional/org/jboss/cache/aop ...
Ben Wang
bwang at jboss.com
Thu Nov 16 01:44:48 EST 2006
User: bwang
Date: 06/11/16 01:44:48
Modified: tests/functional/org/jboss/cache/aop Tag:
Branch_JBossCache_1_4_0 NewLocalAopTest.java
Log:
JBCACHE-847 removeObject didn't restor Collection class instance.
Revision Changes Path
No revision
No revision
1.8.2.2 +55 -3 JBossCache/tests/functional/org/jboss/cache/aop/Attic/NewLocalAopTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: NewLocalAopTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/aop/Attic/NewLocalAopTest.java,v
retrieving revision 1.8.2.1
retrieving revision 1.8.2.2
diff -u -b -r1.8.2.1 -r1.8.2.2
--- NewLocalAopTest.java 16 Nov 2006 02:53:35 -0000 1.8.2.1
+++ NewLocalAopTest.java 16 Nov 2006 06:44:48 -0000 1.8.2.2
@@ -15,6 +15,8 @@
import java.util.Map;
import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.HashMap;
/**
@@ -97,9 +99,9 @@
assertEquals("Age should be updated as ", 20, test.getAge());
}
- public void testRemoveProxy() throws Exception
+ public void testRemoveProxyList() throws Exception
{
- log_.info("testRemoveProxy() ....");
+ log_.info("testRemoveProxyList() ....");
Person test = new Person();
test.setName("Ben");
test.setAge(10);
@@ -113,9 +115,59 @@
assertTrue("Instance of proxyclass ", result.getLanguages() instanceof ClassProxy);
- cache_.removeObject("/a");
+ Person r1 = (Person)cache_.removeObject("/a");
+ assertEquals("Same instance ", result, r1);
assertFalse("Instance of proxyclass ", result.getLanguages() instanceof ClassProxy);
+ assertEquals("Same Collection instance", list, result.getLanguages());
+ }
+
+ public void testRemoveProxySet() throws Exception
+ {
+ log_.info("testRemoveProxySet() ....");
+ Person test = new Person();
+ test.setName("Ben");
+ test.setAge(10);
+ HashSet set = new HashSet();
+ set.add("Golf");
+ set.add("Cooking");
+ test.setSkills(set);
+ cache_.putObject("/a", test);
+ Person result = (Person)cache_.getObject("/a");
+ assertEquals(" ", test, result);
+
+ assertTrue("Instance of proxyclass ", result.getSkills() instanceof ClassProxy);
+
+ Person r1 = (Person)cache_.removeObject("/a");
+
+ assertEquals("Same instance ", result, r1);
+ assertFalse("Instance of proxyclass ", result.getSkills() instanceof ClassProxy);
+ assertEquals("Same Collection instance", set, result.getSkills());
+ }
+
+ public void testRemoveProxyMap() throws Exception
+ {
+ log_.info("testRemoveProxyMap() ....");
+ Person test = new Person();
+ test.setName("Ben");
+ test.setAge(10);
+
+ HashMap map = new HashMap();
+ map.put("1", "Golf");
+ map.put("2", "Surfing");
+ test.setHobbies(map);
+
+ cache_.putObject("/a", test);
+ Person result = (Person)cache_.getObject("/a");
+ assertEquals(" ", test, result);
+
+ assertTrue("Instance of proxyclass ", result.getHobbies() instanceof ClassProxy);
+
+ Person r1 = (Person)cache_.removeObject("/a");
+
+ assertEquals("Same instance ", result, r1);
+ assertFalse("Instance of proxyclass ", result.getHobbies() instanceof ClassProxy);
+ assertEquals("Same Collection instance", map, result.getHobbies());
}
public void testPutRemoveNodeExistence() throws Exception
More information about the jboss-cvs-commits
mailing list