From 71f1a7bcaf7978f092fbcb7f3135cf55e8573690 Mon Sep 17 00:00:00 2001
From: Christophe Sovant <christophe.sovant@forgerock.com>
Date: Thu, 10 Sep 2009 14:14:09 +0000
Subject: [PATCH] Add ldapjdk tools
---
opends/tests/staf-tests/shared/functions/topology.xml | 74 ++++++
opends/tests/staf-tests/shared/java/ldapjndi/addAnEntry.java | 0
opends/tests/staf-tests/shared/functions/ldap.xml | 133 -----------
opends/tests/staf-tests/shared/java/ldapjndi/modifyAnAttribute.java | 0
opends/tests/staf-tests/shared/java/ldapjdk/PSearchOperations.java | 297 +++++++++++++++++++++++++++
opends/tests/staf-tests/shared/java/ldapjndi/saslSearchClient.java | 0
opends/tests/staf-tests/shared/java/ldapjdk/ldapjdk.jar | 0
opends/tests/staf-tests/shared/java/ldapjdk/PSearch.java | 130 +++++++++++
8 files changed, 501 insertions(+), 133 deletions(-)
diff --git a/opends/tests/staf-tests/shared/functions/ldap.xml b/opends/tests/staf-tests/shared/functions/ldap.xml
index 6a1eb35..4c803e5 100755
--- a/opends/tests/staf-tests/shared/functions/ldap.xml
+++ b/opends/tests/staf-tests/shared/functions/ldap.xml
@@ -2821,8 +2821,8 @@
'command' : '%s/bin/java' % JAVA_HOME,
'arguments' : '%s %s' % (STAFCmd,STAFCmdParams),
'location' : location,
- 'envCmd' : ['CLASSPATH=%s/../%s/ldap' % (dsPath,remote.reljavadir)],
- 'path' : '%s/../%s/ldap' % (dsPath,remote.reljavadir),
+ 'envCmd' : ['CLASSPATH=%s/../%s/ldapjndi' % (dsPath,remote.reljavadir)],
+ 'path' : '%s/../%s/ldapjndi' % (dsPath,remote.reljavadir),
'expectedRC': expectedRC,
'knownIssue': knownIssue
}
@@ -3071,8 +3071,8 @@
'command' : '%s/bin/java' % JAVA_HOME,
'arguments' : '%s %s' % (STAFCmd,STAFCmdParams),
'location' : location,
- 'envCmd' : ['CLASSPATH=%s/../%s/ldap' % (dsPath,remote.reljavadir)],
- 'path' : '%s/../%s/ldap' % (dsPath,remote.reljavadir),
+ 'envCmd' : ['CLASSPATH=%s/../%s/ldapjndi' % (dsPath,remote.reljavadir)],
+ 'path' : '%s/../%s/ldapjndi' % (dsPath,remote.reljavadir),
'expectedRC': expectedRC,
'knownIssue': knownIssue
}
@@ -3083,127 +3083,6 @@
</sequence>
</function>
-
- <!-- Modify an attribute -->
- <function name="modifyDn">
- <function-prolog>
- This function rename the rdn
- </function-prolog>
- <function-map-args>
- <function-arg-def name="location" type="optional" default="STAF_REMOTE_HOSTNAME">
- <function-arg-description>
- Location of target host
- </function-arg-description>
- <function-arg-property name="type" value="hostname"/>
- </function-arg-def>
- <function-arg-def name="dsPath" type="optional" default="'%s/%s' % (DIRECTORY_INSTANCE_DIR,OPENDSNAME)">
- <function-arg-description>
- Pathname to installation root
- </function-arg-description>
- <function-arg-property name="type" value="filepath"/>
- </function-arg-def>
- <function-arg-def name="dsInstanceHost" type="optional" default="STAF_REMOTE_HOSTNAME">
- <function-arg-description>
- Directory server hostname or IP address
- </function-arg-description>
- <function-arg-property name="type" value="hostname"/>
- </function-arg-def>
- <function-arg-def name="dsInstancePort" type="required">
- <function-arg-description>
- Directory server port number
- </function-arg-description>
- <function-arg-property name="type" value="Port number"/>
- </function-arg-def>
- <function-arg-def name="dsInstanceDn" type="required">
- <function-arg-description>
- Bind DN
- </function-arg-description>
- <function-arg-property name="type" value="DN"/>
- </function-arg-def>
- <function-arg-def name="dsInstancePswd" type="required">
- <function-arg-description>
- Bind password
- </function-arg-description>
- <function-arg-property name="type" value="string"/>
- </function-arg-def>
- <function-arg-def name="DNToModify" type="required">
- <function-arg-description>
- DN to modify
- </function-arg-description>
- <function-arg-property name="type" value="DN"/>
- </function-arg-def>
- <function-arg-def name="newRDN" type="optional">
- <function-arg-description>
- new rdn name : ie uid=jdoe_bis
- </function-arg-description>
- <function-arg-property name="type" value="string"/>
- </function-arg-def>
- <function-arg-def name="deleteOldRDN" type="optional">
- <function-arg-description>
- 1 : delete old rdn, 0 do not delete old rdn, default value is 1
- </function-arg-description>
- <function-arg-property name="type" value="integer"/>
- </function-arg-def>
- <function-arg-def name="expectedRC" type="optional" default="0">
- <function-arg-description>
- Expected return code value. Default value is 0
- Wildcard 'noCheck' to not check the RC
- </function-arg-description>
- <function-arg-property name="type" value="integer"/>
- </function-arg-def>
- <function-arg-def name="knownIssue" type="optional" default="None">
- <function-arg-description>
- Known issue. Corresponds to an issue number.
- </function-arg-description>
- <function-arg-property name="type" value="string" />
- </function-arg-def>
- </function-map-args>
- <sequence>
-
- <!-- Local variables -->
- <script>
- mylocation=location
- #Build the Command
- STAFCmdParamsList=[]
- STAFCmdParams=''
- STAFCmd=''
- </script>
-
- <!-- Set common ldap arguments -->
- <call function="'_ldapCommonArgs'" />
- <script>
- if DNToModify:
- STAFCmdParamsList.append('-d "%s"' % DNToModify)
-
- if newRDN:
- STAFCmdParamsList.append('-e "%s"' % newRDN)
-
- if deleteOldRDN:
- STAFCmdParamsList.append('-f "%s"' % deleteOldRDN)
-
- STAFCmdParams=' '.join(STAFCmdParamsList)
-
- STAFCmd='modifyDn'
- </script>
- <call function="'runCommand'" >
- { 'name' : 'Modify DN',
- 'command' : '%s/bin/java' % JAVA_HOME,
- 'arguments' : '%s %s' % (STAFCmd,STAFCmdParams),
- 'location' : location,
- 'envCmd' : ['CLASSPATH=%s/../%s/ldap' % (dsPath,remote.reljavadir)],
- 'path' : '%s/../%s/ldap' % (dsPath,remote.reljavadir),
- 'expectedRC': expectedRC,
- 'knownIssue': knownIssue
- }
- </call>
- <return>
- STAXResult
- </return>
- </sequence>
- </function>
-
-
-
<!-- Modify an attribute -->
<function name="saslSearch">
<function-prolog>
@@ -3406,8 +3285,8 @@
'command' : '%s/bin/java' % JAVA_HOME,
'arguments' : '%s %s' % (STAFCmd,STAFCmdParams),
'location' : location,
- 'envCmd' : ['CLASSPATH=%s/../%s/ldap' % (dsPath,remote.reljavadir)],
- 'path' : '%s/../%s/ldap' % (dsPath,remote.reljavadir),
+ 'envCmd' : ['CLASSPATH=%s/../%s/ldapjndi' % (dsPath,remote.reljavadir)],
+ 'path' : '%s/../%s/ldapjndi' % (dsPath,remote.reljavadir),
'expectedRC': expectedRC,
'knownIssue': knownIssue
}
diff --git a/opends/tests/staf-tests/shared/functions/topology.xml b/opends/tests/staf-tests/shared/functions/topology.xml
index 4b1b503..6685b5f 100755
--- a/opends/tests/staf-tests/shared/functions/topology.xml
+++ b/opends/tests/staf-tests/shared/functions/topology.xml
@@ -298,10 +298,10 @@
}
</call>
- <!-- Archive (ldap/.java) files -->
+ <!-- Archive (ldapjndi/.java) files -->
<script>
- javaSharedDir='%s/ldap' % source.java
- javaLocalDir ='%s/ldap' % local.java
+ javaSharedDir='%s/ldapjndi' % source.java
+ javaLocalDir ='%s/ldapjndi' % local.java
</script>
<message>
'Copy java files locally from %s to %s.' % \
@@ -316,7 +316,7 @@
}
</call>
- <!--- Check if ldap java files are already compiled -->
+ <!--- Check if ldapjndi java files are already compiled -->
<call function="'listFolderByExtension'" >
{
'location' : STAXServiceMachine,
@@ -326,7 +326,7 @@
</call>
<if expr="len(STAXResult) == 0">
<sequence>
- <!--- Compile ldap java files on controler host -->
+ <!--- Compile ldapjndi java files on controler host -->
<message>
'Compile Java files under %s on %s' \
% (javaLocalDir, STAXServiceMachine)
@@ -339,7 +339,69 @@
</call>
</sequence>
</if>
-
+
+ <!-- Archive (ldapjdk/.java) files -->
+ <script>
+ javaSharedDir='%s/ldapjdk' % source.java
+ javaLocalDir ='%s/ldapjdk' % local.java
+ </script>
+ <message>
+ 'Copy java files locally from %s to %s.' % \
+ (javaSharedDir,javaLocalDir)
+ </message>
+ <call function="'CopyFolderByExtension'">
+ {
+ 'location' : STAXServiceMachine,
+ 'srcfolder' : javaSharedDir,
+ 'destfolder' : javaLocalDir,
+ 'extension' : 'java'
+ }
+ </call>
+ <call function="'CopyFolderByExtension'">
+ {
+ 'location' : STAXServiceMachine,
+ 'srcfolder' : javaSharedDir,
+ 'destfolder' : javaLocalDir,
+ 'extension' : 'jar'
+ }
+ </call>
+
+ <!--- Check if ldapjdk java files are already compiled -->
+ <call function="'listFolderByExtension'" >
+ {
+ 'location' : STAXServiceMachine,
+ 'foldername' : javaLocalDir,
+ 'extension' : 'class'
+ }
+ </call>
+ <if expr="len(STAXResult) == 0">
+ <sequence>
+ <!--- Compile ldapjdk java files on controller host -->
+ <message>
+ 'Compile Java files under %s on %s' \
+ % (javaLocalDir, STAXServiceMachine)
+ </message>
+ <script>
+ if is_windows_platform(STAXServiceMachine):
+ separator=';'
+ jstaf_jarfile='%s\\bin\\JSTAF.jar' % LOCAL_STAF_ROOT
+ else:
+ separator=':'
+ jstaf_jarfile='%s/lib/JSTAF.jar' % LOCAL_STAF_ROOT
+
+ ldapjdk_jarfile='%s/ldapjdk.jar' % javaLocalDir
+ </script>
+ <call function="'compileJava'" >
+ {
+ 'location' : STAXServiceMachine,
+ 'foldername' : '%s' % javaLocalDir,
+ 'classpath' : '%s%s%s' \
+ % (ldapjdk_jarfile,separator,jstaf_jarfile)
+ }
+ </call>
+ </sequence>
+ </if>
+
<!-- Archive (.security) files -->
<message>
'Copy security data files locally from %s to %s.' % \
diff --git a/opends/tests/staf-tests/shared/java/ldapjdk/PSearch.java b/opends/tests/staf-tests/shared/java/ldapjdk/PSearch.java
new file mode 100644
index 0000000..3169c5c
--- /dev/null
+++ b/opends/tests/staf-tests/shared/java/ldapjdk/PSearch.java
@@ -0,0 +1,130 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ * Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ * Copyright 2009 Sun Microsystems, Inc.
+ */
+
+import netscape.ldap.util.GetOpt;
+
+public class PSearch {
+
+ public static void main(String[] args) {
+ String usage = "Usage: psearch -h <hostname> -p <port> -b <suffix>" + "[-D bindDN] [-w bindPW]" + "-f <fileURL+file name>" + "-l <y>" + "-n <number of thread>" + " -o <add,modify,delete,moddn>";
+ String hostname = "localhost";
+ int portnumber = 1389; //LDAPv3.DEFAULT_PORT;
+ int nbThreads = 1;//number of thread by default
+ // Check for these options. -H means to print out a usage message.
+ GetOpt options = new GetOpt("h:p:b:D:w:H:f:n:o:l", args);
+
+ // Get the arguments specified for each option.
+ String host = options.getOptionParam('h');
+ // host
+ if (options.hasOption('h')) {
+ if (host == null) {
+ // usage
+ System.out.println(usage);
+ System.exit(1);
+ } else {
+ hostname = host;
+ }
+ }
+ String port = options.getOptionParam('p');
+ // If a port number was specified, convert the port value
+ // to an integer.
+ if (port != null) {
+ try {
+ portnumber = java.lang.Integer.parseInt(port);
+ } catch (java.lang.Exception e) {
+ System.out.println("Invalid port number: " + port);
+ System.out.println(usage);
+ System.exit(1);
+ }
+ }
+ //number of thread
+ String nbT = options.getOptionParam('n');
+ if (nbT != null) {
+ try {
+ nbThreads = java.lang.Integer.parseInt(nbT);
+ } catch (java.lang.Exception e) {
+ System.out.println("Invalid Thread number: " + nbT);
+ System.out.println(usage);
+ System.exit(1);
+ }
+ }
+ // PSearch suffix
+ String suffix = options.getOptionParam('b');
+
+ String bindDN = options.getOptionParam('D');
+
+ String bindPW = options.getOptionParam('w');
+
+ //operations all by default
+ String operation = PSearchOperations.ALL;
+ if (options.hasOption('o')) {
+ String opParam = options.getOptionParam('o');
+ if (opParam.equals("add")) {
+ operation = PSearchOperations.ADD;
+ } else if (opParam.equals("modify")) {
+ operation = PSearchOperations.MODIFY;
+ } else if (opParam.equals("delete")) {
+ operation = PSearchOperations.DELETE;
+ } else if (opParam.equals("moddn")) {
+ operation = PSearchOperations.MODDN;
+ }else if (opParam.equals("all")) {
+ operation = PSearchOperations.ALL;;
+ } else {
+ System.out.println("Invalid operation type: " + opParam);
+ System.out.println(usage);
+ System.exit(1);
+ }
+ }
+
+ // to disable the log files
+ boolean useFile = false;
+ String fileName = "logLile";
+ if (options.hasOption('f')) {
+ useFile = options.hasOption('f');
+ fileName = options.getOptionParam('f');
+ }
+ // to enable system out logs
+ boolean output = options.hasOption('l');
+
+ System.out.println("Connecting to " + hostname + ":" + portnumber +
+ " as \"" + bindDN + "\"" +
+ " on suffix \"" + suffix + "\"" +
+ " on operation \"" + operation + "\"" +
+ " use file: \"" + useFile + "\" output: \"" + output + "\"");
+ //start all thread
+ for (int i = 0; i < nbThreads; i++) {
+ PSearchOperations ps = new PSearchOperations(i, hostname, portnumber, bindDN, bindPW, suffix);
+ if (useFile) {
+ ps.useLogFile(useFile);
+ ps.setLogFile(fileName);
+ }
+ ps.setOutput(output);
+ ps.setOperation(operation);
+ ps.start();
+ }
+ }
+}
diff --git a/opends/tests/staf-tests/shared/java/ldapjdk/PSearchOperations.java b/opends/tests/staf-tests/shared/java/ldapjdk/PSearchOperations.java
new file mode 100644
index 0000000..a4aa6ff
--- /dev/null
+++ b/opends/tests/staf-tests/shared/java/ldapjdk/PSearchOperations.java
@@ -0,0 +1,297 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ * Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ * Copyright 2009 Sun Microsystems, Inc.
+ */
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.Calendar;
+import java.util.Enumeration;
+import netscape.ldap.LDAPAttribute;
+import netscape.ldap.LDAPAttributeSet;
+import netscape.ldap.LDAPConnection;
+import netscape.ldap.LDAPEntry;
+import netscape.ldap.LDAPException;
+import netscape.ldap.LDAPSearchConstraints;
+import netscape.ldap.LDAPSearchResults;
+import netscape.ldap.LDAPv3;
+import netscape.ldap.controls.LDAPPersistSearchControl;
+
+
+public class PSearchOperations extends Thread {
+
+ public static final String ADD = "ADD";
+ public static final String MODIFY = "MODIFY";
+ public static final String DELETE = "DELETE";
+ public static final String MODDN = "MODDN";
+ public static final String ALL = "ALL";
+ private LDAPConnection connection;
+ private String hostname;
+ private int portnumber;
+ private String bindDN;
+ private String bindPW;
+ private String suffix;
+ private int threadId;
+ private String fileName;
+ private boolean output;
+ private boolean logFile;
+ private String operation;
+ /**
+ * constructor
+ * @param id
+ * @param hostname
+ * @param portnumber
+ * @param bindDN
+ * @param bindPW
+ * @param suffix
+ */
+ public PSearchOperations(int id, String hostname, int portnumber, String bindDN, String bindPW, String suffix) {
+ this.hostname = hostname;
+ this.portnumber = portnumber;
+ this.bindDN = bindDN;
+ this.bindPW = bindPW;
+ this.suffix = suffix;
+ this.threadId = id;
+ this.output = false;
+ this.logFile = false;
+ //by default all operation
+ this.operation = ALL;
+
+ }
+ /**
+ * to use systeme.out
+ * @param output boolean
+ */
+ public void setOutput(boolean output) {
+ this.output = output;
+ }
+ /**
+ * to use the log file
+ * @param logFile boolean
+ */
+ public void useLogFile(boolean logFile) {
+ this.logFile = logFile;
+ }
+ /**
+ * to define the log file and URI
+ * @param file String
+ */
+ public void setLogFile(String file) {
+ //if there one thread the thread id are not add in the file name
+ this.fileName = file;
+ //in multy thread for each thread the thread id are add in the file name
+ if (threadId!=0) {
+ String ext = file.substring(file.lastIndexOf("."), file.length());
+ this.fileName = file.substring(0, file.lastIndexOf(".")) + threadId + ext;
+ }
+ //delete old log file if logFile is present and enable
+ File fileToDelete = new File(fileName);
+ if (fileToDelete.isFile() && logFile) {
+ fileToDelete.delete();
+ }
+ }
+ /**
+ * to define the PSearch operation
+ * @param operation String
+ */
+ public void setOperation(String operation) {
+ this.operation = operation;
+ }
+
+ /**
+ *Connect to server.
+ */
+ private void connect() {
+ try {
+ connection = new LDAPConnection();
+ connection.connect(3, hostname, portnumber, "", "");
+ connection.authenticate(3, bindDN, bindPW);
+ write("[Thread id: " + threadId + "] \n" + getDate() + connection);
+ } catch (LDAPException ex) {
+ System.out.println("[Thread id: " + threadId + "]Connection :" + ex.getMessage());
+ System.exit(0);
+ }
+ }
+ /**
+ * to instanciate new LDAPPersistSearchControl
+ * @return LDAPPersistSearchControl
+ */
+ private LDAPPersistSearchControl PSearchControl() {
+ int op = 0;
+ if (operation.equals(ALL)) {
+ op = LDAPPersistSearchControl.ADD |
+ LDAPPersistSearchControl.MODIFY |
+ LDAPPersistSearchControl.DELETE |
+ LDAPPersistSearchControl.MODDN;
+ } else if (operation.equals(ADD)) {
+ op = LDAPPersistSearchControl.ADD;
+ } else if (operation.equals(MODIFY)) {
+ op = LDAPPersistSearchControl.MODIFY;
+ } else if (operation.equals(DELETE)) {
+ op = LDAPPersistSearchControl.DELETE;
+ } else if (operation.equals(MODDN)) {
+ op = LDAPPersistSearchControl.MODDN;
+ }
+
+ boolean changesOnly = true;
+ boolean returnControls = true;
+ boolean isCritical = true;
+
+ LDAPPersistSearchControl persistCtrl =
+ new LDAPPersistSearchControl(
+ op,
+ changesOnly,
+ returnControls,
+ isCritical);
+ return persistCtrl;
+ }
+ /**
+ * LDAP Search
+ * @return LDAPSearchResults
+ */
+ public LDAPSearchResults LDAPSearch() {
+ LDAPSearchResults res = null;
+ try {
+ LDAPPersistSearchControl persistCtrl = PSearchControl();
+ LDAPSearchConstraints cons = connection.getSearchConstraints();
+ cons.setBatchSize(1);
+ cons.setServerControls(persistCtrl);
+ // Start the persistent search.
+ res = connection.search(suffix, LDAPv3.SCOPE_SUB, "(objectclass=*)", null, false, cons);
+ } catch (LDAPException ex) {
+ System.out.println("[Thread id: " + threadId + "]LDAPSearch :" + ex.getMessage());
+ System.exit(0);
+ }
+ return res;
+ }
+ /**
+ * return the date and time
+ * @return String
+ */
+ public static String getDate() {
+ // Initialize the today's date string
+ String DATE_FORMAT = "yyyy/MM/dd:HH:mm:ss";
+ java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(DATE_FORMAT);
+ Calendar c1 = Calendar.getInstance(); // today
+ return ("[" + sdf.format(c1.getTime()) + "]");
+ }
+ /**
+ *
+ * @param b byte off control operation
+ * @return
+ */
+ public String controlName(byte b) {
+ String control;
+ switch (b) {
+ case LDAPPersistSearchControl.ADD:
+ control = "ADD";
+ break;
+ case LDAPPersistSearchControl.DELETE:
+ control = "DELETE";
+ break;
+ case LDAPPersistSearchControl.MODDN:
+ control = "MODDN";
+ break;
+ case LDAPPersistSearchControl.MODIFY:
+ control = "MODIFY";
+ break;
+ default:
+ control = String.valueOf(b);
+ break;
+ }
+ return control;
+ }
+ /**
+ * to write on the log file or to use syteme out
+ * @param msg String
+ */
+ public void write(String msg) {
+ if (output) {
+ System.out.println(msg);
+ }
+ if (logFile) {
+ FileWriter aWriter = null;
+ try {
+ aWriter = new FileWriter(fileName, true);
+ aWriter.write(msg + "\n");
+ aWriter.flush();
+ aWriter.close();
+ } catch (IOException ex) {
+ System.out.println("[Thread id: " + threadId + "]Write :" + ex.getMessage());
+ } finally {
+ try {
+ aWriter.close();
+ } catch (IOException ex) {
+ System.out.println("[Thread id: " + threadId + "]Write :" + ex.getMessage());
+ }
+ }
+ }
+ }
+ /**
+ * run thread methode
+ */
+ public void run() {
+ connect();
+ LDAPSearchResults result = LDAPSearch();
+ while (result.hasMoreElements() && connection.isConnected()) {
+ byte[] arr = result.getResponseControls()[0].getValue();
+ LDAPEntry entry = (LDAPEntry) result.nextElement();
+ LDAPAttributeSet attrSet = entry.getAttributeSet();
+ Enumeration attrs = attrSet.getAttributes();
+ if (entry.getDN().contains("break")) {
+ String message = "\n[Thread id: " + threadId + "] " + getDate() + " [BREAK]";
+ write(message);
+ System.exit(0);
+ } else if (entry.getDN().contains("stop")) {
+ try {
+ connection.disconnect();
+ String message = "\n[Thread id: " + threadId + "] " + getDate() + "[STOP]";
+ write(message);
+ System.exit(0);
+ } catch (LDAPException ex) {
+ System.out.println("[Thread id: " + threadId + "]run :" + ex.getLDAPErrorMessage());
+ }
+ }
+ String message = "[Thread id: " + threadId + "] " + getDate() + " [" + controlName(arr[4]) + "]";
+ write("\n" + message);
+ String dn = "dn: " + entry.getDN();
+ write(dn);
+ while (attrs.hasMoreElements()) {
+ LDAPAttribute attr = (LDAPAttribute) attrs.nextElement();
+ String name = attr.getName();
+ Enumeration values = attr.getStringValues();
+ while (values.hasMoreElements()) {
+ String attribute = name + ": " + values.nextElement();
+ write(attribute);
+ }
+ }
+ }
+ if (!connection.isConnected()) {
+ String message = "\n[Thread id: " + threadId + "] " + getDate() + "[CONNECTION CLOSE]";
+ write(message);
+ }
+ }
+}
diff --git a/opends/tests/staf-tests/shared/java/ldapjdk/ldapjdk.jar b/opends/tests/staf-tests/shared/java/ldapjdk/ldapjdk.jar
new file mode 100644
index 0000000..4744bc0
--- /dev/null
+++ b/opends/tests/staf-tests/shared/java/ldapjdk/ldapjdk.jar
Binary files differ
diff --git a/opends/tests/staf-tests/shared/java/ldap/addAnEntry.java b/opends/tests/staf-tests/shared/java/ldapjndi/addAnEntry.java
similarity index 100%
rename from opends/tests/staf-tests/shared/java/ldap/addAnEntry.java
rename to opends/tests/staf-tests/shared/java/ldapjndi/addAnEntry.java
diff --git a/opends/tests/staf-tests/shared/java/ldap/modifyAnAttribute.java b/opends/tests/staf-tests/shared/java/ldapjndi/modifyAnAttribute.java
similarity index 100%
rename from opends/tests/staf-tests/shared/java/ldap/modifyAnAttribute.java
rename to opends/tests/staf-tests/shared/java/ldapjndi/modifyAnAttribute.java
diff --git a/opends/tests/staf-tests/shared/java/ldap/saslSearchClient.java b/opends/tests/staf-tests/shared/java/ldapjndi/saslSearchClient.java
similarity index 100%
rename from opends/tests/staf-tests/shared/java/ldap/saslSearchClient.java
rename to opends/tests/staf-tests/shared/java/ldapjndi/saslSearchClient.java
--
Gitblit v1.10.0