private void injectLdifFiles(DirectoryService service, String... ldifFiles) throws Exception {
        try { fixLNNFE(service); } catch (Exception llne) { }

        if (ldifFiles != null && ldifFiles.length > 0) {
            for (String ldifFile : ldifFiles) {
                InputStream is = null;
                try {
                    is = ApimanLdapServer.class.getClassLoader().getResourceAsStream(ldifFile);
                    if (is == null) {
                        throw new FileNotFoundException("LDIF file '" + ldifFile + "' not found.");
                    } else {
                        try {
                            LdifReader ldifReader = new LdifReader(is);
                            for (LdifEntry entry : ldifReader) {
                                injectEntry(entry, service);
                            }
                            ldifReader.close();
                        } catch (Exception e) {
                            throw new RuntimeException(e);
                        }
                    }
                } finally {
                    IOUtils.closeQuietly(is);
                }
            }
        }
    }
A simple ldap server.

@author eric.wittmann@redhat.com
tools/ldap/src/main/java/io/apiman/tools/ldap/ApimanLdapServer.java