jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1507308 [1/2] - /jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/
Date Fri, 26 Jul 2013 13:40:29 GMT
Author: angela
Date: Fri Jul 26 13:40:29 2013
New Revision: 1507308

URL: http://svn.apache.org/r1507308
Log:
OAK-50: user mgt and OAK-414 : Importing protected properties and nodes 

- split test-cases
- use same setup for all user-import related tests

Added:
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/GroupImportAbortTest.java
      - copied, changed from r1507240, jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/UserImportAbortTest.java
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/GroupImportBestEffortTest.java
      - copied, changed from r1507240, jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/UserImportBestEffortTest.java
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/GroupImportIgnoreTest.java
      - copied, changed from r1507240, jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/UserImportIgnoreTest.java
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/GroupImportTest.java
      - copied, changed from r1507240, jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/UserImportTest.java
Modified:
    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
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/UserImportAbortTest.java
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/UserImportBestEffortTest.java
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/UserImportIgnoreTest.java
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/UserImportTest.java

Modified: 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=1507308&r1=1507307&r2=1507308&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/AbstractImportTest.java (original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/AbstractImportTest.java Fri Jul 26 13:40:29 2013
@@ -20,15 +20,17 @@ import java.io.ByteArrayInputStream;
 import java.io.InputStream;
 import java.util.HashMap;
 import java.util.Iterator;
-import java.util.List;
 import java.util.Map;
 import javax.jcr.ImportUUIDBehavior;
 import javax.jcr.Node;
+import javax.jcr.NodeIterator;
 import javax.jcr.Repository;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
+import javax.jcr.SimpleCredentials;
 
 import com.google.common.collect.ImmutableMap;
+import org.apache.jackrabbit.JcrConstants;
 import org.apache.jackrabbit.api.JackrabbitSession;
 import org.apache.jackrabbit.api.security.user.Authorizable;
 import org.apache.jackrabbit.api.security.user.Group;
@@ -39,49 +41,45 @@ import org.apache.jackrabbit.oak.spi.sec
 import org.apache.jackrabbit.oak.spi.security.SecurityProvider;
 import org.apache.jackrabbit.oak.spi.security.principal.PrincipalImpl;
 import org.apache.jackrabbit.oak.spi.security.user.UserConfiguration;
+import org.apache.jackrabbit.oak.spi.security.user.UserConstants;
 import org.apache.jackrabbit.oak.spi.xml.ProtectedItemImporter;
-import org.apache.jackrabbit.test.AbstractJCRTest;
 import org.apache.jackrabbit.test.NotExecutableException;
 import org.junit.After;
 import org.junit.Before;
 
+import static org.junit.Assert.assertFalse;
+
 /**
  * Base class for user import related tests.
  */
-public abstract class AbstractImportTest extends AbstractJCRTest {
+public abstract class AbstractImportTest {
 
     private static final String ADMINISTRATORS = "administrators";
     protected static final String USERPATH = "/rep:security/rep:authorizables/rep:users";
     protected static final String GROUPPATH = "/rep:security/rep:authorizables/rep:groups";
 
-
-    private boolean removeAdministrators;
-
     private Repository repo;
     protected Session adminSession;
     protected UserManager userMgr;
 
-    protected abstract List<String> getPathsToRemove();
-
-    @Override
     @Before
-    protected void setUp() throws Exception {
-        super.setUp();
+    public void before() throws Exception {
 
         String importBehavior = getImportBehavior();
+        SecurityProvider securityProvider;
         if (importBehavior != null) {
             Map<String, String> userParams = new HashMap();
             userParams.put(ProtectedItemImporter.PARAM_IMPORT_BEHAVIOR, getImportBehavior());
             ConfigurationParameters config = new ConfigurationParameters(ImmutableMap.of(UserConfiguration.NAME, new ConfigurationParameters(userParams)));
 
-            SecurityProvider securityProvider = new SecurityProviderImpl(config);
-            Jcr jcr = new Jcr();
-            jcr.with(securityProvider);
-            repo = jcr.createRepository();
-            adminSession = repo.login(getHelper().getSuperuserCredentials());
+            securityProvider = new SecurityProviderImpl(config);
         } else {
-            adminSession = superuser;
+            securityProvider = new SecurityProviderImpl();
         }
+        Jcr jcr = new Jcr();
+        jcr.with(securityProvider);
+        repo = jcr.createRepository();
+        adminSession = repo.login(new SimpleCredentials(UserConstants.DEFAULT_ADMIN_ID, UserConstants.DEFAULT_ADMIN_ID.toCharArray()));
 
         if (!(adminSession instanceof JackrabbitSession)) {
             throw new NotExecutableException();
@@ -93,27 +91,26 @@ public abstract class AbstractImportTest
         if (administrators == null) {
             administrators = userMgr.createGroup(new PrincipalImpl(ADMINISTRATORS));
             adminSession.save();
-            removeAdministrators = true;
         } else if (!administrators.isGroup()) {
             throw new NotExecutableException("Expected " + administrators.getID() + " to be a group.");
         }
         adminSession.save();
     }
 
-    @Override
     @After
-    protected void tearDown() throws Exception {
+    public void after() throws Exception {
         try {
             adminSession.refresh(false);
-            for (String path : getPathsToRemove()) {
-                if (adminSession.nodeExists(path)) {
-                    adminSession.removeItem(path);
-                }
+            NodeIterator intermediateNodes = adminSession.getNode(GROUPPATH).getNodes();
+            while (intermediateNodes.hasNext()) {
+                intermediateNodes.nextNode().remove();
             }
-            if (removeAdministrators) {
-                Authorizable a = userMgr.getAuthorizable(ADMINISTRATORS);
-                if (a != null) {
-                    a.remove();
+            String builtinPath = USERPATH + "/a";
+            intermediateNodes = adminSession.getNode(USERPATH).getNodes();
+            while (intermediateNodes.hasNext()) {
+                Node n = intermediateNodes.nextNode();
+                if (!builtinPath.equals(n.getPath())) {
+                    n.remove();
                 }
             }
             adminSession.save();
@@ -122,15 +119,20 @@ public abstract class AbstractImportTest
                 adminSession.logout();
                 repo = null;
             }
-            super.tearDown();
         }
     }
 
     protected abstract String getImportBehavior();
 
+    protected abstract String getTargetPath();
+
+    protected Node getTargetNode() throws RepositoryException {
+        return adminSession.getNode(getTargetPath());
+    }
+
     protected String getExistingUUID() throws RepositoryException {
         Node n = adminSession.getRootNode();
-        n.addMixin(mixReferenceable);
+        n.addMixin(JcrConstants.MIX_REFERENCEABLE);
         return n.getUUID();
     }
 

Copied: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/GroupImportAbortTest.java (from r1507240, jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/UserImportAbortTest.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/GroupImportAbortTest.java?p2=jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/GroupImportAbortTest.java&p1=jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/UserImportAbortTest.java&r1=1507240&r2=1507308&rev=1507308&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/UserImportAbortTest.java (original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/GroupImportAbortTest.java Fri Jul 26 13:40:29 2013
@@ -20,26 +20,25 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.UUID;
 import javax.jcr.RepositoryException;
-import javax.security.auth.Subject;
 
-import com.google.common.collect.ImmutableList;
-import org.apache.jackrabbit.oak.spi.security.principal.PrincipalImpl;
 import org.apache.jackrabbit.oak.spi.xml.ImportBehavior;
 import org.junit.Test;
 
+import static org.junit.Assert.fail;
+
 /**
- * Testing {@link ImportBehavior#ABORT} for user/group import
+ * Testing {@link org.apache.jackrabbit.oak.spi.xml.ImportBehavior#ABORT} for group import
  */
-public class UserImportAbortTest extends AbstractImportTest {
+public class GroupImportAbortTest extends AbstractImportTest {
 
     @Override
-    protected List<String> getPathsToRemove() {
-        return ImmutableList.of(GROUPPATH + "/gFolder", USERPATH + "/t");
+    protected String getImportBehavior() {
+        return ImportBehavior.NAME_ABORT;
     }
 
     @Override
-    protected String getImportBehavior() {
-        return ImportBehavior.NAME_ABORT;
+    protected String getTargetPath() {
+        return GROUPPATH;
     }
 
     @Test
@@ -59,7 +58,7 @@ public class UserImportAbortTest extends
                         "</sv:node>" +
                     "</sv:node>";
             try {
-                doImport(GROUPPATH, xml);
+                doImport(getTargetPath(), xml);
                 // import behavior ABORT -> should throw.
                 fail("importing invalid members -> must throw.");
             } catch (RepositoryException e) {
@@ -83,66 +82,10 @@ public class UserImportAbortTest extends
                 "</sv:node>" +
                 "</sv:node>";
         try {
-            doImport(GROUPPATH, xml);
+            doImport(getTargetPath(), xml);
             fail("Importing self as group with ImportBehavior.ABORT must fail.");
         } catch (RepositoryException e) {
             // success.
         }
     }
-
-    @Test
-    public void testImportInvalidImpersonationAbort() throws Exception {
-        List<String> invalid = new ArrayList<String>();
-        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);
-                fail("UserImporter.ImportBehavior.ABORT -> importing invalid impersonators must throw.");
-            } catch (RepositoryException e) {
-                // success
-            } finally {
-                adminSession.refresh(false);
-            }
-        }
-    }
-
-    @Test
-    public void testImportNonExistingImpersonationAbort() throws Exception {
-        List<String> nonExisting = new ArrayList<String>();
-        nonExisting.add("anybody"); // an non-existing princ-name
-
-        for (String principalName : nonExisting) {
-            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);
-                fail("UserImporter.ImportBehavior.ABORT -> importing invalid impersonators must throw.");
-            } catch (RepositoryException e) {
-                // success
-            } finally {
-                adminSession.refresh(false);
-            }
-        }
-    }
 }

Copied: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/GroupImportBestEffortTest.java (from r1507240, jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/UserImportBestEffortTest.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/GroupImportBestEffortTest.java?p2=jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/GroupImportBestEffortTest.java&p1=jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/UserImportBestEffortTest.java&r1=1507240&r2=1507308&rev=1507308&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/UserImportBestEffortTest.java (original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/GroupImportBestEffortTest.java Fri Jul 26 13:40:29 2013
@@ -16,41 +16,38 @@
  */
 package org.apache.jackrabbit.oak.jcr.security.user;
 
-import java.security.Principal;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.UUID;
-import javax.jcr.ImportUUIDBehavior;
-import javax.jcr.ItemExistsException;
 import javax.jcr.Node;
 import javax.jcr.PropertyType;
 import javax.jcr.Value;
-import javax.security.auth.Subject;
 
-import com.google.common.collect.ImmutableList;
-import org.apache.jackrabbit.api.security.principal.PrincipalIterator;
 import org.apache.jackrabbit.api.security.user.Authorizable;
 import org.apache.jackrabbit.api.security.user.Group;
-import org.apache.jackrabbit.api.security.user.Impersonation;
-import org.apache.jackrabbit.api.security.user.User;
 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.Test;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
 /**
- * Testing {@link ImportBehavior#BESTEFFORT} for user/group import
+ * Testing {@link org.apache.jackrabbit.oak.spi.xml.ImportBehavior#BESTEFFORT} for group import
  */
-public class UserImportBestEffortTest extends AbstractImportTest {
+public class GroupImportBestEffortTest extends AbstractImportTest {
 
     @Override
-    protected List<String> getPathsToRemove() {
-        return ImmutableList.of(GROUPPATH + "/gFolder", USERPATH + "/t", USERPATH + "/uFolder");
+    protected String getImportBehavior() {
+        return ImportBehavior.NAME_BESTEFFORT;
     }
 
     @Override
-    protected String getImportBehavior() {
-        return ImportBehavior.NAME_BESTEFFORT;
+    protected String getTargetPath() {
+        return GROUPPATH;
     }
 
     @Test
@@ -71,7 +68,7 @@ public class UserImportBestEffortTest ex
                     "</sv:node>";
             try {
                 // BESTEFFORT behavior -> must import non-existing members.
-                doImport(GROUPPATH, xml);
+                doImport(getTargetPath(), xml);
                 Authorizable a = userMgr.getAuthorizable("g1");
                 if (a.isGroup()) {
                     // the rep:members property must contain the invalid value
@@ -116,7 +113,7 @@ public class UserImportBestEffortTest ex
                 "</sv:node>";
 
         // BESTEFFORT behavior -> must import non-existing members.
-        doImport(GROUPPATH, xml);
+        doImport(getTargetPath(), xml);
         Authorizable g1 = userMgr.getAuthorizable("g1");
         if (g1.isGroup()) {
             // the rep:members property must contain the invalid value
@@ -163,7 +160,7 @@ public class UserImportBestEffortTest ex
                 "   </sv:node>";
 
         // BESTEFFORT behavior -> must import non-existing members.
-        doImport(GROUPPATH, xml);
+        doImport(getTargetPath(), xml);
 
         /*
         now try to import the 'g' group that has a circular group
@@ -174,7 +171,7 @@ public class UserImportBestEffortTest ex
         - g is member of g1
         - g1 isn't member of g
         */
-        doImport(GROUPPATH + "/gFolder", xml2);
+        doImport(getTargetPath() + "/gFolder", xml2);
 
         Authorizable g = userMgr.getAuthorizable("g");
         assertNotNull(g);
@@ -184,129 +181,4 @@ public class UserImportBestEffortTest ex
             fail("'g' was not imported as Group.");
         }
     }
-
-    @Test
-    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>" +
-                "   <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:node>";
-
-        doImport(USERPATH, xml);
-
-        // re-import should succeed if UUID-behavior is set accordingly
-        doImport(USERPATH, xml, ImportUUIDBehavior.IMPORT_UUID_COLLISION_REMOVE_EXISTING);
-
-        // saving changes of the import -> must succeed. add mandatory
-        // props should have been created.
-        adminSession.save();
-    }
-
-    /**
-     * Same as {@link #testImportUuidCollisionRemoveExisting} with the single
-     * difference that the initial import is saved before being overwritten.
-     */
-    @Test
-    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>" +
-                "   <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:node>";
-
-        doImport(USERPATH, xml);
-        adminSession.save();
-
-        // re-import should succeed if UUID-behavior is set accordingly
-        doImport(USERPATH, xml, ImportUUIDBehavior.IMPORT_UUID_COLLISION_REMOVE_EXISTING);
-
-        // saving changes of the import -> must succeed. add mandatory
-        // props should have been created.
-        adminSession.save();
-    }
-
-    @Test
-    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>" +
-                "   <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:node>";
-
-        try {
-            doImport(USERPATH, xml);
-            doImport(USERPATH, xml, ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW);
-            fail("UUID collision must be handled according to the uuid behavior.");
-
-        } catch (ItemExistsException e) {
-            // success.
-        }
-    }
-
-    @Test
-    public void testImportImpersonationBestEffort() 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>" +
-                "<sv:node sv:name=\"t\">" +
-                "   <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:principalName\" sv:type=\"String\"><sv:value>t</sv:value></sv:property>" +
-                "   <sv:property sv:name=\"rep:impersonators\" sv:type=\"String\"><sv:value>g</sv:value></sv:property>" +
-                "</sv:node>" +
-                "<sv:node sv:name=\"g\">" +
-                "   <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>b2f5ff47-4366-31b6-a533-d8dc3614845d</sv:value></sv:property>" +
-                "   <sv:property sv:name=\"rep:principalName\" sv:type=\"String\"><sv:value>g</sv:value></sv:property>" +
-                "</sv:node>" +
-                "</sv:node>";
-        doImport(USERPATH, xml);
-
-        Authorizable newUser = userMgr.getAuthorizable("t");
-        assertNotNull(newUser);
-
-        Authorizable u2 = userMgr.getAuthorizable("g");
-        assertNotNull(u2);
-
-        Subject subj = new Subject();
-        subj.getPrincipals().add(u2.getPrincipal());
-
-        Impersonation imp = ((User) newUser).getImpersonation();
-        assertTrue(imp.allows(subj));
-    }
-
-    @Test
-    public void testImportNonExistingImpersonationBestEffort() throws Exception {
-        String principalName = "anybody"; // an non-existing princ-name
-        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>";
-        doImport(USERPATH, xml);
-
-        Authorizable a = userMgr.getAuthorizable("t");
-        assertFalse(a.isGroup());
-
-        boolean found = false;
-        PrincipalIterator it = ((User) a).getImpersonation().getImpersonators();
-        while (it.hasNext()) {
-            Principal p = it.nextPrincipal();
-            if (principalName.equals(p.getName())) {
-                found = true;
-                break;
-            }
-        }
-        assertTrue(found);
-    }
 }

Copied: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/GroupImportIgnoreTest.java (from r1507240, jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/UserImportIgnoreTest.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/GroupImportIgnoreTest.java?p2=jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/GroupImportIgnoreTest.java&p1=jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/UserImportIgnoreTest.java&r1=1507240&r2=1507308&rev=1507308&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/UserImportIgnoreTest.java (original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/GroupImportIgnoreTest.java Fri Jul 26 13:40:29 2013
@@ -19,22 +19,18 @@ package org.apache.jackrabbit.oak.jcr.se
 import java.util.ArrayList;
 import java.util.List;
 import java.util.UUID;
-import javax.security.auth.Subject;
 
-import com.google.common.collect.ImmutableList;
-import org.apache.jackrabbit.api.security.principal.PrincipalIterator;
 import org.apache.jackrabbit.api.security.user.Authorizable;
 import org.apache.jackrabbit.api.security.user.Group;
-import org.apache.jackrabbit.api.security.user.Impersonation;
-import org.apache.jackrabbit.api.security.user.User;
-import org.apache.jackrabbit.oak.spi.security.principal.PrincipalImpl;
 import org.apache.jackrabbit.oak.spi.xml.ImportBehavior;
 import org.junit.Test;
 
+import static org.junit.Assert.fail;
+
 /**
- * Testing {@link ImportBehavior#IGNORE} for user/group import
+ * Testing {@link org.apache.jackrabbit.oak.spi.xml.ImportBehavior#IGNORE} for group import
  */
-public class UserImportIgnoreTest extends AbstractImportTest {
+public class GroupImportIgnoreTest extends AbstractImportTest {
 
     @Override
     protected String getImportBehavior() {
@@ -42,8 +38,8 @@ public class UserImportIgnoreTest extend
     }
 
     @Override
-    protected List<String> getPathsToRemove() {
-        return ImmutableList.of(GROUPPATH + "/gFolder", USERPATH + "/t");
+    protected String getTargetPath() {
+        return GROUPPATH;
     }
 
     @Test
@@ -58,7 +54,7 @@ public class UserImportIgnoreTest extend
                 "   <sv:property sv:name=\"rep:members\" sv:type=\"WeakReference\"><sv:value>" +invalidId+ "</sv:value></sv:property>" +
                 "</sv:node>" +
                 "</sv:node>";
-        doImport(GROUPPATH, xml);
+        doImport(getTargetPath(), xml);
         // no exception during import -> member must have been ignored though.
         Authorizable a = userMgr.getAuthorizable("g1");
         if (a.isGroup()) {
@@ -69,46 +65,6 @@ public class UserImportIgnoreTest extend
     }
 
     @Test
-    public void testImportInvalidImpersonationIgnore() 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);
-                // no exception during import: no impersonation must be granted
-                // for the invalid principal name
-                Authorizable a = userMgr.getAuthorizable("t");
-                if (!a.isGroup()) {
-                    Impersonation imp = ((User)a).getImpersonation();
-                    Subject s = new Subject();
-                    s.getPrincipals().add(new PrincipalImpl(principalName));
-                    assertFalse(imp.allows(s));
-                    for (PrincipalIterator it = imp.getImpersonators(); it.hasNext();) {
-                        assertFalse(principalName.equals(it.nextPrincipal().getName()));
-                    }
-                } else {
-                    fail("Importing 't' didn't create a User.");
-                }
-            } finally {
-                adminSession.refresh(false);
-            }
-        }
-    }
-
-    @Test
     public void testImportNonExistingMemberIgnore() throws Exception {
         List<String> invalid = new ArrayList<String>();
         invalid.add(UUID.randomUUID().toString()); // random uuid
@@ -127,7 +83,7 @@ public class UserImportIgnoreTest extend
             try {
                 // there should be no exception during import,
                 // but invalid members must be ignored.
-                doImport(GROUPPATH, xml);
+                doImport(getTargetPath(), xml);
                 Authorizable a = userMgr.getAuthorizable("g1");
                 if (a.isGroup()) {
                     assertNotDeclaredMember((Group) a, id, adminSession);

Copied: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/GroupImportTest.java (from r1507240, 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/GroupImportTest.java?p2=jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/GroupImportTest.java&p1=jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/UserImportTest.java&r1=1507240&r2=1507308&rev=1507308&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/GroupImportTest.java Fri Jul 26 13:40:29 2013
@@ -16,49 +16,35 @@
  */
 package org.apache.jackrabbit.oak.jcr.security.user;
 
-import java.security.Principal;
-import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
-import javax.jcr.ImportUUIDBehavior;
-import javax.jcr.ItemExistsException;
 import javax.jcr.Node;
 import javax.jcr.NodeIterator;
 import javax.jcr.RepositoryException;
 import javax.jcr.nodetype.ConstraintViolationException;
-import javax.security.auth.Subject;
 
-import com.google.common.collect.ImmutableList;
-import org.apache.jackrabbit.api.JackrabbitSession;
-import org.apache.jackrabbit.api.security.principal.PrincipalIterator;
-import org.apache.jackrabbit.api.security.principal.PrincipalManager;
 import org.apache.jackrabbit.api.security.user.Authorizable;
-import org.apache.jackrabbit.api.security.user.AuthorizableExistsException;
 import org.apache.jackrabbit.api.security.user.Group;
-import org.apache.jackrabbit.api.security.user.Impersonation;
-import org.apache.jackrabbit.api.security.user.User;
 import org.apache.jackrabbit.oak.spi.security.user.UserConstants;
-import org.apache.jackrabbit.test.NotExecutableException;
 import org.junit.Test;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
 /**
- * Testing user/group import with default {@link org.apache.jackrabbit.oak.spi.xml.ImportBehavior}
+ * Testing group import with default {@link org.apache.jackrabbit.oak.spi.xml.ImportBehavior}
  */
-public class UserImportTest extends AbstractImportTest {
+public class GroupImportTest extends AbstractImportTest {
 
     @Override
-    protected List<String> getPathsToRemove() {
-        return ImmutableList.of(
-                USERPATH + "/t",
-                USERPATH + "/r",
-                USERPATH + "/uFolder",
-                USERPATH + "/some",
-                USERPATH + "/g",
-                USERPATH + "/t_diff",
-                GROUPPATH + "/g",
-                GROUPPATH + "/s",
-                GROUPPATH + "/gFolder");
+    protected String getTargetPath() {
+        return GROUPPATH;
     }
 
     @Override
@@ -67,45 +53,6 @@ public class UserImportTest extends Abst
     }
 
     @Test
-    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>" +
-                "   <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:disabled\" sv:type=\"String\"><sv:value>disabledUser</sv:value></sv:property>" +
-                "</sv:node>";
-
-        Node target = adminSession.getNode(USERPATH);
-        doImport(USERPATH, xml);
-
-        assertTrue(target.isModified());
-        assertTrue(adminSession.hasPendingChanges());
-
-        Authorizable newUser = userMgr.getAuthorizable("t");
-        assertNotNull(newUser);
-        assertFalse(newUser.isGroup());
-        assertEquals("t", newUser.getPrincipal().getName());
-        assertEquals("t", newUser.getID());
-        assertTrue(((User) newUser).isDisabled());
-        assertEquals("disabledUser", ((User) newUser).getDisabledReason());
-
-        Node n = adminSession.getNode(newUser.getPath());
-        assertTrue(n.isNew());
-        assertTrue(n.getParent().isSame(target));
-
-        assertEquals("t", n.getName());
-        assertEquals("t", n.getProperty(UserConstants.REP_PRINCIPAL_NAME).getString());
-        assertEquals("{sha1}8efd86fb78a56a5145ed7739dcb00c78581c5375", n.getProperty(UserConstants.REP_PASSWORD).getString());
-        assertEquals("disabledUser", n.getProperty(UserConstants.REP_DISABLED).getString());
-
-        // saving changes of the import -> must succeed. add mandatory
-        // props should have been created.
-        adminSession.save();
-    }
-
-    @Test
     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\">" +
@@ -114,8 +61,8 @@ public class UserImportTest extends Abst
                 "   <sv:property sv:name=\"rep:principalName\" sv:type=\"String\"><sv:value>g</sv:value></sv:property>" +
                 "</sv:node>";
 
-        Node target = adminSession.getNode(GROUPPATH);
-        doImport(GROUPPATH, xml);
+        Node target = getTargetNode();
+        doImport(getTargetPath(), xml);
 
         assertTrue(target.isModified());
         assertTrue(adminSession.hasPendingChanges());
@@ -138,112 +85,6 @@ public class UserImportTest extends Abst
         adminSession.save();
     }
 
-    /**
-     * @since OAK 1.0 : constraintviolation is no longer detected during import
-     *        but only upon save.
-     */
-    @Test
-    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>" +
-                "   <sv:property sv:name=\"jcr:uuid\" sv:type=\"String\"><sv:value>b2f5ff47-4366-31b6-a533-d8dc3614845d</sv:value></sv:property>" +
-                "   <sv:property sv:name=\"rep:principalName\" sv:type=\"String\"><sv:value>g</sv:value></sv:property>" +
-                "</sv:node>";
-
-        /*
-         importing a group below the users-path:
-         - nonProtected node rep:Group must be created.
-         - protected properties are ignored
-         - UserManager.getAuthorizable must return null.
-         - saving changes must fail with ConstraintViolationEx.
-         */
-
-        Node target = adminSession.getNode(USERPATH);
-        doImport(USERPATH, xml);
-
-        assertTrue(target.isModified());
-        assertTrue(adminSession.hasPendingChanges());
-
-        Authorizable newGroup = userMgr.getAuthorizable("g");
-        assertNotNull(newGroup);
-        assertTrue(target.hasNode("g"));
-        assertTrue(target.hasProperty("g/rep:principalName"));
-
-        // saving changes of the import -> must fail
-        try {
-            adminSession.save();
-            fail("Import must be incomplete. Saving changes must fail.");
-        } catch (ConstraintViolationException e) {
-            // success
-        }
-    }
-
-    @Test
-    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.
-        //String calculatedUUID = "e358efa4-89f5-3062-b10d-d7316b65649e";
-        String mismatchUUID = "a358efa4-89f5-3062-b10d-d7316b65649e";
-
-        String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
-                "<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>" + mismatchUUID + "</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:node>";
-
-        Node target = adminSession.getNode(USERPATH);
-        doImport(USERPATH, xml);
-
-        assertTrue(target.isModified());
-        assertTrue(adminSession.hasPendingChanges());
-
-        // node must be present:
-        assertTrue(target.hasNode("t"));
-        Node n = target.getNode("t");
-        assertEquals(mismatchUUID, n.getUUID());
-
-        // but UserManager.getAuthorizable(String) will not find the
-        // authorizable
-        Authorizable newUser = userMgr.getAuthorizable("t");
-        assertNull(newUser);
-    }
-
-    @Test
-    public void testExistingPrincipal() throws Exception {
-        Principal existing = null;
-        PrincipalIterator principalIterator = ((JackrabbitSession) adminSession).getPrincipalManager().getPrincipals(PrincipalManager.SEARCH_TYPE_ALL);
-        while (principalIterator.hasNext()) {
-            Principal p = principalIterator.nextPrincipal();
-            if (userMgr.getAuthorizable(p) != null) {
-                existing = p;
-                break;
-            }
-        }
-        if (existing == null) {
-            throw new NotExecutableException();
-        }
-
-        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>" + existing.getName() + "</sv:value></sv:property>" +
-                "</sv:node>";
-
-        try {
-            doImport(USERPATH, xml);
-            adminSession.save();
-
-            fail("Import must detect conflicting principals.");
-        } catch (RepositoryException e) {
-            // success
-        }
-    }
-
     @Test
     public void testConflictingPrincipalsWithinImport() throws Exception {
         String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
@@ -264,7 +105,7 @@ public class UserImportTest extends Abst
                 "</sv:node>";
 
         try {
-            doImport(GROUPPATH, xml);
+            doImport(getTargetPath(), xml);
             adminSession.save();
 
             fail("Import must detect conflicting principals.");
@@ -288,8 +129,8 @@ public class UserImportTest extends Abst
          - saving changes must fail with ConstraintViolationEx. as the protected
            mandatory property rep:principalName is missing
          */
-        Node target = adminSession.getNode(GROUPPATH);
-        doImport(GROUPPATH, xml);
+        Node target = getTargetNode();
+        doImport(getTargetPath(), xml);
 
         assertTrue(target.isModified());
         assertTrue(adminSession.hasPendingChanges());
@@ -311,120 +152,6 @@ public class UserImportTest extends Abst
     }
 
     @Test
-    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\">" +
-                "   <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>" + plainPw + "</sv:value></sv:property>" +
-                "   <sv:property sv:name=\"rep:principalName\" sv:type=\"String\"><sv:value>t</sv:value></sv:property>" +
-                "</sv:node>";
-
-        Node target = adminSession.getNode(USERPATH);
-        doImport(USERPATH, xml);
-
-        assertTrue(target.isModified());
-        assertTrue(adminSession.hasPendingChanges());
-
-        Authorizable newUser = userMgr.getAuthorizable("t");
-        Node n = adminSession.getNode(newUser.getPath());
-
-        String pwValue = n.getProperty(UserConstants.REP_PASSWORD).getString();
-        assertFalse(plainPw.equals(pwValue));
-        assertTrue(pwValue.toLowerCase().startsWith("{sha"));
-    }
-
-    /**
-     * @since OAK 1.0 : password property is not longer mandatory -> multivalued
-     *        property will just be ignored (instead of throwing ConstraintViolationException
-     *        upon save).
-     */
-    @Test
-    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>" +
-                "   <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:value>{sha1}8efd86fb78a56a5145ed7739dcb00c78581c5375</sv:value></sv:property>" +
-                "   <sv:property sv:name=\"rep:principalName\" sv:type=\"String\"><sv:value>t</sv:value></sv:property>" +
-                "</sv:node>";
-        /*
-         importing a user with a multi-valued rep:password property
-         - nonProtected node rep:User must be created.
-         - property rep:password must be created regularly without being protected
-         */
-        Node target = adminSession.getNode(USERPATH);
-        doImport(USERPATH, xml);
-
-        assertTrue(target.isModified());
-        assertTrue(adminSession.hasPendingChanges());
-
-        Authorizable newUser = userMgr.getAuthorizable("t");
-        assertNotNull(newUser);
-
-        assertTrue(target.hasNode("t"));
-        assertTrue(target.hasProperty("t/rep:password"));
-        assertFalse(target.getProperty("t/rep:password").getDefinition().isProtected());
-    }
-
-    @Test
-    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\">" +
-                "   <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:node>");
-        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\">" +
-                "   <sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\"><sv:value>rep:User</sv:value></sv:property>" +
-                "   <sv:property sv:name=\"rep:principalName\" sv:type=\"String\"><sv:value>t</sv:value></sv:property>" +
-                "</sv:node>");
-
-        for (String xml : incompleteXml) {
-            Node target = adminSession.getNode(USERPATH);
-            try {
-                doImport(USERPATH, xml);
-                // saving changes of the import -> must fail as mandatory prop is missing
-                try {
-                    adminSession.save();
-                    fail("Import must be incomplete. Saving changes must fail.");
-                } catch (ConstraintViolationException e) {
-                    // success
-                }
-            } finally {
-                adminSession.refresh(false);
-                if (target.hasNode("t")) {
-                    target.getNode("t").remove();
-                    adminSession.save();
-                }
-            }
-        }
-    }
-
-    /**
-     * @since OAK 1.0 : importing User without password must succeed.
-     */
-    @Test
-    public void testUserWithoutPassword() 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>" +
-                "   <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:principalName\" sv:type=\"String\"><sv:value>t</sv:value></sv:property>" +
-                "</sv:node>";
-
-        doImport(USERPATH, xml);
-
-        Authorizable user = userMgr.getAuthorizable("t");
-        assertNotNull(user);
-        assertFalse(user.isGroup());
-        assertFalse(adminSession.propertyExists(user.getPath() + "/rep:password"));
-    }
-
-    @Test
     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\">" +
@@ -436,7 +163,7 @@ public class UserImportTest extends Abst
          importing a group without rep:principalName property
          - saving changes must fail with ConstraintViolationEx.
          */
-        doImport(GROUPPATH, xml);
+        doImport(getTargetPath(), xml);
         // saving changes of the import -> must fail as mandatory prop is missing
         try {
             adminSession.save();
@@ -447,52 +174,6 @@ public class UserImportTest extends Abst
     }
 
     @Test
-    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>" +
-                "   <sv:property sv:name=\"jcr:uuid\" sv:type=\"String\"><sv:value>d5433be9-68d0-4fba-bf96-efc29f461993</sv:value></sv:property>" +
-                "<sv:node sv:name=\"intermediate\">" +
-                "   <sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\"><sv:value>rep:AuthorizableFolder</sv:value></sv:property>" +
-                "   <sv:property sv:name=\"jcr:uuid\" sv:type=\"String\"><sv:value>d87354a4-037e-4756-a8fb-deb2eb7c5149</sv:value></sv:property>" +
-                "<sv:node sv:name=\"path\">" +
-                "   <sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\"><sv:value>rep:AuthorizableFolder</sv:value></sv:property>" +
-                "   <sv:property sv:name=\"jcr:uuid\" sv:type=\"String\"><sv:value>24263272-b789-4568-957a-3bcaf99dbab3</sv:value></sv:property>" +
-                "<sv:node sv:name=\"t3\">" +
-                "   <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>0b8854ad-38f0-36c6-9807-928d28195609</sv:value></sv:property>" +
-                "   <sv:property sv:name=\"rep:password\" sv:type=\"String\"><sv:value>{sha1}4358694eeb098c6708ae914a10562ce722bbbc34</sv:value></sv:property>" +
-                "   <sv:property sv:name=\"rep:principalName\" sv:type=\"String\"><sv:value>t3</sv:value></sv:property>" +
-                "</sv:node>" +
-                "</sv:node>" +
-                "</sv:node>" +
-                "</sv:node>";
-
-        Node target = adminSession.getNode(USERPATH);
-        doImport(USERPATH, xml);
-
-        assertTrue(target.isModified());
-        assertTrue(adminSession.hasPendingChanges());
-
-        Authorizable newUser = userMgr.getAuthorizable("t3");
-        assertNotNull(newUser);
-        assertFalse(newUser.isGroup());
-        assertEquals("t3", newUser.getPrincipal().getName());
-        assertEquals("t3", newUser.getID());
-
-        Node n = adminSession.getNode(newUser.getPath());
-        assertTrue(n.isNew());
-
-        Node parent = n.getParent();
-        assertFalse(n.isSame(target));
-        assertTrue(parent.isNodeType(UserConstants.NT_REP_AUTHORIZABLE_FOLDER));
-        assertFalse(parent.getDefinition().isProtected());
-
-        assertTrue(target.hasNode("some"));
-        assertTrue(target.hasNode("some/intermediate/path"));
-    }
-
-    @Test
     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\">" +
@@ -512,7 +193,7 @@ public class UserImportTest extends Abst
                 "</sv:node>" +
                 "</sv:node>";
 
-        doImport(GROUPPATH, xml);
+        doImport(getTargetPath(), xml);
 
         Group g = (Group) userMgr.getAuthorizable("g");
         assertNotNull(g);
@@ -547,7 +228,7 @@ public class UserImportTest extends Abst
                 "   </sv:node>" +
                 "</sv:node>";
 
-        doImport(GROUPPATH, xml);
+        doImport(getTargetPath(), xml);
 
         Group g = (Group) userMgr.getAuthorizable("g");
         assertNotNull(g);
@@ -565,11 +246,7 @@ public class UserImportTest extends Abst
 
     @Test
     public void testImportMembers() throws Exception {
-        Authorizable admin = userMgr.getAuthorizable("admin");
-        if (admin == null) {
-            throw new NotExecutableException();
-        }
-
+        Authorizable admin = checkNotNull(userMgr.getAuthorizable(UserConstants.DEFAULT_ADMIN_ID));
         String uuid = adminSession.getNode(admin.getPath()).getUUID();
         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\">" +
@@ -582,7 +259,7 @@ public class UserImportTest extends Abst
                 "   </sv:node>" +
                 "</sv:node>";
 
-        doImport(GROUPPATH, xml);
+        doImport(getTargetPath(), xml);
 
         Group g1 = (Group) userMgr.getAuthorizable("g1");
         assertNotNull(g1);
@@ -600,105 +277,6 @@ public class UserImportTest extends Abst
     }
 
     @Test
-    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>" +
-                "<sv:node sv:name=\"t\">" +
-                "   <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:principalName\" sv:type=\"String\"><sv:value>t</sv:value></sv:property>" +
-                "   <sv:property sv:name=\"rep:impersonators\" sv:type=\"String\"><sv:value>g</sv:value></sv:property>" +
-                "</sv:node>" +
-                "<sv:node sv:name=\"g\">" +
-                "   <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>b2f5ff47-4366-31b6-a533-d8dc3614845d</sv:value></sv:property>" +
-                "   <sv:property sv:name=\"rep:principalName\" sv:type=\"String\"><sv:value>g</sv:value></sv:property>" +
-                "</sv:node>" +
-                "</sv:node>";
-
-        doImport(USERPATH, xml);
-
-        Authorizable newUser = userMgr.getAuthorizable("t");
-        assertNotNull(newUser);
-
-        Authorizable u2 = userMgr.getAuthorizable("g");
-        assertNotNull(u2);
-
-        Subject subj = new Subject();
-        subj.getPrincipals().add(u2.getPrincipal());
-
-        Impersonation imp = ((User) newUser).getImpersonation();
-        assertTrue(imp.allows(subj));
-    }
-
-    @Test
-    public void testImportUuidCollisionRemoveExisting() throws Exception {
-        String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
-                "<sv:node sv:name=\"r\" 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>4b43b0ae-e356-34cd-95b9-10189b3dc231</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:node>";
-
-        doImport(USERPATH, xml);
-
-        // re-import should succeed if UUID-behavior is set accordingly
-        doImport(USERPATH, xml, ImportUUIDBehavior.IMPORT_UUID_COLLISION_REMOVE_EXISTING);
-
-        // saving changes of the import -> must succeed. add mandatory
-        // props should have been created.
-        adminSession.save();
-    }
-
-    /**
-     * Same as {@link #testImportUuidCollisionRemoveExisting} with the single
-     * difference that the initial import is saved before being overwritten.
-     *
-     * @throws Exception
-     */
-    @Test
-    public void testImportUuidCollisionRemoveExisting2() throws Exception {
-        String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
-                "<sv:node sv:name=\"r\" 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>4b43b0ae-e356-34cd-95b9-10189b3dc231</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:node>";
-        doImport(USERPATH, xml);
-        adminSession.save();
-
-        // re-import should succeed if UUID-behavior is set accordingly
-        doImport(USERPATH, xml, ImportUUIDBehavior.IMPORT_UUID_COLLISION_REMOVE_EXISTING);
-
-        // saving changes of the import -> must succeed. add mandatory
-        // props should have been created.
-        adminSession.save();
-    }
-
-    @Test
-    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>" +
-                "   <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:node>";
-
-        try {
-            doImport(USERPATH, xml);
-            doImport(USERPATH, xml, ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW);
-            fail("UUID collision must be handled according to the uuid behavior.");
-
-        } catch (ItemExistsException e) {
-            // success.
-        }
-    }
-
-    @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\">" +
@@ -724,18 +302,41 @@ public class UserImportTest extends Abst
                 "                 <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:node 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: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:node 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>" +
                 "</sv:node>";
 
         List<String> createdUsers = new LinkedList<String>();
-        Node target = adminSession.getNode(GROUPPATH);
+        Node target = getTargetNode();
         try {
             String[] users = {"angi", "adi", "hansi", "lisi", "luzi", "susi", "pipi", "hari", "gabi", "eddi",
                     "debbi", "cati", "admin", "anonymous"};
@@ -750,7 +351,7 @@ public class UserImportTest extends Abst
                 adminSession.save();
             }
 
-            doImport(GROUPPATH, xml);
+            doImport(getTargetPath(), xml);
             if (!userMgr.isAutoSave()) {
                 adminSession.save();
             }
@@ -773,15 +374,10 @@ public class UserImportTest extends Abst
                     a.remove();
                 }
             }
-            if (!userMgr.isAutoSave()) {
-                adminSession.save();
-            }
             for (NodeIterator it = target.getNodes(); it.hasNext(); ) {
                 it.nextNode().remove();
             }
-            if (!userMgr.isAutoSave()) {
-                adminSession.save();
-            }
+            adminSession.save();
         }
     }
 
@@ -789,31 +385,6 @@ public class UserImportTest extends Abst
      * @since OAK 1.0 : Importing rep:authorizableId
      */
     @Test
-    public void testImportUserWithAuthorizableId() 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>" +
-                "   <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:authorizableId\" sv:type=\"String\"><sv:value>t</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:node>";
-
-        doImport(USERPATH, xml);
-
-        Authorizable newUser = userMgr.getAuthorizable("t");
-        assertNotNull(newUser);
-        assertFalse(newUser.isGroup());
-        assertEquals("t", newUser.getID());
-        assertTrue(adminSession.propertyExists(newUser.getPath() + "/rep:authorizableId"));
-        assertEquals("t", adminSession.getProperty(newUser.getPath() + "/rep:authorizableId").getString());
-        adminSession.save();
-    }
-
-    /**
-     * @since OAK 1.0 : Importing rep:authorizableId
-     */
-    @Test
     public void testImportGroupWithAuthorizableId() 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\">" +
