Using embedded OpenDJ for unit / integration testing

This topic has 2 replies, 2 voices, and was last updated 7 years, 5 months ago by Gregory Wright.

  • Author
  • #3358
     Gregory Wright

    We’re using OpenDJ to provide the LDAP infrastructure for a project we’re working on, and want to be able to test our LDAP client code against an embedded OpenDJ instance within our Continuous Integration (CI) builds (much like one would test database client code against an embedded database like H2). Unfortunately we haven’t been able to find much in the way of examples of how to do this.

    Our environment:

    * Java 1.8
    * Maven 3.2.5
    * Spring Boot 1.2.1

    The one “full example” example we have been able to find ( appears to use a full-blown installation of OpenDJ server (version 2.4.x). Attempts we’ve made at building the example project using the ForgeRock repositories and the current stable release version have been stymied.

    We’d like to be able to just simply pull in opendj-core as discussed on the OpenDJ LDAP SDK wiki page (, but it isn’t quite clear what configuration files are truly required to spin up a functioning minimal embedded OpenDJ server instance. The “full example” above has many configuration files, but it’s not clear which are actually necessary.

    Any direction, including pointers to working examples or documentation would be greatly appreciated.



    It’s been a while since I’ve tried to build an app with an embedded version of OpenDJ. But OpenAM does it in its nightly builds and releases with 2.6 so I’m guessing it’s working fine.
    The example provided by Emmanuel (aka ehsavoie) should work, although OpenDJ 2.6.0 has an issue with Java 8 when installing (api to create certificates has changed package in Java 8).

    What’s in the OpenDJ LDAP SDK is more of a self contain, very simple in memory example server that we use to test some of the SDK and tools. It seems the javadoc is not fully accurate, but reading the code, it doesn’t need much beyond a listen address and port number, and an LDIF file that contains that to load in the memory backend.

    I hope this helps.

     Gregory Wright

    Thank you Ludo, the MemoryBackend seems to do the trick, at least for testing our direct interactions with LDAP. The next step will be to see if we can wire it into Spring Security for integration tests.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

©2022 ForgeRock - we provide an identity and access platform to secure every online relationship for the enterprise market, educational sector and even entire countries. Click to view our privacy policy and terms of use.

Log in with your credentials

Forgot your details?