Package org.jboss.cache.aop.test

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


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


   public void testPojoEviction() 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);
      // This will use both original the new pojo to get.
      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 testPojoRemove() 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

      Person val = (Person) cache.getObject("/first/second/third"); // should be loaded from cache loader
      assertNull(val);
   }

   public void testSimpleRestart() throws Exception {
      Person test = new Person();
      test.setName("Ben");
      test.setAge(10);
      cache.putObject("/first/second/third", test);   // stored in cache loader
      assertNotNull(loader.get(Fqn.fromString("/first/second/third")));
      stopCache();
      startCache();
      assertNotNull(loader.get(Fqn.fromString("/first/second/third")));
      assertFalse(cache.exists("/first/second/third"));
      Person val = (Person) cache.getObject("/first/second/third"); // should be loaded from cache loader
      assertNotNull(val);
      assertEquals("Age ", 10, val.getAge());
   }
View Full Code Here

      assertNotNull(val);
      assertEquals("Age ", 10, val.getAge());
   }

   public void testRemoveObject() throws Exception {
      Person test = new Person();
      test.setName("Ben");
      test.setAge(10);
      cache.putObject("/first/second/third", test);   // stored in cache loader
      addDelay();
      cache.removeObject("/first/second/third");
      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

   /**
    * This test illustrates the problem in JBCACHE-477. That is transactional remove under
    * cacheloader using pessimistic locking.
    */
   public void testTxCollectionRemove() throws Exception {
      Person joe = new Person();
      joe.setName("Joe");
      joe.setAge(10);
      Person ben = new Person();
      ben.setName("Ben");
      ben.setAge(10);

      ArrayList list =new ArrayList();
      list.add(joe);
      list.add(ben);

View Full Code Here

      cache.stopService();
   }

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

      cache.setSyncCommitPhase(true);
   }

   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

      return hobbies == null ? null : hobbies.get(hobbyKey);
   }

   public void setHobby(String key, Object hobbyKey, Object value)
   {
      Person person = ((Person) getPerson(key));
      Map hobbies = person.getHobbies();
      if (hobbies == null) {
         hobbies = new HashMap();
         person.setHobbies(hobbies);
         // NB: it is neccessary to get hobbies again to get advised version
         hobbies = person.getHobbies();
      }
      hobbies.put(hobbyKey, value);
   }
View Full Code Here

      hobbies.put(hobbyKey, value);
   }

   public void setHobbies(String key, Map map)
   {
      Person person = ((Person) getPerson(key));
      person.setHobbies(map);
   }
View Full Code Here

      return languages;
   }

   public void addLanguage(String key, Object language)
   {
      Person person = ((Person) getPerson(key));
      List languages = person.getLanguages();
      if (languages == null) {
         person.setLanguages(new ArrayList());
         languages = person.getLanguages();
      }
      languages.add(language);
   }
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.