Entry personEntry = getPersonEntry( "Bush", "Kate#Bush" );
String dn = "cn=Kate\\#Bush,ou=system";
personEntry.setDn( new Dn( dn ) );
connection.add( personEntry );
EntryCursor cursor = connection.search( "ou=system", "(cn=Kate#Bush)", SearchScope.SUBTREE, "*" );
boolean entryFound = false;
while ( cursor.next() )
{
Entry entry = cursor.get();
entryFound = true;
assertTrue( personEntry.getDn().equals( entry.getDn() ) );
Attribute cn = entry.get( "cn" );
assertNotNull( cn );
assertTrue( cn.contains( "Kate#Bush" ) );
}
cursor.close();
assertTrue( "entry found", entryFound );
connection.delete( dn );
connection.close();