Package org.jboss.cache.aop.test

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


      log.info("testSimpleTxWithRollback() ....");
      UserTransaction tx = getTransaction();

      Person joe = new Person();
      joe.setName("Joe");
      Address add = new Address();
      add.setZip(104);
      add.setCity("Taipei");
      joe.setAddress(add);

      tx.begin();
      cache_.putObject("/person/joe", joe);
      tx.commit();
      Person p = (Person)cache1_.getObject("/person/joe");
      assertEquals("Zip should be the same ", joe.getAddress().getZip(), p.getAddress().getZip());

      // test rollback
      Person ben = new Person();
      ben.setName("Ben");
      add = new Address();
      add.setZip(104);
      add.setCity("Taipei");
      joe.setAddress(add);
      tx.begin();
      cache_.putObject("/person/ben", ben);
      tx.rollback();
      assertEquals("Zip should be the same ", joe.getAddress().getZip(), p.getAddress().getZip());
View Full Code Here


      log.info("testCollectionTxWithRollback() ....");
      UserTransaction tx = getTransaction();

      Person joe = new Person();
      joe.setName("Joe");
      Address add = new Address();
      add.setZip(104);
      add.setCity("Taipei");
      joe.setAddress(add);
      ArrayList lang = new ArrayList();
      lang.add("English");
      lang.add("Taiwanese");
      lang.add("Mandirin");
      joe.setLanguages(lang);

      tx.begin();
      cache_.putObject("/person/joe", joe);
      tx.commit();
      Person p = (Person)cache1_.getObject("/person/joe");
      assertEquals("Zip should be the same ", joe.getAddress().getZip(), p.getAddress().getZip());

      // test rollback
      Person ben = new Person();
      ben.setName("Ben");
      add = new Address();
      add.setZip(104);
      add.setCity("Taipei");
      ben.setAddress(add);
      tx.begin();
      cache_.putObject("/person/ben", ben);
      tx.rollback();
      assertEquals("Zip should be the same ", joe.getAddress().getZip(), p.getAddress().getZip());
View Full Code Here

      {
         public void run()
         {
            Person p = new Person();
            p.setName("Ben");
            Address add = new Address();
            add.setCity("Taipei");
            p.setAddress(add);
            List  lang = new ArrayList();
            lang.add("English");
            lang.add("Taiwanese");
            lang.add("Japanese");
            p.setLanguages(lang);
            try {
               cache_.putObject("/test/ben", p);
            }
            catch(Exception ex) {
               try {
                  cache_.putObject("/test/ben", p);
               } catch (Exception ex1)
               {
                  t1_ex = ex1;
               }
            }
         }
      };

      Thread t2 = new Thread()
      {
         Transaction tx;
         public void run()
         {
            try {
               UserTransaction tx = getTransaction();
               tx.begin();
               Person p = new Person();
               p.setName("Ben");
               Address add = new Address();
               add.setCity("Taipei");
               p.setAddress(add);
               cache1_.putObject("/test/ben", p);
               TestingUtil.sleepThread(1000);
               tx.commit();
            }
View Full Code Here

         public void run()
         {
            UserTransaction tx = null;
            Person p = new Person();
            p.setName("Ben");
            Address add = new Address();
            add.setCity("Taipei");
            p.setAddress(add);
            List  lang = new ArrayList();
            lang.add("English");
            lang.add("Taiwanese");
            lang.add("Japanese");
            p.setLanguages(lang);
            try {
               tx = getTransaction();
               tx.begin();
               cache_.putObject("/test/ben", p);
               TestingUtil.sleepThread(1000);
               tx.commit();
            }
            catch(RollbackException rollback) {
               try {
                  tx = getTransaction();
                  tx.begin();
                  cache_.putObject("/test/ben", p);
                  tx.commit();
               } catch (Exception ex)
               {
                  t1_ex = ex;
                  ex.printStackTrace();
               }
            }
            catch (Exception ex) {
               t1_ex = ex;
               ex.printStackTrace();
            }
         }
      };

      Thread t2 = new Thread()
      {
         Transaction tx;

         public void run()
         {
            try {
               UserTransaction tx = getTransaction();
               tx.begin();
               Person p = new Person();
               p.setName("Ben");
               Address add = new Address();
               add.setCity("Taipei");
               p.setAddress(add);
               cache1_.putObject("/test/ben", p);
               TestingUtil.sleepThread(1000);
               tx.commit();
            }
View Full Code Here

   public void testConcurrentTxPutsWithRollbackField() throws Exception
   {
      Person p = new Person();
      p.setName("Ben");
      Address add = new Address();
      add.setCity("Taipei");
      p.setAddress(add);
      List  lang = new ArrayList();
      IdObject id1 = new IdObject("1");
      lang.add(id1);
      p.setLanguages(lang);
View Full Code Here

   {
      super.setUp();

      caches = new HashMap();
     
      addr1 = new Address();
      addr1.setStreet("101 Oakview Dr");
      addr1.setCity("Anytown");
      addr1.setZip(11111);
     
      addr2 = new Address();
      addr2.setStreet("222 Happy Dr");
      addr2.setCity("Fremont");
      addr2.setZip(22222);
     
      joe = new Person();
View Full Code Here

         String childFqn = "/a/b/" + name;
        
         Person p = new Person();
         p.setName("Person " + name);
        
         Address addr = new Address();        
         addr.setStreet(name + " Test Street");
         addr.setCity(name + ", CA");
         p.setAddress(addr);
        
         TestingUtil.sleepThread(1);
        
//         tm.begin();
View Full Code Here

         // just whether activation causes problems
         int factor = 0;
         int i = 0;
         String fqn = null;
        
         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");
        
         Person[] people = new Person[SUBTREE_SIZE];
         boolean[] loaded = new boolean[SUBTREE_SIZE];
         for (int j = 0; j < SUBTREE_SIZE; j++)
         {
View Full Code Here

    */
   public void testCLLeakage() throws Exception
   {
      Person p = new Person();
      p.setName("Ben");
      Address add = new Address();
      add.setCity("Taipei");

      ClassLoader cla = getClassLoader();
      WeakReference refa = new WeakReference(cla);
      cache_.registerClassLoader("/aop", cla);
      ClassLoader clb = getClassLoader();
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();
      add1.setCity("Sunnyvale");
      add1.setZip(94086);

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

      Map map = new HashMap();
      map.put("1", add1);
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.