Hi
I run into trouble using LdapTemplate's searchForSingleEntry and the
way the distinguished name is constructed there: for searches that
returned the search base (it is a borderline issue) I would get
',search base' -- note the comma in front. So I revised the
searchForSingleEntry method, see the attached patch, also I made unit
tests for this, but I found no way to run them against RC3 or 1.0 of
Apache Directory Server; basically I added these two fixtures:

   public void testSearchForSingleEntryImmediateDn() {
        final String expectedDn = "uid=ben,ou=people,dc=acegisecurity,dc=org";

       Object entry = template.searchForSingleEntry("ou=people",
"(uid={0})", new String[] {"ben"}, new LdapEntryMapper() {
                        public Object mapAttributes(String dn, Attributes 
attributes) {
                                assertEquals(expectedDn, dn);
                                return null;
                        }
                });
   }

   public void testSearchForSingleEntryRelativeDn() {
        final String expectedDn = "uid=ben,ou=people,dc=acegisecurity,dc=org";

       Object entry = template.searchForSingleEntry("ou=people",
"(uid={0})", new String[] {"ben"}, new LdapEntryMapper() {
                        public Object mapAttributes(String dn, Attributes 
attributes) {
                                assertEquals(expectedDn, dn);
                                return null;
                        }
                });
   }

I hope I did not break anything,

zoran
--
Human by day user by night

Attachment: LdapTemplate.patch
Description: Binary data

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Home: http://acegisecurity.org
Acegisecurity-developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/acegisecurity-developer

Reply via email to