jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r792912 - /jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/random/operation/VersionOperation.java
Date Fri, 10 Jul 2009 12:21:48 GMT
Author: mreutegg
Date: Fri Jul 10 12:21:48 2009
New Revision: 792912

URL: http://svn.apache.org/viewvc?rev=792912&view=rev
Log:
make sure base version is not removed

Modified:
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/random/operation/VersionOperation.java

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/random/operation/VersionOperation.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/random/operation/VersionOperation.java?rev=792912&r1=792911&r2=792912&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/random/operation/VersionOperation.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/random/operation/VersionOperation.java
Fri Jul 10 12:21:48 2009
@@ -18,6 +18,7 @@
 
 import javax.jcr.Session;
 import javax.jcr.RepositoryException;
+import javax.jcr.Node;
 import javax.jcr.version.VersionIterator;
 import javax.jcr.version.Version;
 import java.util.List;
@@ -43,8 +44,15 @@
      */
     protected Version getRandomVersion(boolean excludeReferenced) throws RepositoryException
{
         List allVersions = new ArrayList();
-        for (VersionIterator it = getNode().getVersionHistory().getAllVersions(); it.hasNext();
) {
+        Node n = getNode();
+        for (VersionIterator it = n.getVersionHistory().getAllVersions(); it.hasNext(); )
{
             Version v = it.nextVersion();
+            if (excludeReferenced) {
+                // quick check if it is the base version
+                if (n.getBaseVersion().isSame(v)) {
+                    continue;
+                }
+            }
             if (v.getPredecessors().length > 0) {
                 if (!excludeReferenced || !v.getReferences().hasNext()) {
                     allVersions.add(v);



Mime
View raw message