jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1478860 - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/ oak-core/src/main/java/org/apache/jackrabbit/oak/spi/xml/ oak-jcr/ oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/authorizati...
Date Fri, 03 May 2013 16:17:40 GMT
Author: angela
Date: Fri May  3 16:17:39 2013
New Revision: 1478860

URL: http://svn.apache.org/r1478860
Log:
OAK-414: uncomment failing tests and list them in the pom.xml, move tests for group members stored in a tree structure to a separate class, create importbehavior class

Added:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/xml/ImportBehavior.java
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/AbstractImportTest.java
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/MemberNodeImportTest.java
Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserImporter.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/xml/ProtectedItemImporter.java
    jackrabbit/oak/trunk/oak-jcr/pom.xml
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/authorization/AccessControlImporterTest.java
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/UserImportTest.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserImporter.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserImporter.java?rev=1478860&r1=1478859&r2=1478860&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserImporter.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserImporter.java Fri May  3 16:17:39 2013
@@ -16,9 +16,6 @@
  */
 package org.apache.jackrabbit.oak.security.user;
 
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.apache.jackrabbit.oak.api.Type.STRINGS;
-
 import java.security.Principal;
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -28,7 +25,6 @@ import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 import javax.jcr.ImportUUIDBehavior;
@@ -54,6 +50,7 @@ import org.apache.jackrabbit.oak.namepat
 import org.apache.jackrabbit.oak.spi.security.ConfigurationParameters;
 import org.apache.jackrabbit.oak.spi.security.principal.PrincipalImpl;
 import org.apache.jackrabbit.oak.spi.security.user.UserConstants;
+import org.apache.jackrabbit.oak.spi.xml.ImportBehavior;
 import org.apache.jackrabbit.oak.spi.xml.NodeInfo;
 import org.apache.jackrabbit.oak.spi.xml.PropInfo;
 import org.apache.jackrabbit.oak.spi.xml.ProtectedNodeImporter;
@@ -64,6 +61,9 @@ import org.apache.jackrabbit.oak.util.Tr
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.apache.jackrabbit.oak.api.Type.STRINGS;
+
 /**
  * {@code UserImporter} implements both {@code ode>ProtectedPropertyImporter}
  * and {@code ProtectedNodeImporter} and provides import facilities for protected
@@ -121,11 +121,6 @@ class UserImporter implements ProtectedP
 
     private static final Logger log = LoggerFactory.getLogger(UserImporter.class);
 
-    /**
-     * Parameter name for the import behavior configuration option.
-     */
-    public static final String PARAM_IMPORT_BEHAVIOR = "importBehavior";
-
     private final int importBehavior;
 
     private JackrabbitSession session;
@@ -220,12 +215,14 @@ class UserImporter implements ProtectedP
     public boolean handlePropInfo(Tree parent, PropInfo propInfo, PropertyDefinition def) throws RepositoryException {
         checkInitialized();
 
-        //TODO remove hack that processes principal name first
+        // FIXME: remove hack that processes principal name first
         String propName = propInfo.getName();
         Authorizable a = null;
+        // FIXME: remove try/catch that ignores exception
         try {
             a = userManager.getAuthorizable(parent);
         } catch (RepositoryException ignore) {}
+
         if (a == null && !REP_PRINCIPAL_NAME.equals(propName)) {
             log.warn("Cannot handle protected PropInfo " + propInfo + ". Node " + parent + " doesn't represent a valid Authorizable.");
             return false;
@@ -626,59 +623,4 @@ class UserImporter implements ProtectedP
             }
         }
     }
-
-    /**
-     * Inner class defining the treatment of membership or impersonator
-     * values pointing to non-existing authorizables.
-     */
-    public static final class ImportBehavior {
-
-        /**
-         * If a member or impersonator value cannot be set due to constraints
-         * enforced by the API implementation, the failure is logged as
-         * warning but otherwise ignored.
-         */
-        public static final int IGNORE = 1;
-        /**
-         * Same as {@link #IGNORE} but in addition tries to circumvent the
-         * problem. This option should only be used with validated and trusted
-         * XML passed to the SessionImporter.
-         */
-        public static final int BESTEFFORT = 2;
-        /**
-         * Aborts the import as soon as invalid values are detected throwing
-         * a {@code ConstraintViolationException}.
-         */
-        public static final int ABORT = 3;
-
-        public static final String NAME_IGNORE = "ignore";
-        public static final String NAME_BESTEFFORT = "besteffort";
-        public static final String NAME_ABORT = "abort";
-
-        public static int valueFromString(String behaviorString) {
-            if (NAME_IGNORE.equalsIgnoreCase(behaviorString)) {
-                return IGNORE;
-            } else if (NAME_BESTEFFORT.equalsIgnoreCase(behaviorString)) {
-                return BESTEFFORT;
-            } else if (NAME_ABORT.equalsIgnoreCase(behaviorString)) {
-                return ABORT;
-            } else {
-                log.error("Invalid behavior " + behaviorString + " -> Using default: ABORT.");
-                return ABORT;
-            }
-        }
-
-        public static String nameFromValue(int importBehavior) {
-            switch (importBehavior) {
-                case ImportBehavior.IGNORE:
-                    return NAME_IGNORE;
-                case ImportBehavior.ABORT:
-                    return NAME_ABORT;
-                case ImportBehavior.BESTEFFORT:
-                    return NAME_BESTEFFORT;
-                default:
-                    throw new IllegalArgumentException("Invalid import behavior: " + importBehavior);
-            }
-        }
-    }
 }
\ No newline at end of file

