jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1469349 - in /jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/authorization: NodeTypeDefinitionManagementTest.java NodeTypeManagementTest.java
Date Thu, 18 Apr 2013 14:41:35 GMT
Author: angela
Date: Thu Apr 18 14:41:35 2013
New Revision: 1469349

URL: http://svn.apache.org/r1469349
Log:
OAK-527: permissions (wip, tests)

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

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/authorization/NodeTypeDefinitionManagementTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/authorization/NodeTypeDefinitionManagementTest.java?rev=1469349&r1=1469348&r2=1469349&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/authorization/NodeTypeDefinitionManagementTest.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/authorization/NodeTypeDefinitionManagementTest.java
Thu Apr 18 14:41:35 2013
@@ -152,7 +152,7 @@ public class NodeTypeDefinitionManagemen
                 // success
             }
         } finally {
-            // TODO: diff to jr-core where unregisterNt was not supported
+            // NOTE: diff to jr-core where unregisterNt was not supported
             ntm.unregisterNodeType(ntd.getName());
         }
     }

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/authorization/NodeTypeManagementTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/authorization/NodeTypeManagementTest.java?rev=1469349&r1=1469348&r2=1469349&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/authorization/NodeTypeManagementTest.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/authorization/NodeTypeManagementTest.java
Thu Apr 18 14:41:35 2013
@@ -102,29 +102,18 @@ public class NodeTypeManagementTest exte
     }
 
     @Test
-    public void testSetPrimaryType() throws Exception {
+    public void testSetPrimaryTypeWithoutPrivilege() throws Exception {
         Node child = (Node) superuser.getItem(childNode.getPath());
         String ntName = child.getPrimaryNodeType().getName();
 
-        String changedNtName = "nt:folder";
-        child.setPrimaryType(changedNtName);
-        superuser.save();
-
         try {
-            try {
-                childNode.setPrimaryType(ntName);
-                superuser.save();
-                fail("TestSession does not have sufficient privileges to change the primary
type.");
-            } catch (AccessDeniedException e) {
-                // success
-                testSession.refresh(false); // TODO: see JCR-1916
-            }
-
-            modify(childNode.getPath(), Privilege.JCR_NODE_TYPE_MANAGEMENT, true);
-            childNode.setPrimaryType(ntName);
+            childNode.setPrimaryType("nt:folder");
             superuser.save();
-
+            fail("TestSession does not have sufficient privileges to change the primary type.");
+        } catch (AccessDeniedException e) {
+            // success
         } finally {
+            testSession.refresh(false);
             if (!ntName.equals(child.getPrimaryNodeType().getName())) {
                 child.setPrimaryType(ntName);
                 superuser.save();
@@ -132,6 +121,20 @@ public class NodeTypeManagementTest exte
         }
     }
 
+    @Test
+    public void testSetPrimaryType() throws Exception {
+        Node child = (Node) superuser.getItem(childNode.getPath());
+        String ntName = child.getPrimaryNodeType().getName();
+
+        String changedNtName = "nt:folder";
+        child.setPrimaryType(changedNtName);
+        superuser.save();
+
+        modify(childNode.getPath(), Privilege.JCR_NODE_TYPE_MANAGEMENT, true);
+        childNode.setPrimaryType(ntName);
+        superuser.save();
+    }
+
     /**
      * Test difference between common jcr:write privilege an rep:write privilege
      * that includes the ability to set the primary node type upon child node



Mime
View raw message