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 Summary
Modifier 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
-
connect
public 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 connectport- port of the server to connectrootdn- base of the tree to operate onusername- name of the user to use for bindingpassword- password to use for bindingconnTimeOut- connection timeout for connecting the server see "com.sun.jndi.ldap.connect.timeout"secure- flag whether ssl should be usedtrustAll- flag whether we should trust all certificates- Returns:
- newly created
DirContext - Throws:
NamingException- when creating theDirContextfails
-
disconnect
disconnect from the server- Parameters:
dirContext- context do disconnect (may benull)
-
searchTest
public 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 onsearchBase- base where the search should startsearchFilter- filter this value from the basescope- scope for search. May be one ofSearchControls.OBJECT_SCOPE,SearchControls.ONELEVEL_SCOPEorSearchControls.SUBTREE_SCOPEcountlim- max number of results to get,0for all entriestimelim- max time to wait for entries (in milliseconds),0for unlimited timeattrs- list of attributes to return. Ifnullall attributes will be returned. If empty, none will be returnedretobj- flag whether the objects should be returnedderef- flag whether objects should be dereferenced- Returns:
- result of the search
- Throws:
NamingException- when searching fails
-
compare
public 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 onfilter- filter this value from the baseentrydn- distinguished name of entry to compare- Returns:
- result of the search
- Throws:
NamingException- when searching fails
-
moddnOp
ModDN the data in the ldap directory for the given search base- Parameters:
dirContext- context to operate onddn- distinguished name of object to renamenewdn- new distinguished name of object- Throws:
NamingException- when renaming fails
-
modifyTest
public 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 onmods- list of all theModificationItems to apply onstringstring- distinguished name of the object to modify- Throws:
NamingException- when modification fails
-
createTest
public 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 onattributes- add all the attributes and values from the attributes objectstring- distinguished name of the subcontext to create- Returns:
- newly created subcontext
- Throws:
NamingException- when creating subcontext fails
-
deleteTest
Delete the attribute from the ldap directory- Parameters:
dirContext- context to operate onstring- distinguished name of the subcontext to destroy- Throws:
NamingException- when destroying the subcontext fails
-