jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r1466374 - /jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OakMongoMKRepositoryStub.java
Date Wed, 10 Apr 2013 08:16:02 GMT
Author: thomasm
Date: Wed Apr 10 08:16:02 2013
New Revision: 1466374

URL: http://svn.apache.org/r1466374
Log:
OAK-746 Builder for the MongoMK

Modified:
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OakMongoMKRepositoryStub.java

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OakMongoMKRepositoryStub.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OakMongoMKRepositoryStub.java?rev=1466374&r1=1466373&r2=1466374&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OakMongoMKRepositoryStub.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OakMongoMKRepositoryStub.java
Wed Apr 10 08:16:02 2013
@@ -49,6 +49,13 @@ public class OakMongoMKRepositoryStub ex
 
     protected static final String DB =
             System.getProperty("mongo.db", "MongoMKDB");
+    
+    private static final Principal UNKNOWN_PRINCIPAL = new Principal() {
+        @Override
+        public String getName() {
+            return "an_unknown_user";
+        }
+    };
 
     private final MongoConnection connection;
     private final Repository repository;
@@ -65,7 +72,8 @@ public class OakMongoMKRepositoryStub ex
         Session session = null;
         try {
             this.connection = new MongoConnection(HOST, PORT, DB);
-            Jcr jcr = new Jcr(new MongoMK(connection.getDB(), 0));
+            Jcr jcr = new Jcr(new MongoMK.Builder().
+                    setMongoDB(connection.getDB()).open());
             jcr.with(Executors.newScheduledThreadPool(1));
             this.repository = jcr.createRepository();
 
@@ -83,6 +91,9 @@ public class OakMongoMKRepositoryStub ex
                 new Thread(new ShutdownHook(connection)));
     }
 
+    /**
+     * A shutdown hook that closed the MongoDB connection if needed.
+     */
     private static class ShutdownHook implements Runnable {
 
         private final WeakReference<MongoConnection> reference;
@@ -134,18 +145,10 @@ public class OakMongoMKRepositoryStub ex
     public Principal getKnownPrincipal(Session session) throws RepositoryException {
         if (session instanceof JackrabbitSession) {
             return ((JackrabbitSession) session).getPrincipalManager().getPrincipal(session.getUserID());
-        } else {
-            throw new UnsupportedRepositoryOperationException();
         }
+        throw new UnsupportedRepositoryOperationException();
     }
 
-    private static final Principal UNKNOWN_PRINCIPAL = new Principal() {
-        @Override
-        public String getName() {
-            return "an_unknown_user";
-        }
-    };
-
     @Override
     public Principal getUnknownPrincipal(Session session) throws RepositoryException,
             NotExecutableException {



Mime
View raw message