conn.add(newEntry);
System.out.println("<======Added object: " + EXO_DEVELOPER_DN + " successfully.");
System.out.println("\nAdded object: " + EXO_DEVELOPER_DN + " successfully.");
LDAPSearchResults results = conn.search(DEVELOPER_UNIT_DN, // search only
// the object in
// the subtree of
// this dn
LDAPConnection.SCOPE_SUB, // return
// all the
// objects
// that
// match
// the
// filter
// criteria
// and in
// the sub
// tree
"(objectclass=person)", // query
// filter, (
// objectclass
// =*) for
// all the
// object
null, // return all the attributes
// of the object
false); // return attrs and values
// assertEquals("Expect to find 1 entry", 1, results.getCount()) ;
while (results.hasMore())
{
LDAPEntry nextEntry = null;
nextEntry = results.next();
System.out.println("\n entry: " + nextEntry.getDN());
System.out.println(" Attributes: ");
LDAPAttributeSet attrs = nextEntry.getAttributeSet();
printLDAPAttributeSet(attrs);
}
System.out.println(" ---> count: " + results.getCount());
System.out.println("<======search " + DEVELOPER_UNIT_DN + " successfully.");
// delete the new created ldap entry
conn.delete(EXO_DEVELOPER_DN);
conn.disconnect();
}