jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From resc...@apache.org
Subject svn commit: r772596 - in /jackrabbit/trunk: jackrabbit-core/pom.xml jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/VersionHistoryTest.java
Date Thu, 07 May 2009 10:39:34 GMT
Author: reschke
Date: Thu May  7 10:39:34 2009
New Revision: 772596

URL: http://svn.apache.org/viewvc?rev=772596&view=rev
Log:
JCR-2058: add TCK tests for getAllLinearVersions (and mark them as currently failing in jackrabbit-core)


Modified:
    jackrabbit/trunk/jackrabbit-core/pom.xml
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/VersionHistoryTest.java

Modified: jackrabbit/trunk/jackrabbit-core/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/pom.xml?rev=772596&r1=772595&r2=772596&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/pom.xml (original)
+++ jackrabbit/trunk/jackrabbit-core/pom.xml Thu May  7 10:39:34 2009
@@ -89,6 +89,8 @@
               <value>
                 org.apache.jackrabbit.core.xml.DocumentViewTest#testMultiValue
                 org.apache.jackrabbit.test.api.ShareableNodeTest#testSharedNodePath
+                org.apache.jackrabbit.test.api.version.VersionHistoryTest#testInitialNumberOfLinearVersions
+                org.apache.jackrabbit.test.api.version.VersionHistoryTest#testInitiallyGetAllLinearVersionsContainsTheRootAndTheBaseVersion
               </value>
             </property>
           </systemProperties>

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/VersionHistoryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/VersionHistoryTest.java?rev=772596&r1=772595&r2=772596&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/VersionHistoryTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/VersionHistoryTest.java
Thu May  7 10:39:34 2009
@@ -18,10 +18,12 @@
 
 import java.io.ByteArrayInputStream;
 import java.io.InputStream;
+import java.util.ArrayList;
 import java.util.Calendar;
 import java.util.GregorianCalendar;
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.List;
 import java.util.Set;
 
 import javax.jcr.ItemNotFoundException;
@@ -119,6 +121,21 @@
     }
 
     /**
+     * The version history must initially contain two versions (root version +
+     * first test version) - linear variant
+     *
+     * @throws RepositoryException
+     * @since JCR 2.0
+     */
+    public void testInitialNumberOfLinearVersions() throws RepositoryException {
+        long initialSize = getNumberOfVersions(vHistory);
+        long initialLinearSize = getSize(vHistory.getAllLinearVersions());
+
+        assertEquals("VersionHistory.getAllVersions() and .getAllLinearVersions should return
the same number of versions for a purely linear version history.",
+                initialSize, initialLinearSize);
+    }
+
+    /**
      * Test if the iterator returned by {@link javax.jcr.version.VersionHistory#getAllVersions()}
      * contains the root version upon creation of the version history.
      *
@@ -132,6 +149,29 @@
         }
         assertTrue("root version must be part of the version history", isContained);
     }
+    
+    /**
+     * Test if the iterator returned by {@link javax.jcr.version.VersionHistory#getAllLinearVersions()}
+     * contains both the root and the base version upon creation of the version history.
+     * @since JCR 2.0
+     */
+    public void testInitiallyGetAllLinearVersionsContainsTheRootAndTheBaseVersion() throws
RepositoryException {
+        
+        VersionManager vm = versionableNode.getSession().getWorkspace().getVersionManager();
+        
+        List lvh = new ArrayList();
+        for (VersionIterator it = vHistory.getAllLinearVersions(); it.hasNext(); ) {
+            lvh.add(it.nextVersion().getName());
+        }
+        
+        String rootVersion = vm.getVersionHistory(versionableNode.getPath()).getRootVersion().getName();
+        String baseVersion = vm.getBaseVersion(versionableNode.getPath()).getName();
+
+        assertTrue("root version " + rootVersion + " must be part of the linear version history:
"
+                + lvh, lvh.contains(rootVersion));
+        assertTrue("base version " + baseVersion + " must be part of the linear version history:
"
+                + lvh, lvh.contains(baseVersion));
+    }
 
     /**
      * Test that {@link VersionHistory#getAllVersions()} returns an iterator



Mime
View raw message