org.apache.jmeter.protocol.ldap.sampler

## Class LdapClient

- java.lang.Object
- - org.apache.jmeter.protocol.ldap.sampler.LdapClient

-     public class LdapClient
      extends java.lang.Object

  Ldap Client class is main class to create, modify, search and delete all the LDAP functionality available.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `LdapClient()` Constructor for the LdapClient object.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `connect(java.lang.String host, java.lang.String port, java.lang.String rootdn, java.lang.String username, java.lang.String password)` Connect to server.
    `void` | `createTest(javax.naming.directory.BasicAttributes basicattributes, java.lang.String string)` Create the attribute in the ldap directory for the given string.
    `void` | `deleteTest(java.lang.String string)` Delete the attribute from the ldap directory.
    `void` | `disconnect()` Disconnect from the server.
    `void` | `modifyTest(javax.naming.directory.ModificationItem[] mods, java.lang.String string)` Modify the attribute in the ldap directory for the given string.
    `boolean` | `searchTest(java.lang.String searchBase, java.lang.String searchFilter)` Filter the data in the ldap directory for the given search base.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### LdapClient

          public LdapClient()

      Constructor for the LdapClient object.

  - ### Method Detail

    - #### connect

          public void connect(java.lang.String host,
                              java.lang.String port,
                              java.lang.String rootdn,
                              java.lang.String username,
                              java.lang.String password)
                       throws javax.naming.NamingException

      Connect to server.
      Parameters:
        `host` - name of the ldap server
        `port` - port of the ldap server
        `rootdn` - base dn to start ldap operations from
        `username` - user name to use for binding
        `password` - password to use for binding
      Throws:
        `javax.naming.NamingException` - if `InitialDirContext` can not be build using the above parameters

    - #### disconnect

          public void disconnect()

      Disconnect from the server.

    - #### searchTest

          public boolean searchTest(java.lang.String searchBase,
                                    java.lang.String searchFilter)
                             throws javax.naming.NamingException

      Filter the data in the ldap directory for the given search base.
      Parameters:
        `searchBase` - where the search should start
        `searchFilter` - filter this value from the base
      Returns:
        `true` when the search yields results, `false` otherwise
      Throws:
        `javax.naming.NamingException` - when searching fails

    - #### modifyTest

          public void modifyTest(javax.naming.directory.ModificationItem[] mods,
                                 java.lang.String string)
                          throws javax.naming.NamingException

      Modify the attribute in the ldap directory for the given string.
      Parameters:
        `mods` - list of all `ModificationItem`s to apply
        `string` - dn of the object to modify
      Throws:
        `javax.naming.NamingException` - when modification fails

    - #### createTest

          public void createTest(javax.naming.directory.BasicAttributes basicattributes,
                                 java.lang.String string)
                          throws javax.naming.NamingException

      Create the attribute in the ldap directory for the given string.
      Parameters:
        `basicattributes` - add all the entry in to the basicattribute
        `string` - the string (dn) value
      Throws:
        `javax.naming.NamingException` - when creating subcontext fails

    - #### deleteTest

          public void deleteTest(java.lang.String string)
                          throws javax.naming.NamingException

      Delete the attribute from the ldap directory.
      Parameters:
        `string` - the string (dn) value
      Throws:
        `javax.naming.NamingException` - when destroying sub context fails

Copyright © 1998-2019 Apache Software Foundation. All Rights Reserved.