Class InMemoryDirectoryServer

java.lang.Object
com.unboundid.ldap.listener.InMemoryDirectoryServer
All Implemented Interfaces:
FullLDAPInterface, LDAPInterface, Closeable, AutoCloseable

This class provides a utility that may be used to create a simple LDAP server instance that will hold all of its information in memory. It is intended to be very easy to use, particularly as an embeddable server for testing directory-enabled applications. It can be easily created, configured, populated, and shut down with only a few lines of code, and it provides a number of convenience methods that can be very helpful in writing test cases that validate the content of the server.

Some notes about the capabilities of this server:
  • It provides reasonably complete support for add, compare, delete, modify, modify DN (including new superior and subtree move/rename), search, and unbind operations.
  • It will accept abandon requests, but will not do anything with them.
  • It provides support for simple bind operations, and for the SASL PLAIN mechanism. It also provides an API that can be used to add support for additional SASL mechanisms.
  • It provides support for the password modify, StartTLS, and "who am I?" extended operations, as well as an API that can be used to add support for additional types of extended operations.
  • It provides support for the LDAP assertions, authorization identity, don't use copy, manage DSA IT, permissive modify, pre-read, post-read, proxied authorization v1 and v2, server-side sort, simple paged results, LDAP subentries, subtree delete, and virtual list view request controls.
  • It supports the use of schema (if provided), but it does not currently allow updating the schema on the fly.
  • It has the ability to maintain a log of operations processed, as a simple access log, a more detailed LDAP debug log, or even a log with generated code that may be used to construct and issue the requests received by clients.
  • It has the ability to maintain an LDAP-accessible changelog.
  • It provides an option to generate a number of operational attributes, including entryDN, entryUUID, creatorsName, createTimestamp, modifiersName, modifyTimestamp, and subschemaSubentry.
  • It provides support for referential integrity, in which case specified attributes whose values are DNs may be updated if the entries they reference are deleted or renamed.
  • It provides methods for importing data from and exporting data to LDIF files, and it has the ability to capture a point-in-time snapshot of the data (including changelog information) that may be restored at any point.
  • It implements the FullLDAPInterface interface, which means that in many cases it can be used as a drop-in replacement for an LDAPConnection.


In order to create an in-memory directory server instance, you should first create an InMemoryDirectoryServerConfig object with the desired settings. Then use that configuration object to initialize the directory server instance, and call the startListening() method to start accepting connections from LDAP clients. The getConnection() and getConnectionPool(int) methods may be used to obtain connections to the server and you can also manually create connections using the information obtained via the getListenAddress(), getListenPort(), and getClientSocketFactory() methods. When the server is no longer needed, the shutDown(boolean) method should be used to stop the server. Any number of in-memory directory server instances can be created and running in a single JVM at any time, and many of the methods provided in this class can be used without the server running if operations are to be performed using only method calls rather than via LDAP clients.

Example

