jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From resc...@apache.org
Subject svn commit: r772293 - /jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/GetPredecessorsTest.java
Date Wed, 06 May 2009 14:59:14 GMT
Author: reschke
Date: Wed May  6 14:59:13 2009
New Revision: 772293

URL: http://svn.apache.org/viewvc?rev=772293&view=rev
Log:
JCR-2058: add TCK tests for Version.getLinear{Predecessors|Successors}

Modified:
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/GetPredecessorsTest.java

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/GetPredecessorsTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/GetPredecessorsTest.java?rev=772293&r1=772292&r2=772293&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/GetPredecessorsTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/GetPredecessorsTest.java
Wed May  6 14:59:13 2009
@@ -18,10 +18,12 @@
 
 import javax.jcr.RepositoryException;
 import javax.jcr.version.Version;
+import javax.jcr.version.VersionManager;
 
 /**
  * <code>GetPredecessorsTest</code>  provides test methods covering {@link
- * javax.jcr.version.Version#getPredecessors()}.
+ * Version#getPredecessors()}, {@link Version#getLinearPredecessor()} and
+ * {@link Version#getLinearSuccessor()}.
  *
  * @test
  * @sources GetPredecessorsTest.java
@@ -43,4 +45,38 @@
 
         assertTrue("Version should have at minimum one predecessor version.", version.getPredecessors().length
> 0);
     }
+    
+    /**
+     * Checks ontaining the linear predecessor.
+     * @since JCR 2.0
+     */
+    public void testGetLinearPredecessorSuccessor() throws RepositoryException {
+
+        String path = versionableNode.getPath();
+        
+        VersionManager vm = versionableNode.getSession().getWorkspace().getVersionManager();
+        
+        // get the previous version
+        Version pred = vm.getBaseVersion(path);
+
+        // shouldn't have a successor yet
+        assertNull(pred.getLinearSuccessor());
+        
+        // check root version
+        Version root = vm.getVersionHistory(path).getRootVersion();
+        assertNull(root.getLinearSuccessor());
+        
+        // create a new version
+        vm.checkout(path);
+        Version version = vm.checkin(path);
+        
+        // refresh the predecessor
+        pred = (Version)versionableNode.getSession().getNode(pred.getPath());
+
+        assertTrue("linear predecessor of new version should be previous version",
+                version.getLinearPredecessor().isSame(pred));
+        assertTrue("linear successor of previous version should be new version",
+                pred.getLinearSuccessor().isSame(version));
+    }
+
 }
\ No newline at end of file



Mime
View raw message