jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1489799 - /jackrabbit/trunk/jackrabbit-webapp/src/test/java/org/apache/jackrabbit/j2ee/BackwardsCompatibilityIT.java
Date Wed, 05 Jun 2013 10:32:08 GMT
Author: jukka
Date: Wed Jun  5 10:32:08 2013
New Revision: 1489799

URL: http://svn.apache.org/r1489799
Log:
JCR-3598: Oak in Jackrabbit deployment packages

Verify that Oak can upgrade content from all past Jackrabbit versions

Modified:
    jackrabbit/trunk/jackrabbit-webapp/src/test/java/org/apache/jackrabbit/j2ee/BackwardsCompatibilityIT.java

Modified: jackrabbit/trunk/jackrabbit-webapp/src/test/java/org/apache/jackrabbit/j2ee/BackwardsCompatibilityIT.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-webapp/src/test/java/org/apache/jackrabbit/j2ee/BackwardsCompatibilityIT.java?rev=1489799&r1=1489798&r2=1489799&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-webapp/src/test/java/org/apache/jackrabbit/j2ee/BackwardsCompatibilityIT.java
(original)
+++ jackrabbit/trunk/jackrabbit-webapp/src/test/java/org/apache/jackrabbit/j2ee/BackwardsCompatibilityIT.java
Wed Jun  5 10:32:08 2013
@@ -30,6 +30,7 @@ import java.util.zip.ZipFile;
 
 import javax.jcr.Node;
 import javax.jcr.PathNotFoundException;
+import javax.jcr.Repository;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 import javax.jcr.SimpleCredentials;
@@ -43,7 +44,14 @@ import junit.framework.TestCase;
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.io.IOUtils;
 import org.apache.jackrabbit.core.RepositoryImpl;
+import org.apache.jackrabbit.core.SessionImpl;
 import org.apache.jackrabbit.core.config.RepositoryConfig;
+import org.apache.jackrabbit.mk.core.MicroKernelImpl;
+import org.apache.jackrabbit.oak.Oak;
+import org.apache.jackrabbit.oak.jcr.Jcr;
+import org.apache.jackrabbit.oak.kernel.KernelNodeStore;
+import org.apache.jackrabbit.oak.spi.state.NodeStore;
+import org.apache.jackrabbit.oak.upgrade.RepositoryUpgrade;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -66,12 +74,17 @@ public class BackwardsCompatibilityIT ex
         for (File dir : target.listFiles()) {
             if (dir.isDirectory()) {
                 log.info("Testing backwards compatibility with {}", dir);
-                assertRepository(dir);
+                checkJackrabbitRepository(dir);
+
+                NodeStore store = new KernelNodeStore(new MicroKernelImpl());
+                RepositoryUpgrade.copy(dir, store);
+                checkRepositoryContent(
+                        new Jcr(new Oak(store)).createRepository());
             }
         }
     }
 
-    private void assertRepository(File directory) throws Exception {
+    private void checkJackrabbitRepository(File directory) throws Exception {
         File configuration = new File(directory, "repository.xml");
 
         try {
@@ -79,13 +92,7 @@ public class BackwardsCompatibilityIT ex
                     configuration.getPath(), directory.getPath());
             RepositoryImpl repository = RepositoryImpl.create(config);
             try {
-                Session session = repository.login(
-                        new SimpleCredentials("admin", "admin".toCharArray()));
-                try {
-                    assertTestData(session);
-                } finally {
-                    session.logout();
-                }
+                checkRepositoryContent(repository);
             } finally {
                 repository.shutdown();
             }
@@ -96,6 +103,17 @@ public class BackwardsCompatibilityIT ex
         }
     }
 
+    private void checkRepositoryContent(Repository repository)
+            throws Exception {
+        Session session = repository.login(
+                new SimpleCredentials("admin", "admin".toCharArray()));
+        try {
+            assertTestData(session);
+        } finally {
+            session.logout();
+        }
+    }
+
     private void assertTestData(Session session) throws Exception {
         Node root = session.getRootNode();
 
@@ -104,7 +122,10 @@ public class BackwardsCompatibilityIT ex
 
         Node versionable = assertVersionable(test);
         assertProperties(test, versionable);
-        assertVersionableCopy(test, versionable);
+        if (session instanceof SessionImpl) {
+            // FIXME: Not yet supported by Oak
+            assertVersionableCopy(test, versionable);
+        }
         assertLock(test);
         assertUsers(session);
     }



Mime
View raw message