[jboss-cvs] JBossCache/tests/functional/org/jboss/cache/transaction ...

Manik Surtani msurtani at jboss.com
Mon Mar 5 14:15:16 EST 2007


  User: msurtani
  Date: 07/03/05 14:15:16

  Modified:    tests/functional/org/jboss/cache/transaction  Tag:
                        Branch_JBossCache_1_4_0 TransactionTest.java
  Log:
  JBCACHE-999
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.9.4.4   +80 -1     JBossCache/tests/functional/org/jboss/cache/transaction/TransactionTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: TransactionTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/transaction/TransactionTest.java,v
  retrieving revision 1.9.4.3
  retrieving revision 1.9.4.4
  diff -u -b -r1.9.4.3 -r1.9.4.4
  --- TransactionTest.java	9 Feb 2007 13:49:35 -0000	1.9.4.3
  +++ TransactionTest.java	5 Mar 2007 19:15:16 -0000	1.9.4.4
  @@ -37,7 +37,7 @@
    * Tests transactional access to a local TreeCache.
    * Note: we use DummpyTranasctionManager to replace jta
    *
  - * @version $Id: TransactionTest.java,v 1.9.4.3 2007/02/09 13:49:35 msurtani Exp $
  + * @version $Id: TransactionTest.java,v 1.9.4.4 2007/03/05 19:15:16 msurtani Exp $
    */
   public class TransactionTest extends TestCase {
      TreeCache cache=null;
  @@ -981,6 +981,85 @@
      }
   
   
  +   // thanks to msteiner at gazeta.pl for this test and spotting JBCACHE-999
  +    public void testRootNodeRemoval() throws Exception
  +    {
  +      Fqn root = Fqn.ROOT;
  +      Fqn fqn = new Fqn(root, new Long(1));
  +      //put first time
  +      tx.begin();
  +      this.cache.put(fqn, "k", "v");
  +      tx.commit();
  +
  +      //get works fine
  +      tx.begin();
  +      assertEquals("v", this.cache.get(fqn, "k"));
  +      tx.commit();
  +
  +      //remove all
  +      tx.begin();
  +      this.cache.remove(root);
  +      tx.commit();
  +
  +      //get returns null - ok
  +      //put - endless loop
  +      tx.begin();
  +      assertNull(this.cache.get(fqn, "k"));
  +      this.cache.put(fqn, "k", "v");
  +      tx.commit();
  +	}
  +
  +   // thanks to msteiner at gazeta.pl for this test and spotting JBCACHE-999
  +   public void testNodeAdditionAfterRemoval() throws Exception
  +    {
  +      Fqn fqn = Fqn.fromString("/1/2/3/4");
  +      //put first time
  +      tx.begin();
  +      this.cache.put(fqn, "k", "v");
  +      tx.commit();
  +
  +      //get works fine
  +      tx.begin();
  +      assertEquals("v", this.cache.get(fqn, "k"));
  +      tx.commit();
  +
  +      //remove all
  +      tx.begin();
  +      this.cache.remove(Fqn.ROOT);
  +      tx.commit();
  +
  +      //get returns null - ok
  +      //put - endless loop
  +      tx.begin();
  +      assertNull(this.cache.get(fqn, "k"));
  +      this.cache.put(fqn, "k", "v");
  +      tx.commit();
  +	}
  +
  +   // thanks to msteiner at gazeta.pl for this test and spotting JBCACHE-999
  +   public void testRootNodeRemovalRollback() throws Exception
  +    {
  +
  +      Fqn root = Fqn.ROOT;
  +      Fqn fqn = new Fqn(root, new Long(1));
  +      //put first time
  +      tx.begin();
  +      this.cache.put(fqn, "k", "v");
  +      tx.commit();
  +
  +      //get works fine
  +      tx.begin();
  +      assertEquals("v", this.cache.get(fqn, "k"));
  +      tx.commit();
  +
  +      //remove all
  +      tx.begin();
  +      this.cache.remove(root);
  +      tx.rollback();
  +
  +       assertEquals("v", this.cache.get(fqn, "k"));
  +   }
  +
   
    /*  public void testConcurrentReadAccess() throws Exception {
         cache.setIsolationLevel(IsolationLevel.REPEATABLE_READ);
  
  
  



More information about the jboss-cvs-commits mailing list