directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lucas Theisen <>
Subject LdapConnectionTemplate
Date Sat, 10 May 2014 21:18:08 GMT

I just committed the code for LdapConnectionTemplate.  It is similar in
concept to JdbcTemplate from Spring with the goal of reducing the
boilerplate code.  I added all the CRUD operations with a couple friendly
overloads.  I also added some methods for dealing with authentication and
password updates that respects password policy.  Would you let me know if I
missed something?

Also, in doing this, I made some updates to the testing infrastructure.  To
start with, I added a new annotation @CreateLdapConnectionPool that allows
you to configure a connection pool for your unit tests.  Then I created 3
new TestRule's that can be used in place of the FrameworkRunner:
CreateDsRule, CreateLdapServerRule, and CreateLdapConnectionPoolRule.
CreateLdapConnectionPoolRule extends CreateLdapServerRule, which in turn
extends CreateDsRule.  That means if you use CreateLdapConnectionPoolRule
you get all of the annotation processing it has, plus that of
CreateLdapServerRue, which in turn, provides that of CreateDsRule.  You
will need to create 2 instances of the rule you want to use, one should be
annotated with @ClassRule, one with @TestRule.  The @TestRule instance
should be constructed with the @ClassRule instance as an argument to its
constructor.  This allows you to annotate both at a class level, and a
method level.  While this might sound like a little more work than using
the FrameworkRunner, it means you will now be free to incorporate other
runners (like the Spring test runner) and you no longer have to extend any
base class. I put together some unit tests in the test-framework project
that demonstrate how to use them.

Anyway, I would love to hear what you all think about this stuff.


View raw message