List<Entry> actualOrder = new ArrayList<Entry>();
while ( cursor.next() )
{
SearchResultEntry se = ( SearchResultEntry ) cursor.get();
Entry entry = se.getEntry();
actualOrder.add( entry );
}
cursor.close();
// start deleting from the first entry
// SHOULD succeeded if the order is as expected
for( int i = 0; i < actualOrder.size(); i++ )
{
con.delete( actualOrder.get( i ).getDn() );
}
// now insert from the last entry, SHOULD succeed
for( int i = actualOrder.size() - 1; i >= 0; i-- )
{
con.add( actualOrder.get( i ) );
}
actualOrder.clear();
sk.setReverseOrder( true );
cursor = con.search( req );
while ( cursor.next() )
{
SearchResultEntry se = ( SearchResultEntry ) cursor.get();
Entry entry = se.getEntry();
actualOrder.add( entry );
}
// now delete again, this time from the end, SHOULD succeed
for( int i = actualOrder.size() - 1; i >= 0; i-- )