public void testSimpleSearchWithControl() throws Exception
{
SearchRequest searchRequest = new SearchRequestImpl().setBase( new Dn( "ou=system" ) )
.setFilter( "(objectclass=*)" )
.setScope( SearchScope.ONELEVEL ).addControl( new ManageDsaITImpl() );
SearchCursor cursor = connection.search( searchRequest );
int count = 0;
while ( cursor.next() )
{
Response response = cursor.get();
assertNotNull( response );
if ( response instanceof SearchResultEntry )
{
Entry entry = ( ( SearchResultEntry ) response ).getEntry();
assertNotNull( entry );
}
count++;
}
SearchResultDone done = cursor.getSearchResultDone();
assertNotNull( done );
assertEquals( ResultCodeEnum.SUCCESS, done.getLdapResult().getResultCode() );
assertEquals( 5, count );
cursor.close();
}