The following example demonstrates the process that can be used to create, start, and use an in-memory directory server instance, including support for secure communication using both SSL and StartTLS:
 // Create a base configuration for the server.
 InMemoryDirectoryServerConfig config =
      new InMemoryDirectoryServerConfig("dc=example,dc=com");
 config.addAdditionalBindCredentials("cn=Directory Manager",
      "password");

 // Update the configuration to support LDAP (with StartTLS) and LDAPS
 // listeners.
 final SSLUtil serverSSLUtil = new SSLUtil(
      new KeyStoreKeyManager(serverKeyStorePath, serverKeyStorePIN, "JKS",
           "server-cert"),
      new TrustStoreTrustManager(serverTrustStorePath));
 final SSLUtil clientSSLUtil = new SSLUtil(
      new TrustStoreTrustManager(clientTrustStorePath));
 config.setListenerConfigs(
      InMemoryListenerConfig.createLDAPConfig("LDAP", // Listener name
           null, // Listen address. (null = listen on all interfaces)
           0, // Listen port (0 = automatically choose an available port)
           serverSSLUtil.createSSLSocketFactory()), // StartTLS factory
      InMemoryListenerConfig.createLDAPSConfig("LDAPS", // Listener name
           null, // Listen address. (null = listen on all interfaces)
           0, // Listen port (0 = automatically choose an available port)
           serverSSLUtil.createSSLServerSocketFactory(), // Server factory
           clientSSLUtil.createSSLSocketFactory())); // Client factory

 // Create and start the server instance and populate it with an initial set
 // of data from an LDIF file.
 InMemoryDirectoryServer server = new InMemoryDirectoryServer(config);
 server.importFromLDIF(true, ldifFilePath);

 // Start the server so it will accept client connections.
 server.startListening();

 // Get an unencrypted connection to the server's LDAP listener, then use
 // StartTLS to secure that connection.  Make sure the connection is usable
 // by retrieving the server root DSE.
 LDAPConnection connection = server.getConnection("LDAP");
 connection.processExtendedOperation(new StartTLSExtendedRequest(
      clientSSLUtil.createSSLContext()));
 LDAPTestUtils.assertEntryExists(connection, "");
 connection.close();

 // Establish an SSL-based connection to the LDAPS listener, and make sure
 // that connection is also usable.
 connection = server.getConnection("LDAPS");
 LDAPTestUtils.assertEntryExists(connection, "");
 connection.close();

 // Shut down the server so that it will no longer accept client
 // connections, and close all existing connections.
 server.shutDown(true);
 
  • Constructor Details

    • InMemoryDirectoryServer

      Creates a very simple instance of an in-memory directory server with the specified set of base DNs. It will not use a well-defined schema, and will pick a listen port at random.
      Parameters:
      baseDNs - The base DNs to use for the server. It must not be null or empty.
      Throws:
      LDAPException - If a problem occurs while attempting to initialize the server.
    • InMemoryDirectoryServer

      Creates a new instance of an in-memory directory server with the provided configuration.
      Parameters:
      cfg - The configuration to use for the server. It must not be null.
      Throws:
      LDAPException - If a problem occurs while trying to initialize the directory server with the provided configuration.
  • Method Details

    • startListening

      public void startListening() throws LDAPException
      Attempts to start listening for client connections on all configured listeners. Any listeners that are already running will be unaffected.
      Throws:
      LDAPException - If a problem occurs while attempting to create any of the configured listeners. Even if an exception is thrown, then as many listeners as possible will be started.
    • startListening

      public void startListening(@NotNull String listenerName) throws LDAPException
      Attempts to start listening for client connections on the specified listener. If the listener is already running, then it will be unaffected.
      Parameters:
      listenerName - The name of the listener to be started. It must not be null.
      Throws:
      LDAPException - If a problem occurs while attempting to start the requested listener.
    • close

      public void close()
      Closes the associated interface and frees any resources associated with it. This method may be safely called multiple times, but the associated interface should not be used after it has been closed.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in interface FullLDAPInterface
    • closeAllConnections

      public void closeAllConnections(boolean sendNoticeOfDisconnection)
      Closes all connections that are currently established to the server. This has no effect on the ability to accept new connections.
      Parameters:
      sendNoticeOfDisconnection - Indicates whether to send the client a notice of disconnection unsolicited notification before closing the connection.
    • shutDown

      public void shutDown(boolean closeExistingConnections)
      Shuts down all configured listeners. Any listeners that are already stopped will be unaffected.
      Parameters:
      closeExistingConnections - Indicates whether to close all existing connections, or merely to stop accepting new connections.
    • shutDown

      public void shutDown(@NotNull String listenerName, boolean closeExistingConnections)
      Shuts down the specified listener. If there is no such listener defined, or if the specified listener is not running, then no action will be taken.
      Parameters:
      listenerName - The name of the listener to be shut down. It must not be null.
      closeExistingConnections - Indicates whether to close all existing connections, or merely to stop accepting new connections.
    • restartServer

      public void restartServer() throws LDAPException
      Attempts to restart all listeners defined in the server. All running listeners will be stopped, and all configured listeners will be started.
      Throws:
      LDAPException - If a problem occurs while attempting to restart any of the listeners. Even if an exception is thrown, as many listeners as possible will be started.
    • restartListener

      public void restartListener(@NotNull String listenerName) throws LDAPException
      Attempts to restart the specified listener. If it is running, it will be stopped. It will then be started.
      Parameters:
      listenerName - The name of the listener to be restarted. It must not be null.
      Throws:
      LDAPException - If a problem occurs while attempting to restart the specified listener.
    • getConfig

      Retrieves a read-only representation of the configuration used to create this in-memory directory server instance.
      Returns:
      A read-only representation of the configuration used to create this in-memory directory server instance.
    • createSnapshot

      Creates a point-in-time snapshot of the information contained in this in-memory directory server instance. It may be restored using the restoreSnapshot(com.unboundid.ldap.listener.InMemoryDirectoryServerSnapshot) method.

      This method may be used regardless of whether the server is listening for client connections.
      Returns:
      The snapshot created based on the current content of this in-memory directory server instance.
    • restoreSnapshot

      Restores the this in-memory directory server instance to match the content it held at the time the snapshot was created.

      This method may be used regardless of whether the server is listening for client connections.
      Parameters:
      snapshot - The snapshot to be restored. It must not be null.
    • getBaseDNs

      Retrieves the list of base DNs configured for use by the server.
      Returns:
      The list of base DNs configured for use by the server.
    • getConnection

      Attempts to establish a client connection to the server. If multiple listeners are configured, then it will attempt to establish a connection to the first configured listener that is running.
      Returns:
      The client connection that has been established.
      Throws:
      LDAPException - If a problem is encountered while attempting to create the connection.
    • getConnection

      Attempts to establish a client connection to the server.
      Parameters:
      options - The connection options to use when creating the connection. It may be null if a default set of options should be used.
      Returns:
      The client connection that has been established.
      Throws:
      LDAPException - If a problem is encountered while attempting to create the connection.
    • getConnection

      Attempts to establish a client connection to the specified listener.
      Parameters:
      listenerName - The name of the listener to which to establish the connection. It may be null if a connection should be established to the first available listener.
      Returns:
      The client connection that has been established.
      Throws:
      LDAPException - If a problem is encountered while attempting to create the connection.
    • getConnection

      Attempts to establish a client connection to the specified listener.
      Parameters:
      listenerName - The name of the listener to which to establish the connection. It may be null if a connection should be established to the first available listener.
      options - The set of LDAP connection options to use for the connection that is created.
      Returns:
      The client connection that has been established.
      Throws:
      LDAPException - If a problem is encountered while attempting to create the connection.
    • getConnectionPool

      @NotNull public LDAPConnectionPool getConnectionPool(int maxConnections) throws LDAPException
      Attempts to establish a connection pool to the server with the specified maximum number of connections.
      Parameters:
      maxConnections - The maximum number of connections to maintain in the connection pool. It must be greater than or equal to one.
      Returns:
      The connection pool that has been created.
      Throws:
      LDAPException - If a problem occurs while attempting to create the connection pool.
    • getConnectionPool

      @NotNull public LDAPConnectionPool getConnectionPool(@Nullable String listenerName, @Nullable LDAPConnectionOptions options, int initialConnections, int maxConnections) throws LDAPException
      Attempts to establish a connection pool to the server with the provided settings.
      Parameters:
      listenerName - The name of the listener to which the connections should be established.
      options - The connection options to use when creating connections for use in the pool. It may be null if a default set of options should be used.
      initialConnections - The initial number of connections to establish in the connection pool. It must be greater than or equal to one.
      maxConnections - The maximum number of connections to maintain in the connection pool. It must be greater than or equal to the initial number of connections.
      Returns:
      The connection pool that has been created.
      Throws:
      LDAPException - If a problem occurs while attempting to create the connection pool.
    • getListenAddress

      Retrieves the configured listen address for the first active listener, if defined.
      Returns:
      The configured listen address for the first active listener, or null if that listener does not have an explicitly-configured listen address or there are no active listeners.
    • getListenAddress

      Retrieves the configured listen address for the specified listener, if defined.
      Parameters:
      listenerName - The name of the listener for which to retrieve the listen address. It may be null in order to obtain the listen address for the first active listener.
      Returns:
      The configured listen address for the specified listener, or null if there is no such listener or the listener does not have an explicitly-configured listen address.
    • getListenPort

      public int getListenPort()
      Retrieves the configured listen port for the first active listener.
      Returns:
      The configured listen port for the first active listener, or -1 if there are no active listeners.
    • getListenPort

      public int getListenPort(@Nullable String listenerName)
      Retrieves the configured listen port for the specified listener, if available.
      Parameters:
      listenerName - The name of the listener for which to retrieve the listen port. It may be null in order to obtain the listen port for the first active listener.
      Returns:
      The configured listen port for the specified listener, or -1 if there is no such listener or the listener is not active.
    • getClientSocketFactory

      Retrieves the configured client socket factory for the first active listener.
      Returns:
      The configured client socket factory for the first active listener, or null if that listener does not have an explicitly-configured socket factory or there are no active listeners.
    • getClientSocketFactory

      Retrieves the configured client socket factory for the specified listener, if available.
      Parameters:
      listenerName - The name of the listener for which to retrieve the client socket factory. It may be null in order to obtain the client socket factory for the first active listener.
      Returns:
      The configured client socket factory for the specified listener, or null if there is no such listener or that listener does not have an explicitly-configured client socket factory.
    • getProcessingDelayMillis

      public long getProcessingDelayMillis()
      Retrieves the delay in milliseconds that the server should impose before beginning processing for operations.
      Returns:
      The delay in milliseconds that the server should impose before beginning processing for operations, or 0 if there should be no delay inserted when processing operations.
    • setProcessingDelayMillis

      public void setProcessingDelayMillis(long processingDelayMillis)
      Specifies the delay in milliseconds that the server should impose before beginning processing for operations.
      Parameters:
      processingDelayMillis - The delay in milliseconds that the server should impose before beginning processing for operations. A value less than or equal to zero may be used to indicate that there should be no delay.
    • countEntries

      public int countEntries()
      Retrieves the number of entries currently held in the server. The count returned will not include entries which are part of the changelog.

      This method may be used regardless of whether the server is listening for client connections.
      Returns:
      The number of entries currently held in the server.
    • countEntries

      public int countEntries(boolean includeChangeLog)
      Retrieves the number of entries currently held in the server, optionally including those entries which are part of the changelog.

      This method may be used regardless of whether the server is listening for client connections.
      Parameters:
      includeChangeLog - Indicates whether to include entries that are part of the changelog in the count.
      Returns:
      The number of entries currently held in the server.
    • countEntriesBelow

      public int countEntriesBelow(@NotNull String baseDN) throws LDAPException
      Retrieves the number of entries currently held in the server whose DN matches or is subordinate to the provided base DN.

      This method may be used regardless of whether the server is listening for client connections.
      Parameters:
      baseDN - The base DN to use for the determination.
      Returns:
      The number of entries currently held in the server whose DN matches or is subordinate to the provided base DN.
      Throws:
      LDAPException - If the provided string cannot be parsed as a valid DN.
    • clear

      public void clear()
      Removes all entries currently held in the server. If a changelog is enabled, then all changelog entries will also be cleared but the base "cn=changelog" entry will be retained.

      This method may be used regardless of whether the server is listening for client connections.
    • importFromLDIF

      public int importFromLDIF(boolean clear, @NotNull String path) throws LDAPException
      Reads entries from the specified LDIF file and adds them to the server, optionally clearing any existing entries before beginning to add the new entries. If an error is encountered while adding entries from LDIF then the server will remain populated with the data it held before the import attempt (even if the clear is given with a value of true).

      This method may be used regardless of whether the server is listening for client connections.
      Parameters:
      clear - Indicates whether to remove all existing entries prior to adding entries read from LDIF.
      path - The path to the LDIF file from which the entries should be read. It must not be null.
      Returns:
      The number of entries read from LDIF and added to the server.
      Throws:
      LDAPException - If a problem occurs while reading entries or adding them to the server.
    • importFromLDIF

      public int importFromLDIF(boolean clear, @NotNull File ldifFile) throws LDAPException
      Reads entries from the specified LDIF file and adds them to the server, optionally clearing any existing entries before beginning to add the new entries. If an error is encountered while adding entries from LDIF then the server will remain populated with the data it held before the import attempt (even if the clear is given with a value of true).

      This method may be used regardless of whether the server is listening for client connections.
      Parameters:
      clear - Indicates whether to remove all existing entries prior to adding entries read from LDIF.
      ldifFile - The LDIF file from which the entries should be read. It must not be null.
      Returns:
      The number of entries read from LDIF and added to the server.
      Throws:
      LDAPException - If a problem occurs while reading entries or adding them to the server.
    • importFromLDIF

      public int importFromLDIF(boolean clear, @NotNull LDIFReader reader) throws LDAPException
      Reads entries from the provided LDIF reader and adds them to the server, optionally clearing any existing entries before beginning to add the new entries. If an error is encountered while adding entries from LDIF then the server will remain populated with the data it held before the import attempt (even if the clear is given with a value of true).

      This method may be used regardless of whether the server is listening for client connections.
      Parameters:
      clear - Indicates whether to remove all existing entries prior to adding entries read from LDIF.
      reader - The LDIF reader to use to obtain the entries to be imported.
      Returns:
      The number of entries read from LDIF and added to the server.
      Throws:
      LDAPException - If a problem occurs while reading entries or adding them to the server.
    • exportToLDIF

      public int exportToLDIF(@NotNull String path, boolean excludeGeneratedAttrs, boolean excludeChangeLog) throws LDAPException
      Writes the current contents of the server in LDIF form to the specified file.

      This method may be used regardless of whether the server is listening for client connections.
      Parameters:
      path - The path of the file to which the LDIF entries should be written.
      excludeGeneratedAttrs - Indicates whether to exclude automatically generated operational attributes like entryUUID, entryDN, creatorsName, etc.
      excludeChangeLog - Indicates whether to exclude entries contained in the changelog.
      Returns:
      The number of entries written to LDIF.
      Throws:
      LDAPException - If a problem occurs while writing entries to LDIF.
    • exportToLDIF

      public int exportToLDIF(@NotNull LDIFWriter ldifWriter, boolean excludeGeneratedAttrs, boolean excludeChangeLog, boolean closeWriter) throws LDAPException
      Writes the current contents of the server in LDIF form using the provided LDIF writer.

      This method may be used regardless of whether the server is listening for client connections.
      Parameters:
      ldifWriter - The LDIF writer to use when writing the entries. It must not be null.
      excludeGeneratedAttrs - Indicates whether to exclude automatically generated operational attributes like entryUUID, entryDN, creatorsName, etc.
      excludeChangeLog - Indicates whether to exclude entries contained in the changelog.
      closeWriter - Indicates whether the LDIF writer should be closed after all entries have been written.
      Returns:
      The number of entries written to LDIF.
      Throws:
      LDAPException - If a problem occurs while writing entries to LDIF.
    • applyChangesFromLDIF

      Reads LDIF change records from the specified LDIF file and applies them to the data in the server. Any LDIF records without a changetype will be treated as add change records. If an error is encountered while attempting to apply the requested changes, then the server will remain populated with the data it held before this method was called, even if earlier changes could have been applied successfully.

      This method may be used regardless of whether the server is listening for client connections.
      Parameters:
      path - The path to the LDIF file from which the LDIF change records should be read. It must not be null.
      Returns:
      The number of changes applied from the LDIF file.
      Throws:
      LDAPException - If a problem occurs while reading change records or applying them to the server.
    • applyChangesFromLDIF

      public int applyChangesFromLDIF(@NotNull File ldifFile) throws LDAPException
      Reads LDIF change records from the specified LDIF file and applies them to the data in the server. Any LDIF records without a changetype will be treated as add change records. If an error is encountered while attempting to apply the requested changes, then the server will remain populated with the data it held before this method was called, even if earlier changes could have been applied successfully.

      This method may be used regardless of whether the server is listening for client connections.
      Parameters:
      ldifFile - The LDIF file from which the LDIF change records should be read. It must not be null.
      Returns:
      The number of changes applied from the LDIF file.
      Throws:
      LDAPException - If a problem occurs while reading change records or applying them to the server.
    • applyChangesFromLDIF

      Reads LDIF change records from the provided LDIF reader file and applies them to the data in the server. Any LDIF records without a changetype will be treated as add change records. If an error is encountered while attempting to apply the requested changes, then the server will remain populated with the data it held before this method was called, even if earlier changes could have been applied successfully.

      This method may be used regardless of whether the server is listening for client connections.
      Parameters:
      reader - The LDIF reader to use to obtain the change records to be applied.
      Returns:
      The number of changes applied from the LDIF file.
      Throws:
      LDAPException - If a problem occurs while reading change records or applying them to the server.
    • getRootDSE

      Retrieves the directory server root DSE.

      This method may be used regardless of whether the server is listening for client connections.
      Specified by:
      getRootDSE in interface LDAPInterface
      Returns:
      The directory server root DSE, or null if it is not available.
      Throws:
      LDAPException - If a problem occurs while attempting to retrieve the server root DSE.
    • getSchema

      Retrieves the directory server schema definitions, using the subschema subentry DN contained in the server's root DSE. For directory servers containing a single schema, this should be sufficient for all purposes. For servers with multiple schemas, it may be necessary to specify the DN of the target entry for which to obtain the associated schema.

      This method may be used regardless of whether the server is listening for client connections.
      Specified by:
      getSchema in interface LDAPInterface
      Returns:
      The directory server schema definitions, or null if the schema information could not be retrieved (e.g, the client does not have permission to read the server schema).
      Throws:
      LDAPException - If a problem occurs while attempting to retrieve the server schema.
    • getSchema

      Retrieves the directory server schema definitions that govern the specified entry. The subschemaSubentry attribute will be retrieved from the target entry, and then the appropriate schema definitions will be loaded from the entry referenced by that attribute. This may be necessary to ensure correct behavior in servers that support multiple schemas.

      This method may be used regardless of whether the server is listening for client connections.
      Specified by:
      getSchema in interface LDAPInterface
      Parameters:
      entryDN - The DN of the entry for which to retrieve the associated schema definitions. It may be null or an empty string if the subschemaSubentry attribute should be retrieved from the server's root DSE.
      Returns:
      The directory server schema definitions, or null if the schema information could not be retrieved (e.g, the client does not have permission to read the server schema).
      Throws:
      LDAPException - If a problem occurs while attempting to retrieve the server schema.
    • getEntry

      Retrieves the entry with the specified DN. All user attributes will be requested in the entry to return.

      This method may be used regardless of whether the server is listening for client connections.
      Specified by:
      getEntry in interface LDAPInterface
      Parameters:
      dn - The DN of the entry to retrieve. It must not be null.
      Returns:
      The requested entry, or null if the target entry does not exist or no entry was returned (e.g., if the authenticated user does not have permission to read the target entry).
      Throws:
      LDAPException - If a problem occurs while sending the request or reading the response.
    • getEntry

      Retrieves the entry with the specified DN.

      This method may be used regardless of whether the server is listening for client connections, and regardless of whether search operations are allowed in the server.
      Specified by:
      getEntry in interface LDAPInterface
      Parameters:
      dn - The DN of the entry to retrieve. It must not be null.
      attributes - The set of attributes to request for the target entry. If it is null, then all user attributes will be requested.
      Returns:
      The requested entry, or null if the target entry does not exist or no entry was returned (e.g., if the authenticated user does not have permission to read the target entry).
      Throws:
      LDAPException - If a problem occurs while sending the request or reading the response.
    • add

      @NotNull public LDAPResult add(@NotNull String dn, @NotNull Attribute... attributes) throws LDAPException
      Processes an add operation with the provided information.

      This method may be used regardless of whether the server is listening for client connections, and regardless of whether add operations are allowed in the server.
      Specified by:
      add in interface LDAPInterface
      Parameters:
      dn - The DN of the entry to add. It must not be null.
      attributes - The set of attributes to include in the entry to add. It must not be null.
      Returns:
      The result of processing the add operation.
      Throws:
      LDAPException - If the server rejects the add request, or if a problem is encountered while sending the request or reading the response.
    • add

      Processes an add operation with the provided information.

      This method may be used regardless of whether the server is listening for client connections, and regardless of whether add operations are allowed in the server.
      Specified by:
      add in interface LDAPInterface
      Parameters:
      dn - The DN of the entry to add. It must not be null.
      attributes - The set of attributes to include in the entry to add. It must not be null.
      Returns:
      The result of processing the add operation.
      Throws:
      LDAPException - If the server rejects the add request, or if a problem is encountered while sending the request or reading the response.
    • add

      Processes an add operation with the provided information.

      This method may be used regardless of whether the server is listening for client connections, and regardless of whether add operations are allowed in the server.
      Specified by:
      add in interface LDAPInterface
      Parameters:
      entry - The entry to add. It must not be null.
      Returns:
      The result of processing the add operation.
      Throws:
      LDAPException - If the server rejects the add request, or if a problem is encountered while sending the request or reading the response.
    • add

      Processes an add operation with the provided information.

      This method may be used regardless of whether the server is listening for client connections, and regardless of whether add operations are allowed in the server.
      Specified by:
      add in interface LDAPInterface
      Parameters:
      ldifLines - The lines that comprise an LDIF representation of the entry to add. It must not be empty or null.
      Returns:
      The result of processing the add operation.
      Throws:
      LDIFException - If the provided entry lines cannot be decoded as an entry in LDIF form.
      LDAPException - If the server rejects the add request, or if a problem is encountered while sending the request or reading the response.
    • add

      Processes the provided add request.

      This method may be used regardless of whether the server is listening for client connections, and regardless of whether add operations are allowed in the server.
      Specified by:
      add in interface LDAPInterface
      Parameters:
      addRequest - The add request to be processed. It must not be null.
      Returns:
      The result of processing the add operation.
      Throws:
      LDAPException - If the server rejects the add request, or if a problem is encountered while sending the request or reading the response.
    • add

      Processes the provided add request.

      This method may be used regardless of whether the server is listening for client connections, and regardless of whether add operations are allowed in the server.
      Specified by:
      add in interface LDAPInterface
      Parameters:
      addRequest - The add request to be processed. It must not be null.
      Returns:
      The result of processing the add operation.
      Throws:
      LDAPException - If the server rejects the add request, or if a problem is encountered while sending the request or reading the response.
    • addEntries

      public void addEntries(@NotNull Entry... entries) throws LDAPException
      Attempts to add all of the provided entries to the server. If a problem is encountered while attempting to add any of the provided entries, then the server will remain populated with the data it held before this method was called.

      This method may be used regardless of whether the server is listening for client connections, and regardless of whether add operations are allowed in the server.
      Parameters:
      entries - The entries to be added to the server.
      Throws:
      LDAPException - If a problem is encountered while attempting to add any of the provided entries.
    • addEntries

      public void addEntries(@NotNull List<? extends Entry> entries) throws LDAPException
      Attempts to add all of the provided entries to the server. If a problem is encountered while attempting to add any of the provided entries, then the server will remain populated with the data it held before this method was called.

      This method may be used regardless of whether the server is listening for client connections, and regardless of whether add operations are allowed in the server.
      Parameters:
      entries - The entries to be added to the server.
      Throws:
      LDAPException - If a problem is encountered while attempting to add any of the provided entries.
    • addEntries

      public void addEntries(@NotNull String... ldifEntryLines) throws LDAPException
      Attempts to add a set of entries provided in LDIF form in which each element of the provided array is a line of the LDIF representation, with empty strings as separators between entries (as you would have for blank lines in an LDIF file). If a problem is encountered while attempting to add any of the provided entries, then the server will remain populated with the data it held before this method was called.

      This method may be used regardless of whether the server is listening for client connections, and regardless of whether add operations are allowed in the server.
      Parameters:
      ldifEntryLines - The lines comprising the LDIF representation of the entries to be added.
      Throws:
      LDAPException - If a problem is encountered while attempting to add any of the provided entries.
    • bind

      Processes a simple bind request with the provided DN and password. Note that the bind processing will verify that the provided credentials are valid, but it will not alter the server in any way.
      Specified by:
      bind in interface FullLDAPInterface
      Parameters:
      bindDN - The bind DN for the bind operation.
      password - The password for the simple bind operation.
      Returns:
      The result of processing the bind operation.
      Throws:
      LDAPException - If the server rejects the bind request, or if a problem occurs while sending the request or reading the response.
    • bind

      Processes the provided bind request. Only simple and SASL PLAIN bind requests are supported. Note that the bind processing will verify that the provided credentials are valid, but it will not alter the server in any way.
      Specified by:
      bind in interface FullLDAPInterface
      Parameters:
      bindRequest - The bind request to be processed. It must not be null.
      Returns:
      The result of processing the bind operation.
      Throws:
      LDAPException - If the server rejects the bind request, or if a problem occurs while sending the request or reading the response.
    • compare

      @NotNull public CompareResult compare(@NotNull String dn, @NotNull String attributeName, @NotNull String assertionValue) throws LDAPException
      Processes a compare operation with the provided information.

      This method may be used regardless of whether the server is listening for client connections, and regardless of whether compare operations are allowed in the server.
      Specified by:
      compare in interface LDAPInterface
      Parameters:
      dn - The DN of the entry in which to make the comparison. It must not be null.
      attributeName - The attribute name for which to make the comparison. It must not be null.
      assertionValue - The assertion value to verify in the target entry. It must not be null.
      Returns:
      The result of processing the compare operation.
      Throws:
      LDAPException - If the server rejects the compare request, or if a problem is encountered while sending the request or reading the response.
    • compare

      Processes the provided compare request.

      This method may be used regardless of whether the server is listening for client connections, and regardless of whether compare operations are allowed in the server.
      Specified by:
      compare in interface LDAPInterface
      Parameters:
      compareRequest - The compare request to be processed. It must not be null.
      Returns:
      The result of processing the compare operation.
      Throws:
      LDAPException - If the server rejects the compare request, or if a problem is encountered while sending the request or reading the response.
    • compare

      Processes the provided compare request.

      This method may be used regardless of whether the server is listening for client connections, and regardless of whether compare operations are allowed in the server.
      Specified by:
      compare in interface LDAPInterface
      Parameters:
      compareRequest - The compare request to be processed. It must not be null.
      Returns:
      The result of processing the compare operation.
      Throws:
      LDAPException - If the server rejects the compare request, or if a problem is encountered while sending the request or reading the response.
    • delete

      Deletes the entry with the specified DN.

      This method may be used regardless of whether the server is listening for client connections, and regardless of whether delete operations are allowed in the server.
      Specified by:
      delete in interface LDAPInterface
      Parameters:
      dn - The DN of the entry to delete. It must not be null.
      Returns:
      The result of processing the delete operation.
      Throws:
      LDAPException - If the server rejects the delete request, or if a problem is encountered while sending the request or reading the response.
    • delete

      Processes the provided delete request.

      This method may be used regardless of whether the server is listening for client connections, and regardless of whether delete operations are allowed in the server.
      Specified by:
      delete in interface LDAPInterface
      Parameters:
      deleteRequest - The delete request to be processed. It must not be null.
      Returns:
      The result of processing the delete operation.
      Throws:
      LDAPException - If the server rejects the delete request, or if a problem is encountered while sending the request or reading the response.
    • delete

      Processes the provided delete request.

      This method may be used regardless of whether the server is listening for client connections, and regardless of whether delete operations are allowed in the server.
      Specified by:
      delete in interface LDAPInterface
      Parameters:
      deleteRequest - The delete request to be processed. It must not be null.
      Returns:
      The result of processing the delete operation.
      Throws:
      LDAPException - If the server rejects the delete request, or if a problem is encountered while sending the request or reading the response.
    • deleteSubtree

      public int deleteSubtree(@NotNull String baseDN) throws LDAPException
      Attempts to delete the specified entry and all entries below it from the server.

      This method may be used regardless of whether the server is listening for client connections, and regardless of whether compare operations are allowed in the server.
      Parameters:
      baseDN - The DN of the entry to remove, along with all of its subordinates.
      Returns:
      The number of entries removed from the server, or zero if the specified entry was not found.
      Throws:
      LDAPException - If a problem is encountered while attempting to remove the entries.
    • processExtendedOperation

      Processes an extended request with the provided request OID. Note that because some types of extended operations return unusual result codes under "normal" conditions, the server may not always throw an exception for a failed extended operation like it does for other types of operations. It will throw an exception under conditions where there appears to be a problem with the connection or the server to which the connection is established, but there may be many circumstances in which an extended operation is not processed correctly but this method does not throw an exception. In the event that no exception is thrown, it is the responsibility of the caller to interpret the result to determine whether the operation was processed as expected.

      This method may be used regardless of whether the server is listening for client connections, and regardless of whether extended operations are allowed in the server.
      Specified by:
      processExtendedOperation in interface FullLDAPInterface
      Parameters:
      requestOID - The OID for the extended request to process. It must not be null.
      Returns:
      The extended result object that provides information about the result of the request processing. It may or may not indicate that the operation was successful.
      Throws:
      LDAPException - If a problem occurs while sending the request or reading the response.
    • processExtendedOperation

      Processes an extended request with the provided request OID and value. Note that because some types of extended operations return unusual result codes under "normal" conditions, the server may not always throw an exception for a failed extended operation like it does for other types of operations. It will throw an exception under conditions where there appears to be a problem with the connection or the server to which the connection is established, but there may be many circumstances in which an extended operation is not processed correctly but this method does not throw an exception. In the event that no exception is thrown, it is the responsibility of the caller to interpret the result to determine whether the operation was processed as expected.

      This method may be used regardless of whether the server is listening for client connections, and regardless of whether extended operations are allowed in the server.
      Specified by:
      processExtendedOperation in interface FullLDAPInterface
      Parameters:
      requestOID - The OID for the extended request to process. It must not be null.
      requestValue - The encoded value for the extended request to process. It may be null if there does not need to be a value for the requested operation.
      Returns:
      The extended result object that provides information about the result of the request processing. It may or may not indicate that the operation was successful.
      Throws:
      LDAPException - If a problem occurs while sending the request or reading the response.
    • processExtendedOperation

      Processes the provided extended request. Note that because some types of extended operations return unusual result codes under "normal" conditions, the server may not always throw an exception for a failed extended operation like it does for other types of operations. It will throw an exception under conditions where there appears to be a problem with the connection or the server to which the connection is established, but there may be many circumstances in which an extended operation is not processed correctly but this method does not throw an exception. In the event that no exception is thrown, it is the responsibility of the caller to interpret the result to determine whether the operation was processed as expected.

      This method may be used regardless of whether the server is listening for client connections, and regardless of whether extended operations are allowed in the server.
      Specified by:
      processExtendedOperation in interface FullLDAPInterface
      Parameters:
      extendedRequest - The extended request to be processed. It must not be null.
      Returns:
      The extended result object that provides information about the result of the request processing. It may or may not indicate that the operation was successful.
      Throws:
      LDAPException - If a problem occurs while sending the request or reading the response.
    • modify

      Applies the provided modification to the specified entry.

      This method may be used regardless of whether the server is listening for client connections, and regardless of whether modify operations are allowed in the server.
      Specified by:
      modify in interface LDAPInterface
      Parameters:
      dn - The DN of the entry to modify. It must not be null.
      mod - The modification to apply to the target entry. It must not be null.
      Returns:
      The result of processing the modify operation.
      Throws:
      LDAPException - If the server rejects the modify request, or if a problem is encountered while sending the request or reading the response.
    • modify

      Applies the provided set of modifications to the specified entry.

      This method may be used regardless of whether the server is listening for client connections, and regardless of whether modify operations are allowed in the server.
      Specified by:
      modify in interface LDAPInterface
      Parameters:
      dn - The DN of the entry to modify. It must not be null.
      mods - The set of modifications to apply to the target entry. It must not be null or empty. *
      Returns:
      The result of processing the modify operation.
      Throws:
      LDAPException - If the server rejects the modify request, or if a problem is encountered while sending the request or reading the response.
    • modify

      Applies the provided set of modifications to the specified entry.

      This method may be used regardless of whether the server is listening for client connections, and regardless of whether modify operations are allowed in the server.
      Specified by:
      modify in interface LDAPInterface
      Parameters:
      dn - The DN of the entry to modify. It must not be null.
      mods - The set of modifications to apply to the target entry. It must not be null or empty.
      Returns:
      The result of processing the modify operation.
      Throws:
      LDAPException - If the server rejects the modify request, or if a problem is encountered while sending the request or reading the response.
    • modify

      @NotNull public LDAPResult modify(@NotNull String... ldifModificationLines) throws LDIFException, LDAPException
      Processes a modify request from the provided LDIF representation of the changes.

      This method may be used regardless of whether the server is listening for client connections, and regardless of whether modify operations are allowed in the server.
      Specified by:
      modify in interface LDAPInterface
      Parameters:
      ldifModificationLines - The lines that comprise an LDIF representation of a modify change record. It must not be null or empty.
      Returns:
      The result of processing the modify operation.
      Throws:
      LDIFException - If the provided set of lines cannot be parsed as an LDIF modify change record.
      LDAPException - If the server rejects the modify request, or if a problem is encountered while sending the request or reading the response.
    • modify

      Processes the provided modify request.

      This method may be used regardless of whether the server is listening for client connections, and regardless of whether modify operations are allowed in the server.
      Specified by:
      modify in interface LDAPInterface
      Parameters:
      modifyRequest - The modify request to be processed. It must not be null.
      Returns:
      The result of processing the modify operation.
      Throws:
      LDAPException - If the server rejects the modify request, or if a problem is encountered while sending the request or reading the response.
    • modify

      Processes the provided modify request.

      This method may be used regardless of whether the server is listening for client connections, and regardless of whether modify operations are allowed in the server.
      Specified by:
      modify in interface LDAPInterface
      Parameters:
      modifyRequest - The modify request to be processed. It must not be null.
      Returns:
      The result of processing the modify operation.
      Throws:
      LDAPException - If the server rejects the modify request, or if a problem is encountered while sending the request or reading the response.
    • modifyDN

      @NotNull public LDAPResult modifyDN(@NotNull String dn, @NotNull String newRDN, boolean deleteOldRDN) throws LDAPException
      Performs a modify DN operation with the provided information.

      This method may be used regardless of whether the server is listening for client connections, and regardless of whether modify DN operations are allowed in the server.
      Specified by:
      modifyDN in interface LDAPInterface
      Parameters:
      dn - The current DN for the entry to rename. It must not be null.
      newRDN - The new RDN to use for the entry. It must not be null.
      deleteOldRDN - Indicates whether to delete the current RDN value from the entry.
      Returns:
      The result of processing the modify DN operation.
      Throws:
      LDAPException - If the server rejects the modify DN request, or if a problem is encountered while sending the request or reading the response.
    • modifyDN

      @NotNull public LDAPResult modifyDN(@NotNull String dn, @NotNull String newRDN, boolean deleteOldRDN, @Nullable String newSuperiorDN) throws LDAPException
      Performs a modify DN operation with the provided information.

      This method may be used regardless of whether the server is listening for client connections, and regardless of whether modify DN operations are allowed in the server.
      Specified by:
      modifyDN in interface LDAPInterface
      Parameters:
      dn - The current DN for the entry to rename. It must not be null.
      newRDN - The new RDN to use for the entry. It must not be null.
      deleteOldRDN - Indicates whether to delete the current RDN value from the entry.
      newSuperiorDN - The new superior DN for the entry. It may be null if the entry is not to be moved below a new parent.
      Returns:
      The result of processing the modify DN operation.
      Throws:
      LDAPException - If the server rejects the modify DN request, or if a problem is encountered while sending the request or reading the response.
    • modifyDN

      Processes the provided modify DN request.

      This method may be used regardless of whether the server is listening for client connections, and regardless of whether modify DN operations are allowed in the server.
      Specified by:
      modifyDN in interface LDAPInterface
      Parameters:
      modifyDNRequest - The modify DN request to be processed. It must not be null.
      Returns:
      The result of processing the modify DN operation.
      Throws:
      LDAPException - If the server rejects the modify DN request, or if a problem is encountered while sending the request or reading the response.
    • modifyDN

      Processes the provided modify DN request.

      This method may be used regardless of whether the server is listening for client connections, and regardless of whether modify DN operations are allowed in the server.
      Specified by:
      modifyDN in interface LDAPInterface
      Parameters:
      modifyDNRequest - The modify DN request to be processed. It must not be null.
      Returns:
      The result of processing the modify DN operation.
      Throws:
      LDAPException - If the server rejects the modify DN request, or if a problem is encountered while sending the request or reading the response.
    • search

      Processes a search operation with the provided information. The search result entries and references will be collected internally and included in the SearchResult object that is returned.

      Note that if the search does not complete successfully, an LDAPSearchException will be thrown In some cases, one or more search result entries or references may have been returned before the failure response is received. In this case, the LDAPSearchException methods like getEntryCount, getSearchEntries, getReferenceCount, and getSearchReferences may be used to obtain information about those entries and references.

      This method may be used regardless of whether the server is listening for client connections, and regardless of whether search operations are allowed in the server.
      Specified by:
      search in interface LDAPInterface
      Parameters:
      baseDN - The base DN for the search request. It must not be null.
      scope - The scope that specifies the range of entries that should be examined for the search.
      filter - The string representation of the filter to use to identify matching entries. It must not be null.
      attributes - The set of attributes that should be returned in matching entries. It may be null or empty if the default attribute set (all user attributes) is to be requested.
      Returns:
      A search result object that provides information about the processing of the search, including the set of matching entries and search references returned by the server.
      Throws:
      LDAPSearchException - If the search does not complete successfully, or if a problem is encountered while parsing the provided filter string, sending the request, or reading the response. If one or more entries or references were returned before the failure was encountered, then the LDAPSearchException object may be examined to obtain information about those entries and/or references.
    • search

      Processes a search operation with the provided information. The search result entries and references will be collected internally and included in the SearchResult object that is returned.

      Note that if the search does not complete successfully, an LDAPSearchException will be thrown In some cases, one or more search result entries or references may have been returned before the failure response is received. In this case, the LDAPSearchException methods like getEntryCount, getSearchEntries, getReferenceCount, and getSearchReferences may be used to obtain information about those entries and references.

      This method may be used regardless of whether the server is listening for client connections, and regardless of whether search operations are allowed in the server.
      Specified by:
      search in interface LDAPInterface
      Parameters:
      baseDN - The base DN for the search request. It must not be null.
      scope - The scope that specifies the range of entries that should be examined for the search.
      filter - The filter to use to identify matching entries. It must not be null.
      attributes - The set of attributes that should be returned in matching entries. It may be null or empty if the default attribute set (all user attributes) is to be requested.
      Returns:
      A search result object that provides information about the processing of the search, including the set of matching entries and search references returned by the server.
      Throws:
      LDAPSearchException - If the search does not complete successfully, or if a problem is encountered while sending the request or reading the response. If one or more entries or references were returned before the failure was encountered, then the LDAPSearchException object may be examined to obtain information about those entries and/or references.
    • search

      @NotNull public SearchResult search(@Nullable SearchResultListener searchResultListener, @NotNull String baseDN, @NotNull SearchScope scope, @NotNull String filter, @Nullable String... attributes) throws LDAPSearchException
      Processes a search operation with the provided information.

      Note that if the search does not complete successfully, an LDAPSearchException will be thrown In some cases, one or more search result entries or references may have been returned before the failure response is received. In this case, the LDAPSearchException methods like getEntryCount, getSearchEntries, getReferenceCount, and getSearchReferences may be used to obtain information about those entries and references (although if a search result listener was provided, then it will have been used to make any entries and references available, and they will not be available through the getSearchEntries and getSearchReferences methods).

      This method may be used regardless of whether the server is listening for client connections, and regardless of whether search operations are allowed in the server.
      Specified by:
      search in interface LDAPInterface
      Parameters:
      searchResultListener - The search result listener that should be used to return results to the client. It may be null if the search results should be collected internally and returned in the SearchResult object.
      baseDN - The base DN for the search request. It must not be null.
      scope - The scope that specifies the range of entries that should be examined for the search.
      filter - The string representation of the filter to use to identify matching entries. It must not be null.
      attributes - The set of attributes that should be returned in matching entries. It may be null or empty if the default attribute set (all user attributes) is to be requested.
      Returns:
      A search result object that provides information about the processing of the search, potentially including the set of matching entries and search references returned by the server.
      Throws:
      LDAPSearchException - If the search does not complete successfully, or if a problem is encountered while parsing the provided filter string, sending the request, or reading the response. If one or more entries or references were returned before the failure was encountered, then the LDAPSearchException object may be examined to obtain information about those entries and/or references.
    • search

      @NotNull public SearchResult search(@Nullable SearchResultListener searchResultListener, @NotNull String baseDN, @NotNull SearchScope scope, @NotNull Filter filter, @Nullable String... attributes) throws LDAPSearchException
      Processes a search operation with the provided information.

      Note that if the search does not complete successfully, an LDAPSearchException will be thrown In some cases, one or more search result entries or references may have been returned before the failure response is received. In this case, the LDAPSearchException methods like getEntryCount, getSearchEntries, getReferenceCount, and getSearchReferences may be used to obtain information about those entries and references (although if a search result listener was provided, then it will have been used to make any entries and references available, and they will not be available through the getSearchEntries and getSearchReferences methods).

      This method may be used regardless of whether the server is listening for client connections, and regardless of whether search operations are allowed in the server.
      Specified by:
      search in interface LDAPInterface
      Parameters:
      searchResultListener - The search result listener that should be used to return results to the client. It may be null if the search results should be collected internally and returned in the SearchResult object.
      baseDN - The base DN for the search request. It must not be null.
      scope - The scope that specifies the range of entries that should be examined for the search.
      filter - The filter to use to identify matching entries. It must not be null.
      attributes - The set of attributes that should be returned in matching entries. It may be null or empty if the default attribute set (all user attributes) is to be requested.
      Returns:
      A search result object that provides information about the processing of the search, potentially including the set of matching entries and search references returned by the server.
      Throws:
      LDAPSearchException - If the search does not complete successfully, or if a problem is encountered while sending the request or reading the response. If one or more entries or references were returned before the failure was encountered, then the LDAPSearchException object may be examined to obtain information about those entries and/or references.
    • search

      @NotNull public SearchResult search(@NotNull String baseDN, @NotNull SearchScope scope, @NotNull DereferencePolicy derefPolicy, int sizeLimit, int timeLimit, boolean typesOnly, @NotNull String filter, @Nullable String... attributes) throws LDAPSearchException
      Processes a search operation with the provided information. The search result entries and references will be collected internally and included in the SearchResult object that is returned.

      Note that if the search does not complete successfully, an LDAPSearchException will be thrown In some cases, one or more search result entries or references may have been returned before the failure response is received. In this case, the LDAPSearchException methods like getEntryCount, getSearchEntries, getReferenceCount, and getSearchReferences may be used to obtain information about those entries and references.

      This method may be used regardless of whether the server is listening for client connections, and regardless of whether search operations are allowed in the server.
      Specified by:
      search in interface LDAPInterface
      Parameters:
      baseDN - The base DN for the search request. It must not be null.
      scope - The scope that specifies the range of entries that should be examined for the search.
      derefPolicy - The dereference policy the server should use for any aliases encountered while processing the search.
      sizeLimit - The maximum number of entries that the server should return for the search. A value of zero indicates that there should be no limit.
      timeLimit - The maximum length of time in seconds that the server should spend processing this search request. A value of zero indicates that there should be no limit.
      typesOnly - Indicates whether to return only attribute names in matching entries, or both attribute names and values.
      filter - The string representation of the filter to use to identify matching entries. It must not be null.
      attributes - The set of attributes that should be returned in matching entries. It may be null or empty if the default attribute set (all user attributes) is to be requested.
      Returns:
      A search result object that provides information about the processing of the search, including the set of matching entries and search references returned by the server.
      Throws:
      LDAPSearchException - If the search does not complete successfully, or if a problem is encountered while parsing the provided filter string, sending the request, or reading the response. If one or more entries or references were returned before the failure was encountered, then the LDAPSearchException object may be examined to obtain information about those entries and/or references.
    • search

      @NotNull public SearchResult search(@NotNull String baseDN, @NotNull SearchScope scope, @NotNull DereferencePolicy derefPolicy, int sizeLimit, int timeLimit, boolean typesOnly, @NotNull Filter filter, @Nullable String... attributes) throws LDAPSearchException
      Processes a search operation with the provided information. The search result entries and references will be collected internally and included in the SearchResult object that is returned.

      Note that if the search does not complete successfully, an LDAPSearchException will be thrown In some cases, one or more search result entries or references may have been returned before the failure response is received. In this case, the LDAPSearchException methods like getEntryCount, getSearchEntries, getReferenceCount, and getSearchReferences may be used to obtain information about those entries and references.

      This method may be used regardless of whether the server is listening for client connections, and regardless of whether search operations are allowed in the server.
      Specified by:
      search in interface LDAPInterface
      Parameters:
      baseDN - The base DN for the search request. It must not be null.
      scope - The scope that specifies the range of entries that should be examined for the search.
      derefPolicy - The dereference policy the server should use for any aliases encountered while processing the search.
      sizeLimit - The maximum number of entries that the server should return for the search. A value of zero indicates that there should be no limit.
      timeLimit - The maximum length of time in seconds that the server should spend processing this search request. A value of zero indicates that there should be no limit.
      typesOnly - Indicates whether to return only attribute names in matching entries, or both attribute names and values.
      filter - The filter to use to identify matching entries. It must not be null.
      attributes - The set of attributes that should be returned in matching entries. It may be null or empty if the default attribute set (all user attributes) is to be requested.
      Returns:
      A search result object that provides information about the processing of the search, including the set of matching entries and search references returned by the server.
      Throws:
      LDAPSearchException - If the search does not complete successfully, or if a problem is encountered while sending the request or reading the response. If one or more entries or references were returned before the failure was encountered, then the LDAPSearchException object may be examined to obtain information about those entries and/or references.
    • search

      @NotNull public SearchResult search(@Nullable SearchResultListener searchResultListener, @NotNull String baseDN, @NotNull SearchScope scope, @NotNull DereferencePolicy derefPolicy, int sizeLimit, int timeLimit, boolean typesOnly, @NotNull String filter, @Nullable String... attributes) throws LDAPSearchException
      Processes a search operation with the provided information.

      Note that if the search does not complete successfully, an LDAPSearchException will be thrown In some cases, one or more search result entries or references may have been returned before the failure response is received. In this case, the LDAPSearchException methods like getEntryCount, getSearchEntries, getReferenceCount, and getSearchReferences may be used to obtain information about those entries and references (although if a search result listener was provided, then it will have been used to make any entries and references available, and they will not be available through the getSearchEntries and getSearchReferences methods).

      This method may be used regardless of whether the server is listening for client connections, and regardless of whether search operations are allowed in the server.
      Specified by:
      search in interface LDAPInterface
      Parameters:
      searchResultListener - The search result listener that should be used to return results to the client. It may be null if the search results should be collected internally and returned in the SearchResult object.
      baseDN - The base DN for the search request. It must not be null.
      scope - The scope that specifies the range of entries that should be examined for the search.
      derefPolicy - The dereference policy the server should use for any aliases encountered while processing the search.
      sizeLimit - The maximum number of entries that the server should return for the search. A value of zero indicates that there should be no limit.
      timeLimit - The maximum length of time in seconds that the server should spend processing this search request. A value of zero indicates that there should be no limit.
      typesOnly - Indicates whether to return only attribute names in matching entries, or both attribute names and values.
      filter - The string representation of the filter to use to identify matching entries. It must not be null.
      attributes - The set of attributes that should be returned in matching entries. It may be null or empty if the default attribute set (all user attributes) is to be requested.
      Returns:
      A search result object that provides information about the processing of the search, potentially including the set of matching entries and search references returned by the server.
      Throws:
      LDAPSearchException - If the search does not complete successfully, or if a problem is encountered while parsing the provided filter string, sending the request, or reading the response. If one or more entries or references were returned before the failure was encountered, then the LDAPSearchException object may be examined to obtain information about those entries and/or references.
    • search

      @NotNull public SearchResult search(@Nullable SearchResultListener searchResultListener, @NotNull String baseDN, @NotNull SearchScope scope, @NotNull DereferencePolicy derefPolicy, int sizeLimit, int timeLimit, boolean typesOnly, @NotNull Filter filter, @Nullable String... attributes) throws LDAPSearchException
      Processes a search operation with the provided information.

      Note that if the search does not complete successfully, an LDAPSearchException will be thrown In some cases, one or more search result entries or references may have been returned before the failure response is received. In this case, the LDAPSearchException methods like getEntryCount, getSearchEntries, getReferenceCount, and getSearchReferences may be used to obtain information about those entries and references (although if a search result listener was provided, then it will have been used to make any entries and references available, and they will not be available through the getSearchEntries and getSearchReferences methods).

      This method may be used regardless of whether the server is listening for client connections, and regardless of whether search operations are allowed in the server.
      Specified by:
      search in interface LDAPInterface
      Parameters:
      searchResultListener - The search result listener that should be used to return results to the client. It may be null if the search results should be collected internally and returned in the SearchResult object.
      baseDN - The base DN for the search request. It must not be null.
      scope - The scope that specifies the range of entries that should be examined for the search.
      derefPolicy - The dereference policy the server should use for any aliases encountered while processing the search.
      sizeLimit - The maximum number of entries that the server should return for the search. A value of zero indicates that there should be no limit.
      timeLimit - The maximum length of time in seconds that the server should spend processing this search request. A value of zero indicates that there should be no limit.
      typesOnly - Indicates whether to return only attribute names in matching entries, or both attribute names and values.
      filter - The filter to use to identify matching entries. It must not be null.
      attributes - The set of attributes that should be returned in matching entries. It may be null or empty if the default attribute set (all user attributes) is to be requested.
      Returns:
      A search result object that provides information about the processing of the search, potentially including the set of matching entries and search references returned by the server.
      Throws:
      LDAPSearchException - If the search does not complete successfully, or if a problem is encountered while sending the request or reading the response. If one or more entries or references were returned before the failure was encountered, then the LDAPSearchException object may be examined to obtain information about those entries and/or references.
    • search

      Processes the provided search request.

      Note that if the search does not complete successfully, an LDAPSearchException will be thrown In some cases, one or more search result entries or references may have been returned before the failure response is received. In this case, the LDAPSearchException methods like getEntryCount, getSearchEntries, getReferenceCount, and getSearchReferences may be used to obtain information about those entries and references (although if a search result listener was provided, then it will have been used to make any entries and references available, and they will not be available through the getSearchEntries and getSearchReferences methods).

      This method may be used regardless of whether the server is listening for client connections, and regardless of whether search operations are allowed in the server.
      Specified by:
      search in interface LDAPInterface
      Parameters:
      searchRequest - The search request to be processed. It must not be null.
      Returns:
      A search result object that provides information about the processing of the search, potentially including the set of matching entries and search references returned by the server.
      Throws:
      LDAPSearchException - If the search does not complete successfully, or if a problem is encountered while sending the request or reading the response. If one or more entries or references were returned before the failure was encountered, then the LDAPSearchException object may be examined to obtain information about those entries and/or references.
    • search

      Processes the provided search request.

      Note that if the search does not complete successfully, an LDAPSearchException will be thrown In some cases, one or more search result entries or references may have been returned before the failure response is received. In this case, the LDAPSearchException methods like getEntryCount, getSearchEntries, getReferenceCount, and getSearchReferences may be used to obtain information about those entries and references (although if a search result listener was provided, then it will have been used to make any entries and references available, and they will not be available through the getSearchEntries and getSearchReferences methods).

      This method may be used regardless of whether the server is listening for client connections, and regardless of whether search operations are allowed in the server.
      Specified by:
      search in interface LDAPInterface
      Parameters:
      searchRequest - The search request to be processed. It must not be null.
      Returns:
      A search result object that provides information about the processing of the search, potentially including the set of matching entries and search references returned by the server.
      Throws:
      LDAPSearchException - If the search does not complete successfully, or if a problem is encountered while sending the request or reading the response. If one or more entries or references were returned before the failure was encountered, then the LDAPSearchException object may be examined to obtain information about those entries and/or references.
    • searchForEntry

      Processes a search operation with the provided information. It is expected that at most one entry will be returned from the search, and that no additional content from the successful search result (e.g., diagnostic message or response controls) are needed.

      Note that if the search does not complete successfully, an LDAPSearchException will be thrown In some cases, one or more search result entries or references may have been returned before the failure response is received. In this case, the LDAPSearchException methods like getEntryCount, getSearchEntries, getReferenceCount, and getSearchReferences may be used to obtain information about those entries and references.

      This method may be used regardless of whether the server is listening for client connections, and regardless of whether search operations are allowed in the server.
      Specified by:
      searchForEntry in interface LDAPInterface
      Parameters:
      baseDN - The base DN for the search request. It must not be null.
      scope - The scope that specifies the range of entries that should be examined for the search.
      filter - The string representation of the filter to use to identify matching entries. It must not be null.
      attributes - The set of attributes that should be returned in matching entries. It may be null or empty if the default attribute set (all user attributes) is to be requested.
      Returns:
      The entry that was returned from the search, or null if no entry was returned or the base entry does not exist.
      Throws:
      LDAPSearchException - If the search does not complete successfully, if more than a single entry is returned, or if a problem is encountered while parsing the provided filter string, sending the request, or reading the response. If one or more entries or references were returned before the failure was encountered, then the LDAPSearchException object may be examined to obtain information about those entries and/or references.
    • searchForEntry

      Processes a search operation with the provided information. It is expected that at most one entry will be returned from the search, and that no additional content from the successful search result (e.g., diagnostic message or response controls) are needed.

      Note that if the search does not complete successfully, an LDAPSearchException will be thrown In some cases, one or more search result entries or references may have been returned before the failure response is received. In this case, the LDAPSearchException methods like getEntryCount, getSearchEntries, getReferenceCount, and getSearchReferences may be used to obtain information about those entries and references.

      This method may be used regardless of whether the server is listening for client connections, and regardless of whether search operations are allowed in the server.
      Specified by:
      searchForEntry in interface LDAPInterface
      Parameters:
      baseDN - The base DN for the search request. It must not be null.
      scope - The scope that specifies the range of entries that should be examined for the search.
      filter - The string representation of the filter to use to identify matching entries. It must not be null.
      attributes - The set of attributes that should be returned in matching entries. It may be null or empty if the default attribute set (all user attributes) is to be requested.
      Returns:
      The entry that was returned from the search, or null if no entry was returned or the base entry does not exist.
      Throws:
      LDAPSearchException - If the search does not complete successfully, if more than a single entry is returned, or if a problem is encountered while parsing the provided filter string, sending the request, or reading the response. If one or more entries or references were returned before the failure was encountered, then the LDAPSearchException object may be examined to obtain information about those entries and/or references.
    • searchForEntry

      @Nullable public SearchResultEntry searchForEntry(@NotNull String baseDN, @NotNull SearchScope scope, @NotNull DereferencePolicy derefPolicy, int timeLimit, boolean typesOnly, @NotNull String filter, @Nullable String... attributes) throws LDAPSearchException
      Processes a search operation with the provided information. It is expected that at most one entry will be returned from the search, and that no additional content from the successful search result (e.g., diagnostic message or response controls) are needed.

      Note that if the search does not complete successfully, an LDAPSearchException will be thrown In some cases, one or more search result entries or references may have been returned before the failure response is received. In this case, the LDAPSearchException methods like getEntryCount, getSearchEntries, getReferenceCount, and getSearchReferences may be used to obtain information about those entries and references.

      This method may be used regardless of whether the server is listening for client connections, and regardless of whether search operations are allowed in the server.
      Specified by:
      searchForEntry in interface LDAPInterface
      Parameters:
      baseDN - The base DN for the search request. It must not be null.
      scope - The scope that specifies the range of entries that should be examined for the search.
      derefPolicy - The dereference policy the server should use for any aliases encountered while processing the search.
      timeLimit - The maximum length of time in seconds that the server should spend processing this search request. A value of zero indicates that there should be no limit.
      typesOnly - Indicates whether to return only attribute names in matching entries, or both attribute names and values.
      filter - The string representation of the filter to use to identify matching entries. It must not be null.
      attributes - The set of attributes that should be returned in matching entries. It may be null or empty if the default attribute set (all user attributes) is to be requested.
      Returns:
      The entry that was returned from the search, or null if no entry was returned or the base entry does not exist.
      Throws:
      LDAPSearchException - If the search does not complete successfully, if more than a single entry is returned, or if a problem is encountered while parsing the provided filter string, sending the request, or reading the response. If one or more entries or references were returned before the failure was encountered, then the LDAPSearchException object may be examined to obtain information about those entries and/or references.
    • searchForEntry

      @Nullable public SearchResultEntry searchForEntry(@NotNull String baseDN, @NotNull SearchScope scope, @NotNull DereferencePolicy derefPolicy, int timeLimit, boolean typesOnly, @NotNull Filter filter, @Nullable String... attributes) throws LDAPSearchException
      Processes a search operation with the provided information. It is expected that at most one entry will be returned from the search, and that no additional content from the successful search result (e.g., diagnostic message or response controls) are needed.

      Note that if the search does not complete successfully, an LDAPSearchException will be thrown In some cases, one or more search result entries or references may have been returned before the failure response is received. In this case, the LDAPSearchException methods like getEntryCount, getSearchEntries, getReferenceCount, and getSearchReferences may be used to obtain information about those entries and references.

      This method may be used regardless of whether the server is listening for client connections, and regardless of whether search operations are allowed in the server.
      Specified by:
      searchForEntry in interface LDAPInterface
      Parameters:
      baseDN - The base DN for the search request. It must not be null.
      scope - The scope that specifies the range of entries that should be examined for the search.
      derefPolicy - The dereference policy the server should use for any aliases encountered while processing the search.
      timeLimit - The maximum length of time in seconds that the server should spend processing this search request. A value of zero indicates that there should be no limit.
      typesOnly - Indicates whether to return only attribute names in matching entries, or both attribute names and values.
      filter - The filter to use to identify matching entries. It must not be null.
      attributes - The set of attributes that should be returned in matching entries. It may be null or empty if the default attribute set (all user attributes) is to be requested.
      Returns:
      The entry that was returned from the search, or null if no entry was returned or the base entry does not exist.
      Throws:
      LDAPSearchException - If the search does not complete successfully, if more than a single entry is returned, or if a problem is encountered while parsing the provided filter string, sending the request, or reading the response. If one or more entries or references were returned before the failure was encountered, then the LDAPSearchException object may be examined to obtain information about those entries and/or references.
    • searchForEntry

      Processes the provided search request. It is expected that at most one entry will be returned from the search, and that no additional content from the successful search result (e.g., diagnostic message or response controls) are needed.

      Note that if the search does not complete successfully, an LDAPSearchException will be thrown In some cases, one or more search result entries or references may have been returned before the failure response is received. In this case, the LDAPSearchException methods like getEntryCount, getSearchEntries, getReferenceCount, and getSearchReferences may be used to obtain information about those entries and references.

      This method may be used regardless of whether the server is listening for client connections, and regardless of whether search operations are allowed in the server.
      Specified by:
      searchForEntry in interface LDAPInterface
      Parameters:
      searchRequest - The search request to be processed. If it is configured with a search result listener or a size limit other than one, then the provided request will be duplicated with the appropriate settings.
      Returns:
      The entry that was returned from the search, or null if no entry was returned or the base entry does not exist.
      Throws:
      LDAPSearchException - If the search does not complete successfully, if more than a single entry is returned, or if a problem is encountered while parsing the provided filter string, sending the request, or reading the response. If one or more entries or references were returned before the failure was encountered, then the LDAPSearchException object may be examined to obtain information about those entries and/or references.
    • searchForEntry

      Processes the provided search request. It is expected that at most one entry will be returned from the search, and that no additional content from the successful search result (e.g., diagnostic message or response controls) are needed.

      Note that if the search does not complete successfully, an LDAPSearchException will be thrown In some cases, one or more search result entries or references may have been returned before the failure response is received. In this case, the LDAPSearchException methods like getEntryCount, getSearchEntries, getReferenceCount, and getSearchReferences may be used to obtain information about those entries and references.

      This method may be used regardless of whether the server is listening for client connections, and regardless of whether search operations are allowed in the server.
      Specified by:
      searchForEntry in interface LDAPInterface
      Parameters:
      searchRequest - The search request to be processed. If it is configured with a search result listener or a size limit other than one, then the provided request will be duplicated with the appropriate settings.
      Returns:
      The entry that was returned from the search, or null if no entry was returned or the base entry does not exist.
      Throws:
      LDAPSearchException - If the search does not complete successfully, if more than a single entry is returned, or if a problem is encountered while parsing the provided filter string, sending the request, or reading the response. If one or more entries or references were returned before the failure was encountered, then the LDAPSearchException object may be examined to obtain information about those entries and/or references.
    • getPasswordAttributes

      Retrieves the configured list of password attributes.
      Returns:
      The configured list of password attributes.
    • getPrimaryPasswordEncoder

      Retrieves the primary password encoder that has been configured for the server.
      Returns:
      The primary password encoder that has been configured for the server.
    • getAllPasswordEncoders

      Retrieves a list of all password encoders configured for the server.
      Returns:
      A list of all password encoders configured for the server.
    • getPasswordsInEntry

      Retrieves a list of the passwords contained in the provided entry.
      Parameters:
      entry - The entry from which to obtain the list of passwords. It must not be null.
      clearPasswordToMatch - An optional clear-text password that should match the values that are returned. If this is null, then all passwords contained in the provided entry will be returned. If this is non-null, then only passwords matching the clear-text password will be returned.
      Returns:
      A list of the passwords contained in the provided entry, optionally restricted to those matching the provided clear-text password, or an empty list if the entry does not contain any passwords.
    • entryExists

      public boolean entryExists(@NotNull String dn) throws LDAPException
      Indicates whether the specified entry exists in the server.

      This method may be used regardless of whether the server is listening for client connections.
      Parameters:
      dn - The DN of the entry for which to make the determination.
      Returns:
      true if the entry exists, or false if not.
      Throws:
      LDAPException - If a problem is encountered while trying to communicate with the directory server.
    • entryExists

      public boolean entryExists(@NotNull String dn, @NotNull String filter) throws LDAPException
      Indicates whether the specified entry exists in the server and matches the given filter.

      This method may be used regardless of whether the server is listening for client connections.
      Parameters:
      dn - The DN of the entry for which to make the determination.
      filter - The filter the entry is expected to match.
      Returns:
      true if the entry exists and matches the specified filter, or false if not.
      Throws:
      LDAPException - If a problem is encountered while trying to communicate with the directory server.
    • entryExists

      public boolean entryExists(@NotNull Entry entry) throws LDAPException
      Indicates whether the specified entry exists in the server. This will return true only if the target entry exists and contains all values for all attributes of the provided entry. The entry will be allowed to have attribute values not included in the provided entry.

      This method may be used regardless of whether the server is listening for client connections.
      Parameters:
      entry - The entry to compare against the directory server.
      Returns:
      true if the entry exists in the server and is a superset of the provided entry, or false if not.
      Throws:
      LDAPException - If a problem is encountered while trying to communicate with the directory server.
    • assertEntryExists

      Ensures that an entry with the provided DN exists in the directory.

      This method may be used regardless of whether the server is listening for client connections.
      Parameters:
      dn - The DN of the entry for which to make the determination.
      Throws:
      LDAPException - If a problem is encountered while trying to communicate with the directory server.
      AssertionError - If the target entry does not exist.
    • assertEntryExists

      Ensures that an entry with the provided DN exists in the directory.

      This method may be used regardless of whether the server is listening for client connections.
      Parameters:
      dn - The DN of the entry for which to make the determination.
      filter - A filter that the target entry must match.
      Throws:
      LDAPException - If a problem is encountered while trying to communicate with the directory server.
      AssertionError - If the target entry does not exist or does not match the provided filter.
    • assertEntryExists

      Ensures that an entry exists in the directory with the same DN and all attribute values contained in the provided entry. The server entry may contain additional attributes and/or attribute values not included in the provided entry.

      This method may be used regardless of whether the server is listening for client connections.
      Parameters:
      entry - The entry expected to be present in the directory server.
      Throws:
      LDAPException - If a problem is encountered while trying to communicate with the directory server.
      AssertionError - If the target entry does not exist or does not match the provided filter.
    • getMissingEntryDNs

      Retrieves a list containing the DNs of the entries which are missing from the directory server.

      This method may be used regardless of whether the server is listening for client connections.
      Parameters:
      dns - The DNs of the entries to try to find in the server.
      Returns:
      A list containing all of the provided DNs that were not found in the server, or an empty list if all entries were found.
      Throws:
      LDAPException - If a problem is encountered while trying to communicate with the directory server.
    • getMissingEntryDNs

      Retrieves a list containing the DNs of the entries which are missing from the directory server.

      This method may be used regardless of whether the server is listening for client connections.
      Parameters:
      dns - The DNs of the entries to try to find in the server.
      Returns:
      A list containing all of the provided DNs that were not found in the server, or an empty list if all entries were found.
      Throws:
      LDAPException - If a problem is encountered while trying to communicate with the directory server.
    • assertEntriesExist

      Ensures that all of the entries with the provided DNs exist in the directory.

      This method may be used regardless of whether the server is listening for client connections.
      Parameters:
      dns - The DNs of the entries for which to make the determination.
      Throws:
      LDAPException - If a problem is encountered while trying to communicate with the directory server.
      AssertionError - If any of the target entries does not exist.
    • assertEntriesExist

      Ensures that all of the entries with the provided DNs exist in the directory.

      This method may be used regardless of whether the server is listening for client connections.
      Parameters:
      dns - The DNs of the entries for which to make the determination.
      Throws:
      LDAPException - If a problem is encountered while trying to communicate with the directory server.
      AssertionError - If any of the target entries does not exist.
    • getMissingAttributeNames

      Retrieves a list containing all of the named attributes which do not exist in the target entry.

      This method may be used regardless of whether the server is listening for client connections.
      Parameters:
      dn - The DN of the entry to examine.
      attributeNames - The names of the attributes expected to be present in the target entry.
      Returns:
      A list containing the names of the attributes which were not present in the target entry, an empty list if all specified attributes were found in the entry, or null if the target entry does not exist.
      Throws:
      LDAPException - If a problem is encountered while trying to communicate with the directory server.
    • getMissingAttributeNames

      Retrieves a list containing all of the named attributes which do not exist in the target entry.

      This method may be used regardless of whether the server is listening for client connections.
      Parameters:
      dn - The DN of the entry to examine.
      attributeNames - The names of the attributes expected to be present in the target entry.
      Returns:
      A list containing the names of the attributes which were not present in the target entry, an empty list if all specified attributes were found in the entry, or null if the target entry does not exist.
      Throws:
      LDAPException - If a problem is encountered while trying to communicate with the directory server.
    • assertAttributeExists

      public void assertAttributeExists(@NotNull String dn, @NotNull String... attributeNames) throws LDAPException, AssertionError
      Ensures that the specified entry exists in the directory with all of the specified attributes.

      This method may be used regardless of whether the server is listening for client connections.
      Parameters:
      dn - The DN of the entry to examine.
      attributeNames - The names of the attributes that are expected to be present in the provided entry.
      Throws:
      LDAPException - If a problem is encountered while trying to communicate with the directory server.
      AssertionError - If the target entry does not exist or does not contain all of the specified attributes.
    • assertAttributeExists

      Ensures that the specified entry exists in the directory with all of the specified attributes.

      This method may be used regardless of whether the server is listening for client connections.
      Parameters:
      dn - The DN of the entry to examine.
      attributeNames - The names of the attributes that are expected to be present in the provided entry.
      Throws:
      LDAPException - If a problem is encountered while trying to communicate with the directory server.
      AssertionError - If the target entry does not exist or does not contain all of the specified attributes.
    • getMissingAttributeValues

      @Nullable public List<String> getMissingAttributeValues(@NotNull String dn, @NotNull String attributeName, @NotNull String... attributeValues) throws LDAPException
      Retrieves a list of all provided attribute values which are missing from the specified entry.

      This method may be used regardless of whether the server is listening for client connections.
      Parameters:
      dn - The DN of the entry to examine.
      attributeName - The attribute expected to be present in the target entry with the given values.
      attributeValues - The values expected to be present in the target entry.
      Returns:
      A list containing all of the provided values which were not found in the entry, an empty list if all provided attribute values were found, or null if the target entry does not exist.
      Throws:
      LDAPException - If a problem is encountered while trying to communicate with the directory server.
    • getMissingAttributeValues

      Retrieves a list of all provided attribute values which are missing from the specified entry. The target attribute may or may not contain additional values.

      This method may be used regardless of whether the server is listening for client connections.
      Parameters:
      dn - The DN of the entry to examine.
      attributeName - The attribute expected to be present in the target entry with the given values.
      attributeValues - The values expected to be present in the target entry.
      Returns:
      A list containing all of the provided values which were not found in the entry, an empty list if all provided attribute values were found, or null if the target entry does not exist.
      Throws:
      LDAPException - If a problem is encountered while trying to communicate with the directory server.
    • assertValueExists

      public void assertValueExists(@NotNull String dn, @NotNull String attributeName, @NotNull String... attributeValues) throws LDAPException, AssertionError
      Ensures that the specified entry exists in the directory with all of the specified values for the given attribute. The attribute may or may not contain additional values.

      This method may be used regardless of whether the server is listening for client connections.
      Parameters:
      dn - The DN of the entry to examine.
      attributeName - The name of the attribute to examine.
      attributeValues - The set of values which must exist for the given attribute.
      Throws:
      LDAPException - If a problem is encountered while trying to communicate with the directory server.
      AssertionError - If the target entry does not exist, does not contain the specified attribute, or that attribute does not have all of the specified values.
    • assertValueExists

      public void assertValueExists(@NotNull String dn, @NotNull String attributeName, @NotNull Collection<String> attributeValues) throws LDAPException, AssertionError
      Ensures that the specified entry exists in the directory with all of the specified values for the given attribute. The attribute may or may not contain additional values.

      This method may be used regardless of whether the server is listening for client connections.
      Parameters:
      dn - The DN of the entry to examine.
      attributeName - The name of the attribute to examine.
      attributeValues - The set of values which must exist for the given attribute.
      Throws:
      LDAPException - If a problem is encountered while trying to communicate with the directory server.
      AssertionError - If the target entry does not exist, does not contain the specified attribute, or that attribute does not have all of the specified values.
    • assertEntryMissing

      Ensures that the specified entry does not exist in the directory.

      This method may be used regardless of whether the server is listening for client connections.
      Parameters:
      dn - The DN of the entry expected to be missing.
      Throws:
      LDAPException - If a problem is encountered while trying to communicate with the directory server.
      AssertionError - If the target entry is found in the server.
    • assertAttributeMissing

      public void assertAttributeMissing(@NotNull String dn, @NotNull String... attributeNames) throws LDAPException, AssertionError
      Ensures that the specified entry exists in the directory but does not contain any of the specified attributes.

      This method may be used regardless of whether the server is listening for client connections.
      Parameters:
      dn - The DN of the entry expected to be present.
      attributeNames - The names of the attributes expected to be missing from the entry.
      Throws:
      LDAPException - If a problem is encountered while trying to communicate with the directory server.
      AssertionError - If the target entry is missing from the server, or if it contains any of the target attributes.
    • assertAttributeMissing

      Ensures that the specified entry exists in the directory but does not contain any of the specified attributes.

      This method may be used regardless of whether the server is listening for client connections.
      Parameters:
      dn - The DN of the entry expected to be present.
      attributeNames - The names of the attributes expected to be missing from the entry.
      Throws:
      LDAPException - If a problem is encountered while trying to communicate with the directory server.
      AssertionError - If the target entry is missing from the server, or if it contains any of the target attributes.
    • assertValueMissing

      public void assertValueMissing(@NotNull String dn, @NotNull String attributeName, @NotNull String... attributeValues) throws LDAPException, AssertionError
      Ensures that the specified entry exists in the directory but does not contain any of the specified attribute values.

      This method may be used regardless of whether the server is listening for client connections.
      Parameters:
      dn - The DN of the entry expected to be present.
      attributeName - The name of the attribute to examine.
      attributeValues - The values expected to be missing from the target entry.
      Throws:
      LDAPException - If a problem is encountered while trying to communicate with the directory server.
      AssertionError - If the target entry is missing from the server, or if it contains any of the target attribute values.
    • assertValueMissing

      public void assertValueMissing(@NotNull String dn, @NotNull String attributeName, @NotNull Collection<String> attributeValues) throws LDAPException, AssertionError
      Ensures that the specified entry exists in the directory but does not contain any of the specified attribute values.

      This method may be used regardless of whether the server is listening for client connections.
      Parameters:
      dn - The DN of the entry expected to be present.
      attributeName - The name of the attribute to examine.
      attributeValues - The values expected to be missing from the target entry.
      Throws:
      LDAPException - If a problem is encountered while trying to communicate with the directory server.
      AssertionError - If the target entry is missing from the server, or if it contains any of the target attribute values.