jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r927856 - in /jackrabbit/trunk/jackrabbit-jcr-rmi: pom.xml src/test/java/org/apache/jackrabbit/rmi/RepositoryStubImpl.java
Date Fri, 26 Mar 2010 14:03:41 GMT
Author: jukka
Date: Fri Mar 26 14:03:40 2010
New Revision: 927856

URL: http://svn.apache.org/viewvc?rev=927856&view=rev
Log:
JCRRMI-27: JSR-283: Support AccessControlManager

Use a trick in RepositoryStub.getKnownPrincipal to enable ACL tests.

Modified:
    jackrabbit/trunk/jackrabbit-jcr-rmi/pom.xml
    jackrabbit/trunk/jackrabbit-jcr-rmi/src/test/java/org/apache/jackrabbit/rmi/RepositoryStubImpl.java

Modified: jackrabbit/trunk/jackrabbit-jcr-rmi/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-rmi/pom.xml?rev=927856&r1=927855&r2=927856&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-rmi/pom.xml (original)
+++ jackrabbit/trunk/jackrabbit-jcr-rmi/pom.xml Fri Mar 26 14:03:40 2010
@@ -116,7 +116,7 @@
                   <value>true</value>
                 </property>
                 <property>
-                  <name>unknown.issues</name>
+                  <name>known.issues</name>
                   <value>
 org.apache.jackrabbit.test.api.LifecycleTest#testFollowLifecycleTransition
 org.apache.jackrabbit.test.api.LifecycleTest#testGetAllowedLifecycleTransitions
@@ -490,25 +490,6 @@ org.apache.jackrabbit.test.api.query.XPa
 org.apache.jackrabbit.test.api.query.XPathQueryLevel2Test#testPathColumn
 org.apache.jackrabbit.test.api.query.XPathQueryLevel2Test#testRange
 org.apache.jackrabbit.test.api.query.XPathQueryLevel2Test#testScoreColumn
-org.apache.jackrabbit.test.api.security.AccessControlListTest#testAddAbstractPrivilege
-org.apache.jackrabbit.test.api.security.AccessControlListTest#testAddAccessControlEntry
-org.apache.jackrabbit.test.api.security.AccessControlListTest#testAddAccessControlEntryAgain
-org.apache.jackrabbit.test.api.security.AccessControlListTest#testAddAccessControlEntryAndSetPolicy
-org.apache.jackrabbit.test.api.security.AccessControlListTest#testAddAccessControlEntryEmptyPrivilegeArray
-org.apache.jackrabbit.test.api.security.AccessControlListTest#testAddAccessControlEntryInvalidPrincipal
-org.apache.jackrabbit.test.api.security.AccessControlListTest#testAddAccessControlEntryInvalidPrivilege
-org.apache.jackrabbit.test.api.security.AccessControlListTest#testAddAccessControlEntryIsTransient
-org.apache.jackrabbit.test.api.security.AccessControlListTest#testAddAccessControlEntryTwice
-org.apache.jackrabbit.test.api.security.AccessControlListTest#testAddAggregatedPrivilegesSeparately
-org.apache.jackrabbit.test.api.security.AccessControlListTest#testAddAggregatePrivilege
-org.apache.jackrabbit.test.api.security.AccessControlListTest#testAddPrivilegesPresentInEntries
-org.apache.jackrabbit.test.api.security.AccessControlListTest#testExtendPrivileges
-org.apache.jackrabbit.test.api.security.AccessControlListTest#testGetAccessControlEntries
-org.apache.jackrabbit.test.api.security.AccessControlListTest#testRemoveAccessControlEntry
-org.apache.jackrabbit.test.api.security.AccessControlListTest#testRemoveAccessControlEntryAndSetPolicy
-org.apache.jackrabbit.test.api.security.AccessControlListTest#testRemoveAccessControlEntryIsTransient
-org.apache.jackrabbit.test.api.security.AccessControlListTest#testRemoveAddedAccessControlEntry
-org.apache.jackrabbit.test.api.security.AccessControlListTest#testRemoveIllegalAccessControlEntry
 org.apache.jackrabbit.test.api.security.AccessControlPolicyTest#testSetIllegalPolicy
 org.apache.jackrabbit.test.api.security.RSessionAccessControlPolicyTest#testSetInvalidPolicy
 org.apache.jackrabbit.test.api.SerializationTest#testLockExceptionSessionWithHandler

Modified: jackrabbit/trunk/jackrabbit-jcr-rmi/src/test/java/org/apache/jackrabbit/rmi/RepositoryStubImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-rmi/src/test/java/org/apache/jackrabbit/rmi/RepositoryStubImpl.java?rev=927856&r1=927855&r2=927856&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-rmi/src/test/java/org/apache/jackrabbit/rmi/RepositoryStubImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-rmi/src/test/java/org/apache/jackrabbit/rmi/RepositoryStubImpl.java
Fri Mar 26 14:03:40 2010
@@ -21,11 +21,17 @@ import java.io.ByteArrayOutputStream;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 import java.rmi.server.RemoteObject;
+import java.security.Principal;
+import java.security.acl.Group;
 import java.util.Properties;
 
 import javax.jcr.Repository;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.jcr.SimpleCredentials;
 
 import org.apache.jackrabbit.core.JackrabbitRepositoryStub;
+import org.apache.jackrabbit.core.SessionImpl;
 import org.apache.jackrabbit.rmi.client.ClientAdapterFactory;
 import org.apache.jackrabbit.rmi.client.LocalAdapterFactory;
 import org.apache.jackrabbit.rmi.remote.RemoteRepository;
@@ -35,6 +41,11 @@ import org.apache.jackrabbit.test.Reposi
 
 public class RepositoryStubImpl extends JackrabbitRepositoryStub {
 
+    /**
+     * A known principal used for access control tests.
+     */
+    private Principal principal;
+
     private RemoteRepository remote;
 
     private Repository repository;
@@ -48,6 +59,19 @@ public class RepositoryStubImpl extends 
             throws RepositoryStubException {
         if (repository == null) {
             try {
+                Repository repo = super.getRepository();
+                SessionImpl session = (SessionImpl) repo.login(
+                        new SimpleCredentials("admin", "admin".toCharArray()));
+                try {
+                    for (Principal p : session.getSubject().getPrincipals()) {
+                        if (!(p instanceof Group)) {
+                            principal = p;
+                        }
+                    }
+                } finally {
+                    session.logout();
+                }
+
                 RemoteAdapterFactory raf = new ServerAdapterFactory();
                 remote = raf.getRemoteRepository(super.getRepository());
 
@@ -69,4 +93,14 @@ public class RepositoryStubImpl extends 
         return repository;
     }
 
+    @Override
+    public Principal getKnownPrincipal(Session ignored)
+            throws RepositoryException {
+        if (principal != null) {
+            return principal;
+        } else {
+            throw new RepositoryException("no applicable principal found");
+        }
+    }
+
 }



Mime
View raw message