// Use the client API as JNDI cannot be used to do a search without
// first binding. (hmmm, even client API won't allow searching without binding)
connection.bind( "uid=admin,ou=system", "secret" );
// Searches for all the entries in ou=system
EntryCursor cursor = connection.search( "uid=admin,ou=system", "(ObjectClass=*)",
SearchScope.OBJECT, "*" );
int i = 0;
while ( cursor.next() )
{
cursor.get();
++i;
}
cursor.close();
assertEquals( 1, i );
for ( int j = 0; j < 10000; j++ )
{
cursor = connection.search( "uid=admin,ou=system", "(ObjectClass=*)", SearchScope.OBJECT, "*" );
while ( cursor.next() )
{
}
cursor.close();
}
long t0 = System.currentTimeMillis();
int nbIterations = 200000;
for ( int j = 0; j < nbIterations; j++ )
{
if ( j % 10000 == 0 )
{
System.out.println( j );
}
cursor = connection.search( "uid=admin,ou=system", "(ObjectClass=*)", SearchScope.OBJECT, "*" );
while ( cursor.next() )
{
}
cursor.close();
}
long t1 = System.currentTimeMillis();
Long deltaWarmed = ( t1 - t0 );