[jboss-cvs] JBossCache/tests/functional/org/jboss/cache/aop/loader ...
Ben Wang
bwang at jboss.com
Wed Jan 17 09:43:23 EST 2007
User: bwang
Date: 07/01/17 09:43:23
Modified: tests/functional/org/jboss/cache/aop/loader Tag:
Branch_JBossCache_1_4_0 ObjectGraphTestsBase.java
Log:
Test object remove with loader.
Revision Changes Path
No revision
No revision
1.3.2.1 +32 -1 JBossCache/tests/functional/org/jboss/cache/aop/loader/Attic/ObjectGraphTestsBase.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ObjectGraphTestsBase.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/aop/loader/Attic/ObjectGraphTestsBase.java,v
retrieving revision 1.3
retrieving revision 1.3.2.1
diff -u -b -r1.3 -r1.3.2.1
--- ObjectGraphTestsBase.java 9 Apr 2006 12:33:49 -0000 1.3
+++ ObjectGraphTestsBase.java 17 Jan 2007 14:43:23 -0000 1.3.2.1
@@ -13,11 +13,14 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import java.util.Map;
+import java.util.HashMap;
+
/**
* Commons tests for all CacheLoaders. Aop version.
*
* @author bwang
- * @version $Id: ObjectGraphTestsBase.java,v 1.3 2006/04/09 12:33:49 bwang Exp $
+ * @version $Id: ObjectGraphTestsBase.java,v 1.3.2.1 2007/01/17 14:43:23 bwang Exp $
*/
abstract public class ObjectGraphTestsBase extends AbstractCacheLoaderTestBase {
Log log=LogFactory.getLog(ObjectGraphTestsBase.class);
@@ -104,6 +107,34 @@
// assertEquals(add1.getCity(), add2.getCity());
}
+ public void testObjectRemoved() throws Exception
+ {
+ log.info("testObjectRemoved() ...");
+ cache.putObject("/person/joe", createPerson("Joe Black", 31));
+ Person joe = (Person) cache.getObject("/person/joe");
+ Address addr = new Address();
+ addr.setStreet("123 Albert Ave.");
+ addr.setCity("Sunnyvale");
+ addr.setZip(94087);
+
+ // They share the sub-object: address
+ joe.setAddress(addr);
+
+ log.info("testMultipleReference(): verify");
+ Address add1 = (Address) ((Person)cache.getObject("/person/joe")).getAddress();
+
+ Map map = new HashMap();
+ map.put("1", "1");
+ Map m1 = new HashMap();
+ m1.put("2", "2");
+ map.put("m1", m1);
+ joe.setHobbies(map);
+
+ cache.removeObject("/person/joe");
+ joe = (Person) cache.getObject("/person/joe");
+ assertNull("Joe should be null ", joe);
+ }
+
public static Test suite() {
return new TestSuite(ObjectGraphTestsBase.class);
}
More information about the jboss-cvs-commits
mailing list