[jboss-cvs] JBossCache/tests/functional/org/jboss/cache/options ...
Manik Surtani
msurtani at jboss.com
Thu Jan 18 11:02:10 EST 2007
User: msurtani
Date: 07/01/18 11:02:10
Modified: tests/functional/org/jboss/cache/options
ExplicitVersionsTest.java
Log:
Potential bug in versioning?
Revision Changes Path
1.12 +37 -3 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.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- ExplicitVersionsTest.java 11 Jan 2007 13:49:07 -0000 1.11
+++ ExplicitVersionsTest.java 18 Jan 2007 16:02:10 -0000 1.12
@@ -11,6 +11,7 @@
import org.jboss.cache.CacheImpl;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
+import org.jboss.cache.Node;
import org.jboss.cache.NodeSPI;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.Option;
@@ -136,6 +137,41 @@
assertEquals(v, ((NodeSPI) cache.get("/org/domain/Entity/EntityInstance#1")).getVersion());
}
+ public void testExplicitVersionsOnParents()
+ {
+ Node root = cache.getRoot();
+
+ TestVersion lev2V = new TestVersion("Lev2-v");
+ cache.getInvocationContext().getOptionOverrides().setDataVersion(lev2V);
+ root.addChild(Fqn.fromString("LEV2"));
+
+ NodeSPI lev2 = (NodeSPI) root.getChild(Fqn.fromString("LEV2"));
+
+ assertNotNull(lev2);
+
+ assertEquals(lev2V, lev2.getVersion());
+
+ TestVersion lev3V = new TestVersion("Lev3-v");
+ cache.getInvocationContext().getOptionOverrides().setDataVersion(lev3V);
+ lev2.addChild(Fqn.fromString("LEV3"));
+
+ NodeSPI lev3 = (NodeSPI) lev2.getChild(Fqn.fromString("LEV3"));
+
+ assertNotNull(lev3);
+
+ assertEquals(lev3V, lev3.getVersion());
+
+ TestVersion lev4V = new TestVersion("Lev4-v");
+ cache.getInvocationContext().getOptionOverrides().setDataVersion(lev4V);
+ lev3.addChild(Fqn.fromString("LEV4"));
+
+ NodeSPI lev4 = (NodeSPI) lev3.getChild(Fqn.fromString("LEV4"));
+
+ assertNotNull(lev4);
+
+ assertEquals(lev4V, lev4.getVersion());
+ }
+
}
class TestVersion implements DataVersion
@@ -161,9 +197,7 @@
{
if (other instanceof TestVersion)
{
- int myInt = Integer.parseInt(myVersion);
- int otherInt = Integer.parseInt(((TestVersion) other).getInternalVersion());
- return myInt > otherInt;
+ return myVersion.compareTo(((TestVersion) other).getInternalVersion()) > 0;
}
else
{
More information about the jboss-cvs-commits
mailing list