@Test
public void testSearchWithDerefAlias() throws Exception
{
SearchRequest searchRequest = new SearchRequestImpl();
searchRequest.setBase( new Dn( "ou=users,ou=system" ) );
searchRequest.setFilter( "(objectClass=*)" );
searchRequest.setScope( SearchScope.ONELEVEL );
searchRequest.addAttributes( "*" );
int count = 0;
Cursor<Response> cursor = connection.search( searchRequest );
while ( cursor.next() )
{
count++;
}
cursor.close();
// due to dereferencing of aliases we get only one entry
assertEquals( 2, count );
count = 0;
searchRequest.setDerefAliases( AliasDerefMode.NEVER_DEREF_ALIASES );
cursor = connection.search( searchRequest );
while ( cursor.next() )
{
count++;