TCK: ImpersonateTest#testImpersonate should allow LoginException
----------------------------------------------------------------

                 Key: JCR-498
                 URL: http://issues.apache.org/jira/browse/JCR-498
             Project: Jackrabbit
          Issue Type: Bug
          Components: test
            Reporter: David Pitfield


JSR-170 allows Session.impersonate to throw LoginException if the session lacks 
permission to impersonate another user.  Some repositories may not allow any 
session to impersonate another user, in which case this test would fail.

Proposal: catch and consume LoginException.

--- ImpersonateTest.java        (revision 422074)
+++ ImpersonateTest.java        (working copy)
@@ -17,11 +17,13 @@
 package org.apache.jackrabbit.test.api;
  
 import org.apache.jackrabbit.test.AbstractJCRTest;
+import org.apache.jackrabbit.test.NotExecutableException;
  
 import javax.jcr.Session;
 import javax.jcr.Credentials;
 import javax.jcr.NodeIterator;
 import javax.jcr.Node;
+import javax.jcr.LoginException;
 import java.security.AccessControlException;
  
 /**
@@ -40,7 +42,14 @@
      */
     public void testImpersonate() throws Exception {
         // impersonate to read-only user
-        Session session = 
superuser.impersonate(helper.getReadOnlyCredentials());
+        Session session = null;
+
+        try {
+            session = superuser.impersonate(helper.getReadOnlyCredentials());
+        }
+        catch (LoginException e) {
+          throw new NotExecutableException("impersonate threw LoginException");
+        }
  
         // get a path to test the permissions on
         String thePath = "";


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to