Package org.jboss.cache.aop.test

Examples of org.jboss.cache.aop.test.Person


   }

   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());
   }
View Full Code Here


   }

   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());
   }
View Full Code Here

   }

   public void testPutRemoveNodeExistence() throws Exception
   {
      log_.info("testPutRemove() ....");
      Person test = new Person();
      test.setName("Ben");
      test.setAge(10);
      cache_.putObject("/a", test);
      Person result = (Person)cache_.getObject("/a");
      assertEquals(" ", test, result);
      result.setAge(20);
      cache_.removeObject("/a");
      assertNull("Object should be null ", cache_.getObject("/a"));
      assertEquals("Age should be updated as ", 20, test.getAge());

      assertNull("DataNode should not exisit ", cache_.get("/a"));
View Full Code Here

   public void testFindObjects() throws Exception
   {
      log_.info("testFindObjects() ....");
      Map map = cache_.findObjects("/");
      assertEquals("Objects size should be ", 0, map.size());
      Person ben = new Person();
      ben.setName("Ben");
      ben.setAge(10);
      cache_.putObject("/a/b/c", ben);
      cache_.putObject("/e", ben); // multiple keys, same pojo
      Person joe = new Person();
      joe.setName("Joe");
      joe.setAge(10);
      cache_.putObject("/f/joe", joe);
      map = cache_.findObjects("/");
      assertEquals("Objects size should be ", 3, map.size());

      map = cache_.findObjects("/a");
View Full Code Here

   public void testFindObjectsWithGenericFqn() throws Exception
   {
      log_.info("testFindObjectsWithGenericFqn() ....");
      Map map = cache_.findObjects("/");
      assertEquals("Objects size should be ", 0, map.size());
      Person ben = new Person();
      ben.setName("Ben");
      ben.setAge(10);
      cache_.putObject("/a/b/c", ben);
      cache_.putObject("/e", ben); // multiple keys, same pojo
      Person joe = new Person();
      joe.setName("Joe");
      joe.setAge(10);
      Fqn base = Fqn.fromString("/a");
      Fqn fqn = new Fqn(base, new Long(3));
      cache_.putObject(fqn, joe);
      map = cache_.findObjects("/");
      assertEquals("Objects size should be ", 3, map.size());
View Full Code Here

   }

   public void testPutArray2() throws Exception
   {
      log_.info("testPutArray2() ....");
      Person p1 = new Person();
      p1.setName("Ben");
      p1.setAge(10);

      Person p2 = new Person();
      p2.setName("Joe");
      p2.setAge(20);
      Person[] arr = new Person[] {p1, p2};
      cache_.putObject("array", arr);
   }
View Full Code Here

   }

   public void testNotification() throws Exception
   {
      log_.info("testNotification() ....");
      Person test = new Person();
      test.setName("Ben");
      test.setAge(10);
      cache_.putObject("/a", test);
      Person result = (Person)cache_.getObject("/a");
      assertEquals(" ", test, result);
   }
View Full Code Here

        
         people = new Person[SUBTREE_SIZE];
         loaded = new boolean[SUBTREE_SIZE];
         for (int j = 0; j < SUBTREE_SIZE; j++)
         {
            Person p = new Person();
            p.setName("Person " + j);
            p.setAge(j);
            p.setAddress((j % 2 == 0) ? addr1 : addr2);
            people[j] = p;
         }
        
         thread = new Thread(this);
         thread.start();
View Full Code Here

      assertTrue(cache.exists("/first"));
   }


   public void testPojoEvictionWithCacheLoader() throws Exception {
      Person test = new Person();
      test.setName("Ben");
      test.setAge(10);
      cache.putObject("/first/second/third", test);   // stored in cache loader
      cache.evict(Fqn.fromString("/first/second/third"))// removes node, because there are no children
      addDelay();
      assertFalse(cache.exists("/first/second/third"));
      assertTrue(cache.exists("/first/second"));
      assertTrue(cache.exists("/first"));
      Person val = (Person) cache.getObject("/first/second/third"); // should be loaded from cache loader
      assertNotNull(val);
      assertEquals(test.getName(), val.getName());
      assertTrue(cache.exists("/first/second/third"));
      assertTrue(cache.exists("/first/second"));
      assertTrue(cache.exists("/first"));
   }
View Full Code Here

      assertTrue(cache.exists("/first/second"));
      assertTrue(cache.exists("/first"));
   }

   public void testPojoRemoveWithCacheLoader() throws Exception {
      Person test = new Person();
      test.setName("Ben");
      test.setAge(10);
      cache.putObject("/first/second/third", test);   // stored in cache loader
      cache.remove(Fqn.fromString("/first/second/third"))// removes node, because there are no children
      addDelay();
      assertFalse(cache.exists("/first/second/third"));
      assertTrue(cache.exists("/first/second"));
      assertTrue(cache.exists("/first"));
      Person val = (Person) cache.getObject("/first/second/third"); // should be loaded from cache loader
      assertNull(val);
   }
View Full Code Here

TOP

Related Classes of org.jboss.cache.aop.test.Person

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.