LdapClient (Apache JMeter dist API)
Description: declaration: package: org.apache.jmeter.protocol.ldap.sampler, class: LdapClient

Package org.apache.jmeter.protocol.ldap.sampler

# Class LdapClient

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

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

- ## Constructor Summary

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

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `connect(String host, String port, String rootdn, String username, String password)`
  Connect to server.
  `void`
  `createTest(BasicAttributes basicattributes, String string)`
  Create the attribute in the ldap directory for the given string.
  `void`
  `deleteTest(String string)`
  Delete the attribute from the ldap directory.
  `void`
  `disconnect()`
  Disconnect from the server.
  `void`
  `modifyTest(ModificationItem[] mods, String string)`
  Modify the attribute in the ldap directory for the given string.
  `boolean`
  `searchTest(String searchBase, 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 Details

  - ### LdapClient

    public LdapClient()
    Constructor for the LdapClient object.

- ## Method Details

  - ### connect

    public void connect(String host, String port, String rootdn, String username, String password) throws 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:
      `NamingException` - if `InitialDirContext` can not be build using the above parameters

  - ### disconnect

    public void disconnect()
    Disconnect from the server.

  - ### searchTest

    public boolean searchTest(String searchBase, String searchFilter) throws 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:
      `NamingException` - when searching fails

  - ### modifyTest

    public void modifyTest(ModificationItem[] mods, String string) throws 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:
      `NamingException` - when modification fails

  - ### createTest

    public void createTest(BasicAttributes basicattributes, String string) throws 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:
      `NamingException` - when creating subcontext fails

  - ### deleteTest

    public void deleteTest(String string) throws NamingException
    Delete the attribute from the ldap directory.
    Parameters:
      `string` - the string (dn) value
    Throws:
      `NamingException` - when destroying sub context fails