jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1461032 - /jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/authorization/AccessControlImporterTest.java
Date Tue, 26 Mar 2013 09:22:49 GMT
Author: angela
Date: Tue Mar 26 09:22:49 2013
New Revision: 1461032

URL: http://svn.apache.org/r1461032
Log:
OAK-414: remove jr-core specific test (already commented out), mark failing tests with @Ignore

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

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/authorization/AccessControlImporterTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/authorization/AccessControlImporterTest.java?rev=1461032&r1=1461031&r2=1461032&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/authorization/AccessControlImporterTest.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/authorization/AccessControlImporterTest.java
Tue Mar 26 09:22:49 2013
@@ -35,6 +35,7 @@ import org.apache.jackrabbit.api.securit
 import org.apache.jackrabbit.api.security.JackrabbitAccessControlList;
 import org.apache.jackrabbit.oak.jcr.SessionImpl;
 import org.apache.jackrabbit.test.AbstractJCRTest;
+import org.junit.Ignore;
 import org.xml.sax.SAXException;
 
 public class AccessControlImporterTest extends AbstractJCRTest {
@@ -198,8 +199,6 @@ public class AccessControlImporterTest e
                 "</sv:node>" +
             "</sv:node>";
 
-    private static final String XML_AC_TREE       = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><sv:node
sv:name=\"rep:security\" xmlns:mix=\"http://www.jcp.org/jcr/mix/1.0\" xmlns:nt=\"http://www.jcp.org/jcr/nt/1.0\"
xmlns:fn_old=\"http://www.w3.org/2004/10/xpath-functions\" xmlns:fn=\"http://www.w3.org/2005/xpath-functions\"
xmlns:crx=\"http://www.day.com/crx/1.0\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" xmlns:sv=\"http://www.jcp.org/jcr/sv/1.0\"
xmlns:repl=\"http://www.day.com/crx/replication/1.0\" xmlns:rep=\"internal\" xmlns:jcr=\"http://www.jcp.org/jcr/1.0\"><sv:property
sv:name=\"jcr:primaryType\" sv:type=\"Name\"><sv:value>rep:AccessControl</sv:value></sv:property><sv:node
sv:name=\"rep:authorizables\"><sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\"><sv:value>rep:AccessControl</sv:value></sv:property><sv:node
sv:name=\"rep:groups\"><sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\"><sv:value>rep:AccessControl</sv:value></sv:property><sv:node
sv:
 name=\"administrators\"><sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\"><sv:value>rep:PrincipalAccessControl</sv:value></sv:property><sv:node
sv:name=\"rep:policy\"><sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\"><sv:value>rep:ACL</sv:value></sv:property><sv:node
sv:name=\"entry\"><sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\"><sv:value>rep:GrantACE</sv:value></sv:property><sv:property
sv:name=\"rep:glob\" sv:type=\"String\"><sv:value>*</sv:value></sv:property><sv:property
sv:name=\"rep:nodePath\" sv:type=\"Path\"><sv:value>/</sv:value></sv:property><sv:property
sv:name=\"rep:principalName\" sv:type=\"String\"><sv:value>administrators</sv:value></sv:property><sv:property
sv:name=\"rep:privileges\" sv:type=\"Name\"><sv:value>jcr:all</sv:value></sv:property></sv:node></sv:node></sv:node></sv:node><sv:node
sv:name=\"rep:users\"><sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\"><sv:value>rep:AccessControl</sv:value></sv:property><sv:node
sv
 :name=\"admin\"><sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\"><sv:value>rep:AccessControl</sv:value></sv:property><sv:node
sv:name=\"t\"><sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\"><sv:value>rep:PrincipalAccessControl</sv:value></sv:property></sv:node><sv:node
sv:name=\"a\"><sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\"><sv:value>rep:PrincipalAccessControl</sv:value></sv:property></sv:node></sv:node><sv:node
sv:name=\"anonymous\"><sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\"><sv:value>rep:PrincipalAccessControl</sv:value></sv:property></sv:node></sv:node></sv:node></sv:node>";
-
     private static final String XML_POLICY_ONLY   = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><sv:node
sv:name=\"test\" xmlns:mix=\"http://www.jcp.org/jcr/mix/1.0\" xmlns:nt=\"http://www.jcp.org/jcr/nt/1.0\"
xmlns:fn_old=\"http://www.w3.org/2004/10/xpath-functions\" xmlns:fn=\"http://www.w3.org/2005/xpath-functions\"
xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" xmlns:sv=\"http://www.jcp.org/jcr/sv/1.0\" xmlns:rep=\"internal\"
xmlns:jcr=\"http://www.jcp.org/jcr/1.0\"><sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\"><sv:value>nt:unstructured</sv:value></sv:property><sv:property
sv:name=\"jcr:mixinTypes\" sv:type=\"Name\"><sv:value>rep:AccessControllable</sv:value><sv:value>mix:versionable</sv:value></sv:property><sv:property
sv:name=\"jcr:uuid\" sv:type=\"String\"><sv:value>0a0ca2e9-ab98-4433-a12b-d57283765207</sv:value></sv:property><sv:property
sv:name=\"jcr:baseVersion\" sv:type=\"Reference\"><sv:value>35d0d137-a3a4-4af3-8cdd-ce565ea6bdc9</sv:value></sv:property>
 <sv:property sv:name=\"jcr:isCheckedOut\" sv:type=\"Boolean\"><sv:value>true</sv:value></sv:property><sv:property
sv:name=\"jcr:predecessors\" sv:type=\"Reference\"><sv:value>35d0d137-a3a4-4af3-8cdd-ce565ea6bdc9</sv:value></sv:property><sv:property
sv:name=\"jcr:versionHistory\" sv:type=\"Reference\"><sv:value>428c9ef2-78e5-4f1c-95d3-16b4ce72d815</sv:value></sv:property><sv:node
sv:name=\"rep:policy\"><sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\"><sv:value>rep:ACL</sv:value></sv:property></sv:node></sv:node>";
 
     /**
@@ -284,6 +283,7 @@ public class AccessControlImporterTest e
      *
      * @throws Exception
      */
+    @Ignore("") // FIXME
     public void testImportACLRemoveACE() throws Exception {
         try {
             Node target = testRootNode.addNode(nodeName1);
@@ -309,7 +309,7 @@ public class AccessControlImporterTest e
             assertEquals(1, entry.getPrivileges().length);
             assertEquals(acMgr.privilegeFromName(Privilege.JCR_WRITE), entry.getPrivileges()[0]);
 
-            if(entry instanceof JackrabbitAccessControlEntry) {
+            if (entry instanceof JackrabbitAccessControlEntry) {
                 assertTrue(((JackrabbitAccessControlEntry) entry).isAllow());
             }
         } finally {
@@ -322,6 +322,7 @@ public class AccessControlImporterTest e
      *
      * @throws Exception
      */
+    @Ignore("") // FIXME
     public void testImportACLUnknown() throws Exception {
         try {
             Node target = testRootNode.addNode(nodeName1);
@@ -366,8 +367,8 @@ public class AccessControlImporterTest e
      * @throws Exception
      */
     public void testImportPolicyExists() throws Exception {
-        // this test does not work anymore, since the normal behavior is replace
-        // all ACEs for an import. maybe control this behavior via uuid-flag.
+        // FIXME this test does not work anymore, since the normal behavior is replace
+        // FIXME all ACEs for an import. maybe control this behavior via uuid-flag.
         if (true) {
             return;
         }
@@ -515,64 +516,6 @@ public class AccessControlImporterTest e
         }
     }
 
-    /**
-     * Imports a principal-based ACL containing a single entry mist fail with
-     * the default configuration.
-     *
-     * @throws Exception
-     */
-    public void testImportPrincipalBasedACL() throws Exception {
-//        JackrabbitAccessControlManager acMgr = (JackrabbitAccessControlManager) superuser.getAccessControlManager();
-//        if (acMgr.getApplicablePolicies(EveryonePrincipal.getInstance()).length > 0
||
-//                acMgr.getPolicies(EveryonePrincipal.getInstance()).length > 0) {
-//            // test expects that only resource-based acl is supported
-//            throw new NotExecutableException();
-//        }
-//
-//        PrincipalManager pmgr = sImpl.getPrincipalManager();
-//        if (!pmgr.hasPrincipal(SecurityConstants.ADMINISTRATORS_NAME)) {
-//            UserManager umgr = sImpl.getUserManager();
-//            umgr.createGroup(new PrincipalImpl(SecurityConstants.ADMINISTRATORS_NAME));
-//            if (!umgr.isAutoSave()) {
-//                sImpl.save();
-//            }
-//            if (pmgr.hasPrincipal(SecurityConstants.ADMINISTRATORS_NAME)) {
-//                throw new NotExecutableException();
-//            }
-//        }
-//
-//
-//        NodeImpl target;
-//        NodeImpl root = (NodeImpl) sImpl.getRootNode();
-//        if (!root.hasNode(AccessControlConstants.N_ACCESSCONTROL)) {
-//            target = root.addNode(AccessControlConstants.N_ACCESSCONTROL, AccessControlConstants.NT_REP_ACCESS_CONTROL,
null);
-//        } else {
-//            target = root.getNode(AccessControlConstants.N_ACCESSCONTROL);
-//            if (!target.isNodeType(AccessControlConstants.NT_REP_ACCESS_CONTROL)) {
-//                target.setPrimaryType(sImpl.getJCRName(AccessControlConstants.NT_REP_ACCESS_CONTROL));
-//            }
-//        }
-//        try {
-//
-//            InputStream in = new ByteArrayInputStream(XML_AC_TREE.getBytes("UTF-8"));
-//
-//            SessionImporter importer = new SessionImporter(target, sImpl, ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW,
new PseudoConfig());
-//            ImportHandler ih = new ImportHandler(importer, sImpl);
-//            new ParsingContentHandler(ih).parse(in);
-//
-//            fail("Default config only allows resource-based ACL -> protected import
must fail");
-//
-//        } catch (SAXException e) {
-//            if (e.getException() instanceof ConstraintViolationException) {
-//                // success
-//            } else {
-//                throw e;
-//            }
-//        } finally {
-//            superuser.refresh(false);
-//        }
-    }
-
     private void doImport(String parentPath, String xml) throws IOException, SAXException,
RepositoryException {
         InputStream in = new ByteArrayInputStream(xml.getBytes("UTF-8"));
         superuser.importXML(parentPath, in, ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW);



Mime
View raw message