UnboundID LDAP SDK for Java

Ping Identity
Product Information
Advantages of the LDAP SDK

Testing Support Classes

When developing a directory-enabled application, having test cases that ensure that the application works correctly can be just as important as the code for the application itself. The UnboundID LDAP SDK for Java aims to make it as easy and convenient as possible to write such test cases so that you can get the greatest efficiency from the time you spend writing those tests.

One of the most significant testing-related features that the LDAP SDK provides is the in-memory directory server. This is an extremely lightweight yet reasonably standards-compliant LDAP server that you can easily create, manage and manipulate using Java code. It is easy to populate the server with a set of test data, exercise those portions of your application which perform LDAP communication, and then confirm that the content of the server is what you expect it to be. In many ways, it can be more convenient to use this in-memory server than the server because you can interact with this server entirely from within your test code so there is no need to coordinate with an external server.

Another key feature that the UnboundID LDAP SDK for Java provides to make testing easier is the LDAPTestUtils class. This class provides a number of convenience and utility methods that can be used to make assertions about the contents of a directory server (e.g., to ensure that the appropriate entries exist and have the expected content), to easily create various kinds of entries (e.g., users, groups, organizations, organizational units, etc.) for testing purposes, and for ensuring that operations return the expected results. Many of the methods in this class for verifying server content are also included in the in-memory directory server for further convenience when using it.

Another testing convenience that the LDAP SDK provides is the ability to easily create entries and modifications from their LDIF representations. This isn't something that is particularly useful in real-world applications, but it is useful for test code when you know exactly the contents of the entries that you want to create or the types of changes you want to apply to them.