Added: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/xml/ImportBehavior.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/xml/ImportBehavior.java?rev=1478860&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/xml/ImportBehavior.java (added)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/xml/ImportBehavior.java Fri May  3 16:17:39 2013
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.oak.spi.xml;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Utility class defining specific, configurable import behavior. A given
+ * implementation of the {@link ProtectedItemImporter} may support this
+ * as part of the overall import configuration.
+ */
+public final class ImportBehavior {
+
+    private static final Logger log = LoggerFactory.getLogger(ImportBehavior.class);
+
+    /**
+     * If a value cannot be set due to constraints
+     * enforced by the API implementation, the failure is logged as
+     * warning but otherwise ignored.
+     */
+    public static final int IGNORE = 1;
+    /**
+     * Same as {@link #IGNORE} but in addition tries to circumvent the
+     * problem. This option should only be used with validated and trusted
+     * XML passed to the SessionImporter.
+     */
+    public static final int BESTEFFORT = 2;
+    /**
+     * Aborts the import as soon as invalid values are detected throwing
+     * a {@code ConstraintViolationException}.
+     */
+    public static final int ABORT = 3;
+
+    public static final String NAME_IGNORE = "ignore";
+    public static final String NAME_BESTEFFORT = "besteffort";
+    public static final String NAME_ABORT = "abort";
+
+    /**
+     * Private constructor to avoid instantiation.
+     */
+    private ImportBehavior() {}
+
+    public static int valueFromString(String behaviorString) {
+        if (NAME_IGNORE.equalsIgnoreCase(behaviorString)) {
+            return IGNORE;
+        } else if (NAME_BESTEFFORT.equalsIgnoreCase(behaviorString)) {
+            return BESTEFFORT;
+        } else if (NAME_ABORT.equalsIgnoreCase(behaviorString)) {
+            return ABORT;
+        } else {
+            log.error("Invalid behavior " + behaviorString + " -> Using default: ABORT.");
+            return ABORT;
+        }
+    }
+
+    public static String nameFromValue(int importBehavior) {
+        switch (importBehavior) {
+            case ImportBehavior.IGNORE:
+                return NAME_IGNORE;
+            case ImportBehavior.ABORT:
+                return NAME_ABORT;
+            case ImportBehavior.BESTEFFORT:
+                return NAME_BESTEFFORT;
+            default:
+                throw new IllegalArgumentException("Invalid import behavior: " + importBehavior);
+        }
+    }
+}
\ No newline at end of file

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/xml/ProtectedItemImporter.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/xml/ProtectedItemImporter.java?rev=1478860&r1=1478859&r2=1478860&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/xml/ProtectedItemImporter.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/xml/ProtectedItemImporter.java Fri May  3 16:17:39 2013
@@ -29,6 +29,11 @@ import org.apache.jackrabbit.oak.namepat
 public interface ProtectedItemImporter {
 
     /**
+     * Parameter name for the import behavior configuration option.
+     */
+    String PARAM_IMPORT_BEHAVIOR = "importBehavior";
+
+    /**
      * Initializes the importer.
      *
      * @param session The session that is running the import.

Modified: jackrabbit/oak/trunk/oak-jcr/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/pom.xml?rev=1478860&r1=1478859&r2=1478860&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/pom.xml (original)
+++ jackrabbit/oak/trunk/oak-jcr/pom.xml Fri May  3 16:17:39 2013
@@ -242,6 +242,7 @@
       org.apache.jackrabbit.oak.jcr.security.user.GroupTest#testCyclicGroups2                               <!-- OAK-615 -->
       org.apache.jackrabbit.oak.jcr.security.authorization.AccessControlImporterTest#testImportACLRemoveACE <!-- OAK-414 -->
       org.apache.jackrabbit.oak.jcr.security.authorization.AccessControlImporterTest#testImportACLUnknown   <!-- OAK-414 -->
+      org.apache.jackrabbit.oak.jcr.security.authorization.AccessControlImporterTest#testImportPolicyExists <!-- OAK-414 -->
       org.apache.jackrabbit.oak.jcr.security.user.UserImportTest#testImportGroupIntoUsersTree               <!-- OAK-414 -->
       org.apache.jackrabbit.oak.jcr.security.user.UserImportTest#testExistingPrincipal                      <!-- OAK-414 -->
       org.apache.jackrabbit.oak.jcr.security.user.UserImportTest#testConflictingPrincipalsWithinImport      <!-- OAK-414 -->
@@ -249,6 +250,11 @@
       org.apache.jackrabbit.oak.jcr.security.user.UserImportTest#testMultiValuedPassword                    <!-- OAK-414 -->
       org.apache.jackrabbit.oak.jcr.security.user.UserImportTest#testIncompleteUser                         <!-- OAK-414 -->
       org.apache.jackrabbit.oak.jcr.security.user.UserImportTest#testImportImpersonation                    <!-- OAK-414 -->
+      org.apache.jackrabbit.oak.jcr.security.user.UserImportTest#testImportNonExistingMemberAbort           <!-- OAK-414 -->
+      org.apache.jackrabbit.oak.jcr.security.user.UserImportTest#testImportSelfAsGroupAbort                 <!-- OAK-414 -->
+      org.apache.jackrabbit.oak.jcr.security.user.UserImportTest#testImportInvalidImpersonationAbort        <!-- OAK-414 -->
+      org.apache.jackrabbit.oak.jcr.security.user.UserImportTest#testImportGroupMembersFromNodesBestEffort  <!-- OAK-414 -->
+      org.apache.jackrabbit.oak.jcr.security.user.MemberNodeImportTest                                      <!-- OAK-414, OAK-482 -->
       org.apache.jackrabbit.oak.jcr.version.VersionHistoryTest#testGetVersionHistoryFromNode             <!-- OAK-601 -->
       org.apache.jackrabbit.oak.jcr.version.VersionHistoryTest#testGetVersionHistory                     <!-- OAK-602 -->
       org.apache.jackrabbit.oak.jcr.version.VersionHistoryTest#testGetVersionHistoryAfterMove            <!-- OAK-602 -->

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=1478860&r1=1478859&r2=1478860&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 Fri May  3 16:17:39 2013
@@ -322,7 +322,7 @@ public class AccessControlImporterTest e
      *
      * @throws Exception
      */
-    @Ignore("") // FIXME
+    @Ignore("OAK-414") // FIXME
     public void testImportACLUnknown() throws Exception {
         try {
             Node target = testRootNode.addNode(nodeName1);
@@ -366,13 +366,8 @@ public class AccessControlImporterTest e
      *
      * @throws Exception
      */
+    @Ignore("OAK-414") // FIXME
     public void testImportPolicyExists() throws Exception {
-        // 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;
-        }
-
         Node target = testRootNode;
         target = target.addNode("test", "test:sameNameSibsFalseChildNodeDefinition");
         AccessControlManager acMgr = superuser.getAccessControlManager();

Added: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/AbstractImportTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/AbstractImportTest.java?rev=1478860&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/AbstractImportTest.java (added)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/AbstractImportTest.java Fri May  3 16:17:39 2013
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.oak.jcr.security.user;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.util.Iterator;
+import javax.jcr.ImportUUIDBehavior;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+
+import org.apache.jackrabbit.api.security.user.Authorizable;
+import org.apache.jackrabbit.api.security.user.Group;
+
+/**
+ * Base class for user import related tests.
+ */
+public abstract class AbstractImportTest extends AbstractUserTest {
+
+    protected static final String USERPATH = "/rep:security/rep:authorizables/rep:users";
+    protected static final String GROUPPATH = "/rep:security/rep:authorizables/rep:groups";
+
+    protected void doImport(String parentPath, String xml) throws Exception {
+        InputStream in = new ByteArrayInputStream(xml.getBytes("UTF-8"));
+        superuser.importXML(parentPath, in, ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW);
+    }
+
+    protected void doImport(String parentPath, String xml, int importUUIDBehavior) throws Exception {
+        InputStream in = new ByteArrayInputStream(xml.getBytes("UTF-8"));
+        superuser.importXML(parentPath, in, importUUIDBehavior);
+    }
+
+    protected static void assertNotDeclaredMember(Group gr, String potentialID, Session session ) throws RepositoryException {
+        // declared members must not list the invalid entry.
+        Iterator<Authorizable> it = gr.getDeclaredMembers();
+        while (it.hasNext()) {
+            Authorizable member = it.next();
+            assertFalse(potentialID.equals(session.getNode(member.getPath()).getIdentifier()));
+        }
+    }
+}
\ No newline at end of file

Added: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/MemberNodeImportTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/MemberNodeImportTest.java?rev=1478860&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/MemberNodeImportTest.java (added)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/MemberNodeImportTest.java Fri May  3 16:17:39 2013
@@ -0,0 +1,165 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.oak.jcr.security.user;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+import javax.jcr.Node;
+import javax.jcr.PropertyType;
+import javax.jcr.Value;
+
+import org.apache.jackrabbit.api.security.user.Authorizable;
+import org.apache.jackrabbit.api.security.user.Group;
+import org.apache.jackrabbit.oak.spi.security.user.UserConstants;
+import org.apache.jackrabbit.oak.spi.xml.ImportBehavior;
+import org.apache.jackrabbit.test.NotExecutableException;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * Testing import behavior if user mgt is configured to store group members
+ * in a tree structure.
+ */
+@Ignore("OAK-414") // TODO: waiting for OAK-482
+public class MemberNodeImportTest extends AbstractImportTest {
+
+    @Override
+    @Before
+    public void setUp() throws Exception {
+        // FIXME: create JCR repository with user mgt setup that stores group members in a tree structure (blocked by OAK-482)
+    }
+
+    @Test
+    public void testImportNonExistingMemberBestEffort() throws Exception {
+        Node n = testRootNode.addNode(nodeName1, ntUnstructured);
+        n.addMixin(mixReferenceable);
+
+        List<String> invalid = new ArrayList<String>();
+        invalid.add(UUID.randomUUID().toString()); // random uuid
+        invalid.add(n.getUUID()); // uuid of non-authorizable node
+
+        for (String id : invalid) {
+            String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+                    "<sv:node sv:name=\"gFolder\" 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>rep:AuthorizableFolder</sv:value></sv:property>" +
+                        "<sv:node sv:name=\"g1\"><sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\"><sv:value>rep:Group</sv:value></sv:property>" +
+                        "   <sv:property sv:name=\"jcr:uuid\" sv:type=\"String\"><sv:value>0120a4f9-196a-3f9e-b9f5-23f31f914da7</sv:value></sv:property>" +
+                        "   <sv:property sv:name=\"rep:principalName\" sv:type=\"String\"><sv:value>g1</sv:value></sv:property>" +
+                        "   <sv:property sv:name=\"rep:members\" sv:type=\"WeakReference\"><sv:value>" +id+ "</sv:value></sv:property>" +
+                        "</sv:node>" +
+                    "</sv:node>";
+            try {
+                // BESTEFFORT behavior -> must import non-existing members.
+                doImport(GROUPPATH, xml, ImportBehavior.BESTEFFORT);
+                Authorizable a = userMgr.getAuthorizable("g1");
+                if (a.isGroup()) {
+                    // the rep:members property must contain the invalid value
+                    boolean found = false;
+                    Node grNode = superuser.getNode(a.getPath());
+                    for (Value memberValue : grNode.getProperty(UserConstants.REP_MEMBERS).getValues()) {
+                        assertEquals(PropertyType.WEAKREFERENCE, memberValue.getType());
+                        if (id.equals(memberValue.getString())) {
+                            found = true;
+                            break;
+                        }
+                    }
+                    assertTrue("ImportBehavior.BESTEFFORT must import non-existing members.",found);
+
+                    // declared members must not list the invalid entry.
+                    assertNotDeclaredMember((Group) a, id, superuser);
+                } else {
+                    fail("'g1' was not imported as Group.");
+                }
+            } finally {
+                superuser.refresh(false);
+            }
+        }
+    }
+
+    @Test
+    public void testImportNonExistingMemberBestEffort2() throws Exception {
+
+        String g1Id = "0120a4f9-196a-3f9e-b9f5-23f31f914da7";
+        String nonExistingId = "b2f5ff47-4366-31b6-a533-d8dc3614845d"; // groupId of 'g' group.
+        if (userMgr.getAuthorizable("g") != null) {
+            throw new NotExecutableException();
+        }
+
+        String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+                "<sv:node sv:name=\"gFolder\" 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>rep:AuthorizableFolder</sv:value></sv:property>" +
+                "<sv:node sv:name=\"g1\"><sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\"><sv:value>rep:Group</sv:value></sv:property>" +
+                "   <sv:property sv:name=\"jcr:uuid\" sv:type=\"String\"><sv:value>" + g1Id + "</sv:value></sv:property>" +
+                "   <sv:property sv:name=\"rep:principalName\" sv:type=\"String\"><sv:value>g1</sv:value></sv:property>" +
+                "   <sv:property sv:name=\"rep:members\" sv:type=\"WeakReference\"><sv:value>" +nonExistingId+ "</sv:value></sv:property>" +
+                "</sv:node>" +
+                "</sv:node>";
+
+        String xml2 = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+                "   <sv:node sv:name=\"g\" 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>rep:Group</sv:value></sv:property>" +
+                "       <sv:property sv:name=\"jcr:uuid\" sv:type=\"String\"><sv:value>" + nonExistingId + "</sv:value></sv:property>" +
+                "       <sv:property sv:name=\"rep:principalName\" sv:type=\"String\"><sv:value>g</sv:value></sv:property>" +
+                "       <sv:property sv:name=\"rep:members\" sv:type=\"WeakReference\"><sv:value>" + g1Id + "</sv:value></sv:property>" +
+                "   </sv:node>";
+
+        try {
+            // BESTEFFORT behavior -> must import non-existing members.
+            doImport(GROUPPATH, xml, ImportBehavior.BESTEFFORT);
+            Authorizable g1 = userMgr.getAuthorizable("g1");
+            if (g1.isGroup()) {
+                // the rep:members property must contain the invalid value
+                boolean found = false;
+                Node grNode = superuser.getNode(g1.getPath());
+                for (Value memberValue : grNode.getProperty(UserConstants.REP_MEMBERS).getValues()) {
+                    assertEquals(PropertyType.WEAKREFERENCE, memberValue.getType());
+                    if (nonExistingId.equals(memberValue.getString())) {
+                        found = true;
+                        break;
+                    }
+                }
+                assertTrue("ImportBehavior.BESTEFFORT must import non-existing members.",found);
+            } else {
+                fail("'g1' was not imported as Group.");
+            }
+
+            /*
+            now try to import the 'g' group that has a circular group
+            membership references.
+            expected:
+            - group is imported
+            - circular membership is ignored
+            - g is member of g1
+            - g1 isn't member of g
+            */
+            doImport(GROUPPATH + "/gFolder", xml2, ImportBehavior.BESTEFFORT);
+
+            Authorizable g = userMgr.getAuthorizable("g");
+            assertNotNull(g);
+            if (g.isGroup()) {
+                assertNotDeclaredMember((Group) g, g1Id, superuser);
+            } else {
+                fail("'g' was not imported as Group.");
+            }
+
+        } finally {
+            superuser.refresh(false);
+        }
+    }
+}
\ No newline at end of file

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/UserImportTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/UserImportTest.java?rev=1478860&r1=1478859&r2=1478860&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/UserImportTest.java (original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/UserImportTest.java Fri May  3 16:17:39 2013
@@ -16,9 +16,7 @@
  */
 package org.apache.jackrabbit.oak.jcr.security.user;
 
-import java.io.ByteArrayInputStream;
 import java.io.IOException;
-import java.io.InputStream;
 import java.security.Principal;
 import java.util.ArrayList;
 import java.util.Iterator;
@@ -30,7 +28,6 @@ import javax.jcr.ItemExistsException;
 import javax.jcr.Node;
 import javax.jcr.NodeIterator;
 import javax.jcr.RepositoryException;
-import javax.jcr.Session;
 import javax.jcr.nodetype.ConstraintViolationException;
 import javax.security.auth.Subject;
 
@@ -43,17 +40,16 @@ import org.apache.jackrabbit.api.securit
 import org.apache.jackrabbit.api.security.user.User;
 import org.apache.jackrabbit.oak.spi.security.principal.PrincipalImpl;
 import org.apache.jackrabbit.oak.spi.security.user.UserConstants;
+import org.apache.jackrabbit.oak.spi.xml.ImportBehavior;
 import org.apache.jackrabbit.test.NotExecutableException;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.xml.sax.SAXException;
 
 /**
  * UserImportTest...
  */
-public class UserImportTest extends AbstractUserTest {
-
-    private static final String USERPATH = "/rep:security/rep:authorizables/rep:users";
-    private static final String GROUPPATH = "/rep:security/rep:authorizables/rep:groups";
+public class UserImportTest extends AbstractImportTest {
 
     private JackrabbitSession jrSession;
 
@@ -83,7 +79,7 @@ public class UserImportTest extends Abst
     }
 
     @Test
-    public void testImportUser() throws RepositoryException, IOException, SAXException {
+    public void testImportUser() throws Exception {
             String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
                     "<sv:node sv:name=\"t\" 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>rep:User</sv:value></sv:property>" +
@@ -131,7 +127,7 @@ public class UserImportTest extends Abst
     }
 
     @Test
-    public void testImportGroup() throws RepositoryException, IOException, SAXException  {
+    public void testImportGroup() throws Exception  {
         String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
                 "<sv:node sv:name=\"g\" 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>rep:Group</sv:value></sv:property>" +
@@ -173,7 +169,7 @@ public class UserImportTest extends Abst
     }
 
     @Test
-    public void testImportGroupIntoUsersTree() throws RepositoryException, IOException, SAXException, NotExecutableException {
+    public void testImportGroupIntoUsersTree() throws Exception {
         String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
                 "<sv:node sv:name=\"g\" 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>rep:Group</sv:value></sv:property>" +
@@ -220,7 +216,7 @@ public class UserImportTest extends Abst
     }
 
     @Test
-    public void testImportAuthorizableId() throws IOException, RepositoryException, SAXException, NotExecutableException {
+    public void testImportAuthorizableId() throws Exception {
         // importing an authorizable with an jcr:uuid that doesn't match the
         // hash of the given ID -> getAuthorizable(String id) will not find the
         // authorizable.
@@ -258,7 +254,7 @@ public class UserImportTest extends Abst
     }
 
     @Test
-    public void testExistingPrincipal() throws RepositoryException, NotExecutableException, IOException, SAXException {
+    public void testExistingPrincipal() throws Exception {
         Principal existing = null;
         PrincipalIterator principalIterator = jrSession.getPrincipalManager().getPrincipals(PrincipalManager.SEARCH_TYPE_ALL);
         while (principalIterator.hasNext()) {
@@ -292,7 +288,7 @@ public class UserImportTest extends Abst
     }
 
     @Test
-    public void testConflictingPrincipalsWithinImport() throws IOException, RepositoryException, NotExecutableException {
+    public void testConflictingPrincipalsWithinImport() throws Exception {
         String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
                 "<sv:node sv:name=\"gFolder\" 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\">" +
@@ -310,7 +306,6 @@ public class UserImportTest extends Abst
                 "</sv:node>" +
                 "</sv:node>";
 
-        Node target = superuser.getNode(GROUPPATH);
         try {
             doImport(GROUPPATH, xml);
             fail("Import must detect conflicting principals.");
@@ -322,7 +317,7 @@ public class UserImportTest extends Abst
     }
 
     @Test
-    public void testMultiValuedPrincipalName() throws RepositoryException, IOException, SAXException, NotExecutableException {
+    public void testMultiValuedPrincipalName() throws Exception {
         String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
                 "<sv:node sv:name=\"g\" 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>rep:Group</sv:value></sv:property>" +
@@ -368,7 +363,7 @@ public class UserImportTest extends Abst
     }
 
     @Test
-    public void testPlainTextPassword() throws RepositoryException, IOException, SAXException, NotExecutableException {
+    public void testPlainTextPassword() throws Exception {
         String plainPw = "myPassword";
         String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
                 "<sv:node sv:name=\"t\" 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\">" +
@@ -398,7 +393,7 @@ public class UserImportTest extends Abst
     }
 
     @Test
-    public void testMultiValuedPassword() throws RepositoryException, IOException, SAXException, NotExecutableException {
+    public void testMultiValuedPassword() throws Exception {
         String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
                 "<sv:node sv:name=\"t\" 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>rep:User</sv:value></sv:property>" +
@@ -445,7 +440,7 @@ public class UserImportTest extends Abst
     }
 
     @Test
-    public void testIncompleteUser() throws RepositoryException, IOException, SAXException, NotExecutableException {
+    public void testIncompleteUser() throws Exception {
         List<String> incompleteXml = new ArrayList<String>();
         incompleteXml.add("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
                 "<sv:node sv:name=\"t\" 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\">" +
@@ -482,7 +477,7 @@ public class UserImportTest extends Abst
     }
 
     @Test
-    public void testIncompleteGroup() throws IOException, RepositoryException, SAXException, NotExecutableException {
+    public void testIncompleteGroup() throws Exception {
         String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
                 "<sv:node sv:name=\"g\" 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>rep:Group</sv:value></sv:property>" +
@@ -514,7 +509,7 @@ public class UserImportTest extends Abst
     }
 
     @Test
-    public void testImportWithIntermediatePath() throws IOException, RepositoryException, SAXException, NotExecutableException {
+    public void testImportWithIntermediatePath() throws Exception {
         String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
                 "<sv:node sv:name=\"some\" 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>rep:AuthorizableFolder</sv:value></sv:property>" +
@@ -565,7 +560,7 @@ public class UserImportTest extends Abst
     }
 
     @Test
-    public void testImportNewMembers() throws IOException, RepositoryException, SAXException, NotExecutableException {
+    public void testImportNewMembers() throws Exception {
         String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
                 "<sv:node sv:name=\"gFolder\" 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\">" +
@@ -611,7 +606,7 @@ public class UserImportTest extends Abst
     }
 
     @Test
-    public void testImportNewMembersReverseOrder() throws IOException, RepositoryException, SAXException, NotExecutableException {
+    public void testImportNewMembersReverseOrder() throws Exception {
         // group is imported before the member
         String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
                 "<sv:node sv:name=\"gFolder\" 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\">" +
@@ -656,7 +651,7 @@ public class UserImportTest extends Abst
     }
 
     @Test
-    public void testImportMembers() throws RepositoryException, IOException, SAXException, NotExecutableException {
+    public void testImportMembers() throws Exception {
         Authorizable admin = userMgr.getAuthorizable("admin");
         if (admin == null) {
             throw new NotExecutableException();
@@ -700,7 +695,7 @@ public class UserImportTest extends Abst
     }
 
     @Test
-    public void testImportNonExistingMemberIgnore() throws IOException, RepositoryException, SAXException, NotExecutableException {
+    public void testImportNonExistingMemberIgnore() throws Exception {
         Node n = testRootNode.addNode(nodeName1, ntUnstructured);
         n.addMixin(mixReferenceable);
 
@@ -718,9 +713,8 @@ public class UserImportTest extends Abst
                         "   <sv:property sv:name=\"rep:members\" sv:type=\"WeakReference\"><sv:value>" +id+ "</sv:value></sv:property>" +
                         "</sv:node>" +
                     "</sv:node>";
-            Node target = superuser.getNode(GROUPPATH);
             try {
-                doImport(GROUPPATH, xml /*, UserImporter.ImportBehavior.IGNORE*/);
+                doImport(GROUPPATH, xml, ImportBehavior.IGNORE);
                 // there should be no exception during import,
                 // but invalid members must be ignored.
                 Authorizable a = userMgr.getAuthorizable("g1");
@@ -735,164 +729,40 @@ public class UserImportTest extends Abst
         }
     }
 
-    //TODO test UserImporter.ImportBehavior != ignore
-//    public void testImportNonExistingMemberAbort() throws IOException, RepositoryException, SAXException, NotExecutableException {
-//        Node n = testRootNode.addNode(nodeName1, ntUnstructured);
-//        n.addMixin(mixReferenceable);
-//
-//        List<String> invalid = new ArrayList<String>();
-//        invalid.add(UUID.randomUUID().toString()); // random uuid
-//        invalid.add(n.getUUID()); // uuid of non-authorizable node
-//
-//        for (String id : invalid) {
-//            String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
-//                    "<sv:node sv:name=\"gFolder\" 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>rep:AuthorizableFolder</sv:value></sv:property>" +
-//                        "<sv:node sv:name=\"g1\"><sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\"><sv:value>rep:Group</sv:value></sv:property>" +
-//                        "   <sv:property sv:name=\"jcr:uuid\" sv:type=\"String\"><sv:value>0120a4f9-196a-3f9e-b9f5-23f31f914da7</sv:value></sv:property>" +
-//                        "   <sv:property sv:name=\"rep:principalName\" sv:type=\"String\"><sv:value>g1</sv:value></sv:property>" +
-//                        "   <sv:property sv:name=\"rep:members\" sv:type=\"WeakReference\"><sv:value>" +id+ "</sv:value></sv:property>" +
-//                        "</sv:node>" +
-//                    "</sv:node>";
-//            NodeImpl target = (NodeImpl) sImpl.getNode(umgr.getGroupsPath());
-//            try {
-//                doImport(target, xml, UserImporter.ImportBehavior.ABORT);
-//                // import behavior ABORT -> should throw.
-//                fail("importing invalid members -> must throw.");
-//            } catch (SAXException e) {
-//                // success as well
-//            } finally {
-//                sImpl.refresh(false);
-//            }
-//        }
-//    }
-//
-//    public void testImportNonExistingMemberBestEffort() throws IOException, RepositoryException, SAXException, NotExecutableException {
-//        if (umgr.hasMemberSplitSize()) {
-//            throw new NotExecutableException();
-//        }
-//
-//        Node n = testRootNode.addNode(nodeName1, ntUnstructured);
-//        n.addMixin(mixReferenceable);
-//
-//        List<String> invalid = new ArrayList<String>();
-//        invalid.add(UUID.randomUUID().toString()); // random uuid
-//        invalid.add(n.getUUID()); // uuid of non-authorizable node
-//
-//        for (String id : invalid) {
-//            String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
-//                    "<sv:node sv:name=\"gFolder\" 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>rep:AuthorizableFolder</sv:value></sv:property>" +
-//                        "<sv:node sv:name=\"g1\"><sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\"><sv:value>rep:Group</sv:value></sv:property>" +
-//                        "   <sv:property sv:name=\"jcr:uuid\" sv:type=\"String\"><sv:value>0120a4f9-196a-3f9e-b9f5-23f31f914da7</sv:value></sv:property>" +
-//                        "   <sv:property sv:name=\"rep:principalName\" sv:type=\"String\"><sv:value>g1</sv:value></sv:property>" +
-//                        "   <sv:property sv:name=\"rep:members\" sv:type=\"WeakReference\"><sv:value>" +id+ "</sv:value></sv:property>" +
-//                        "</sv:node>" +
-//                    "</sv:node>";
-//            NodeImpl target = (NodeImpl) sImpl.getNode(umgr.getGroupsPath());
-//            try {
-//                // BESTEFFORT behavior -> must import non-existing members.
-//                doImport(target, xml, UserImporter.ImportBehavior.BESTEFFORT);
-//                Authorizable a = umgr.getAuthorizable("g1");
-//                if (a.isGroup()) {
-//                    // the rep:members property must contain the invalid value
-//                    boolean found = false;
-//                    NodeImpl grNode = ((AuthorizableImpl) a).getNode();
-//                    for (Value memberValue : grNode.getProperty(UserConstants.P_MEMBERS).getValues()) {
-//                        assertEquals(PropertyType.WEAKREFERENCE, memberValue.getType());
-//                        if (id.equals(memberValue.getString())) {
-//                            found = true;
-//                            break;
-//                        }
-//                    }
-//                    assertTrue("ImportBehavior.BESTEFFORT must import non-existing members.",found);
-//
-//                    // declared members must not list the invalid entry.
-//                    assertNotDeclaredMember((Group) a, id);
-//                } else {
-//                    fail("'g1' was not imported as Group.");
-//                }
-//            } finally {
-//                sImpl.refresh(false);
-//            }
-//        }
-//    }
-//
-//    public void testImportNonExistingMemberBestEffort2() throws IOException, RepositoryException, SAXException, NotExecutableException {
-//
-//        String g1Id = "0120a4f9-196a-3f9e-b9f5-23f31f914da7";
-//        String nonExistingId = "b2f5ff47-4366-31b6-a533-d8dc3614845d"; // groupId of 'g' group.
-//        if (umgr.getAuthorizable("g") != null || umgr.hasMemberSplitSize()) {
-//            throw new NotExecutableException();
-//        }
-//
-//        String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
-//                "<sv:node sv:name=\"gFolder\" 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>rep:AuthorizableFolder</sv:value></sv:property>" +
-//                "<sv:node sv:name=\"g1\"><sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\"><sv:value>rep:Group</sv:value></sv:property>" +
-//                "   <sv:property sv:name=\"jcr:uuid\" sv:type=\"String\"><sv:value>" + g1Id + "</sv:value></sv:property>" +
-//                "   <sv:property sv:name=\"rep:principalName\" sv:type=\"String\"><sv:value>g1</sv:value></sv:property>" +
-//                "   <sv:property sv:name=\"rep:members\" sv:type=\"WeakReference\"><sv:value>" +nonExistingId+ "</sv:value></sv:property>" +
-//                "</sv:node>" +
-//                "</sv:node>";
-//
-//        String xml2 = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
-//                "   <sv:node sv:name=\"g\" 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>rep:Group</sv:value></sv:property>" +
-//                "       <sv:property sv:name=\"jcr:uuid\" sv:type=\"String\"><sv:value>" + nonExistingId + "</sv:value></sv:property>" +
-//                "       <sv:property sv:name=\"rep:principalName\" sv:type=\"String\"><sv:value>g</sv:value></sv:property>" +
-//                "       <sv:property sv:name=\"rep:members\" sv:type=\"WeakReference\"><sv:value>" + g1Id + "</sv:value></sv:property>" +
-//                "   </sv:node>";
-//
-//        NodeImpl target = (NodeImpl) sImpl.getNode(umgr.getGroupsPath());
-//        try {
-//            // BESTEFFORT behavior -> must import non-existing members.
-//            doImport(target, xml, UserImporter.ImportBehavior.BESTEFFORT);
-//            Authorizable g1 = umgr.getAuthorizable("g1");
-//            if (g1.isGroup()) {
-//                // the rep:members property must contain the invalid value
-//                boolean found = false;
-//                NodeImpl grNode = ((AuthorizableImpl) g1).getNode();
-//                for (Value memberValue : grNode.getProperty(UserConstants.P_MEMBERS).getValues()) {
-//                    assertEquals(PropertyType.WEAKREFERENCE, memberValue.getType());
-//                    if (nonExistingId.equals(memberValue.getString())) {
-//                        found = true;
-//                        break;
-//                    }
-//                }
-//                assertTrue("ImportBehavior.BESTEFFORT must import non-existing members.",found);
-//            } else {
-//                fail("'g1' was not imported as Group.");
-//            }
-//
-//            /*
-//            now try to import the 'g' group that has a circular group
-//            membership references.
-//            expected:
-//            - group is imported
-//            - circular membership is ignored
-//            - g is member of g1
-//            - g1 isn't member of g
-//            */
-//            target = (NodeImpl) target.getNode("gFolder");
-//            doImport(target, xml2, UserImporter.ImportBehavior.BESTEFFORT);
-//
-//            Authorizable g = umgr.getAuthorizable("g");
-//            assertNotNull(g);
-//            if (g.isGroup()) {
-//                assertNotDeclaredMember((Group) g, g1Id);
-//            } else {
-//                fail("'g' was not imported as Group.");
-//            }
-//
-//        } finally {
-//            sImpl.refresh(false);
-//        }
-//    }
+    @Ignore("OAK-414")
+    @Test
+    public void testImportNonExistingMemberAbort() throws Exception {
+        Node n = testRootNode.addNode(nodeName1, ntUnstructured);
+        n.addMixin(mixReferenceable);
+
+        List<String> invalid = new ArrayList<String>();
+        invalid.add(UUID.randomUUID().toString()); // random uuid
+        invalid.add(n.getUUID()); // uuid of non-authorizable node
+
+        for (String id : invalid) {
+            String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+                    "<sv:node sv:name=\"gFolder\" 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>rep:AuthorizableFolder</sv:value></sv:property>" +
+                        "<sv:node sv:name=\"g1\"><sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\"><sv:value>rep:Group</sv:value></sv:property>" +
+                        "   <sv:property sv:name=\"jcr:uuid\" sv:type=\"String\"><sv:value>0120a4f9-196a-3f9e-b9f5-23f31f914da7</sv:value></sv:property>" +
+                        "   <sv:property sv:name=\"rep:principalName\" sv:type=\"String\"><sv:value>g1</sv:value></sv:property>" +
+                        "   <sv:property sv:name=\"rep:members\" sv:type=\"WeakReference\"><sv:value>" +id+ "</sv:value></sv:property>" +
+                        "</sv:node>" +
+                    "</sv:node>";
+            try {
+                doImport(GROUPPATH, xml, ImportBehavior.ABORT);
+                // import behavior ABORT -> should throw.
+                fail("importing invalid members -> must throw.");
+            } catch (SAXException e) {
+                // success as well
+            } finally {
+                superuser.refresh(false);
+            }
+        }
+    }
 
     @Test
     public void testImportSelfAsGroupIgnore() throws Exception {
-
         String invalidId = "0120a4f9-196a-3f9e-b9f5-23f31f914da7"; // uuid of the group itself
         String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
                 "<sv:node sv:name=\"gFolder\" 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\">" +
@@ -903,7 +773,6 @@ public class UserImportTest extends Abst
                 "   <sv:property sv:name=\"rep:members\" sv:type=\"WeakReference\"><sv:value>" +invalidId+ "</sv:value></sv:property>" +
                 "</sv:node>" +
                 "</sv:node>";
-        Node target = superuser.getNode(GROUPPATH);
         try {
             doImport(GROUPPATH, xml);
             // no exception during import -> member must have been ignored though.
@@ -918,32 +787,32 @@ public class UserImportTest extends Abst
         }
     }
 
-    //TODO test UserImporter.ImportBehavior != ignore
-//    public void testImportSelfAsGroupAbort() throws Exception {
-//
-//        String invalidId = "0120a4f9-196a-3f9e-b9f5-23f31f914da7"; // uuid of the group itself
-//        String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
-//                "<sv:node sv:name=\"gFolder\" 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>rep:AuthorizableFolder</sv:value></sv:property>" +
-//                "<sv:node sv:name=\"g1\"><sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\"><sv:value>rep:Group</sv:value></sv:property>" +
-//                "   <sv:property sv:name=\"jcr:uuid\" sv:type=\"String\"><sv:value>"+invalidId+"</sv:value></sv:property>" +
-//                "   <sv:property sv:name=\"rep:principalName\" sv:type=\"String\"><sv:value>g1</sv:value></sv:property>" +
-//                "   <sv:property sv:name=\"rep:members\" sv:type=\"WeakReference\"><sv:value>" +invalidId+ "</sv:value></sv:property>" +
-//                "</sv:node>" +
-//                "</sv:node>";
-//        NodeImpl target = (NodeImpl) sImpl.getNode(umgr.getGroupsPath());
-//        try {
-//            doImport(target, xml, UserImporter.ImportBehavior.ABORT);
-//            fail("Importing self as group with ImportBehavior.ABORT must fail.");
-//        } catch (SAXException e) {
-//            // success.
-//        }finally {
-//            sImpl.refresh(false);
-//        }
-//    }
+    @Ignore("OAK-414")
+    @Test
+    public void testImportSelfAsGroupAbort() throws Exception {
+
+        String invalidId = "0120a4f9-196a-3f9e-b9f5-23f31f914da7"; // uuid of the group itself
+        String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+                "<sv:node sv:name=\"gFolder\" 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>rep:AuthorizableFolder</sv:value></sv:property>" +
+                "<sv:node sv:name=\"g1\"><sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\"><sv:value>rep:Group</sv:value></sv:property>" +
+                "   <sv:property sv:name=\"jcr:uuid\" sv:type=\"String\"><sv:value>"+invalidId+"</sv:value></sv:property>" +
+                "   <sv:property sv:name=\"rep:principalName\" sv:type=\"String\"><sv:value>g1</sv:value></sv:property>" +
+                "   <sv:property sv:name=\"rep:members\" sv:type=\"WeakReference\"><sv:value>" +invalidId+ "</sv:value></sv:property>" +
+                "</sv:node>" +
+                "</sv:node>";
+        try {
+            doImport(GROUPPATH, xml, ImportBehavior.ABORT);
+            fail("Importing self as group with ImportBehavior.ABORT must fail.");
+        } catch (SAXException e) {
+            // success.
+        }finally {
+            superuser.refresh(false);
+        }
+    }
 
     @Test
-    public void testImportImpersonation() throws IOException, RepositoryException, SAXException, NotExecutableException {
+    public void testImportImpersonation() throws Exception {
         String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
                 "<sv:node sv:name=\"uFolder\" 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>rep:AuthorizableFolder</sv:value></sv:property>" +
@@ -959,8 +828,6 @@ public class UserImportTest extends Abst
                     "   <sv:property sv:name=\"rep:principalName\" sv:type=\"String\"><sv:value>g</sv:value></sv:property>" +
                     "</sv:node>" +
                 "</sv:node>";
-
-        Node target = superuser.getNode(USERPATH);
         try {
             doImport(USERPATH, xml);
 
@@ -982,7 +849,7 @@ public class UserImportTest extends Abst
     }
 
     @Test
-    public void testImportInvalidImpersonationIgnore() throws IOException, RepositoryException, SAXException, NotExecutableException {
+    public void testImportInvalidImpersonationIgnore() throws Exception {
         List<String> invalid = new ArrayList<String>();
         invalid.add("anybody"); // an non-existing princ-name
         invalid.add("administrators"); // a group
@@ -1022,38 +889,38 @@ public class UserImportTest extends Abst
         }
     }
 
-    //TODO test UserImporter.ImportBehavior != ignore
-//    public void testImportInvalidImpersonationAbort() throws IOException, RepositoryException, SAXException, NotExecutableException {
-//        List<String> invalid = new ArrayList<String>();
-//        invalid.add("anybody"); // an non-existing princ-name
-//        invalid.add("administrators"); // a group
-//        invalid.add("t"); // principal of the user itself.
-//
-//        for (String principalName : invalid) {
-//            String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
-//                    "<sv:node sv:name=\"t\" 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>rep:User</sv:value></sv:property>" +
-//                    "   <sv:property sv:name=\"jcr:uuid\" sv:type=\"String\"><sv:value>e358efa4-89f5-3062-b10d-d7316b65649e</sv:value></sv:property>" +
-//                    "   <sv:property sv:name=\"rep:password\" sv:type=\"String\"><sv:value>{sha1}8efd86fb78a56a5145ed7739dcb00c78581c5375</sv:value></sv:property>" +
-//                    "   <sv:property sv:name=\"rep:principalName\" sv:type=\"String\"><sv:value>t</sv:value></sv:property><sv:property sv:name=\"rep:impersonators\" sv:type=\"String\"><sv:value>" +principalName+ "</sv:value></sv:property>" +
-//                    "</sv:node>";
-//            Subject subj = new Subject();
-//            subj.getPrincipals().add(new PrincipalImpl(principalName));
-//
-//            NodeImpl target = (NodeImpl) sImpl.getNode(umgr.getUsersPath());
-//            try {
-//                doImport(target, xml, UserImporter.ImportBehavior.ABORT);
-//                fail("UserImporter.ImportBehavior.ABORT -> importing invalid impersonators must throw.");
-//            } catch (SAXException e) {
-//                // success
-//            } finally {
-//                sImpl.refresh(false);
-//            }
-//        }
-//    }
+    @Ignore("OAK-414")
+    @Test
+    public void testImportInvalidImpersonationAbort() throws Exception {
+        List<String> invalid = new ArrayList<String>();
+        invalid.add("anybody"); // an non-existing princ-name
+        invalid.add("administrators"); // a group
+        invalid.add("t"); // principal of the user itself.
+
+        for (String principalName : invalid) {
+            String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
+                    "<sv:node sv:name=\"t\" 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>rep:User</sv:value></sv:property>" +
+                    "   <sv:property sv:name=\"jcr:uuid\" sv:type=\"String\"><sv:value>e358efa4-89f5-3062-b10d-d7316b65649e</sv:value></sv:property>" +
+                    "   <sv:property sv:name=\"rep:password\" sv:type=\"String\"><sv:value>{sha1}8efd86fb78a56a5145ed7739dcb00c78581c5375</sv:value></sv:property>" +
+                    "   <sv:property sv:name=\"rep:principalName\" sv:type=\"String\"><sv:value>t</sv:value></sv:property><sv:property sv:name=\"rep:impersonators\" sv:type=\"String\"><sv:value>" +principalName+ "</sv:value></sv:property>" +
+                    "</sv:node>";
+            Subject subj = new Subject();
+            subj.getPrincipals().add(new PrincipalImpl(principalName));
+
+            try {
+                doImport(USERPATH, xml, ImportBehavior.ABORT);
+                fail("UserImporter.ImportBehavior.ABORT -> importing invalid impersonators must throw.");
+            } catch (SAXException e) {
+                // success
+            } finally {
+                superuser.refresh(false);
+            }
+        }
+    }
 
     @Test
-    public void testImportUuidCollisionRemoveExisting() throws RepositoryException, IOException, SAXException {
+    public void testImportUuidCollisionRemoveExisting() throws Exception {
         String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
                 "<sv:node sv:name=\"t\" 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>rep:User</sv:value></sv:property>" +
@@ -1092,7 +959,7 @@ public class UserImportTest extends Abst
      * @throws SAXException
      */
     @Test
-    public void testImportUuidCollisionRemoveExisting2() throws RepositoryException, IOException, SAXException {
+    public void testImportUuidCollisionRemoveExisting2() throws Exception {
         String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
                 "<sv:node sv:name=\"t\" 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>rep:User</sv:value></sv:property>" +
@@ -1124,7 +991,7 @@ public class UserImportTest extends Abst
     }
 
     @Test
-    public void testImportUuidCollisionThrow() throws RepositoryException, IOException, SAXException {
+    public void testImportUuidCollisionThrow() throws Exception {
         String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
                 "<sv:node sv:name=\"t\" 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>rep:User</sv:value></sv:property>" +
@@ -1154,8 +1021,67 @@ public class UserImportTest extends Abst
         }
     }
 
+    @Ignore("OAK-414")
     @Test
-    public void testImportGroupMembersFromNodes() throws RepositoryException, IOException, SAXException {
+    public void testImportGroupMembersFromNodesBestEffort() throws Exception {
+        String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><sv:node sv:name=\"s\" xmlns:mix=\"http://www.jcp.org/jcr/mix/1.0\" xmlns:sling=\"http://sling.apache.org/jcr/sling/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:jcr=\"http://www.jcp.org/jcr/1.0\" xmlns:sv=\"http://www.jcp.org/jcr/sv/1.0\" xmlns:rep=\"internal\"><sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\"><sv:value>rep:AuthorizableFolder</sv:value></sv:property><sv:property sv:name=\"jcr:created\" sv:type=\"Date\"><sv:value>2010-08-17T18:22:20.086+02:00</sv:value></sv:property><sv:property sv:name=\"jcr:createdBy\" sv:type=\"String\"><sv:value>admin</sv:value></sv:property><sv:node sv:name=\"sh\"><sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\"><sv:value>rep:AuthorizableFolder</sv:value></sv:property><sv:property sv:name=\"jcr
 :created\" sv:type=\"Date\"><sv:value>2010-08-17T18:22:20.086+02:00</sv:value></sv:property><sv:property sv:name=\"jcr:createdBy\" sv:type=\"String\"><sv:value>admin</sv:value></sv:property><sv:node sv:name=\"shrimps\"><sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\"><sv:value>rep:Group</sv:value></sv:property><sv:property sv:name=\"jcr:uuid\" sv:type=\"String\"><sv:value>08429aec-6f09-30db-8c83-1a2a57fc760c</sv:value></sv:property><sv:property sv:name=\"jcr:created\" sv:type=\"Date\">" +
+                "<sv:value>2010-08-17T18:22:20.086+02:00</sv:value></sv:property><sv:property sv:name=\"jcr:createdBy\" sv:type=\"String\"><sv:value>admin</sv:value></sv:property><sv:property sv:name=\"rep:principalName\" sv:type=\"String\"><sv:value>shrimps</sv:value></sv:property><sv:node sv:name=\"rep:members\"><sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\"><sv:value>rep:Members</sv:value></sv:property><sv:node sv:name=\"adi\"><sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\"><sv:value>rep:Members</sv:value></sv:property><sv:node sv:name=\"adi\"><sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\"><sv:value>rep:Members</sv:value></sv:property><sv:property sv:name=\"adi\" sv:type=\"WeakReference\"><sv:value>c46335eb-267e-3e1c-9e5b-017acb4cd799</sv:value></sv:property><sv:property sv:name=\"admin\" sv:type=\"WeakReference\"><sv:value>21232f29-7a57-35a7-8389-4a0e4a801fc3</sv:value></sv:property></sv:node><sv:node sv:name=\"angi\"><sv:property sv:name=
 \"jcr:primaryType\" sv:type=\"Name\"><sv:value>rep:Members</sv:value></sv:property><sv:property sv:name=\"angi\" sv:type=\"WeakReference\"><sv:value>a468b64f-b1df-377c-b325-20d97aaa1ad9</sv:value></sv:property><sv:property sv:name=\"anonymous\" sv:type=\"WeakReference\"><sv:value>294de355-7d9d-30b3-92d8-a1e6aab028cf</sv:value></sv:property><sv:property sv:name=\"cati\" sv:type=\"WeakReference\"><sv:value>f08910b6-41c8-3cb9-a648-1dddd14b132d</sv:value></sv:property></sv:node></sv:node><sv:n" +
+                "ode sv:name=\"debbi\"><sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\"><sv:value>rep:Members</sv:value></sv:property><sv:node sv:name=\"debbi\"><sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\"><sv:value>rep:Members</sv:value></sv:property><sv:property sv:name=\"debbi\" sv:type=\"WeakReference\"><sv:value>d53bedf9-ebb8-3117-a8b8-162d32b4bee2</sv:value></sv:property><sv:property sv:name=\"eddi\" sv:type=\"WeakReference\"><sv:value>1795fa1a-3d20-3a64-996e-eaaeb520a01e</sv:value></sv:property><sv:property sv:name=\"gabi\" sv:type=\"WeakReference\"><sv:value>a0d499c7-5105-3663-8611-a32779a57104</sv:value></sv:property><sv:property sv:name=\"hansi\" sv:type=\"WeakReference\"><sv:value>9ea4d671-8ed1-399a-8401-59487a14d00a</sv:value></sv:property></sv:node><sv:node sv:name=\"hari\"><sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\"><sv:value>rep:Members</sv:value></sv:property><sv:property sv:name=\"hari\" sv:type=\"WeakReference\"><sv:value
 >a9bcf1e4-d7b9-3a22-a297-5c812d938889</sv:value></sv:property><sv:property sv:name=\"lisi\" sv:type=\"WeakReference\"><sv:value>dc3a8f16-70d6-3bea-a9b7-b65048a0ac40</sv:value></sv:property></sv:node><sv:node sv:name=\"luzi\"><sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\"><sv:value>rep:Members</sv:value></sv:property><sv:property sv:name=\"luzi\" sv:type=\"WeakReference\"><sv:value>9ec299fd-3461-3f1a-9749-92a76f2516eb</sv:value></sv:property><sv:property sv:name=\"pipi\" sv:type=" +
+                "\"WeakReference\"><sv:value>16d5d24f-5b09-3199-9bd4-e5f57bf11237</sv:value></sv:property><sv:property sv:name=\"susi\" sv:type=\"WeakReference\"><sv:value>536931d8-0dec-318c-b3db-9612bdd004d4</sv:value></sv:property></sv:node></sv:node></sv:node></sv:node></sv:node></sv:node>";
+
+        List<String> createdUsers = new LinkedList<String>();
+        Node groupsNode = superuser.getNode(GROUPPATH);
+        try {
+            String[] users = {"angi", "adi", "hansi", "lisi", "luzi", "susi", "pipi", "hari", "gabi", "eddi",
+                    "debbi", "cati", "admin", "anonymous"};
+
+            doImport(groupsNode.getPath(), xml, ImportBehavior.BESTEFFORT);
+            if (!userMgr.isAutoSave()) {
+                superuser.save();
+            }
+
+            for (String user : users) {
+                if (userMgr.getAuthorizable(user) == null) {
+                    userMgr.createUser(user, user);
+                    createdUsers.add(user);
+                }
+            }
+            if (!userMgr.isAutoSave()) {
+                superuser.save();
+            }
+
+            Authorizable aShrimps = userMgr.getAuthorizable("shrimps");
+            assertNotNull(aShrimps);
+            assertTrue(aShrimps.isGroup());
+
+            Group gShrimps = (Group) aShrimps;
+            for (String user : users) {
+                assertTrue(user + " should be member of " + gShrimps, gShrimps.isMember(userMgr.getAuthorizable(user)));
+            }
+
+
+        } finally {
+            superuser.refresh(false);
+            for (String user : createdUsers) {
+                Authorizable a = userMgr.getAuthorizable(user);
+                if (a != null && !a.isGroup()) {
+                    a.remove();
+                }
+            }
+            if (!userMgr.isAutoSave()) {
+                superuser.save();
+            }
+            for (NodeIterator it = groupsNode.getNodes(); it.hasNext(); ) {
+                it.nextNode().remove();
+            }
+            if (!userMgr.isAutoSave()) {
+                superuser.save();
+            }
+        }
+    }
+
+    @Test
+    public void testImportGroupMembersFromNodes() throws Exception {
         String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><sv:node sv:name=\"s\" xmlns:mix=\"http://www.jcp.org/jcr/mix/1.0\" xmlns:sling=\"http://sling.apache.org/jcr/sling/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:jcr=\"http://www.jcp.org/jcr/1.0\" xmlns:sv=\"http://www.jcp.org/jcr/sv/1.0\" xmlns:rep=\"internal\"><sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\"><sv:value>rep:AuthorizableFolder</sv:value></sv:property><sv:property sv:name=\"jcr:created\" sv:type=\"Date\"><sv:value>2010-08-17T18:22:20.086+02:00</sv:value></sv:property><sv:property sv:name=\"jcr:createdBy\" sv:type=\"String\"><sv:value>admin</sv:value></sv:property><sv:node sv:name=\"sh\"><sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\"><sv:value>rep:AuthorizableFolder</sv:value></sv:property><sv:property sv:name=\"jcr
 :created\" sv:type=\"Date\"><sv:value>2010-08-17T18:22:20.086+02:00</sv:value></sv:property><sv:property sv:name=\"jcr:createdBy\" sv:type=\"String\"><sv:value>admin</sv:value></sv:property><sv:node sv:name=\"shrimps\"><sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\"><sv:value>rep:Group</sv:value></sv:property><sv:property sv:name=\"jcr:uuid\" sv:type=\"String\"><sv:value>08429aec-6f09-30db-8c83-1a2a57fc760c</sv:value></sv:property><sv:property sv:name=\"jcr:created\" sv:type=\"Date\">" +
                      "<sv:value>2010-08-17T18:22:20.086+02:00</sv:value></sv:property><sv:property sv:name=\"jcr:createdBy\" sv:type=\"String\"><sv:value>admin</sv:value></sv:property><sv:property sv:name=\"rep:principalName\" sv:type=\"String\"><sv:value>shrimps</sv:value></sv:property><sv:node sv:name=\"rep:members\"><sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\"><sv:value>rep:Members</sv:value></sv:property><sv:node sv:name=\"adi\"><sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\"><sv:value>rep:Members</sv:value></sv:property><sv:node sv:name=\"adi\"><sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\"><sv:value>rep:Members</sv:value></sv:property><sv:property sv:name=\"adi\" sv:type=\"WeakReference\"><sv:value>c46335eb-267e-3e1c-9e5b-017acb4cd799</sv:value></sv:property><sv:property sv:name=\"admin\" sv:type=\"WeakReference\"><sv:value>21232f29-7a57-35a7-8389-4a0e4a801fc3</sv:value></sv:property></sv:node><sv:node sv:name=\"angi\"><sv:property sv:
 name=\"jcr:primaryType\" sv:type=\"Name\"><sv:value>rep:Members</sv:value></sv:property><sv:property sv:name=\"angi\" sv:type=\"WeakReference\"><sv:value>a468b64f-b1df-377c-b325-20d97aaa1ad9</sv:value></sv:property><sv:property sv:name=\"anonymous\" sv:type=\"WeakReference\"><sv:value>294de355-7d9d-30b3-92d8-a1e6aab028cf</sv:value></sv:property><sv:property sv:name=\"cati\" sv:type=\"WeakReference\"><sv:value>f08910b6-41c8-3cb9-a648-1dddd14b132d</sv:value></sv:property></sv:node></sv:node><sv:n" +
                      "ode sv:name=\"debbi\"><sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\"><sv:value>rep:Members</sv:value></sv:property><sv:node sv:name=\"debbi\"><sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\"><sv:value>rep:Members</sv:value></sv:property><sv:property sv:name=\"debbi\" sv:type=\"WeakReference\"><sv:value>d53bedf9-ebb8-3117-a8b8-162d32b4bee2</sv:value></sv:property><sv:property sv:name=\"eddi\" sv:type=\"WeakReference\"><sv:value>1795fa1a-3d20-3a64-996e-eaaeb520a01e</sv:value></sv:property><sv:property sv:name=\"gabi\" sv:type=\"WeakReference\"><sv:value>a0d499c7-5105-3663-8611-a32779a57104</sv:value></sv:property><sv:property sv:name=\"hansi\" sv:type=\"WeakReference\"><sv:value>9ea4d671-8ed1-399a-8401-59487a14d00a</sv:value></sv:property></sv:node><sv:node sv:name=\"hari\"><sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\"><sv:value>rep:Members</sv:value></sv:property><sv:property sv:name=\"hari\" sv:type=\"WeakReference\"><sv:
 value>a9bcf1e4-d7b9-3a22-a297-5c812d938889</sv:value></sv:property><sv:property sv:name=\"lisi\" sv:type=\"WeakReference\"><sv:value>dc3a8f16-70d6-3bea-a9b7-b65048a0ac40</sv:value></sv:property></sv:node><sv:node sv:name=\"luzi\"><sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\"><sv:value>rep:Members</sv:value></sv:property><sv:property sv:name=\"luzi\" sv:type=\"WeakReference\"><sv:value>9ec299fd-3461-3f1a-9749-92a76f2516eb</sv:value></sv:property><sv:property sv:name=\"pipi\" sv:type=" +
@@ -1211,81 +1137,4 @@ public class UserImportTest extends Abst
             }
         }
     }
-
-    //TODO test UserImporter.ImportBehavior != ignore
-//    public void testImportGroupMembersFromNodesBestEffort() throws RepositoryException, IOException, SAXException {
-//        String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><sv:node sv:name=\"s\" xmlns:mix=\"http://www.jcp.org/jcr/mix/1.0\" xmlns:sling=\"http://sling.apache.org/jcr/sling/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:jcr=\"http://www.jcp.org/jcr/1.0\" xmlns:sv=\"http://www.jcp.org/jcr/sv/1.0\" xmlns:rep=\"internal\"><sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\"><sv:value>rep:AuthorizableFolder</sv:value></sv:property><sv:property sv:name=\"jcr:created\" sv:type=\"Date\"><sv:value>2010-08-17T18:22:20.086+02:00</sv:value></sv:property><sv:property sv:name=\"jcr:createdBy\" sv:type=\"String\"><sv:value>admin</sv:value></sv:property><sv:node sv:name=\"sh\"><sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\"><sv:value>rep:AuthorizableFolder</sv:value></sv:property><sv:property sv:name=\"j
 cr:created\" sv:type=\"Date\"><sv:value>2010-08-17T18:22:20.086+02:00</sv:value></sv:property><sv:property sv:name=\"jcr:createdBy\" sv:type=\"String\"><sv:value>admin</sv:value></sv:property><sv:node sv:name=\"shrimps\"><sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\"><sv:value>rep:Group</sv:value></sv:property><sv:property sv:name=\"jcr:uuid\" sv:type=\"String\"><sv:value>08429aec-6f09-30db-8c83-1a2a57fc760c</sv:value></sv:property><sv:property sv:name=\"jcr:created\" sv:type=\"Date\">" +
-//                     "<sv:value>2010-08-17T18:22:20.086+02:00</sv:value></sv:property><sv:property sv:name=\"jcr:createdBy\" sv:type=\"String\"><sv:value>admin</sv:value></sv:property><sv:property sv:name=\"rep:principalName\" sv:type=\"String\"><sv:value>shrimps</sv:value></sv:property><sv:node sv:name=\"rep:members\"><sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\"><sv:value>rep:Members</sv:value></sv:property><sv:node sv:name=\"adi\"><sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\"><sv:value>rep:Members</sv:value></sv:property><sv:node sv:name=\"adi\"><sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\"><sv:value>rep:Members</sv:value></sv:property><sv:property sv:name=\"adi\" sv:type=\"WeakReference\"><sv:value>c46335eb-267e-3e1c-9e5b-017acb4cd799</sv:value></sv:property><sv:property sv:name=\"admin\" sv:type=\"WeakReference\"><sv:value>21232f29-7a57-35a7-8389-4a0e4a801fc3</sv:value></sv:property></sv:node><sv:node sv:name=\"angi\"><sv:property s
 v:name=\"jcr:primaryType\" sv:type=\"Name\"><sv:value>rep:Members</sv:value></sv:property><sv:property sv:name=\"angi\" sv:type=\"WeakReference\"><sv:value>a468b64f-b1df-377c-b325-20d97aaa1ad9</sv:value></sv:property><sv:property sv:name=\"anonymous\" sv:type=\"WeakReference\"><sv:value>294de355-7d9d-30b3-92d8-a1e6aab028cf</sv:value></sv:property><sv:property sv:name=\"cati\" sv:type=\"WeakReference\"><sv:value>f08910b6-41c8-3cb9-a648-1dddd14b132d</sv:value></sv:property></sv:node></sv:node><sv:n" +
-//                     "ode sv:name=\"debbi\"><sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\"><sv:value>rep:Members</sv:value></sv:property><sv:node sv:name=\"debbi\"><sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\"><sv:value>rep:Members</sv:value></sv:property><sv:property sv:name=\"debbi\" sv:type=\"WeakReference\"><sv:value>d53bedf9-ebb8-3117-a8b8-162d32b4bee2</sv:value></sv:property><sv:property sv:name=\"eddi\" sv:type=\"WeakReference\"><sv:value>1795fa1a-3d20-3a64-996e-eaaeb520a01e</sv:value></sv:property><sv:property sv:name=\"gabi\" sv:type=\"WeakReference\"><sv:value>a0d499c7-5105-3663-8611-a32779a57104</sv:value></sv:property><sv:property sv:name=\"hansi\" sv:type=\"WeakReference\"><sv:value>9ea4d671-8ed1-399a-8401-59487a14d00a</sv:value></sv:property></sv:node><sv:node sv:name=\"hari\"><sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\"><sv:value>rep:Members</sv:value></sv:property><sv:property sv:name=\"hari\" sv:type=\"WeakReference\"><s
 v:value>a9bcf1e4-d7b9-3a22-a297-5c812d938889</sv:value></sv:property><sv:property sv:name=\"lisi\" sv:type=\"WeakReference\"><sv:value>dc3a8f16-70d6-3bea-a9b7-b65048a0ac40</sv:value></sv:property></sv:node><sv:node sv:name=\"luzi\"><sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\"><sv:value>rep:Members</sv:value></sv:property><sv:property sv:name=\"luzi\" sv:type=\"WeakReference\"><sv:value>9ec299fd-3461-3f1a-9749-92a76f2516eb</sv:value></sv:property><sv:property sv:name=\"pipi\" sv:type=" +
-//                     "\"WeakReference\"><sv:value>16d5d24f-5b09-3199-9bd4-e5f57bf11237</sv:value></sv:property><sv:property sv:name=\"susi\" sv:type=\"WeakReference\"><sv:value>536931d8-0dec-318c-b3db-9612bdd004d4</sv:value></sv:property></sv:node></sv:node></sv:node></sv:node></sv:node></sv:node>";
-//
-//        List<String> createdUsers = new LinkedList<String>();
-//        NodeImpl groupsNode = (NodeImpl) sImpl.getNode(umgr.getGroupsPath());
-//        try {
-//            String[] users = {"angi", "adi", "hansi", "lisi", "luzi", "susi", "pipi", "hari", "gabi", "eddi",
-//                              "debbi", "cati", "admin", "anonymous"};
-//
-//            doImport(groupsNode, xml, UserImporter.ImportBehavior.BESTEFFORT);
-//            if (!umgr.isAutoSave()) {
-//                sImpl.save();
-//            }
-//
-//            for (String user : users) {
-//                if (umgr.getAuthorizable(user) == null) {
-//                    umgr.createUser(user, user);
-//                    createdUsers.add(user);
-//                }
-//            }
-//            if (!umgr.isAutoSave()) {
-//                sImpl.save();
-//            }
-//
-//            Authorizable aShrimps = umgr.getAuthorizable("shrimps");
-//            assertNotNull(aShrimps);
-//            assertTrue(aShrimps.isGroup());
-//
-//            Group gShrimps = (Group) aShrimps;
-//            for (String user : users) {
-//                assertTrue(user + " should be member of " + gShrimps, gShrimps.isMember(umgr.getAuthorizable(user)));
-//            }
-//
-//
-//        } finally {
-//            sImpl.refresh(false);
-//            for (String user : createdUsers) {
-//                Authorizable a = umgr.getAuthorizable(user);
-//                if (a != null && !a.isGroup()) {
-//                    a.remove();
-//                }
-//            }
-//            if (!umgr.isAutoSave()) {
-//                sImpl.save();
-//            }
-//            for (NodeIterator it = groupsNode.getNodes(); it.hasNext(); ) {
-//                it.nextNode().remove();
-//            }
-//            if (!umgr.isAutoSave()) {
-//                sImpl.save();
-//            }
-//        }
-//    }
-
-    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);
-    }
-
-    private void doImport(String parentPath, String xml, int importUUIDBehavior) throws IOException, SAXException, RepositoryException {
-        InputStream in = new ByteArrayInputStream(xml.getBytes("UTF-8"));
-        superuser.importXML(parentPath, in, importUUIDBehavior);
-    }
-
-    private static void assertNotDeclaredMember(Group gr, String potentialID, Session session ) throws RepositoryException {
-        // declared members must not list the invalid entry.
-        Iterator<Authorizable> it = gr.getDeclaredMembers();
-        while (it.hasNext()) {
-            Authorizable member = it.next();
-            assertFalse(potentialID.equals(session.getNode(member.getPath()).getIdentifier()));
-        }
-    }
 }



Mime
View raw message