[jboss-cvs] JBossCache/tests-50/functional/org/jboss/cache/pojo ...

Ben Wang bwang at jboss.com
Thu Nov 16 01:45:55 EST 2006


  User: bwang   
  Date: 06/11/16 01:45:55

  Modified:    tests-50/functional/org/jboss/cache/pojo  NewLocalTest.java
  Log:
  upd
  
  Revision  Changes    Path
  1.11      +78 -0     JBossCache/tests-50/functional/org/jboss/cache/pojo/NewLocalTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: NewLocalTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests-50/functional/org/jboss/cache/pojo/NewLocalTest.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -b -r1.10 -r1.11
  --- NewLocalTest.java	31 Oct 2006 11:07:17 -0000	1.10
  +++ NewLocalTest.java	16 Nov 2006 06:45:55 -0000	1.11
  @@ -7,8 +7,12 @@
   import org.apache.commons.logging.LogFactory;
   import org.jboss.cache.pojo.test.Person;
   import org.jboss.cache.pojo.InternalConstant;
  +import org.jboss.aop.proxy.ClassProxy;
   
   import java.util.Map;
  +import java.util.HashSet;
  +import java.util.HashMap;
  +import java.util.ArrayList;
   
   /**
    * Additional basic tests
  @@ -106,6 +110,77 @@
         assertNull("DataNode should not exisit ", cache_.getCache().get("person"));
      }
   
  +   public void testRemoveProxyList() throws Exception
  +   {
  +      log_.info("testRemoveProxyList() ....");
  +      Person test = new Person();
  +      test.setName("Ben");
  +      test.setAge(10);
  +      ArrayList list = new ArrayList();
  +      list.add("English");
  +      list.add("Taiwanese");
  +      test.setLanguages(list);
  +      cache_.attach("/a", test);
  +      Person result = (Person)cache_.find("/a");
  +      assertEquals(" ", test, result);
  +
  +      assertTrue("Instance of proxyclass ", result.getLanguages() instanceof ClassProxy);
  +
  +      Person r1 = (Person)cache_.detach("/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_.attach("/a", test);
  +      Person result = (Person)cache_.find("/a");
  +      assertEquals(" ", test, result);
  +
  +      assertTrue("Instance of proxyclass ", result.getSkills() instanceof ClassProxy);
  +
  +      Person r1 = (Person)cache_.detach("/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_.attach("/a", test);
  +      Person result = (Person)cache_.find("/a");
  +      assertEquals(" ", test, result);
  +
  +      assertTrue("Instance of proxyclass ", result.getHobbies() instanceof ClassProxy);
  +
  +      Person r1 = (Person)cache_.detach("/a");
  +
  +      assertEquals("Same instance ", result, r1);
  +      assertFalse("Instance of proxyclass ", result.getHobbies() instanceof ClassProxy);
  +      assertEquals("Same Collection instance", map, result.getHobbies());
  +   }
  +
      public void testFindObjects() throws Exception
      {
         log_.info("testFindObjects() ....");
  @@ -128,6 +203,9 @@
         cache_.detach("/e");
         map = cache_.findAll("/");
         assertEquals("Objects size should be ", 2, map.size());
  +
  +      map = cache_.findAll(null); // should everything.
  +      assertEquals("Objects size should be ", 2, map.size());
      }
   
      public static Test suite() throws Exception
  
  
  



More information about the jboss-cvs-commits mailing list