You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2007/02/15 21:26:36 UTC
svn commit: r508126 -
/directory/apacheds/branches/1.0/core-unit/src/test/java/org/apache/directory/server/core/jndi/SearchITest.java
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();
}
}
}