Class LdapExtClient
java.lang.Object
org.apache.jmeter.protocol.ldap.sampler.LdapExtClient
Ldap Client class is main class to create ,modify, search and delete all the
 LDAP functionality available
 Based on the work of: author T.Elanjchezhiyan(chezhiyan@siptech.co.in)
- 
Method SummaryModifier and TypeMethodDescriptionstatic NamingEnumeration<SearchResult>compare(DirContext dirContext, String filter, String entrydn) Filter the data in the ldap directorystatic DirContextconnect(String host, String port, String rootdn, String username, String password, String connTimeOut, boolean secure, boolean trustAll) connect to serverstatic DirContextcreateTest(DirContext dirContext, Attributes attributes, String string) Create the entry in the ldap directory for the given stringstatic voiddeleteTest(DirContext dirContext, String string) Delete the attribute from the ldap directorystatic voiddisconnect(DirContext dirContext) disconnect from the serverstatic voidmoddnOp(DirContext dirContext, String ddn, String newdn) ModDN the data in the ldap directory for the given search basestatic voidmodifyTest(DirContext dirContext, ModificationItem[] mods, String string) Modify the attribute in the ldap directory for the given stringstatic NamingEnumeration<SearchResult>searchTest(DirContext dirContext, String searchBase, String searchFilter, int scope, long countlim, int timelim, String[] attrs, boolean retobj, boolean deref) Filter the data in the ldap directory for the given search base
- 
Method Details- 
connectpublic static DirContext connect(String host, String port, String rootdn, String username, String password, String connTimeOut, boolean secure, boolean trustAll) throws NamingException connect to server- Parameters:
- host- name of the server to connect
- port- port of the server to connect
- rootdn- base of the tree to operate on
- username- name of the user to use for binding
- password- password to use for binding
- connTimeOut- connection timeout for connecting the server see "com.sun.jndi.ldap.connect.timeout"
- secure- flag whether ssl should be used
- trustAll- flag whether we should trust all certificates
- Returns:
- newly created DirContext
- Throws:
- NamingException- when creating the- DirContextfails
 
- 
disconnectdisconnect from the server- Parameters:
- dirContext- context do disconnect (may be- null)
 
- 
searchTestpublic static NamingEnumeration<SearchResult> searchTest(DirContext dirContext, String searchBase, String searchFilter, int scope, long countlim, int timelim, String[] attrs, boolean retobj, boolean deref) throws NamingException Filter the data in the ldap directory for the given search base- Parameters:
- dirContext- context to perform the search on
- searchBase- base where the search should start
- searchFilter- filter this value from the base
- scope- scope for search. May be one of- SearchControls.OBJECT_SCOPE,- SearchControls.ONELEVEL_SCOPEor- SearchControls.SUBTREE_SCOPE
- countlim- max number of results to get,- 0for all entries
- timelim- max time to wait for entries (in milliseconds),- 0for unlimited time
- attrs- list of attributes to return. If- nullall attributes will be returned. If empty, none will be returned
- retobj- flag whether the objects should be returned
- deref- flag whether objects should be dereferenced
- Returns:
- result of the search
- Throws:
- NamingException- when searching fails
 
- 
comparepublic static NamingEnumeration<SearchResult> compare(DirContext dirContext, String filter, String entrydn) throws NamingException Filter the data in the ldap directory- Parameters:
- dirContext- the context to operate on
- filter- filter this value from the base
- entrydn- distinguished name of entry to compare
- Returns:
- result of the search
- Throws:
- NamingException- when searching fails
 
- 
moddnOpModDN the data in the ldap directory for the given search base- Parameters:
- dirContext- context to operate on
- ddn- distinguished name of object to rename
- newdn- new distinguished name of object
- Throws:
- NamingException- when renaming fails
 
- 
modifyTestpublic static void modifyTest(DirContext dirContext, ModificationItem[] mods, String string) throws NamingException Modify the attribute in the ldap directory for the given string- Parameters:
- dirContext- context to operate on
- mods- list of all the- ModificationItems to apply on- string
- string- distinguished name of the object to modify
- Throws:
- NamingException- when modification fails
 
- 
createTestpublic static DirContext createTest(DirContext dirContext, Attributes attributes, String string) throws NamingException Create the entry in the ldap directory for the given string- Parameters:
- dirContext- context to operate on
- attributes- add all the attributes and values from the attributes object
- string- distinguished name of the subcontext to create
- Returns:
- newly created subcontext
- Throws:
- NamingException- when creating subcontext fails
 
- 
deleteTestDelete the attribute from the ldap directory- Parameters:
- dirContext- context to operate on
- string- distinguished name of the subcontext to destroy
- Throws:
- NamingException- when destroying the subcontext fails
 
 
-