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

Manik Surtani msurtani at jboss.com
Tue Jan 30 17:22:31 EST 2007


  User: msurtani
  Date: 07/01/30 17:22:31

  Modified:    tests/functional/org/jboss/cache/options  
                        ExplicitVersionsTest.java
                        ExplicitVersionsReplTest.java
  Log:
  Added tests
  
  Revision  Changes    Path
  1.14      +25 -0     JBossCache/tests/functional/org/jboss/cache/options/ExplicitVersionsTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ExplicitVersionsTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/options/ExplicitVersionsTest.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -b -r1.13 -r1.14
  --- ExplicitVersionsTest.java	18 Jan 2007 16:42:14 -0000	1.13
  +++ ExplicitVersionsTest.java	30 Jan 2007 22:22:31 -0000	1.14
  @@ -14,6 +14,7 @@
   import org.jboss.cache.Node;
   import org.jboss.cache.NodeSPI;
   import org.jboss.cache.config.Configuration;
  +import org.jboss.cache.config.Option;
   import org.jboss.cache.optimistic.DataVersion;
   import org.jboss.cache.optimistic.DefaultDataVersion;
   
  @@ -169,6 +170,30 @@
         assertEquals(lev4V, lev4.getVersion());
      }
   
  +   public void testExplicitVersionOnParentAndChild() throws Exception
  +   {
  +      TestVersion vParent = new TestVersion("Parent-Version");
  +
  +      cache.getTransactionManager().begin();
  +      cache.getInvocationContext().getOptionOverrides().setDataVersion(vParent);
  +      cache.put(Fqn.fromString("/parent"), "k", "v");
  +      cache.getTransactionManager().commit();
  +
  +      assertEquals(1, ((DefaultDataVersion)((NodeSPI)cache.get("/")).getVersion()).getRawVersion());
  +      assertEquals(vParent, ((NodeSPI)cache.get("/parent")).getVersion());
  +
  +      TestVersion vChild = new TestVersion("Child-Version");
  +
  +      cache.getTransactionManager().begin();
  +      cache.getInvocationContext().getOptionOverrides().setDataVersion(vChild);
  +      cache.put(Fqn.fromString("/parent/child"), "k", "v");
  +      cache.getTransactionManager().commit();
  +
  +      assertEquals(1, ((DefaultDataVersion)((NodeSPI)cache.get("/")).getVersion()).getRawVersion());
  +      assertEquals(vParent, ((NodeSPI)cache.get("/parent")).getVersion());
  +      assertEquals(vChild, ((NodeSPI)cache.get("/parent/child")).getVersion());
  +   }
  +
   }
   
   /**
  
  
  
  1.10      +30 -0     JBossCache/tests/functional/org/jboss/cache/options/ExplicitVersionsReplTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ExplicitVersionsReplTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/options/ExplicitVersionsReplTest.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -b -r1.9 -r1.10
  --- ExplicitVersionsReplTest.java	18 Jan 2007 16:42:14 -0000	1.9
  +++ ExplicitVersionsReplTest.java	30 Jan 2007 22:22:31 -0000	1.10
  @@ -7,6 +7,7 @@
   import org.jboss.cache.Fqn;
   import org.jboss.cache.NodeSPI;
   import org.jboss.cache.config.Configuration;
  +import org.jboss.cache.config.Option;
   import org.jboss.cache.misc.TestingUtil;
   import org.jboss.cache.optimistic.DataVersion;
   import org.jboss.cache.optimistic.DefaultDataVersion;
  @@ -331,5 +332,34 @@
   
      }
   
  +   public void testExplicitVersionOnParentAndChild() throws Exception
  +   {
  +      TestVersion vParent = new TestVersion("Parent-Version");
  +
  +      cache[0].getTransactionManager().begin();
  +      cache[0].getInvocationContext().getOptionOverrides().setDataVersion(vParent);
  +      cache[0].put(Fqn.fromString("/parent"), "k", "v");
  +      cache[0].getTransactionManager().commit();
  +
  +      assertEquals(1, ((DefaultDataVersion)((NodeSPI)cache[0].get("/")).getVersion()).getRawVersion());
  +      assertEquals(vParent, ((NodeSPI)cache[0].get("/parent")).getVersion());
  +      assertEquals(1, ((DefaultDataVersion)((NodeSPI)cache[1].get("/")).getVersion()).getRawVersion());
  +      assertEquals(vParent, ((NodeSPI)cache[1].get("/parent")).getVersion());
  +
   
  +      TestVersion vChild = new TestVersion("Child-Version");
  +
  +      cache[0].getTransactionManager().begin();
  +      cache[0].getInvocationContext().getOptionOverrides().setDataVersion(vChild);
  +      cache[0].put(Fqn.fromString("/parent/child"), "k", "v");
  +      cache[0].getTransactionManager().commit();
  +
  +      assertEquals(1, ((DefaultDataVersion)((NodeSPI)cache[0].get("/")).getVersion()).getRawVersion());
  +      assertEquals(vParent, ((NodeSPI)cache[0].get("/parent")).getVersion());
  +      assertEquals(vChild, ((NodeSPI)cache[0].get("/parent/child")).getVersion());
  +      assertEquals(1, ((DefaultDataVersion)((NodeSPI)cache[1].get("/")).getVersion()).getRawVersion());
  +      assertEquals(vParent, ((NodeSPI)cache[1].get("/parent")).getVersion());
  +      assertEquals(vChild, ((NodeSPI)cache[1].get("/parent/child")).getVersion());
  +
  +   }
   }
  
  
  



More information about the jboss-cvs-commits mailing list