jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r788446 - /jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/AccessManagerTest.java
Date Thu, 25 Jun 2009 17:30:18 GMT
Author: angela
Date: Thu Jun 25 17:30:18 2009
New Revision: 788446

URL: http://svn.apache.org/viewvc?rev=788446&view=rev
Log:
- add missing Session.logout to prevent ERROR in jcr.log
- minor improvement


Modified:
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/AccessManagerTest.java

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/AccessManagerTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/AccessManagerTest.java?rev=788446&r1=788445&r2=788446&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/AccessManagerTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/AccessManagerTest.java
Thu Jun 25 17:30:18 2009
@@ -37,6 +37,7 @@
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 import javax.jcr.ItemNotFoundException;
+import javax.jcr.NoSuchWorkspaceException;
 import java.util.Arrays;
 import java.util.HashSet;
 import java.util.Set;
@@ -114,14 +115,15 @@
 
     public void testCheckPermissionWithUnknowId() throws RepositoryException, NotExecutableException
{
         Session s = helper.getReadOnlySession();
-        AccessManager acMgr = getAccessManager(s);
-
         NodeId id = new NodeId(UUID.randomUUID());
         try {
+            AccessManager acMgr = getAccessManager(s);
             acMgr.checkPermission(id, AccessManager.READ);
             fail("AccessManager.checkPermission should throw ItemNotFoundException with a
random (unknown) item id.");
         } catch (ItemNotFoundException e) {
             // ok
+        } finally {
+            s.logout();
         }
     }
 
@@ -213,16 +215,18 @@
     public void testCanAccessNotExistingWorkspace() throws RepositoryException, NotExecutableException
{
         Session s = helper.getReadOnlySession();
         try {
-        List all = Arrays.asList(s.getWorkspace().getAccessibleWorkspaceNames());
-        String testName = "anyWorkspace";
-        int i = 0;
-        while (all.contains(testName)) {
-            testName = "anyWorkspace" + i;
-            i++;
-        }
-        assertFalse(getAccessManager(s).canAccess(testName));
+            List all = Arrays.asList(s.getWorkspace().getAccessibleWorkspaceNames());
+            String testName = "anyWorkspace";
+            int i = 0;
+            while (all.contains(testName)) {
+                testName = "anyWorkspace" + i;
+                i++;
+            }
+            assertFalse(getAccessManager(s).canAccess(testName));
+        } catch (NoSuchWorkspaceException e) {
+            // fine as well.
         } finally {
-        s.logout();
+            s.logout();
         }
     }
 



Mime
View raw message