jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1466902 - /jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/authorization/AbstractEvaluationTest.java
Date Thu, 11 Apr 2013 14:29:02 GMT
Author: angela
Date: Thu Apr 11 14:29:02 2013
New Revision: 1466902

URL: http://svn.apache.org/r1466902
Log:
OAK-527: permissions (WIP: tests)

Modified:
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/authorization/AbstractEvaluationTest.java

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/authorization/AbstractEvaluationTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/authorization/AbstractEvaluationTest.java?rev=1466902&r1=1466901&r2=1466902&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/authorization/AbstractEvaluationTest.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/authorization/AbstractEvaluationTest.java
Thu Apr 11 14:29:02 2013
@@ -22,6 +22,8 @@ import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
 import java.util.UUID;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
 import javax.jcr.Credentials;
 import javax.jcr.Node;
 import javax.jcr.PathNotFoundException;
@@ -138,7 +140,7 @@ public abstract class AbstractEvaluation
             }
             superuser.refresh(false);
             for (String path : toClear) {
-                if (superuser.nodeExists(path)) {
+                if (path != null && superuser.nodeExists(path)) {
                     AccessControlPolicy[] policies = acMgr.getPolicies(path);
                     for (AccessControlPolicy policy : policies) {
                         acMgr.removePolicy(path, policy);
@@ -191,12 +193,14 @@ public abstract class AbstractEvaluation
         return Collections.singletonMap("rep:glob", testSession.getValueFactory().createValue(value));
     }
 
-    protected void assertHasPrivilege(String path, String privName, boolean isAllow) throws
Exception {
+    protected void assertHasPrivilege(@Nullable String path,
+                                      @Nonnull String privName, boolean isAllow) throws Exception
{
         Privilege[] privs = privilegesFromName(privName.toString());
         assertEquals(isAllow, testAcMgr.hasPrivileges(path, privs));
     }
 
-    protected void assertHasPrivileges(String path, Privilege[] privileges, boolean isAllow)
throws Exception {
+    protected void assertHasPrivileges(@Nullable String path,
+                                       @Nonnull Privilege[] privileges, boolean isAllow)
throws Exception {
         if (testSession.nodeExists(path)) {
             assertEquals(isAllow, testAcMgr.hasPrivileges(path, privileges));
         } else {
@@ -214,7 +218,8 @@ public abstract class AbstractEvaluation
         assertArrayEquals(privilegesFromName(Privilege.JCR_READ), privs);
     }
 
-    protected JackrabbitAccessControlList modify(String path, String privilege, boolean isAllow)
throws Exception {
+    protected JackrabbitAccessControlList modify(@Nullable String path,
+                                                 @Nonnull String privilege, boolean isAllow)
throws Exception {
         return modify(path, testUser.getPrincipal(), privilegesFromName(privilege), isAllow,
EMPTY_RESTRICTIONS);
     }
 
@@ -231,12 +236,14 @@ public abstract class AbstractEvaluation
         return tmpl;
     }
 
-    protected JackrabbitAccessControlList allow(String nPath, Privilege[] privileges)
+    protected JackrabbitAccessControlList allow(@Nullable String nPath,
+                                                @Nonnull Privilege[] privileges)
             throws Exception {
         return modify(nPath, testUser.getPrincipal(), privileges, true, EMPTY_RESTRICTIONS);
     }
 
-    protected JackrabbitAccessControlList allow(String nPath, Privilege[] privileges,
+    protected JackrabbitAccessControlList allow(@Nullable String nPath,
+                                                @Nonnull Privilege[] privileges,
                                                 Map<String, Value> restrictions)
             throws Exception {
         return modify(nPath, testUser.getPrincipal(), privileges, true, restrictions);



Mime
View raw message