[jboss-cvs] JBossCache/tests-50/functional/org/jboss/cache/pojo ...
Ben Wang
bwang at jboss.com
Fri Jul 14 13:55:27 EDT 2006
User: bwang
Date: 06/07/14 13:55:27
Modified: tests-50/functional/org/jboss/cache/pojo LocalTest.java
Log:
JBCACHE-697 PojoCache sub-field Collection reference.
Revision Changes Path
1.3 +35 -0 JBossCache/tests-50/functional/org/jboss/cache/pojo/LocalTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: LocalTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests-50/functional/org/jboss/cache/pojo/LocalTest.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- LocalTest.java 27 Jun 2006 09:19:31 -0000 1.2
+++ LocalTest.java 14 Jul 2006 17:55:27 -0000 1.3
@@ -135,6 +135,41 @@
log.debug("Hobbies is " + hobbies.toString());
}
+ public void testMapDetachAttach() throws Exception
+ {
+ log.info("testMapDetachATtach() ....");
+ Person ben = createPerson("/person/test1", "Ben Wang", 40);
+ assertEquals((Object) "Ben Wang", ben.getName());
+ Map<String, String> hobbies = ben.getHobbies();
+ if (hobbies == null)
+ {
+ hobbies = new HashMap<String, String>();
+ ben.setHobbies(hobbies);
+ // NB: it is neccessary to get hobbies again to get advised version
+ hobbies = ben.getHobbies();
+ }
+ hobbies.put("1", "English");
+ hobbies.put("2", "French");
+ if (!(hobbies instanceof ClassProxy))
+ {
+ fail("Hobbies is not an instance of ClassProxy");
+ }
+
+ hobbies = ben.getHobbies();
+ assertEquals("Hobbies size", 2, hobbies.size());
+ log.debug("Hobbies is " + hobbies.toString());
+
+ cache_.detach("/person/test1");
+ hobbies = ben.getHobbies();
+ if ((hobbies instanceof ClassProxy))
+ {
+ fail("Hobbies should not be an instance of ClassProxy");
+ }
+
+ cache_.attach("/person/1", ben);
+
+ }
+
public void testMap2() throws Throwable
{
Person joe = createPerson("/person/test5", "Joe Black", 32);
More information about the jboss-cvs-commits
mailing list