jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1455636 - /jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OakSegmentMKRepositoryStub.java
Date Tue, 12 Mar 2013 17:25:12 GMT
Author: jukka
Date: Tue Mar 12 17:25:11 2013
New Revision: 1455636

URL: http://svn.apache.org/r1455636
Log:
OAK-593: Segment-based MK

Make the security tests pass also with SegmentMK

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

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OakSegmentMKRepositoryStub.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OakSegmentMKRepositoryStub.java?rev=1455636&r1=1455635&r2=1455636&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OakSegmentMKRepositoryStub.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OakSegmentMKRepositoryStub.java
Tue Mar 12 17:25:11 2013
@@ -27,6 +27,9 @@ import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 import javax.jcr.UnsupportedRepositoryOperationException;
 
+import org.apache.jackrabbit.api.JackrabbitSession;
+import org.apache.jackrabbit.api.security.principal.PrincipalIterator;
+import org.apache.jackrabbit.api.security.principal.PrincipalManager;
 import org.apache.jackrabbit.oak.Oak;
 import org.apache.jackrabbit.oak.plugins.segment.MongoStore;
 import org.apache.jackrabbit.oak.plugins.segment.SegmentNodeStore;
@@ -119,6 +122,13 @@ public class OakSegmentMKRepositoryStub 
 
     @Override
     public Principal getKnownPrincipal(Session session) throws RepositoryException {
+        if (session instanceof JackrabbitSession) {
+            PrincipalIterator principals = ((JackrabbitSession) session).getPrincipalManager().getPrincipals(PrincipalManager.SEARCH_TYPE_NOT_GROUP);
+            if (principals.hasNext()) {
+                return principals.nextPrincipal();
+            }
+        }
+
         throw new UnsupportedRepositoryOperationException();
     }
 
@@ -130,8 +140,8 @@ public class OakSegmentMKRepositoryStub 
     };
 
     @Override
-    public Principal getUnknownPrincipal(Session session) throws RepositoryException,
-            NotExecutableException {
+    public Principal getUnknownPrincipal(Session session) throws RepositoryException, NotExecutableException
{
         return UNKNOWN_PRINCIPAL;
     }
+
 }



Mime
View raw message