Package org.jboss.cache.aop.test

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


   private void stage2(PojoCache cache) throws Exception
   {
      //
      cache.removeObject("/person/joe");
      Person ben = (Person) cache.getObject("/person/ben");
      assertEquals("Ben's address should still be valid ", "Sunnyvale", ben.getAddress().getCity());
      Address addr = ben.getAddress();
      addr.setCity("Santa Clara");
      assertEquals("Ben's address should be changed ", "Santa Clara", ben.getAddress().getCity());
   }
View Full Code Here


   public void XtestCheckReplInstance() throws Exception
   {
      log.info("testCheckReplInstance() ...");
      stage0();
      TestingUtil.sleepThread(100);
      Person joe = (Person)cache1.getObject("/person/joe");
      Person ben = (Person)cache1.getObject("/person/ben");
      assertEquals("Ben and Joe's address should be the same ", joe.getAddress().getCity(),
            ben.getAddress().getCity());

      Address joe1 = (Address)cache2.getObject("/address");
      assertEquals("Ben's address should not be changed ", joe.getAddress().getCity(), joe1.getCity());
      cache1.removeObject("/person/ben");
      Address joe2 = (Address)cache2.getObject("/address");
View Full Code Here

   public void testRefCountCheckRepl() throws Exception
   {
      log.info("testRefCountCheckRepl() ...");
      stage1();
      TestingUtil.sleepThread(100);
      Person joe = (Person)cache1.getObject("/person/joe");
      Person ben = (Person)cache1.getObject("/person/ben");
      assertEquals("Ben and Joe's address should be the same ", joe.getAddress().getCity(),
            ben.getAddress().getCity());
      TestingUtil.sleepThread(100);
      stage2(cache2);
      assertEquals("Ben's address should be changed on cache1 as well ", "Santa Clara", ben.getAddress().getCity());
      cache2.removeObject("/person/ben");
   }
View Full Code Here

   public void testRemoveObject1() throws Exception
   {
      log.info("testRemoveObject1() ...");
      cache1.putObject("/person/joe", createPerson("Joe Black", 31));
      Person joe = (Person) cache1.getObject("/person/joe");
      cache1.putObject("/person/ben", createPerson("Ben Hogan", 51));
      Person ben = (Person) cache1.getObject("/person/ben");

      Address addr = new Address();
      addr.setStreet("123 Albert Ave.");
      addr.setCity("Sunnyvale");
      addr.setZip(94087);

      // They share the sub-object: address
      log.info("testMultipleReference(): set Joe address");
      joe.setAddress(addr);
      log.info("testMultipleReference(): set Ben address");
      ben.setAddress(addr);

      Address add1 = (Address) ((Person)cache2.getObject("/person/joe")).getAddress();
      Address add2 = (Address) ((Person)cache2.getObject("/person/ben")).getAddress();
      assertEquals(add1.getCity(), add2.getCity());
      addr.setCity("Santa Clara");
View Full Code Here

   public void testRemoveObject2() throws Exception
   {
      log.info("testRemoveObject2() ...");
      cache1.putObject("/person/joe", createPerson("Joe Black", 31));
      Person joe = (Person) cache1.getObject("/person/joe");
      cache1.putObject("/person/ben", createPerson("Ben Hogan", 51));
      Person ben = (Person) cache1.getObject("/person/ben");
      cache1.putObject("/person/john", createPerson("John Daly", 41));
      Person john = (Person) cache1.getObject("/person/john");

      Address addr = new Address();
      addr.setStreet("123 Albert Ave.");
      addr.setCity("Sunnyvale");
      addr.setZip(94087);

      Address addr1 = new Address();
      addr1.setStreet("123 Albert Ave.");
      addr1.setCity("San Jose");
      addr1.setZip(94087);

      // They share the sub-object: address
      log.info("testMultipleReference(): set Joe address");
      joe.setAddress(addr);
      log.info("testMultipleReference(): set Ben address");
      ben.setAddress(addr);
      john.setAddress(addr);

      Address add1 = (Address) ((Person)cache2.getObject("/person/joe")).getAddress();
      Address add2 = (Address) ((Person)cache2.getObject("/person/ben")).getAddress();
      assertEquals(add1.getCity(), add2.getCity());
      addr.setCity("Santa Clara");
View Full Code Here

   
    protected void setUp() throws Exception
   {
      super.setUp();
     
      husband = new Person();
      husband.setName("Joe");
      husband.setAge(60);
     
      wife = new Person();
      wife.setName("Mary");
      wife.setAge(20);
     
      medications = new ArrayList();
      medications.add("Viagra");
View Full Code Here

        }
      
        // according to data gravitation, a call to *any* cache should
        // retrieve the data and move the data to the new cache.
       
        Person wife2 = (Person) caches[2].getObject(fqnW);
       
        dumpCacheContents(caches);
       
        assertNotNull("Wife has gravitated", wife2);
        assertEquals("Wife's address has gravitated", wife.getAddress().getStreet(),
                     wife2.getAddress().getStreet());
        assertEquals("Wife's hobby has gravitated", "Excellent",
              wife2.getHobbies().get("Tennis"));
       
//        Person husband2 = (Person) caches[2].getObject(fqnH);
//       
//        assertNotNull("Husband has gravitated", husband2);
//        assertTrue("Husband's medication has gravitated",
View Full Code Here

//   public void testDummy() {}

   public void testBadFqn() throws Exception
   {
      log_.info("testBadFqn() ....");
      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);

      try {
         cache_.putObject(InternalDelegate.JBOSS_INTERNAL, test);
         fail("putObject under JBoss_Internal should fail");
      } catch (IllegalArgumentException iex)
View Full Code Here

   }

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

   }

   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_.putObject("/a", test);
      Person result = (Person)cache_.getObject("/a");
      assertEquals(" ", test, result);

      assertTrue("Instance of proxyclass ", result.getLanguages() instanceof ClassProxy);

      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());
   }
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.