Package org.jboss.cache.aop.test

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


      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");
      assertEquals(add1.getCity(), add2.getCity());

      // Remove pojo joe will relocate the address field to ben's
      cache2.removeObject("/person/joe");
      add2 = (Address) ((Person)cache2.getObject("/person/ben")).getAddress();
      System.out.println("*** Cache content *** " +cache2.printDetails());

      assertEquals("City ", "Santa Clara", add2.getCity());
   }
View Full Code Here


      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");
      assertEquals(add1.getCity(), add2.getCity());

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

      hobbies = new HashMap();
      hobbies.put("Tennis", "Excellent");
     
      wife.setHobbies(hobbies);
     
      address = new Address();
      address.setStreet("101 Easy Street");
      address.setCity("Fremont, CA");
      address.setZip(94536);
     
      husband.setAddress(address);
View Full Code Here

      {
         this.cache = createCache(name, sync);
         this.semaphore = semaphore;
         this.name = name;
        
         Address addr1 = new Address();
         addr1.setStreet("1 Test Street");
         addr1.setCity("TestOne, CA");
        
         Address addr2 = new Address();
         addr2.setStreet("2 Test Street");
         addr2.setCity("TestTwo, CA");
        
         people = new Person[SUBTREE_SIZE];
         loaded = new boolean[SUBTREE_SIZE];
         for (int j = 0; j < SUBTREE_SIZE; j++)
         {
View Full Code Here

      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);
      cache1.putObject("/address", addr);

      // They share the sub-object: address
      joe.setAddress(addr);
      ben.setAddress(addr);
View Full Code Here

      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
      joe.setAddress(addr);
      ben.setAddress(addr);
      assertEquals("Joe's address should still be valid ", "Sunnyvale", joe.getAddress().getCity());
View Full Code Here

   {
      //
      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

      String fqn = "/testMaxNode";

      Student test = new Student();
      test.setName("Ben");
      test.setAge(10);
      Address addr = new Address();
      addr.setZip(95123);
      List lang = new ArrayList();
      lang.add("English");
      lang.add("French");
      lang.add("Mandarin");
      test.setLanguages(lang);
View Full Code Here

      Person mary = new Person();
      mary.setName("Mary");
      mary.setAge(20);

      Address addr = new Address();
      addr.setCity("Sunnyvale");
      addr.setZip(95123);

      ben.setAddress(addr);
      mary.setAddress(addr);

      cache_.putObject("/pojo/ben", ben);
      cache_.putObject("/pojo/mary", mary);
      Person result = (Person)cache_.getObject("/pojo/ben");
      assertEquals(" ", ben, result);
      result.setAge(20);

      int period = (wakeupIntervalMillis_);
      log_.info("period is " + period);
      TestingUtil.sleepThread(period/2)// it really depends on the eviction thread time.
      addr.getZip();

      TestingUtil.sleepThread(period/2);
      addr.getZip();
      TestingUtil.sleepThread(period/2);
      addr.getZip();
      TestingUtil.sleepThread(period/2);
      // It is failing now but need to fix.
      assertFalse("pojo node should not exist ", cache_.exists("/pojo/mary"));
      assertFalse("pojo node should exist ", cache_.exists("/pojo/ben"));
      assertEquals("Age should still be after eviction/detachment: ", 20, ben.getAge());
View Full Code Here

      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");
      assertEquals("Joe's reference should be the same.", joe1, joe2);
   }
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.