@@ -823,7 +394,7 @@ public class UserImportTest extends Abst
                 "   <sv:property sv:name=\"rep:authorizableId\" sv:type=\"String\"><sv:value>g</sv:value></sv:property>" +
                 "</sv:node>";
 
-        doImport(GROUPPATH, xml);
+        doImport(getTargetPath(), xml);
 
         Authorizable newGroup = userMgr.getAuthorizable("g");
         assertNotNull(newGroup);
@@ -834,112 +405,4 @@ public class UserImportTest extends Abst
 
         adminSession.save();
     }
-
-    /**
-     * @since OAK 1.0 : Importing rep:authorizableId
-     */
-    @Test
-    public void testImportUserWithIdDifferentFromNodeName() throws Exception {
-        String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
-                "<sv:node sv:name=\"t_diff\" 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:authorizableId\" sv:type=\"String\"><sv:value>t</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:node>";
-
-        doImport(USERPATH, xml);
-
-        Authorizable newUser = userMgr.getAuthorizable("t");
-
-        assertNotNull(newUser);
-        assertFalse(newUser.isGroup());
-        assertEquals("t", newUser.getID());
-        assertTrue(adminSession.propertyExists(newUser.getPath() + "/rep:authorizableId"));
-        assertEquals("t", adminSession.getProperty(newUser.getPath() + "/rep:authorizableId").getString());
-        adminSession.save();
-    }
-
-    /**
-     * Same as {@link #testImportUserWithIdDifferentFromNodeName} but with
-     * different order of properties.
-     *
-     * @since OAK 1.0 : Importing rep:authorizableId
-     */
-    @Test
-    public void testImportUserWithIdDifferentFromNodeName2() throws Exception {
-        String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
-                "<sv:node sv:name=\"t_diff\" 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:authorizableId\" sv:type=\"String\"><sv:value>t</sv:value></sv:property>" +
-                "</sv:node>";
-        doImport(USERPATH, xml);
-
-        Authorizable newUser = userMgr.getAuthorizable("t");
-
-        assertNotNull(newUser);
-        assertFalse(newUser.isGroup());
-        assertEquals("t", newUser.getID());
-        assertTrue(adminSession.propertyExists(newUser.getPath() + "/rep:authorizableId"));
-        assertEquals("t", adminSession.getProperty(newUser.getPath() + "/rep:authorizableId").getString());
-        adminSession.save();
-    }
-
-    /**
-     * @since OAK 1.0 : Importing rep:authorizableId
-     */
-    @Test
-    public void testImportUserWithExistingId() throws Exception {
-        String existingId = "admin";
-        String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
-                "<sv:node sv:name=\"t_diff\" 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:authorizableId\" sv:type=\"String\"><sv:value>" + existingId + "</sv:value></sv:property>" +
-                "</sv:node>";
-        try {
-            doImport(USERPATH, xml);
-            fail("Reuse of existing ID must be detected.");
-        } catch (AuthorizableExistsException e) {
-            // success
-        }
-    }
-
-    /**
-     * @since OAK 1.0 : Importing rep:authorizableId
-     */
-    @Test
-    public void testImportUserWithIdCollision() throws Exception {
-        String collidingId = "t";
-        String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
-                "<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>" +
-                "<sv:node sv:name=\"t1\" 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:authorizableId\" sv:type=\"String\"><sv:value>" + collidingId + "</sv:value></sv:property>" +
-                "</sv:node>" +
-                "<sv:node sv:name=\"t2\" 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>0f826a89-cf68-3399-85f4-cf320c1a5842</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:authorizableId\" sv:type=\"String\"><sv:value>" + collidingId + "</sv:value></sv:property>" +
-                "</sv:node>" +
-                "</sv:node>";
-        try {
-            doImport(USERPATH, xml);
-            fail("Reuse of existing ID must be detected.");
-        } catch (AuthorizableExistsException e) {
-            // success
-        }
-    }
 }



Mime
View raw message