Return-Path: Delivered-To: apmail-jackrabbit-commits-archive@www.apache.org Received: (qmail 79225 invoked from network); 26 Mar 2009 14:04:03 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 26 Mar 2009 14:04:03 -0000 Received: (qmail 84242 invoked by uid 500); 26 Mar 2009 14:04:02 -0000 Delivered-To: apmail-jackrabbit-commits-archive@jackrabbit.apache.org Received: (qmail 84183 invoked by uid 500); 26 Mar 2009 14:04:02 -0000 Mailing-List: contact commits-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jackrabbit.apache.org Delivered-To: mailing list commits@jackrabbit.apache.org Received: (qmail 84174 invoked by uid 99); 26 Mar 2009 14:04:02 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 26 Mar 2009 14:04:02 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 26 Mar 2009 14:04:00 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 2DC9423888EB; Thu, 26 Mar 2009 14:03:39 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r758649 - /jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/security/AccessControlListTest.java Date: Thu, 26 Mar 2009 14:03:32 -0000 To: commits@jackrabbit.apache.org From: angela@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090326140339.2DC9423888EB@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: angela Date: Thu Mar 26 14:03:23 2009 New Revision: 758649 URL: http://svn.apache.org/viewvc?rev=758649&view=rev Log: JCR-1588: Access Control tests: missing session.logout in case of failing setup Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/security/AccessControlListTest.java Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/security/AccessControlListTest.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/security/AccessControlListTest.java?rev=758649&r1=758648&r2=758649&view=diff ============================================================================== --- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/security/AccessControlListTest.java (original) +++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/security/AccessControlListTest.java Thu Mar 26 14:03:23 2009 @@ -25,7 +25,6 @@ import javax.jcr.AccessDeniedException; import javax.jcr.Node; import javax.jcr.RepositoryException; -import javax.jcr.Session; import java.security.Principal; import java.security.acl.Group; import java.util.ArrayList; @@ -53,36 +52,41 @@ //checkSupportedOption(Repository.OPTION_ACCESS_CONTROL_SUPPORTED); super.setUp(); - // TODO: retrieve targetPath from configuration - Node n = testRootNode.addNode(nodeName1, testNodeType); - superuser.save(); - path = n.getPath(); - - privs = acMgr.getSupportedPrivileges(path); - if (privs.length == 0) { - throw new NotExecutableException("No supported privileges at absPath " + path); - } - // TODO: make sure, entries to ADD are not present yet. // TODO: retrieve principal name from tck-Configuration // TODO: get rid of SessionImpl dependency - Session s = superuser; - if (s instanceof SessionImpl) { - for (Iterator it = ((SessionImpl) s).getSubject().getPrincipals().iterator(); it.hasNext();) { - Principal p = (Principal) it.next(); - if (!(p instanceof Group)) { - testPrincipal = p; - } + try { + // TODO: retrieve targetPath from configuration + Node n = testRootNode.addNode(nodeName1, testNodeType); + superuser.save(); + path = n.getPath(); + + privs = acMgr.getSupportedPrivileges(path); + + if (privs.length == 0) { + throw new NotExecutableException("No supported privileges at absPath " + path); } - if (testPrincipal == null) { - throw new NotExecutableException("Test principal missing."); + + if (superuser instanceof SessionImpl) { + for (Iterator it = ((SessionImpl) superuser).getSubject().getPrincipals().iterator(); it.hasNext();) { + Principal p = (Principal) it.next(); + if (!(p instanceof Group)) { + testPrincipal = p; + } + } + if (testPrincipal == null) { + throw new NotExecutableException("Test principal missing."); + } + } else { + throw new NotExecutableException("SessionImpl expected"); } - } else { - throw new NotExecutableException("SessionImpl expected"); - } - // remember existing entries for test-principal -> later restore. - privilegesToRestore = currentPrivileges(getList(acMgr, path), testPrincipal); + // remember existing entries for test-principal -> later restore. + privilegesToRestore = currentPrivileges(getList(acMgr, path), testPrincipal); + } catch (Exception e) { + superuser.logout(); + throw e; + } } protected void tearDown() throws Exception {