Package org.jboss.cache.aop.test

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


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


      cache_.putObject("/person/joe", createPerson("Joe Black", 31));
      Person joe = (Person) cache_.getObject("/person/joe");
      cache_.putObject("/person/ben", createPerson("Ben Hogan", 51));
      Person ben = (Person) cache_.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)cache_.getObject("/person/joe")).getAddress();
      Address add2 = (Address) ((Person)cache_.getObject("/person/ben")).getAddress();
      assertEquals(add1.getCity(), add2.getCity());
      addr.setCity("Santa Clara");
      assertEquals(add1.getCity(), add2.getCity());

      // Remove pojo joe will relocate the address field to ben's
      cache_.removeObject("/person/joe");
      add2 = (Address) ((Person)cache_.getObject("/person/ben")).getAddress();
      assertEquals("City ", "Santa Clara", add2.getCity());
   }
View Full Code Here

      cache_.putObject("/person/ben", createPerson("Ben Hogan", 51));
      Person ben = (Person) cache_.getObject("/person/ben");
      cache_.putObject("/person/john", createPerson("John Daly", 41));
      Person john = (Person) cache_.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);
      log.info("testMultipleReference(): set John address");
      john.setAddress(addr);

      Address add1 = (Address) ((Person)cache_.getObject("/person/joe")).getAddress();
      Address add2 = (Address) ((Person)cache_.getObject("/person/ben")).getAddress();
      assertEquals(add1.getCity(), add2.getCity());
      addr.setCity("Santa Clara");
      assertEquals(add1.getCity(), add2.getCity());

      // Remove pojo joe will relocate the address field to ben's
      joe.setAddress(addr1);
      add2 = (Address) ((Person)cache_.getObject("/person/joe")).getAddress();
      assertEquals("City ", "San Jose", add2.getCity());
      add2 = (Address) ((Person)cache_.getObject("/person/ben")).getAddress();
      assertEquals("City ", "Santa Clara", add2.getCity());
      add2 = (Address) ((Person)cache_.getObject("/person/john")).getAddress();
      assertEquals("City ", "Santa Clara", add2.getCity());
   }
View Full Code Here

      System.out.println(cache_.printDetails());
   }

   public void testPojoAttachAndDetach() throws Exception
   {
      Address add1 = new Address();
      add1.setCity("San Jose");
      add1.setZip(95123);

      Address add2 = new Address();
      add2.setCity("Sunnyvale");
      add2.setZip(94086);

      Address add3 = new Address();
      add3.setCity("Santa Clara");
      add3.setZip(951131);

      Set set = new HashSet();
      set.add(add1);
      set.add(add2);
      set.add(add3);
View Full Code Here

      System.out.println(cache_.printDetails());
   }

   public void testPojoAttachAndDetach() throws Exception
   {
      Address add1 = new Address();
      add1.setCity("San Jose");
      add1.setZip(95123);

      Address add2 = new Address();
      add2.setCity("Sunnyvale");
      add2.setZip(94086);

      Address add3 = new Address();
      add3.setCity("Santa Clara");
      add3.setZip(951131);

      Map map = new HashMap();
      map.put("1", add1);
      map.put("2", add2);
      map.put("3", add3);
View Full Code Here

   {
      log_.info("testPutPut() ....");
      Person test = new Person();
      test.setName("Ben");
      test.setAge(10);
      Address addr = new Address();
      addr.setZip(95123);
      addr.setCity("Sunnyvale");
      test.setAddress(addr);
      cache_.putObject("/a", test);
      Person result = (Person)cache_.getObject("/a");
      assertEquals(" ", test, result);
View Full Code Here

   {
      log_.info("testPutPut() ....");
      Person test = new Person();
      test.setName("Ben");
      test.setAge(10);
      Address addr = new Address();
      addr.setZip(95123);
      addr.setCity("Sunnyvale");
      test.setAddress(addr);
      cache_.putObject("/a", test);
      Person result = (Person)cache_.getObject("/a");
      assertEquals(" ", test, result);
View Full Code Here

      assertEquals("Zip should be ", 95123, result.getAddress().getZip());
   }

   Address getAddress(String city)
   {
      Address addr = new Address();
      addr.setCity(city);
      addr.setZip(95123);
      addr.setStreet("Sunnyvale");
      return addr;
   }
View Full Code Here

   {
      log_.info("testRemoteRemove() ....");
      Person test = new Person();
      test.setName("Ben");
      test.setAge(10);
      Address addr = new Address();
      addr.setCity("Taipei");
      addr.setZip(106);
      test.setAddress(addr);
      cache_.putObject("/a", test);
      Person result = (Person)cache_.getObject("/a");
      assertEquals(" ", test, result);
View Full Code Here

   {
      log_.info("testsubClass() ....");
      Student test = new Student();
      test.setName("Ben");
      test.setAge(10);
      Address addr = new Address();
      addr.setCity("Taipei");
      addr.setZip(106);
      test.setAddress(addr);
      cache_.putObject("/a", test);
      Student result = (Student)cache_.getObject("/a");
      assertEquals(" ", test, result);
View Full Code Here

TOP

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

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.