jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1208376 - /jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/xml/AccessControlImporterTest.java
Date Wed, 30 Nov 2011 10:57:50 GMT
Author: angela
Date: Wed Nov 30 10:57:50 2011
New Revision: 1208376

URL: http://svn.apache.org/viewvc?rev=1208376&view=rev
Log:
JCR-3152 : AccessControlImporter does not import repo level ac content

Modified:
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/xml/AccessControlImporterTest.java

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/xml/AccessControlImporterTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/xml/AccessControlImporterTest.java?rev=1208376&r1=1208375&r2=1208376&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/xml/AccessControlImporterTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/xml/AccessControlImporterTest.java
Wed Nov 30 10:57:50 2011
@@ -202,7 +202,7 @@ public class AccessControlImporterTest e
                 "<sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\">" +
                     "<sv:value>rep:ACL</sv:value>" +
                 "</sv:property>" +
-                "<sv:node sv:name=\"allow0\">" +
+                "<sv:node sv:name=\"allow\">" +
                     "<sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\">" +
                         "<sv:value>rep:GrantACE</sv:value>" +
                     "</sv:property>" +
@@ -578,6 +578,13 @@ public class AccessControlImporterTest e
         NodeImpl target = (NodeImpl) sImpl.getRootNode();
         AccessControlManager acMgr = sImpl.getAccessControlManager();
         try {
+            // need to add mixin. in contrast to only using JCR API to retrieve
+            // and set the policies the protected item import only is called if
+            // the node to be imported is defined to be protected. however, if
+            // the root node doesn't have the mixin assigned the defining node
+            // type of the imported policy nodes will be rep:root (unstructured)
+            // and the items will not be detected as being protected.
+            target.addMixin("rep:RepoAccessControllable");            
             InputStream in = new ByteArrayInputStream(XML_REPO_POLICY_TREE.getBytes("UTF-8"));
 
             SessionImporter importer = new SessionImporter(target, sImpl, ImportUUIDBehavior.IMPORT_UUID_CREATE_NEW,
new PseudoConfig());
@@ -595,7 +602,12 @@ public class AccessControlImporterTest e
             assertEquals(acMgr.privilegeFromName("jcr:workspaceManagement"), entries[0].getPrivileges()[0]);
 
             assertTrue(target.hasNode("rep:repoPolicy"));
-            assertFalse(target.hasNode("rep:repoPolicy/allow0"));
+            assertTrue(target.hasNode("rep:repoPolicy/allow"));
+
+            // clean up again
+            acMgr.removePolicy(null, policies[0]);
+            assertFalse(target.hasNode("rep:repoPolicy"));
+            assertFalse(target.hasNode("rep:repoPolicy/allow"));
 
         } finally {
             superuser.refresh(false);



Mime
View raw message