Package org.jboss.cache.aop.test

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


   public void testSeriazableSubObject() throws Exception
   {
      log_.info("testSerializableSubObject() ....");

      Student ben = new Student();
      ben.setName("Ben");
      ben.setYear("9th grade");
      CacheObject co1 = new CacheObject("1");
      ben.setCO1(co1);
      CacheObject co2 = new CacheObject("2");
      ben.setCO2(co2);

      cache_.putObject("/test", ben);

      Student be = (Student)cache1_.getObject("/test");
      assertNotNull("CacheObject should not be null", be.getCO1());
      assertNotNull("CacheObject should not be null", be.getCO2());
      assertEquals("1", be.getCO1().getId());
      assertEquals("2", be.getCO2().getId());
   }
View Full Code Here


    */
   public void XtestSeriazableSubObjectRelation() throws Exception
   {
      log_.info("testSerializableSubObjectRelation() ....");

      Student ben = new Student();
      ben.setName("Ben");
      ben.setYear("9th grade");
      CacheObject co1 = new CacheObject("1");
      ben.setCO1(co1);

      Student elynne = new Student();
      elynne.setName("Elynne");
      elynne.setYear("9th grade");
      // Same co object
      elynne.setCO1(co1);

      cache_.putObject("/ben", ben);
      cache_.putObject("/elynne", elynne);

      Student be = (Student)cache1_.getObject("/ben");
      Student el = (Student)cache1_.getObject("/elynne");
      assertNotNull("CacheObject should not be null", be.getCO1());
      assertNotNull("CacheObject should not be null", el.getCO1());
      assertEquals("Both co object should be the same", be.getCO1().getId(), el.getCO1().getId());
      assertTrue("Both co should be the same reference", be.getCO1() == el.getCO1());
   }
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

   }

   public void testSubClass() throws Exception
   {
      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);

      Student remote = (Student)cache1_.getObject("/a");
      System.out.println("Output on cache1: "+ result);
      System.out.println("Output on cache2: "+ remote);
      assertEquals("Age should be ", 10, remote.getAge());
   }
View Full Code Here

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

      cache_.putObject(fqn, test);
      Person result = (Person)cache_.getObject(fqn);
      assertEquals(" ", test, result);
      result.setAge(20);

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

      assertFalse("pojo node should not exist ", cache_.exists(fqn));
      assertEquals("Age should still be after eviction/detachment: ", 20, test.getAge());
   }
View Full Code Here

    */
   protected void init() throws Exception {
      Random r = new Random();

      for (int i = 0; i < TIMES; i++) {
        Student unk = new Student();
        unk.setName(""+ i );

        Address address = new Address();
        address.setStreet(r.nextInt() + "Oak Drive");
        address.setCity("Pleasantville, CA" + r.nextInt());
        address.setZip(r.nextInt(99999));
        unk.setAddress(address);

        hash.put(unk.getName(),unk);
      }
      System.out.println("Finished with init...");
   }
View Full Code Here

      //iterate through all without the cache...
      long ms = System.currentTimeMillis();
      System.out.print("running through hash by itself...");
      for(int i = 0; i < TIMES; i++)  {
        Student x = (Student)hash.get("" + i);
        if(i % 100 == 0) {
            System.out.println(x);
        }
      }
      System.out.println(TIMES + " hashmap ops took "+(System.currentTimeMillis() - ms));
View Full Code Here

TOP

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

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.