jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r758641 - in /jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/security/user: AbstractUserTest.java ImpersonationTest.java UserTest.java
Date Thu, 26 Mar 2009 13:44:20 GMT
Author: angela
Date: Thu Mar 26 13:44:10 2009
New Revision: 758641

URL: http://svn.apache.org/viewvc?rev=758641&view=rev
Log:
JCR-1588: Access Control

tests: missing session.logout

Modified:
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/security/user/AbstractUserTest.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/security/user/ImpersonationTest.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/security/user/UserTest.java

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/security/user/AbstractUserTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/security/user/AbstractUserTest.java?rev=758641&r1=758640&r2=758641&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/security/user/AbstractUserTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/security/user/AbstractUserTest.java
Thu Mar 26 13:44:10 2009
@@ -48,7 +48,12 @@
     protected void setUp() throws Exception {
         super.setUp();
 
-        userMgr = getUserManager(superuser);
+        try {
+            userMgr = getUserManager(superuser);
+        } catch (Exception e) {
+            superuser.logout();
+            throw e;
+        }
     }
 
     protected static UserManager getUserManager(Session session) throws RepositoryException,
NotExecutableException {

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/security/user/ImpersonationTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/security/user/ImpersonationTest.java?rev=758641&r1=758640&r2=758641&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/security/user/ImpersonationTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/security/user/ImpersonationTest.java
Thu Mar 26 13:44:10 2009
@@ -22,6 +22,7 @@
 
 import javax.jcr.Credentials;
 import javax.jcr.RepositoryException;
+import javax.jcr.Session;
 import javax.security.auth.Subject;
 import java.security.Principal;
 import java.util.Collections;
@@ -68,17 +69,27 @@
     }
 
     public void testImpersonateGroup() throws RepositoryException, NotExecutableException
{
-        Principal group = getTestGroup(helper.getReadOnlySession()).getPrincipal();
-        Subject subject = createSubject(group);
-        assertFalse("An group principal should not be allowed to impersonate.", impersonation.allows(subject));
+        Session s = helper.getReadOnlySession();
+        try {
+            Principal group = getTestGroup(s).getPrincipal();
+            Subject subject = createSubject(group);
+            assertFalse("An group principal should not be allowed to impersonate.", impersonation.allows(subject));
+        } finally {
+            s.logout();
+        }
     }
 
     public void testGrantImpersonationToGroupPrincipal() throws RepositoryException, NotExecutableException
{
-        Principal group = getTestGroup(helper.getReadOnlySession()).getPrincipal();
+        Session s = helper.getReadOnlySession();
         try {
-            assertFalse("Granting impersonation to a Group should not be successful.", impersonation.grantImpersonation(group));
-        }  finally {
-            impersonation.revokeImpersonation(group);
+            Principal group = getTestGroup(s).getPrincipal();
+            try {
+                assertFalse("Granting impersonation to a Group should not be successful.",
impersonation.grantImpersonation(group));
+            }  finally {
+                impersonation.revokeImpersonation(group);
+            }
+        } finally {
+            s.logout();
         }
     }
 

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/security/user/UserTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/security/user/UserTest.java?rev=758641&r1=758640&r2=758641&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/security/user/UserTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/security/user/UserTest.java
Thu Mar 26 13:44:10 2009
@@ -44,8 +44,13 @@
     }
 
     public void testReadOnlyIsntAdmin() throws NotExecutableException, RepositoryException
{
-        User user = getTestUser(helper.getReadOnlySession());
-        assertFalse(user.isAdmin());
+        Session s = helper.getReadOnlySession();
+        try {
+            User user = getTestUser(s);
+            assertFalse(user.isAdmin());
+        } finally {
+            s.logout();
+        }
     }
 
     public void testUserHasCredentials() throws RepositoryException, NotExecutableException
{



Mime
View raw message