@Test
public void testSubDn() throws Exception
{
connection.loadSchema();
EntryCursor cursor = connection.search( "ou=system", "(cn=user1)", SearchScope.SUBTREE, "publicKey" );
assertTrue( cursor.next() );
Entry entry = cursor.get();
assertEquals( "cn=user1,ou=system", entry.getDn().getName() );
cursor.close();
SearchRequest req = new SearchRequestImpl();
req.setScope( SearchScope.SUBTREE );
req.addAttributes( "*" );
req.setTimeLimit( 0 );
req.setBase( new Dn( "ou=system" ) );
req.setFilter( "(cn=user1)" );
SearchCursor searchCursor = connection.search( req );
assertTrue( searchCursor.next() );
Response response = searchCursor.get();
Entry resultEntry = ( ( SearchResultEntry ) response ).getEntry();
assertEquals( "cn=user1,ou=system", resultEntry.getDn().getName() );
cursor.close();
}