Package org.jboss.cache.aop.test

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


   public void testRelationshipWithSharedSet2() throws Exception
   {
      log.info("testRelationshipWithSet2() ....");
      Set set1 = new HashSet();
      Address addr = new Address();
      addr.setCity("San Jose");
      addr.setZip(95123);
      set1.add(addr);

      Set set2 = new HashSet();
      set2.add(addr);

      cache_.putObject("/set1", set1);
      cache_.putObject("/set2", set2);

      Address add2 = (Address)((Set)cache_.getObject("/set2")).iterator().next();
      Address add1 = (Address)((Set)cache_.getObject("/set1")).iterator().next();
      assertEquals("Address should be the same", add1, add2);
      assertEquals("Both shared object should be equal ", add2.getZip(), add1.getZip());
   }
View Full Code Here


   public void testRelationshipWithSharedMap1() throws Exception
   {
      log.info("testRelationshipWithMap() ....");
      Map map1 = new HashMap();
      Address addr = new Address();
      addr.setCity("San Jose");
      addr.setZip(95123);
      map1.put("key1", addr);

      cache_.putObject("/map", map1);
      cache_.putObject("/alias", map1);

      map1 = (Map)cache_.getObject("/map");
      Map map2 = (Map)cache_.getObject("/alias");
      assertTrue("Map size should not be 0 ", (map2.size() != 0));
      assertEquals("Both maps should be equal ", map1, map2);
      Address add1 = (Address)((Map.Entry)map2.entrySet().iterator().next()).getValue();
      assertNotNull("Address should not be null", add1);
      assertEquals("Zip ", 95123, add1.getZip());
   }
View Full Code Here

   public void testRelationshipWithSharedMap2() throws Exception
   {
      log.info("testRelationshipWithMap2() ....");
      Map map1 = new HashMap();
      Address addr = new Address();
      addr.setCity("San Jose");
      addr.setZip(95123);
      map1.put("key1", addr);

      Map map2 = new HashMap();
      map2.put("key2", addr);

      // Pure map
      cache_.putObject("/map", map1);
      cache_.putObject("/alias", map2);

      map1 = (Map)cache_.getObject("/map");
      map2 = (Map)cache_.getObject("/alias");
      assertTrue("Map size should not be 0 ", (map2.size() != 0));
      Address add1 = (Address)((Map.Entry)map2.entrySet().iterator().next()).getValue();
      assertNotNull("Address should not be null", add1);
      assertEquals("Zip ", 95123, add1.getZip());
   }
View Full Code Here

    */
   public void testAttachDetach() throws Exception
   {
      log.info("testAttachDetach() ....");
      List list1 = new ArrayList();
      Address addr = new Address();
      addr.setCity("San Jose");
      addr.setZip(95123);
      list1.add(addr);

      Address addr2 = new Address();
      addr2.setCity("Santa Clara");
      addr2.setZip(95131);

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

      // Pure list
      cache1.putObject("/list", list1);
      list1 = (List)cache1.getObject("/list");
      list1.add(addr2);
View Full Code Here

    */
   public void testRelationshipWithSharedList1() throws Exception
   {
      log.info("testRelationshipWithList() ....");
      List list1 = new ArrayList();
      Address addr = new Address();
      addr.setCity("San Jose");
      addr.setZip(95123);
      list1.add(addr);

      // Pure list
      cache1.putObject("/list", list1);
      // We specifically need to use Proxy otherwise it won't work with multiple references
      list1 = (List)cache1.getObject("/list");
      cache1.putObject("/alias", list1);

      List list2 = (List)cache1.getObject("/alias");
      Address add1 = (Address)list2.get(0);
      assertNotNull("Address should not be null", add1);
      assertEquals("Zip ", 95123, add1.getZip());

      list1 = (List)cache2.getObject("/list");
      list2 = (List)cache2.getObject("/alias");
      assertTrue("List size should not be 0 ", (list2.size() != 0));
      assertEquals("Both lists should be equal ", list1, list2);
View Full Code Here

   public void testRelationshipWithSharedList2() throws Exception
   {
      log.info("testRelationshipWithList2() ....");
      // 2 lists with shared objects
      List list1 = new ArrayList();
      Address addr = new Address();
      addr.setCity("San Jose");
      addr.setZip(95123);
      list1.add(addr);

      List list2 = new ArrayList();
      list2.add(addr);

      cache1.putObject("/list1", list1);
      cache1.putObject("/list2", list2);
      Address add2 = (Address)((List)cache2.getObject("/list2")).get(0);
      Address add1 = (Address)((List)cache2.getObject("/list1")).get(0);
      assertEquals("Address should be the same", add1, add2);
      assertEquals("Both shared object should be equal ", add2.getZip(), add1.getZip());
   }
View Full Code Here

   public void testRelationshipWithSharedList3() throws Exception
   {
      log.info("testRelationshipWithList3() ....");
      // 2 lists with shared objects
      List list1 = new ArrayList();
      Address addr = new Address();
      addr.setCity("San Jose");
      addr.setZip(95123);
      list1.add(addr);

      List list2 = new ArrayList();
      list2.add(addr);

      cache1.putObject("/address", addr);
      cache1.putObject("/list1", list1);
      Address add1 = (Address)((List)cache2.getObject("/list1")).get(0);
      Address add2 = (Address)cache2.getObject("/address");
      assertEquals("Address should be the same", add1, add2);
      assertEquals("Both shared object should be equal ", 95123, add1.getZip());
   }
View Full Code Here

      Person p = new Person();
      if (!(p instanceof Advised)) {
         logger_.error("testSetup(): p is not an instance of Advised");
         throw new RuntimeException("Person must be advised!");
      }
      Address a = new Address();
      if (!(a instanceof Advised)) {
         logger_.error("testSetup(): a is not an instance of Advised");
         throw new RuntimeException("Address must be advised!");
      }
   }
View Full Code Here

   public void createPerson(String key, String name, int age)
   {
      Person p = new Person();
      p.setName(name);
      p.setAge(age);
      p.setAddress(new Address());
      try {
         cache.putObject(key, p);
      } catch (Exception e) {
         throw new RuntimeException(e);
      }
View Full Code Here

   public void createStudent(String key, String name, int age, String year)
   {
      Student p = new Student();
      p.setName(name);
      p.setAge(age);
      p.setAddress(new Address());
      p.setYear(year);
      try {
         cache.putObject(key, p);
      } catch (Exception e) {
         throw new RuntimeException(e);
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.