Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 61858 invoked from network); 15 Feb 2007 20:27:09 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 15 Feb 2007 20:27:08 -0000 Received: (qmail 78730 invoked by uid 500); 15 Feb 2007 20:27:07 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 78671 invoked by uid 500); 15 Feb 2007 20:27:07 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 78647 invoked by uid 99); 15 Feb 2007 20:27:07 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Feb 2007 12:27:07 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Feb 2007 12:26:57 -0800 Received: by eris.apache.org (Postfix, from userid 65534) id C834F1A981A; Thu, 15 Feb 2007 12:26:36 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r508126 - /directory/apacheds/branches/1.0/core-unit/src/test/java/org/apache/directory/server/core/jndi/SearchITest.java Date: Thu, 15 Feb 2007 20:26:36 -0000 To: commits@directory.apache.org From: elecharny@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070215202636.C834F1A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: elecharny Date: Thu Feb 15 12:26:35 2007 New Revision: 508126 URL: http://svn.apache.org/viewvc?view=rev&rev=508126 Log: Fix DIRSERVER-856 and DIRSERVER-836 again. It's basically a revert of commit 507352, but loging some warning and keeping the GlobalOidRegistry modification Modified: directory/apacheds/branches/1.0/core-unit/src/test/java/org/apache/directory/server/core/jndi/SearchITest.java Modified: directory/apacheds/branches/1.0/core-unit/src/test/java/org/apache/directory/server/core/jndi/SearchITest.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/1.0/core-unit/src/test/java/org/apache/directory/server/core/jndi/SearchITest.java?view=diff&rev=508126&r1=508125&r2=508126 ============================================================================== --- directory/apacheds/branches/1.0/core-unit/src/test/java/org/apache/directory/server/core/jndi/SearchITest.java (original) +++ directory/apacheds/branches/1.0/core-unit/src/test/java/org/apache/directory/server/core/jndi/SearchITest.java Thu Feb 15 12:26:35 2007 @@ -262,20 +262,35 @@ ctls.setSearchScope( SearchControls.OBJECT_SCOPE ); ctls.setReturningAttributes( new String[] { "cn", "unknownAttribute" } ); - NamingEnumeration result = null; + NamingEnumeration list = null; + HashMap map = new HashMap(); + try { - result = sysRoot.search( rdn, filter, ctls ); - fail( "should never get here due to an invalid attribute exception" ); + list = sysRoot.search( rdn, filter, ctls ); + + while ( list.hasMore() ) + { + SearchResult result = ( SearchResult ) list.next(); + map.put( result.getName(), result.getAttributes() ); + } + + assertEquals( "Expected number of results returned was incorrect!", 1, map.size() ); + + Attributes attrs = (Attributes)map.get( "cn=Heather Nova,ou=system" ); + + assertNotNull( attrs.get( "cn" ) ); + assertNull( attrs.get( "unknownAttribute" ) ); } catch ( LdapInvalidAttributeIdentifierException e ) { + fail( "should never get here due to an invalid attribute exception: it should be simply ignored" ); } finally { - if ( result != null ) + if ( list != null ) { - result.close(); + list.close(); } } } @@ -290,20 +305,34 @@ ctls.setSearchScope( SearchControls.OBJECT_SCOPE ); ctls.setReturningAttributes( new String[] { "cn", "sn;unknownOption" } ); - NamingEnumeration result = null; + NamingEnumeration list = null; + HashMap map = new HashMap(); + try { - result = sysRoot.search( rdn, filter, ctls ); - fail( "should never get here due to an invalid attribute exception" ); + list = sysRoot.search( rdn, filter, ctls ); + while ( list.hasMore() ) + { + SearchResult result = ( SearchResult ) list.next(); + map.put( result.getName(), result.getAttributes() ); + } + + assertEquals( "Expected number of results returned was incorrect!", 1, map.size() ); + + Attributes attrs = (Attributes)map.get( "cn=Heather Nova,ou=system" ); + + assertNotNull( attrs.get( "cn" ) ); + assertNull( attrs.get( "unknownAttribute" ) ); } catch ( LdapInvalidAttributeIdentifierException e ) { + fail( "should never get here due to an invalid attribute exception: it should be simply ignored" ); } finally { - if ( result != null ) + if ( list != null ) { - result.close(); + list.close(); } } }