Hi there,
I'm a big believer in black-box testing, and my application uses LDAP as a user
store. The embedded ApacheDS support is great, but it's not very black-box if
you have to modify the app to add a directory server. Since I use maven, I put
together a maven plugin that runs ApacheDS within the build. It'll go into
central sometime in the next 24 hours.
A simple example:
<plugin>
<groupId>ca.grimoire.maven</groupId>
<artifactId>apacheds-maven-plugin</artifactId>
<version>0.1</version>
<configuration>
<partitions>
<partition>
<id>example.com</id>
<baseDn>dc=example,dc=com</baseDn>
</partition>
</partitions>
<ldifDirectory>\${baseDir}/src/test/ldif/example.com.ldif</ldifDirectory>
</configuration>
<executions>
<execution>
<id>start-apache-ds</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>stop-apache-ds</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
Documentation:
http://alchemy.grimoire.ca/m2/sites/ca.grimoire.maven/apacheds-maven-plugin/
Source: http://bitbucket.org/ojacobson/apacheds-maven-plugin (Mercurial;
patches and bug reports welcome; MIT license).
Enjoy!
-o