From 2cb8eeb33b3d2a1e26b08e36f6525e07510dc10f Mon Sep 17 00:00:00 2001
From: smaguin <smaguin@localhost>
Date: Thu, 19 Jun 2008 11:55:58 +0000
Subject: [PATCH] not used
---
/dev/null | 223 -------------------------------------------------------
1 files changed, 0 insertions(+), 223 deletions(-)
diff --git a/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/secureModifyEntries/build.ksh b/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/secureModifyEntries/build.ksh
deleted file mode 100755
index 367e089..0000000
--- a/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/secureModifyEntries/build.ksh
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/bin/ksh
-
-# 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
-# information:
-# Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2008 Sun Microsystems, Inc.
-
-export CLASSPATH=$CLASSPATH:.
-
-mkdir -p $COMPILDIR
-echo "Compiling classes..."
-javac src/*.java -d $COMPILDIR
-[ $? -ne 0 ] && return 1
-echo "Creating jarfile"
-cd $COMPILDIR
-jar cvf secureModifyEntries.jar *.class
-[ $? -ne 0 ] && return 1
-echo "Cleanup"
-rm -f *.class
diff --git a/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/secureModifyEntries/run.ksh b/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/secureModifyEntries/run.ksh
deleted file mode 100644
index 95effcf..0000000
--- a/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/secureModifyEntries/run.ksh
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/bin/ksh
-
-# 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
-# information:
-# Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2008 Sun Microsystems, Inc.
-
-suffix="dc=com"
-hostname=nott
-maxDuration=50
-nb_threads=1
-NB_MAX_mod=100
-keystorePath=/tmp/sylvie
-LDAPSport=1235
-
-bindDN="cn=directory manager"
-bindPW=password
-
-#java -client -Xmx1G -Xms1G -XX:NewRatio=1 -XX:SurvivorRatio=100 -cp ../LDAPjdk/ldapjdk.jar:search.jar Client $@
-
-#java -client -Xmx1G -Xms1G -XX:NewRatio=1 -XX:SurvivorRatio=100 -cp ../LDAPjdk/ldapjdk.jar:search.jar -Djavax.net.ssl.keyStore=/tmp/shared/data/CERT_1111/keystore -Djavax.net.ssl.trustStorePassword=password -Djavax.net.ssl.keyStorePassword=password -Djavax.net.ssl.trustStore=/tmp/shared/data/CERT_1111/keystore -Djava.security.debug=ALL -Djava.security.auth.debug=ALL -Djavax.net.debug=ALL -Djavax.security.sasl.level=FINEST Client $@
-
-## SSL
-java -client -Xmx1G -Xms1G -XX:NewRatio=1 -XX:SurvivorRatio=100 -cp secureModifyEntries.jar -Djavax.net.ssl.keyStore=$keystorePath/keystore -Djavax.net.ssl.trustStorePassword=password -Djavax.net.ssl.keyStorePassword=password -Djavax.net.ssl.trustStore=$keystorePath/keystore -Djavax.security.sasl.level=FINEST -Dport=$LDAPSport -DmaxDuration=$maxDuration -DNB_MAX_mod=$NB_MAX_mod -Dsuffix=$suffix -Dnb_threads=$nb_threads -Dhostname=$hostname Client $@
-#
-
-
-## CLEAR
-#java -client -Xmx1G -Xms1G -XX:NewRatio=1 -XX:SurvivorRatio=100 -cp search.jar -Djavax.net.ssl.keyStore=/tmp/shared/data/CERT_1111/keystore -Djavax.net.ssl.trustStorePassword=password -Djavax.net.ssl.keyStorePassword=password -Djavax.net.ssl.trustStore=/tmp/shared/data/CERT_1111/keystore -Djavax.security.sasl.level=FINEST -Dport=1111 -DmaxDuration=$maxDuration -DNB_MAX_mod=$NB_MAX_mod -Dsuffix=$suffix -Dnb_threads=$nb_threads -Dhostname=$hostname -DbindDN="$bindDN" -DbindPW=$bindPW Client $@
-
diff --git a/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/secureModifyEntries/secureModifyEntries.xml b/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/secureModifyEntries/secureModifyEntries.xml
deleted file mode 100644
index 21cb5bc..0000000
--- a/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/secureModifyEntries/secureModifyEntries.xml
+++ /dev/null
@@ -1,340 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!DOCTYPE stax SYSTEM "../../../shared/stax.dtd">
-<!--
- ! 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 2008 Sun Microsystems, Inc.
- ! -->
-<stax>
-
- <defaultcall function="secureModifyEntries"/>
-
- <!-- ************************************************************ -->
- <function name="secureModifyEntries" scope="local">
-
- <function-map-args>
- <function-arg-def name="workingDir" type="required"/>
- <function-arg-def name="client" type="required"/>
- <function-arg-def name="instances" type="required"/>
- <function-arg-def name="duration" type="required"/>
- <function-arg-def name="suffix" type="required"/>
- <function-arg-def name="outFile" type="required"/>
- <function-arg-def name="fileFd" type="required"/>
- </function-map-args>
-
-
- <sequence>
- <!-- =================== Comments =================== -->
- <!-- client is run under paralleliterate tag -->
- <!-- each variables defined are internal -->
- <!-- client should have its own err_num variable in order -->
- <!-- to inform scheduler if it has pass/fail status -->
- <script>
- errNum = 0
- msg = ''
- </script>
-
- <!-- ================== Preamble =================== -->
- <!-- parse the client parameters : -->
- <!-- params is [[param1,val1],[param2,val2],...] -->
- <!-- get the ldap instance parameters -->
-
-
- <script>
- compilDir = '%s/%s_%s' % (workingDir,client.getHost(),client.getId())
-
- outFile = '%s/client_secureModifyEntries_id%s.txt' % \
- (client.getLogDir(),client.getId())
-
- #
- # Extract client parameters from client.getParams()
- #
- cParams = client.getParams()
- try:
- serverInstanceFromClient = cParams[0][1]
- except IndexError:
- serverInstanceFromClient = NOT_DEFINED
- msg = '%s\nERROR: serverInstanceFromClient undefined,mandatory' % msg
- try:
- baseDn = cParams[1][1]
- except IndexError:
- baseDn = NOT_DEFINED
- msg = '%s\nERROR: baseDn undefined,mandatory' % msg
- try:
- nbCnx = cParams[2][1]
- except IndexError:
- nbCnx = NOT_DEFINED
- msg = '%s\nERROR: nbCnx undefined,mandatory' % msg
- try:
- nbMaxOp = cParams[3][1]
- except IndexError:
- nbMaxOp = NOT_DEFINED
- msg = '%s\nERROR: nbMaxOperations undefined,mandatory' % msg
- try:
- attributeName = cParams[4][1]
- except IndexError:
- attributeName = NOT_DEFINED
- try:
- protocol = cParams[5][1]
- except IndexError:
- protocol = NOT_DEFINED
- try:
- authentication = cParams[6][1]
- except IndexError:
- authentication = NOT_DEFINED
- try:
- certAlias = cParams[7][1]
- except IndexError:
- certAlias = NOT_DEFINED
- try:
- operation = cParams[8][1]
- except IndexError:
- operation = NOT_DEFINED
- try:
- delaySec = cParams[9][1]
- except IndexError:
- delaySec = NOT_DEFINED
- #
- # setup parms to run the client
- #
- if serverInstanceFromClient != NOT_DEFINED:
- sys.path.append("%s/phases/scheduler" % TESTS_DIR )
- from scheduler import getInstance
- serverInstance = getInstance(serverInstanceFromClient,instances)
- if (serverInstance == 'ERROR'):
- msg = '%s\nERROR: cant find client instance named' % msg
- msg = '%s %s in server instance list' % \
- (msg,serverInstanceFromClient)
-
- else:
- # remove sec, try to finish before timer kill -9 the client
- duration = duration - 120
-
- # keystorePath
- keystorePath = "%s/CERT_%s_%s/config" % (client.getLogDir(),client.getName(),client.getId())
-
- parms=[]
- if (protocol == 'ssl'):
- parms.append('-Dhostname=%s -Dport=%s' % \
- (serverInstance.getHost(),serverInstance.getLDAPSPort()))
- else:
- parms.append('-Dhostname=%s -Dport=%s' % \
- (serverInstance.getHost(),serverInstance.getLDAPPort()))
-
- parms.append('-Dsuffix="%s"' % baseDn)
-
- parms.append('-Dnb_threads=%s -DNB_MAX_mod=%s -DmaxDuration=%s' % (nbCnx,nbMaxOp,duration))
- parms.append('-Dprotocol="%s"' % protocol)
- if attributeName != NOT_DEFINED:
- parms.append('-DattributeName="%s"' % attributeName)
- parms.append('-Dauthentication="%s"' % authentication)
-
- parms.append('-DbindDN="%s"' % DIRECTORY_INSTANCE_DN)
- parms.append('-DbindPW="%s"' % DIRECTORY_INSTANCE_PSWD)
-
- parms.append('-Doperation="%s"' % operation)
- if delaySec != NOT_DEFINED:
- parms.append('-DdelaySec="%s"' % delaySec)
- parms = ' '.join(parms)
- </script>
-
- <if expr="msg.find('ERROR') != -1">
- <sequence>
- <message>'%s' % msg</message>
- <call function="'writeOperationResult'">
- {
- 'returncode' : '1',
- 'expected' : '0',
- 'result' : msg,
- 'status' : 'ERROR',
- 'fileFd' : fileFd
- }
- </call>
- <script>
- errNum += 1
- </script>
- </sequence>
- <else>
- <sequence>
-
- <!-- ==== Add execute permission to build.ksh file ==== -->
- <call function="'writeStartTagOperation'">
- { 'tagName' : 'chmod',
- 'fileFd' : fileFd }
- </call>
- <call function="'writeMessage'">
- {'content' : 'Add execute permission to build.ksh file',
- 'fileFd' : fileFd}
- </call>
-
-
- <process name="'%s: chmod +x build.ksh' % client.getHost()">
- <location>client.getHost()</location>
- <command mode="'shell'">'chmod +x build.ksh'</command>
- <parms/>
- <workdir>workingDir</workdir>
- <envs>['PATH=/bin:/usr/bin']</envs>
- <stderr mode="'stdout'"/>
- <stdout/>
- <returnstdout/>
- </process>
- <call function="'checkRC'">
- { 'returncode' : RC,
- 'result' : STAXResult[0][1],
- 'fileFd' : fileFd }
- </call>
- <script>
- errNum += STAXResult
- </script>
- <call function="'writeEndTagOperation'">{'fileFd' : fileFd}</call>
-
-
- <!-- ==== Build client : run build.ksh file ==== -->
- <call function="'writeStartTagOperation'">
- { 'tagName' : 'build',
- 'fileFd' : fileFd }
- </call>
-
-
- <!-- Build Client in unique directory (compilDir), avoid -->
- <!-- conflict if same client is run several time at the same time -->
- <process name="'%s: build %s' % (client.getHost(),client.getName())">
- <location>client.getHost()</location>
- <command mode="'shell'">'./build.ksh'</command>
- <parms/>
- <workdir>workingDir</workdir>
- <envs>['PATH=%s/bin:/bin:/usr/bin' % JAVA_HOME,'COMPILDIR=%s' % compilDir ]</envs>
- <stderr mode="'stdout'"/>
- <stdout/>
- <returnstdout/>
- </process>
- <call function="'checkRC'">
- { 'returncode' : RC,
- 'result' : STAXResult[0][1],
- 'fileFd' : fileFd }
- </call>
- <if expr="RC != 0">
- <message>
- 'FAILED to build client %s on %s' % \
- (client.getName(),client.getHost())
- </message>
- </if>
- <script>
- errNum += STAXResult
- </script>
- <call function="'writeEndTagOperation'">{'fileFd' : fileFd}</call>
-
-
- <!-- ========== Run the client ========== -->
- <call function="'writeStartTagOperation'">
- { 'tagName' : 'run',
- 'fileFd' : fileFd }
- </call>
- <call function="'writeMessage'">
- { 'fileFd' : fileFd,
- 'content' : 'Do ldapmodify on %s:%s' % \
- (serverInstance.getHost(),serverInstance.getLDAPSPort())
- }
- </call>
-
- <script>
- cParam = '-client -Xmx1G -Xms1G'
- cParam = '%s -XX:NewRatio=1 -XX:SurvivorRatio=100' % cParam
- cParam = '%s -cp %s/secureModifyEntries.jar' % (cParam,compilDir)
- cParam = '%s -Djavax.net.ssl.keyStore=%s/keystore' % (cParam,keystorePath)
- cParam = '%s -Djavax.net.ssl.trustStore=%s/keystore' % (cParam,keystorePath)
- cParam = '%s -Djavax.security.sasl.level=FINEST' % cParam
- cParam = '%s -Djavax.net.ssl.trustStorePassword=password' % cParam
- cParam = '%s -Djavax.net.ssl.keyStorePassword=password' % cParam
- cParam = '%s %s Client' % (cParam,parms)
-
- titleName = '%s: run %s on %s' % \
- (client.getHost(),client.getName(),
- serverInstance.getName())
- </script>
- <call function="'writeMessage'">
- { 'fileFd' : fileFd,
- 'content' : 'DEBUG %s' % cParam
- }
- </call>
- <process name="'%s' % titleName">
- <location>client.getHost()</location>
- <command>'%s/bin/java' % JAVA_HOME</command>
- <parms>cParam </parms>
- <workdir>workingDir</workdir>
- <envs>['PATH=%s/bin:/bin:/usr/bin' % JAVA_HOME]</envs>
- <stderr mode="'stdout'"/>
- <stdout>outFile</stdout>
- <returnstdout/>
- </process>
- <!-- TBD : result should be STAXResult[0][1] : problem when
- javaexception, with carac " and < >-->
- <call function="'checkRC'">
- { 'returncode' : RC ,
- 'result' : '',
- 'fileFd' : fileFd }
- </call>
- <script>
- errNum += STAXResult
- </script>
- <call function="'writeEndTagOperation'">{'fileFd' : fileFd}</call>
-
- <!-- ========== Postamble ========== -->
- <call function="'writeMessage'">
- {'content' : 'Output file %s' % outFile,
- 'fileFd' : fileFd}
- </call>
-
-
- <process name="'%s:%s: Grep' % (client.getHost(),client.getName())">
- <location>client.getHost()</location>
- <command mode="'shell'">
- "grep 'TOTAL' %s | cut -d ' ' -f3-" % outFile
- </command>
- <envs>['PATH=/bin:/usr/bin']</envs>
- <stderr mode="'stdout'"/>
- <stdout/>
- <returnstdout/>
- </process>
- <script>
- summary = STAXResult[0][1]
- </script>
-
-
- <call function="'writeMessage'">
- {'content' : 'Summary %s' % (summary),
- 'fileFd' : fileFd}
- </call>
-
- </sequence>
- </else>
- </if>
-
- <return> errNum </return>
-
- </sequence>
-
- </function>
-
-</stax>
-
diff --git a/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/secureModifyEntries/src/Client.java b/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/secureModifyEntries/src/Client.java
deleted file mode 100644
index dc3f4ad..0000000
--- a/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/secureModifyEntries/src/Client.java
+++ /dev/null
@@ -1,498 +0,0 @@
-// 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
-// information:
-// Portions Copyright [yyyy] [name of copyright owner]
-//
-// CDDL HEADER END
-//
-//
-// Copyright 2008 Sun Microsystems, Inc.
-
-import java.util.*;
-import java.io.*;
-import java.lang.Thread;
-import javax.naming.*;
-import javax.naming.directory.InitialDirContext;
-import javax.naming.directory.SearchControls;
-import javax.naming.directory.DirContext;
-import javax.naming.directory.SearchResult;
-import javax.naming.directory.Attributes;
-
-
-public class Client {
-
-
- static int NB_MAX_mod=100;
- static int nb_mod_started=0;
- static int nb_mod_done=0;
- static int total_nb_mod=0;
- static int nb_threads=3;
- static int nb_thread_ready=0;
-
- static Random random;
- static String hostname ;
- static int portnumber;
- static String bindDN;
- static String bindPW;
- static String suffix;
- static Server server;
- static String authentication;
- static String protocol;
- static String operation;
- static String attributeName;
- static String time= new String ("0 sec.");
- static long timeTostopTest=0;
- static long maxDuration=0;
- static long duration=0;
- static long startup=0;
- static ArrayList<String> DNList;
- static long delayCnx=1000;
- static long delaySec=1;
-
-
- public Client()
- {
-
- random= new Random();
- DNList=new ArrayList<String>();
-
- try {
-
- /*
- * bind as directory manager to get the full list of DN
- * create a list of DN
- */
- Hashtable envLdap = set_properties_LDAP_simpleBind();
-
- DirContext ctx = null;
- ctx = new InitialDirContext(envLdap);
-
- // Search options
- String filter = "(objectclass=inetorgperson)";
- String[] attrs = { "uid"};
-
- SearchControls constraints = new SearchControls();
- constraints.setSearchScope(SearchControls.SUBTREE_SCOPE);
- constraints.setReturningAttributes(attrs);
-
- NamingEnumeration results = ctx.search(suffix, filter, constraints);
- Exception exc = null;
- int count = 0;
-
- try {
- while (results != null && results.hasMore()) {
- SearchResult res = (SearchResult) results.next();
- DNList.add (res.getNameInNamespace());
-
- count++;
- }
-
- DNList.trimToSize();
- if ( DNList.size() == 0) {
- println("ERROR", "No entry found in \"" + suffix + "\"");
- System.exit(1);
- }
- } catch (Exception ex) {
- exc = ex;
- }
- if ( exc != null ) {
- throw exc;
- }
- } catch (Exception e) {
-
- println ("INFO", "Failed to establish connection ");
- e.printStackTrace();
- System.exit(1);
- }
-
- try {
-
-
- // execute the threads
- for (int i=0; i < nb_threads; i++ ) {
- Worker w = new Worker(this, server);
- }
- println ("INFO", nb_threads + " threads connected to server " + server );
- //println ("INFO", "Will search using filter \"(" + attr + " = <value> )\" (MAX =" + NB_MAX_mod + ")" );
-
- // Wait until all the threads have initialized their context
- // and are ready to bind
- try {
- while ( nb_thread_ready() < nb_threads) {
- // wait
- }
- // All the threads are ready, wake up all the threads
- synchronized(this) {
- nb_thread_ready=0;
- notifyAll();
- }
- }
- catch ( Exception e1 ) {
- System.out.println ("E1");
- e1.printStackTrace();
- }
-
- int seconds=0;
- // initialize startup
- long t1=System.currentTimeMillis();
-
- // work until Max duration is reached
- while (true) {
-
- long new_t1=System.currentTimeMillis();
-
- // end of the system test. Exit
- if ( ( timeTostopTest != 0 ) && ( new_t1 > timeTostopTest ) ) {
-
- // inform all the threads it's the end
- synchronized (this) {
- nb_mod_started=NB_MAX_mod;
- }
- break;
- }
-
- // status every delayCnx
- if ( (new_t1 - t1) >= delayCnx) {
-
- println("INFO", (nb_mod_done/delaySec) + " mod/sec.");
-
- // inform all the threads the max nb searchs has been reached
- synchronized (this) {
- nb_mod_started=NB_MAX_mod;
- }
-
- // Wait all the threads to close their cnx and sleep
- try {
- total_nb_mod+=nb_mod_done;
- while ( nb_thread_ready() < nb_threads) {
- // wait
- }
- // All the threads are ready, wake up all the threads
- synchronized(this) {
- nb_thread_ready=0;
- nb_mod_started=0;
- nb_mod_done=0;
-
- notifyAll();
- }
- }
- catch ( Exception e1 ) {
- System.out.println ("E1");
- e1.printStackTrace();
- }
-
- if ( (seconds++) >= 9 ) {
- duration=((new_t1-startup)/1000);
- println("INFO", "Avg rate: " + (total_nb_mod/duration) + " mod/sec. after " + getTime(duration));
- seconds=0;
- }
- t1=new_t1;
- }
- }
- println ("INFO", "End of the client");
- System.exit(0);
- }
- catch( Exception e ) {
-
- e.printStackTrace();
- System.exit(1);
- }
-
-
- }
-
-
-/* =========================================
- * MAIN
- * ======================================= */
-
- public static void main( String[] args )
-
- {
-
- startup=System.currentTimeMillis();
-
- // ===========================================
- // Get the arguments specified for each option.
- //
-
- // Ldap port
- String sport = System.getProperty("port");
- portnumber = Integer.parseInt(sport);
-
- // BaseDN
- suffix = System.getProperty("suffix");
- println ("INFO" , "suffix " + suffix);
-
- // nb_threads
- String snb_threads = System.getProperty("nb_threads");
- nb_threads = Integer.parseInt(snb_threads);
-
- println ("INFO" , "nb_threads " + snb_threads);
-
- // test duration
- String sMaxDuration = System.getProperty("maxDuration");
- maxDuration = Long.parseLong(sMaxDuration);
- println ("INFO" , "maxDuration " + maxDuration);
-
- // credential for simple bind
- bindDN = System.getProperty("bindDN");
- bindPW = System.getProperty("bindPW");
- println ("INFO" , "bindDN " + bindDN);
-
- // Max number of searchs
- String sNB_MAX_mod = System.getProperty("NB_MAX_mod");
- NB_MAX_mod = Integer.parseInt(sNB_MAX_mod);
- println ("INFO" , "sNB_MAX_mod " + sNB_MAX_mod);
-
- // attribute to modify or add
- attributeName = System.getProperty("attributeName");
- println ("INFO" , "attributeName " + attributeName);
-
- // operation to perform: modify or add
- operation = System.getProperty("operation");
- println ("INFO" , "operation " + operation);
- // hostname
- hostname = System.getProperty("hostname");
-
- // protocol : SSL or TLS
- protocol = System.getProperty("protocol");
- println ("INFO" , "protocol " + protocol);
-
- // authentication : EXTERNAL or simple
- authentication = System.getProperty("authentication");
- println ("INFO" , "authentication " + authentication);
-
- // delay Sec before closing conx
- String sdelaySec = System.getProperty("delaySec");
- delaySec = Long.parseLong(sdelaySec);
- delayCnx = delaySec * 1000;
- println ("INFO" , "delayCnx " + delayCnx);
-
- if ( maxDuration != 0 ) {
- maxDuration= maxDuration * 1000;
- }
- timeTostopTest=( startup + maxDuration);
- println("INFO", "the test will finish at " + timeTostopTest );
-
- // ===========================================
- // Initialize the Server
- server=new Server (hostname,portnumber);
-
- System.out.println ("DEBUG declare server " + portnumber + " " + hostname);
-
- Runtime.getRuntime().addShutdownHook(new Thread() {
-
- public void run() {
- }
- });
-
- Client c = new Client();
- }
-
-/* =========================================
- * Get Date
- * ======================================= */
- public static String getTime(long d) {
- String time=new String (d + " sec.");
- if ( d > 10000 ) {
- time=new String ((d/3600) + " hours");
- } else if ( d > 300 ) {
- time=new String ((d/60) + " min.");
- }
- return time;
- }
-
-/* =========================================
- * return true if the number of NB_MAX_mod has been reached
- * else, increase nb_mod_started
- * ======================================= */
-
- public boolean nb_mod_started_reached() {
-
- synchronized (this) {
- if ( nb_mod_started>=NB_MAX_mod ) {
- return true;
-
- } else {
- nb_mod_started++;
- return false;
- }
- }
- }
-
-
-/* =========================================
- * thread is waiting for a notify from the main thread
- * ======================================= */
-
- public void thread_go_to_sleep() {
-
- synchronized (this) {
- try {
- nb_thread_ready++;
-
- this.wait();
- } catch ( Exception e ) {
- e.printStackTrace();
- }
- }
- }
-
-
-/* =========================================
- * increase the number of mod started
- * ======================================= */
- public void inc_mod_started() {
-
- synchronized (this) {
- if ( nb_mod_started>=NB_MAX_mod ) {
- try {
- this.wait();
- } catch ( Exception e ) {
- e.printStackTrace();
- }
-
- } else {
- nb_mod_started++;
- }
- }
- }
-
-
-
-/* =========================================
- * increase the number of mod done
- * ======================================= */
- public void inc_mod_done() {
- synchronized (this) {
- try {
- nb_mod_done++;
- } catch ( Exception e ) {
- e.printStackTrace();
- }
- }
- }
-
-
-/* =========================================
- * Configure the Properties depending of the selected authentication and protocol
- * authentication : EXTERNAL or simple
- * protocol ssl, tls or clear
- * ======================================= */
- public static Hashtable set_properties_LDAP() {
-
- String provider ;
-
- Hashtable envLdap = new Hashtable();
- envLdap.put("java.naming.factory.initial",
- "com.sun.jndi.ldap.LdapCtxFactory");
-
- envLdap.put(Context.SECURITY_AUTHENTICATION, authentication);
-
- if ( protocol.equals("ssl")) {
- provider = "ldaps://"+server.host+":"+server.port+"/";
- envLdap.put(Context.SECURITY_PROTOCOL, protocol);
-
- } else {
- provider = "ldap://"+server.host+":"+server.port+"/";
- }
- envLdap.put(Context.PROVIDER_URL, provider);
-
- return envLdap;
- }
-
-
-/* =========================================
- * Configure the Properties for a simple Bind
- * bind as directory manager
- * use the selected protocol : ssl, tls or clear
- * ======================================= */
-
- public static Hashtable set_properties_LDAP_simpleBind() {
-
- String provider ;
-
- Hashtable envLdap = new Hashtable();
- envLdap.put("java.naming.factory.initial",
- "com.sun.jndi.ldap.LdapCtxFactory");
-
- envLdap.put(Context.SECURITY_AUTHENTICATION, "simple");
-
- envLdap.put(Context.SECURITY_PRINCIPAL, bindDN);
- envLdap.put(Context.SECURITY_CREDENTIALS, bindPW);
-
- if ( protocol.equals("ssl")) {
- provider = "ldaps://"+server.host+":"+server.port+"/";
- envLdap.put(Context.SECURITY_PROTOCOL, protocol);
-
- } else {
- provider = "ldap://"+server.host+":"+server.port+"/";
- }
-
- envLdap.put(Context.PROVIDER_URL, provider);
- return envLdap;
- }
-
-/* =========================================
- * Get Date
- * ======================================= */
- 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()) + "]");
- }
-
-
-/* =========================================
- * Print
- * ======================================= */
- public static void println(String level, String msg) {
- System.out.println (getDate() + " - " + level + ": " + msg );
- }
-
-
-/* =========================================
- * increase the number of threads ready
- * ======================================= */
- public void inc_thread_ready() {
- synchronized (this) {
- nb_thread_ready++;
-
- try {
- this.wait();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- }
-
-
-/* =========================================
- * return the number of threads ready
- * ======================================= */
- public static int nb_thread_ready() {
- return nb_thread_ready;
- }
-}
-
diff --git a/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/secureModifyEntries/src/Server.java b/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/secureModifyEntries/src/Server.java
deleted file mode 100644
index dbf2405..0000000
--- a/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/secureModifyEntries/src/Server.java
+++ /dev/null
@@ -1,46 +0,0 @@
-// 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
-// information:
-// Portions Copyright [yyyy] [name of copyright owner]
-//
-// CDDL HEADER END
-//
-//
-// Copyright 2008 Sun Microsystems, Inc.
-import java.util.*;
-
-
-public class Server {
- public String host;
- public int port;
-
- public Server (String host, int port) {
- this.host=host;
- this.port=port;
- }
-
- public Server (String hostPort) {
- StringTokenizer st = new StringTokenizer(hostPort, ":");
- this.host=st.nextToken();
- this.port=Integer.parseInt(st.nextToken());
- }
-
- public String toString() {
- return (host + ":" + port);
- }
-}
diff --git a/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/secureModifyEntries/src/Worker.java b/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/secureModifyEntries/src/Worker.java
deleted file mode 100644
index 64613d3..0000000
--- a/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/secureModifyEntries/src/Worker.java
+++ /dev/null
@@ -1,182 +0,0 @@
-// 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
-// information:
-// Portions Copyright [yyyy] [name of copyright owner]
-//
-// CDDL HEADER END
-//
-//
-// Copyright 2008 Sun Microsystems, Inc.
-
-import java.util.*;
-import java.io.*;
-import java.lang.Thread;
-import javax.naming.*;
-
-import javax.naming.directory.SearchControls;
-import javax.naming.directory.SearchResult;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.DirContext;
-import javax.naming.Context;
-import javax.naming.directory.InitialDirContext;
-import javax.naming.directory.BasicAttributes;
-
-
-public class Worker extends Thread {
-
- Server server;
- Client client;
- long myId = this.getId();
-
- /**
- ** Constructor for Worker thread
- **/
- public Worker(Client client2, Server server2) {
-
- super();
- try {
-
- server = server2;
- client = client2;
- start();
-
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- * Connect to the server
- * wait a notify from the main thread to startthe modify operations
- **/
- public void run() {
-
- String value="";
- String DNtoModify;
- String attrVal1;
- ArrayList<String> mailEXT_values= new ArrayList<String>();
- Random random_cpt= new Random();
-
- try {
- /* Define the list of values for mailEXT attribute */
- mailEXT_values.add("group1");
- mailEXT_values.add("group2");
- mailEXT_values.add("group3");
-
- DirContext ctx = null;
-
- // Set the properties
- Hashtable envLdap = client.set_properties_LDAP();
-
- println("INFO","THREAD " + myId + " is waiting ");
- // Waiting a notify from the main thread
- client.inc_thread_ready();
-
-
- /*
- * Start modify operations
- */
- String[] attrIds = { (String)client.attributeName };
- while (true) {
-
- // no sasl authentication
- // use a random DN to bind
- if ( client.authentication.equals("simple")) {
-
- String bindDN=(String) client.DNList.get(client.random.nextInt(client.DNList.size()));
- String bindPW="userpassword";
- envLdap.put(Context.SECURITY_PRINCIPAL, bindDN);
- envLdap.put(Context.SECURITY_CREDENTIALS, bindPW);
- //println("INFO","THREAD " + myId + "BIND as " + bindDN);
- }
- // bind
- ctx = new InitialDirContext(envLdap);
-
- while (true) {
- try {
-
- //String value=String.valueOf(client.random.nextInt(10000));
- DNtoModify=(String) client.DNList.get(client.random.nextInt(client.DNList.size()));
-
- // If attributeName to modify is mailEXT, we get the new value from the list
- // group1, group2, group2
- // this list is the list used to define the dynamic groups
-
- if (client.attributeName.equals("mailEXT")) {
- attrVal1 = (String) mailEXT_values.get(random_cpt.nextInt(3));
- } else {
-
- String value_cpt=String.valueOf(random_cpt.nextInt(10000));
- long cur_date=System.currentTimeMillis();
- String scur_date = String.valueOf(cur_date);
- attrVal1 = "new description"+scur_date+"-"+value_cpt;
- }
-
- Attributes attrs = new BasicAttributes(attrIds[0], attrVal1, true);
-
- // if the Max_nb_mod is reached, counters are initialized
- // disconnect cnx
- // Wait the main to wake up
- if ( client.nb_mod_started_reached() == false) {
-
- if (client.operation.equals("modify")) {
- ctx.modifyAttributes(DNtoModify, DirContext.REPLACE_ATTRIBUTE, attrs);
- } else {
- ctx.modifyAttributes(DNtoModify, DirContext.ADD_ATTRIBUTE, attrs);
- }
-
- client.inc_mod_done();
- } else {
- ctx.close();
- client.thread_go_to_sleep();
- break;
- }
- } catch (Exception ex) {
-
- println("INFO","THREAD " + myId + " CATCH " + ex);
-
- }
- // update the total number of searchs
- client.inc_mod_done();
- }
- }
- } catch (Exception e) {
-
- println("INFO", "Failed: expected error code 3 ");
-
- e.printStackTrace();
- System.exit(1);
- }
- }
-
- private 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()) + "]");
- }
-
- private void println(String level, String msg) {
- System.out.println(getDate() + " - " + level + ": (" + server + ") " + msg );
- }
-
-}
diff --git a/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/secureSearch/build.ksh b/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/secureSearch/build.ksh
deleted file mode 100755
index 2eef307..0000000
--- a/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/secureSearch/build.ksh
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/bin/ksh
-
-# 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
-# information:
-# Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2008 Sun Microsystems, Inc.
-
-export CLASSPATH=$CLASSPATH:.
-
-mkdir -p $COMPILDIR
-echo "Compiling classes..."
-javac src/*.java -d $COMPILDIR
-[ $? -ne 0 ] && return 1
-echo "Creating jarfile"
-cd $COMPILDIR
-jar cvf secureSearch.jar *.class
-[ $? -ne 0 ] && return 1
-echo "Cleanup"
-rm -f *.class
\ No newline at end of file
diff --git a/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/secureSearch/run.ksh b/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/secureSearch/run.ksh
deleted file mode 100755
index 3fb7502..0000000
--- a/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/secureSearch/run.ksh
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/bin/ksh
-
-# 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
-# information:
-# Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2008 Sun Microsystems, Inc.
-
-suffix="dc=com"
-hostname=nott
-maxDuration=50
-nb_threads=10
-NB_MAX_srchs=100
-keystorePath=/tmp/sylvie
-LDAPSport=1235
-
-bindDN="cn=directory manager"
-bindPW=password
-
-#java -client -Xmx1G -Xms1G -XX:NewRatio=1 -XX:SurvivorRatio=100 -cp ../LDAPjdk/ldapjdk.jar:search.jar Client $@
-
-#java -client -Xmx1G -Xms1G -XX:NewRatio=1 -XX:SurvivorRatio=100 -cp ../LDAPjdk/ldapjdk.jar:search.jar -Djavax.net.ssl.keyStore=/tmp/shared/data/CERT_1111/keystore -Djavax.net.ssl.trustStorePassword=password -Djavax.net.ssl.keyStorePassword=password -Djavax.net.ssl.trustStore=/tmp/shared/data/CERT_1111/keystore -Djava.security.debug=ALL -Djava.security.auth.debug=ALL -Djavax.net.debug=ALL -Djavax.security.sasl.level=FINEST Client $@
-
-## SSL
-java -client -Xmx1G -Xms1G -XX:NewRatio=1 -XX:SurvivorRatio=100 -cp secureSearch.jar -Djavax.net.ssl.keyStore=$keystorePath/keystore -Djavax.net.ssl.trustStorePassword=password -Djavax.net.ssl.keyStorePassword=password -Djavax.net.ssl.trustStore=$keystorePath/keystore -Djavax.security.sasl.level=FINEST -Dport=$LDAPSport -DmaxDuration=$maxDuration -DNB_MAX_srchs=$NB_MAX_srchs -Dsuffix=$suffix -Dnb_threads=$nb_threads -Dhostname=$hostname Client $@
-#
-
-
-## CLEAR
-#java -client -Xmx1G -Xms1G -XX:NewRatio=1 -XX:SurvivorRatio=100 -cp search.jar -Djavax.net.ssl.keyStore=/tmp/shared/data/CERT_1111/keystore -Djavax.net.ssl.trustStorePassword=password -Djavax.net.ssl.keyStorePassword=password -Djavax.net.ssl.trustStore=/tmp/shared/data/CERT_1111/keystore -Djavax.security.sasl.level=FINEST -Dport=1111 -DmaxDuration=$maxDuration -DNB_MAX_srchs=$NB_MAX_srchs -Dsuffix=$suffix -Dnb_threads=$nb_threads -Dhostname=$hostname -DbindDN="$bindDN" -DbindPW=$bindPW Client $@
-
diff --git a/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/secureSearch/secureSearch.jar b/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/secureSearch/secureSearch.jar
deleted file mode 100644
index 1cefe66..0000000
--- a/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/secureSearch/secureSearch.jar
+++ /dev/null
Binary files differ
diff --git a/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/secureSearch/secureSearch.xml b/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/secureSearch/secureSearch.xml
deleted file mode 100644
index c839d23..0000000
--- a/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/secureSearch/secureSearch.xml
+++ /dev/null
@@ -1,342 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!DOCTYPE stax SYSTEM "../../../shared/stax.dtd">
-<!--
- ! 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 2008 Sun Microsystems, Inc.
- ! -->
-<stax>
-
- <defaultcall function="secureSearch"/>
-
-
-
- <!-- ************************************************************ -->
- <function name="secureSearch" scope="local">
- <function-map-args>
- <function-arg-def name="workingDir" type="required"/>
- <function-arg-def name="client" type="required"/>
- <function-arg-def name="instances" type="required"/>
- <function-arg-def name="duration" type="required"/>
- <function-arg-def name="suffix" type="required"/>
- <function-arg-def name="outFile" type="required"/>
- <function-arg-def name="fileFd" type="required"/>
- </function-map-args>
-
- <sequence>
- <!-- =================== Comments =================== -->
- <!-- client is run under paralleliterate tag -->
- <!-- each variables defined are internal -->
- <!-- client should have its own err_num variable in order -->
- <!-- to inform scheduler if it has pass/fail status -->
- <script>
- errNum = 0
- msg = ''
- </script>
-
- <!-- ================== Preamble =================== -->
- <!-- parse the client parameters : -->
- <!-- params is [[param1,val1],[param2,val2],...] -->
- <!-- get the ldap instance parameters -->
-
- <script>
- compilDir = '%s/%s_%s' % (workingDir,client.getHost(),client.getId())
-
- outFile = '%s/client_secureSearch_id%s.txt' % \
- (client.getLogDir(),client.getId())
-
- #
- # Extract client parameters from client.getParams()
- #
- cParams = client.getParams()
- try:
- serverInstanceFromClient = cParams[0][1]
- except IndexError:
- serverInstanceFromClient = NOT_DEFINED
- msg = '%s\nERROR: serverInstanceFromClient undefined,mandatory' % msg
- try:
- baseDn = cParams[1][1]
- except IndexError:
- baseDn = NOT_DEFINED
- msg = '%s\nERROR: baseDn undefined,mandatory' % msg
- try:
- nbCnx = cParams[2][1]
- except IndexError:
- nbCnx = NOT_DEFINED
- msg = '%s\nERROR: nbCnx undefined,mandatory' % msg
- try:
- nbMaxOp = cParams[3][1]
- except IndexError:
- nbMaxOp = NOT_DEFINED
- msg = '%s\nERROR: nbMaxOperations undefined,mandatory' % msg
- try:
- attributeName = cParams[4][1]
- except IndexError:
- attributeName = NOT_DEFINED
- try:
- protocol = cParams[5][1]
- except IndexError:
- protocol = NOT_DEFINED
- try:
- authentication = cParams[6][1]
- except IndexError:
- authentication = NOT_DEFINED
- try:
- certAlias = cParams[7][1]
- except IndexError:
- certAlias = NOT_DEFINED
- try:
- delaySec = cParams[8][1]
- except IndexError:
- delaySec = NOT_DEFINED
-
- #
- # setup parms to run the client
- #
- if serverInstanceFromClient != NOT_DEFINED:
- sys.path.append("%s/phases/scheduler" % TESTS_DIR )
- from scheduler import getInstance
- serverInstance = getInstance(serverInstanceFromClient,instances)
- if (serverInstance == 'ERROR'):
- msg = '%s\nERROR: cant find client instance named' % msg
- msg = '%s %s in server instance list' % \
- (msg,serverInstanceFromClient)
-
- else:
- # remove sec, try to finish before timer kill -9 the client
- duration = duration - 60
-
- # keystorePath
- keystorePath = "%s/CERT_%s_%s/config" % (client.getLogDir(),client.getName(),client.getId())
-
- parms=[]
- if (protocol == 'ssl'):
- parms.append('-Dhostname=%s -Dport=%s' % \
- (serverInstance.getHost(),serverInstance.getLDAPSPort()))
- else:
- parms.append('-Dhostname=%s -Dport=%s' % \
- (serverInstance.getHost(),serverInstance.getLDAPPort()))
-
- parms.append('-Dsuffix="%s"' % baseDn)
-
- parms.append('-Dnb_threads=%s -DNB_MAX_srchs=%s -DmaxDuration=%s' % (nbCnx,nbMaxOp,duration))
-
- parms.append('-Dprotocol="%s"' % protocol)
- if attributeName != NOT_DEFINED:
- parms.append('-DattributeName="%s"' % attributeName)
- parms.append('-Dauthentication="%s"' % authentication)
-
-
- parms.append('-DbindDN="%s"' % DIRECTORY_INSTANCE_DN)
- parms.append('-DbindPW="%s"' % DIRECTORY_INSTANCE_PSWD)
-
- if delaySec != NOT_DEFINED:
- parms.append('-DdelaySec="%s"' % delaySec)
- parms = ' '.join(parms)
- </script>
-
- <call function="'writeMessage'">
- {'content' : 'DEBUG params %s' % parms ,
- 'fileFd' : fileFd}
- </call>
- <if expr="msg.find('ERROR') != -1">
- <sequence>
- <message>'%s' % msg</message>
- <call function="'writeOperationResult'">
- {
- 'returncode' : '1',
- 'expected' : '0',
- 'result' : msg,
- 'status' : 'ERROR',
- 'fileFd' : fileFd
- }
- </call>
- <script>
- errNum += 1
- </script>
- </sequence>
- <else>
- <sequence>
-
- <!-- ==== Add execute permission to build.ksh file ==== -->
- <call function="'writeStartTagOperation'">
- { 'tagName' : 'chmod',
- 'fileFd' : fileFd }
- </call>
- <call function="'writeMessage'">
- {'content' : 'Add execute permission to build.ksh file',
- 'fileFd' : fileFd}
- </call>
-
-
- <process name="'%s: chmod +x build.ksh' % client.getHost()">
- <location>client.getHost()</location>
- <command mode="'shell'">'chmod +x build.ksh'</command>
- <parms/>
- <workdir>workingDir</workdir>
- <envs>['PATH=/bin:/usr/bin']</envs>
- <stderr mode="'stdout'"/>
- <stdout/>
- <returnstdout/>
- </process>
- <call function="'checkRC'">
- { 'returncode' : RC,
- 'result' : STAXResult[0][1],
- 'fileFd' : fileFd }
- </call>
- <script>
- errNum += STAXResult
- </script>
- <call function="'writeEndTagOperation'">{'fileFd' : fileFd}</call>
-
-
- <!-- ==== Build client : run build.ksh file ==== -->
- <call function="'writeStartTagOperation'">
- { 'tagName' : 'build',
- 'fileFd' : fileFd }
- </call>
-
-
- <!-- Build Client in unique directory (compilDir), avoid -->
- <!-- conflict if same client is run several time at the same time -->
- <process name="'%s: build %s' % (client.getHost(),client.getName())">
- <location>client.getHost()</location>
- <command mode="'shell'">'./build.ksh'</command>
- <parms/>
- <workdir>workingDir</workdir>
- <envs>['PATH=%s/bin:/bin:/usr/bin' % JAVA_HOME,'COMPILDIR=%s' % compilDir ]</envs>
- <stderr mode="'stdout'"/>
- <stdout/>
- <returnstdout/>
- </process>
- <call function="'checkRC'">
- { 'returncode' : RC,
- 'result' : STAXResult[0][1],
- 'fileFd' : fileFd }
- </call>
- <if expr="RC != 0">
- <message>
- 'FAILED to build client %s on %s' % \
- (client.getName(),client.getHost())
- </message>
- </if>
- <script>
- errNum += STAXResult
- </script>
- <call function="'writeEndTagOperation'">{'fileFd' : fileFd}</call>
-
-
- <!-- ========== Run the client ========== -->
- <call function="'writeStartTagOperation'">
- { 'tagName' : 'run',
- 'fileFd' : fileFd }
- </call>
- <call function="'writeMessage'">
- { 'fileFd' : fileFd,
- 'content' : 'Do ldapsearchs on %s:%s' % \
- (serverInstance.getHost(),serverInstance.getLDAPSPort())
- }
- </call>
-
- <script>
- cParam = '-client -Xmx1G -Xms1G'
- cParam = '%s -XX:NewRatio=1 -XX:SurvivorRatio=100' % cParam
- cParam = '%s -cp %s/secureSearch.jar' % (cParam,compilDir)
- cParam = '%s -Djavax.net.ssl.keyStore=%s/keystore' % (cParam,keystorePath)
- cParam = '%s -Djavax.net.ssl.trustStore=%s/keystore' % (cParam,keystorePath)
- cParam = '%s -Djavax.security.sasl.level=FINEST' % cParam
- cParam = '%s -Djavax.net.ssl.trustStorePassword=password' % cParam
- cParam = '%s -Djavax.net.ssl.keyStorePassword=password' % cParam
- cParam = '%s %s Client' % (cParam,parms)
-
- titleName = '%s: run %s on %s' % \
- (client.getHost(),client.getName(),
- serverInstance.getName())
- </script>
- <call function="'writeMessage'">
- { 'fileFd' : fileFd,
- 'content' : 'DEBUG %s' % cParam
- }
- </call>
- <process name="'%s' % titleName">
- <location>client.getHost()</location>
- <command>'%s/bin/java' % JAVA_HOME</command>
- <parms>cParam </parms>
- <workdir>workingDir</workdir>
- <envs>['PATH=%s/bin:/bin:/usr/bin' % JAVA_HOME]</envs>
- <stderr mode="'stdout'"/>
- <stdout>outFile</stdout>
- <returnstdout/>
- </process>
- <!-- java -client -Xmx1G -Xms1G -XX:NewRatio=1 -XX:SurvivorRatio=100 -cp secureSearch.jar -Djavax.net.ssl.keyStore=/tmp/shared/data/CERT_1111/keystore -Djavax.net.ssl.trustStorePassword=password -Djavax.net.ssl.keyStorePassword=password -Djavax.net.ssl.trustStore=/tmp/shared/data/CERT_1111/keystore -Djavax.security.sasl.level=FINEST -Dport=1636 -DmaxDuration=$maxDuration -DNB_MAX_srchs=$NB_MAX_srchs -Dsuffix=$suffix -Dnb_threads=$nb_threads -Dhostname=$hostname Client $@
--->
- <!-- TBD : result should be STAXResult[0][1] : problem when
- javaexception, with carac " and < >-->
- <call function="'checkRC'">
- { 'returncode' : RC ,
- 'result' : '',
- 'fileFd' : fileFd }
- </call>
- <script>
- errNum += STAXResult
- </script>
- <call function="'writeEndTagOperation'">{'fileFd' : fileFd}</call>
-
- <!-- ========== Postamble ========== -->
- <call function="'writeMessage'">
- {'content' : 'Output file %s' % outFile,
- 'fileFd' : fileFd}
- </call>
-
- <process name="'%s:%s: Grep' % (client.getHost(),client.getName())">
- <location>client.getHost()</location>
- <command mode="'shell'">
- "grep 'TOTAL' %s | cut -d ' ' -f3-" % outFile
- </command>
- <envs>['PATH=/bin:/usr/bin']</envs>
- <stderr mode="'stdout'"/>
- <stdout/>
- <returnstdout/>
- </process>
- <script>
- summary = STAXResult[0][1]
- </script>
- <call function="'writeMessage'">
- {'content' : 'Summary %s' % (summary),
- 'fileFd' : fileFd}
- </call>
-
- </sequence>
- </else>
- </if>
-
- <return> errNum </return>
-
- </sequence>
-
- </function>
-
-
-
-</stax>
-
diff --git a/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/secureSearch/src/Client.java b/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/secureSearch/src/Client.java
deleted file mode 100644
index 50162e6..0000000
--- a/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/secureSearch/src/Client.java
+++ /dev/null
@@ -1,488 +0,0 @@
-// 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
-// information:
-// Portions Copyright [yyyy] [name of copyright owner]
-//
-// CDDL HEADER END
-//
-//
-// Copyright 2008 Sun Microsystems, Inc.
-
-import java.util.*;
-import java.io.*;
-import java.lang.Thread;
-import javax.naming.*;
-import javax.naming.directory.InitialDirContext;
-import javax.naming.directory.SearchControls;
-import javax.naming.directory.DirContext;
-import javax.naming.directory.SearchResult;
-import javax.naming.directory.Attributes;
-
-public class Client {
-
- static int NB_MAX_srchs=100;
- static int nb_srchs_started=0;
- static int nb_srchs_done=0;
- static int total_nb_srchs=0;
- static int nb_threads=3;
- static int nb_thread_ready=0;
-
- static Random random;
- static String hostname ;
- static int portnumber;
- static String bindDN;
- static String bindPW;
- static String suffix;
- static Server server;
- static String authentication;
- static String protocol;
- static String attributeName;
- static String time= new String ("0 sec.");;
- static long duration=0;
- static long maxDuration=0;
- static long startup=0;
- static long timeTostopTest=0;
- static ArrayList<String> DNList;
- static ArrayList<String> uidList;
- static long delayCnx=1000;
- static long delaySec=1;
-
- public Client()
- {
- random= new Random();
- DNList=new ArrayList<String>();
- uidList=new ArrayList<String>();
-
- try {
-
- Hashtable envLdap = set_properties_LDAP_simpleBind();
-
- DirContext ctx = null;
- ctx = new InitialDirContext(envLdap);
-
- // Search options
- String filter = "(objectclass=inetorgperson)";
- String[] attrs = { "uid"};
-
- SearchControls constraints = new SearchControls();
- constraints.setSearchScope(SearchControls.SUBTREE_SCOPE);
- constraints.setReturningAttributes(attrs);
-
- NamingEnumeration results = ctx.search(suffix, filter, constraints);
- Exception exc = null;
- int count = 0;
-
- try {
- while (results != null && results.hasMore()) {
- SearchResult res = (SearchResult) results.next();
- DNList.add (res.getNameInNamespace());
-
- Attributes uidAttrs = res.getAttributes();
- uidList.add ((String) uidAttrs.get("uid").get());
-
- count++;
- }
-
- DNList.trimToSize();
- if ( DNList.size() == 0) {
- println("ERROR", "No entry found in \"" + suffix + "\"");
- System.exit(1);
- }
- } catch (Exception ex) {
- exc = ex;
- }
- if ( exc != null ) {
- throw exc;
- }
- ctx.close();
- } catch (Exception e) {
-
- println ("INFO", "Failed: expected error code 3 ");
- e.printStackTrace();
- System.exit(1);
- }
-
-
- try {
-
- // execute the threads
- for (int i=0; i < nb_threads; i++ ) {
- Worker w = new Worker(this, server);
- }
- println ("INFO", nb_threads + " threads connected to server " + server );
-
- // Wait until all the threads have initialized their context
- // and are ready to bind
- try {
- while ( nb_thread_ready() < nb_threads) {
- // wait
- }
- // All the threads are ready, wake up all the threads
- synchronized(this) {
- nb_thread_ready=0;
- notifyAll();
- }
- }
- catch ( Exception e1 ) {
- System.out.println ("E1");
- e1.printStackTrace();
- }
-
- int seconds=0;
- long t1=System.currentTimeMillis();
-
- // work until Max duration is reached
- while (true) {
-
- long new_t1=System.currentTimeMillis();
-
- // end of the system test. Exit
- if ( ( timeTostopTest != 0 ) && ( new_t1 > timeTostopTest ) ) {
-
- // inform all the threads it's the end
- synchronized (this) {
- nb_srchs_started=NB_MAX_srchs;
- }
- break;
- }
-
- // status every second
- if ( (new_t1 - t1) >= delayCnx ) {
-
- println("INFO", (nb_srchs_done/delaySec) + " srch/sec.");
-
- // inform all the threads the max nb searchs has been reached
- synchronized (this) {
- nb_srchs_started=NB_MAX_srchs;
- }
-
- // Wait all the threads to close their cnx and sleep
- try {
- total_nb_srchs+=nb_srchs_done;
- while ( nb_thread_ready() < nb_threads) {
- // wait
- }
- // All the threads are ready, wake up all the threads
- synchronized(this) {
- nb_thread_ready=0;
- nb_srchs_started=0;
- nb_srchs_done=0;
-
- notifyAll();
- }
- }
- catch ( Exception e1 ) {
- System.out.println ("E1");
- e1.printStackTrace();
- }
-
- if ( (seconds++) >= 9 ) {
- duration=((new_t1-startup)/1000);
- println("INFO", "Avg rate: " + (total_nb_srchs/duration) + " srchs/sec. after " + getTime(duration));
- seconds=0;
- }
- t1=new_t1;
- }
- }
- System.exit(0);
- }
- catch( Exception e ) {
-
- e.printStackTrace();
- System.exit(1);
- }
-
-
- }
-
-
-
-
-/* =========================================
- * MAIN
- * ======================================= */
-
- public static void main( String[] args )
- {
-
- startup=System.currentTimeMillis();
-
- // ===========================================
- // Get the arguments specified for each option.
- //
-
- // Ldap port
- String sport = System.getProperty("port");
- portnumber = Integer.parseInt(sport);
-
-
- // BaseDN
- suffix = System.getProperty("suffix");
- println ("INFO" , "suffix " + suffix);
-
- // nb_threads
- String snb_threads = System.getProperty("nb_threads");
- nb_threads = Integer.parseInt(snb_threads);
-
- println ("INFO" , "nb_threads " + snb_threads);
-
- // test duration
- String sMaxDuration = System.getProperty("maxDuration");
- maxDuration = Long.parseLong(sMaxDuration);
- println ("INFO" , "maxDuration " + maxDuration);
-
- // credential for simple bind
- bindDN = System.getProperty("bindDN");
- bindPW = System.getProperty("bindPW");
- println ("INFO" , "bindDN " + bindDN);
-
- // attribute to search
- attributeName = System.getProperty("attributeName");
- println ("INFO" , "attributeName " + attributeName);
-
- // Max number of searchs
- String sNB_MAX_srchs = System.getProperty("NB_MAX_srchs");
- NB_MAX_srchs = Integer.parseInt(sNB_MAX_srchs);
- println ("INFO" , "sNB_MAX_srchs " + sNB_MAX_srchs);
-
- // hostname
- hostname = System.getProperty("hostname");
-
-
- // protocol : SSL or TLS
- protocol = System.getProperty("protocol");
- println ("INFO" , "protocol " + protocol);
-
- // authentication : EXTERNAL or simple
- authentication = System.getProperty("authentication");
- println ("INFO" , "authentication " + authentication);
-
- // delay Sec before closing conx
- String sdelaySec = System.getProperty("delaySec");
- delaySec = Long.parseLong(sdelaySec);
- delayCnx = delaySec * 1000;
- println ("INFO" , "delayCnx " + delayCnx);
-
-
- if ( maxDuration != 0 ) {
- maxDuration= maxDuration * 1000;
- }
- timeTostopTest=( startup + maxDuration);
- println("INFO", "END of the test : " + timeTostopTest );
-
-
- // ===========================================
- // Initialize the Server
- server=new Server (hostname,portnumber);
-
- System.out.println ("DEBUG declare server " + portnumber + " " + hostname);
-
- Runtime.getRuntime().addShutdownHook(new Thread() {
-
- public void run() {
- }
- });
-
- Client c = new Client();
- }
-
-
-/* =========================================
- * return true if the number of NB_MAX_srchs has been reached
- * else, increase nb_srchs_started
- * ======================================= */
-
- public boolean nb_srchs_started_reached() {
-
- synchronized (this) {
- if ( nb_srchs_started>=NB_MAX_srchs ) {
- return true;
-
- } else {
- nb_srchs_started++;
- return false;
- }
- }
- }
-
-
-/* =========================================
- * thread is waiting for a notify from the main thread
- * ======================================= */
- public void thread_go_to_sleep() {
-
- synchronized (this) {
- try {
- nb_thread_ready++;
-
- this.wait();
- } catch ( Exception e ) {
- e.printStackTrace();
- }
- }
- }
-
-
-/* =========================================
- * increase the number of srchs started
- * ======================================= */
- public void inc_srchs_started() {
-
- synchronized (this) {
- if ( nb_srchs_started>=NB_MAX_srchs ) {
- try {
- this.wait();
- } catch ( Exception e ) {
- e.printStackTrace();
- }
-
- } else {
- nb_srchs_started++;
- }
- }
- }
-
-/* =========================================
- * increase the number of srchs done
- * ======================================= */
- public void inc_srchs_done() {
- synchronized (this) {
- try {
- nb_srchs_done++;
- } catch ( Exception e ) {
- e.printStackTrace();
- }
- }
- }
-
-/* =========================================
- * Configure the Properties depending of the selected authentication and protocol
- * authentication : EXTERNAL or simple
- * protocol ssl, tls or clear
- * ======================================= */
-
- public static Hashtable set_properties_LDAP() {
-
- String provider ;
-
- Hashtable envLdap = new Hashtable();
- envLdap.put("java.naming.factory.initial",
- "com.sun.jndi.ldap.LdapCtxFactory");
-
- envLdap.put(Context.SECURITY_AUTHENTICATION, authentication);
-
- if ( protocol.equals("ssl")) {
- provider = "ldaps://"+server.host+":"+server.port+"/";
- envLdap.put(Context.SECURITY_PROTOCOL, protocol);
-
- } else {
- provider = "ldap://"+server.host+":"+server.port+"/";
- }
-
- envLdap.put(Context.PROVIDER_URL, provider);
- return envLdap;
- }
-
-
-/* =========================================
- * Configure the Properties for a simple Bind
- * bind as directory manager
- * use the selected protocol : ssl, tls or clear
- * ======================================= */
- public static Hashtable set_properties_LDAP_simpleBind() {
-
- String provider ;
-
- Hashtable envLdap = new Hashtable();
- envLdap.put("java.naming.factory.initial",
- "com.sun.jndi.ldap.LdapCtxFactory");
-
- envLdap.put(Context.SECURITY_AUTHENTICATION, "simple");
-
- envLdap.put(Context.SECURITY_PRINCIPAL, bindDN);
- envLdap.put(Context.SECURITY_CREDENTIALS, bindPW);
-
- if ( protocol.equals("ssl")) {
- provider = "ldaps://"+server.host+":"+server.port+"/";
- envLdap.put(Context.SECURITY_PROTOCOL, protocol);
-
- } else {
- provider = "ldap://"+server.host+":"+server.port+"/";
- }
-
- envLdap.put(Context.PROVIDER_URL, provider);
- return envLdap;
- }
-
-/* =========================================
- * Get Date
- * ======================================= */
- 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()) + "]");
- }
-
-/* =========================================
- * print
- * ======================================= */
- public static void println(String level, String msg) {
- System.out.println (getDate() + " - " + level + ": " + msg );
- }
-
-/* =========================================
- * increase the number of threads ready
- * ======================================= */
- public void inc_thread_ready() {
- synchronized (this) {
- nb_thread_ready++;
-
- try {
- this.wait();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- }
-/* =========================================
- * return the number of threads ready
- * ======================================= */
- public static int nb_thread_ready() {
-
- return nb_thread_ready;
-
- }
-
-/* =========================================
- * getTime
- * ======================================= */
- public static String getTime(long d) {
- String time=new String (d + " sec.");
- if ( d > 10000 ) {
- time=new String ((d/3600) + " hours");
- } else if ( d > 300 ) {
- time=new String ((d/60) + " min.");
- }
- return time;
- }
-}
diff --git a/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/secureSearch/src/OK/Client.java b/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/secureSearch/src/OK/Client.java
deleted file mode 100644
index 74db2b9..0000000
--- a/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/secureSearch/src/OK/Client.java
+++ /dev/null
@@ -1,324 +0,0 @@
-package system-tests.scenario.single.clients.secureSearch.src.OK-tests.scenario.single.clients.searchLoad.src.OK;
-// 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
-// information:
-// Portions Copyright [yyyy] [name of copyright owner]
-//
-// CDDL HEADER END
-//
-//
-// Copyright 2008 Sun Microsystems, Inc.
-//import netscape.ldap.*;
-//import netscape.ldap.util.*;
-
-import java.util.*;
-import java.io.*;
-import java.lang.Thread;
-import javax.naming.*;
-import javax.naming.directory.InitialDirContext;
-import javax.naming.directory.SearchControls;
-import javax.naming.directory.DirContext;
-
-
-public class Client {
-
-
-// static String dn="cn=Directory Manager";
-// static String password="secret12";
- static int NB_MAX_srchs=100;
- static Object lock;
- static int nb_srchs_started=0;
- static int nb_srchs_done=0;
- static int total_nb_srchs=0;
- static int nb_threads=3;
- public ArrayList<String> ValueList;
- // String dn="cn=admin,dc=com";
-// String dn="cn=Directory Manager";
-// String password="secret12";
- Random random;
- static String attr="cn";
- public String attribute;
-
- static String hostname ;
- static int portnumber;
- static String bindDN;
- static String bindPW;
- static String suffix;
- static Server server;
- static String time= new String ("0 sec.");;
- static long duration=0;
- static long maxDuration=0;
- static long startup=System.currentTimeMillis();
-
- public Client()
- {
-
- attribute=attr;
- random= new Random();
- lock = new Object();
-
- ValueList=new ArrayList<String>();
- // println("INFO", "Getting DN from file " + DNFileName);
- try {
- println ("INFO", "Get the DNs on suffix \"" + suffix + "\" from server " + server );
-
-
- String provider = "ldaps://nott:1636/";
- DirContext ctx = null;
-
- Properties envLdap = System.getProperties();
- envLdap.put("java.naming.factory.initial",
- "com.sun.jndi.ldap.LdapCtxFactory");
-
- envLdap.put(Context.PROVIDER_URL, provider);
- envLdap.put(Context.SECURITY_AUTHENTICATION, "EXTERNAL");
- envLdap.put(Context.SECURITY_PROTOCOL, "ssl");
-
- ctx = new InitialDirContext(envLdap);
-
- String filter = "(objectclass=*)";
-
- SearchControls constraints = new SearchControls();
-
- NamingEnumeration results = ctx.search("dc=com", filter, constraints);
- Exception exc = null;
- int count = 0;
-
- try {
- while (results != null && results.hasMore()) {
- results.next();
- println ("INFO " ," res " + results.toString());
- count++;
- }
- } catch (Exception ex) {
- exc = ex;
- }
- if ( exc != null ) {
- throw exc;
- }
-
- } catch (Exception e) {
-
- println ("INFO", "Failed: expected error code 3 ");
-
-
- e.printStackTrace();
- System.exit(1);
- }
-
-
- try {
- // reinitialize startup
- startup=System.currentTimeMillis();
- long t1=System.currentTimeMillis();
-
- if ( maxDuration != 0 ) {
- maxDuration= t1 + maxDuration * 1000;
- }
- for (int i=0; i < nb_threads; i++ ) {
- Worker w = new Worker(this, server);
- }
- println ("INFO", nb_threads + " threads connected to server " + server );
- println ("INFO", "Will search using filter \"(" + attr + " = <value> )\" (MAX =" + NB_MAX_srchs + ")" );
- synchronized (lock) {
- lock.notifyAll();
- }
- int seconds=0;
- while (true) {
-
- long new_t1=System.currentTimeMillis();
-
- if ( ( maxDuration != 0 ) && ( new_t1 > maxDuration ) ) { break; }
-
- if ( (new_t1 - t1) >= 1000 ) {
-
-
- println("INFO", nb_srchs_done + " srchs/sec."); // (time = "+(new_t1-t1) + "ms)");
- println("DEBUG", nb_srchs_started + " srchs/sec started");
-
- total_nb_srchs+=nb_srchs_done;
- nb_srchs_started=0;
- nb_srchs_done=0;
- synchronized (lock) {
- lock.notifyAll();
- }
-
- if ( (seconds++) >= 9 ) {
-
- duration=((new_t1-startup)/1000);
-
- println("INFO", "Avg rate: " + (total_nb_srchs/duration) + " srchs/sec. after " + getTime(duration));
- seconds=0;
- }
- t1=new_t1;
-
- }
- }
-
- System.exit(0);
-
- }
- catch( Exception e ) {
-
- e.printStackTrace();
- System.exit(1);
- }
-
-
- }
-
- public static String getTime(long d) {
- String time=new String (d + " sec.");
- if ( d > 10000 ) {
- time=new String ((d/3600) + " hours");
- } else if ( d > 300 ) {
- time=new String ((d/60) + " min.");
- }
- return time;
- }
-
- public static void main( String[] args )
-
- {
- String usage = "Usage: java Main [-h <host>] [-p <port>] -b <base_dn> "
- + "[-D <bindDN> ] [-w <bindPW> ] [-t <nb_threads>] [-M <nb_max_srchs>] [-a <attribute>] [-d duration (seconds)]";
- // int portnumber = LDAPv2.DEFAULT_PORT;
-
-
- // Check for these options. -H means to print out a usage message.
- // GetOpt options = new GetOpt( "h:p:b:d:D:w:H:t:M:a:", args );
- // Get the arguments specified for each option.
-
- String port = System.getProperty("port");
-
- suffix = System.getProperty("suffix");
- println ("INFO" , "suffix " + suffix);
-
- String snb_threads = System.getProperty("nb_threads");
- nb_threads = Integer.parseInt(snb_threads);
-
- println ("INFO" , "nb_threads " + snb_threads);
-
-
- String sMaxDuration = System.getProperty("maxDuration");
- maxDuration = Long.parseLong(sMaxDuration);
- println ("INFO" , "maxDuration " + maxDuration);
-
- bindDN = System.getProperty("bindDN");
- bindPW = System.getProperty("bindPW");
-
- String sNB_MAX_srchs = System.getProperty("NB_MAX_srchs");
- NB_MAX_srchs = Integer.parseInt(sNB_MAX_srchs);
- println ("INFO" , "sNB_MAX_srchs " + sNB_MAX_srchs);
-
- hostname = System.getProperty("hostname");
-
-
- if ( hostname == null ) hostname="localhost";
- // 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 );
- }
- }
- else {
- portnumber=1389;
- }
-
- server=new Server (hostname,portnumber);
- System.out.println ("DEBUG declare server " + portnumber + " " + hostname);
- Runtime.getRuntime().addShutdownHook(new Thread() {
-
- public void run() {
- duration=((System.currentTimeMillis()-startup)/1000);
- if ( duration != 0 )
- println("INFO", "TOTAL: " + total_nb_srchs + " srchs (Avg rate: " + (total_nb_srchs/duration) + " srchs/sec.) after " + getTime(duration));
- }
- });
-
- System.out.println ("DEBUG declare client ");
- Client c = new Client();
- System.out.println ("DEBUG FIN client ");
- }
-
-
- public static void inc_srchs_started() {
- check_srchs_started();
- nb_srchs_started++;
- }
-
-
- public static void inc_srchs_done() {
- nb_srchs_done++;
- }
-
- public static void check_srchs_started() {
- if ( nb_srchs_started>=NB_MAX_srchs ) {
- // println("DEBUG", "srchs=" + nb_srchs_started );
- try {
- synchronized (lock) {
- lock.wait();
- }
- } catch ( InterruptedException e ) {
- e.printStackTrace();
- }
- }
- }
-
- public static void wait_after_error() {
- try {
- synchronized (lock) {
- lock.wait();
- }
- } catch ( InterruptedException e ) {
- e.printStackTrace();
- }
- }
-
- public static void sleep(int time) {
- try {
- Thread.sleep(time);
- }
- catch ( InterruptedException e )
- {
- println( "ERROR" , e.toString() );
- }
- }
-
-
- 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()) + "]");
- }
-
- public static void println(String level, String msg) {
- System.out.println (getDate() + " - " + level + ": " + msg );
- }
-
-}
-
diff --git a/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/secureSearch/src/OK/Server.java b/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/secureSearch/src/OK/Server.java
deleted file mode 100644
index a5e44e5..0000000
--- a/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/secureSearch/src/OK/Server.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package system-tests.scenario.single.clients.secureSearch.src.OK-tests.scenario.single.clients.searchLoad.src.OK;
-// 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
-// information:
-// Portions Copyright [yyyy] [name of copyright owner]
-//
-// CDDL HEADER END
-//
-//
-// Copyright 2008 Sun Microsystems, Inc.
-import java.util.*;
-
-
-public class Server {
- public String host;
- public int port;
-
- public Server (String host, int port) {
- this.host=host;
- this.port=port;
- }
-
- public Server (String hostPort) {
- StringTokenizer st = new StringTokenizer(hostPort, ":");
- this.host=st.nextToken();
- this.port=Integer.parseInt(st.nextToken());
- }
-
- public String toString() {
- return (host + ":" + port);
- }
-}
diff --git a/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/secureSearch/src/OK/Worker.java b/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/secureSearch/src/OK/Worker.java
deleted file mode 100644
index f5654f0..0000000
--- a/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/secureSearch/src/OK/Worker.java
+++ /dev/null
@@ -1,135 +0,0 @@
-package system-tests.scenario.single.clients.secureSearch.src.OK-tests.scenario.single.clients.searchLoad.src.OK;
-// 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
-// information:
-// Portions Copyright [yyyy] [name of copyright owner]
-//
-// CDDL HEADER END
-//
-//
-// Copyright 2008 Sun Microsystems, Inc.
-import netscape.ldap.*;
-import netscape.ldap.util.*;
-
-import java.util.*;
-import java.io.*;
-import java.lang.Thread;
-import javax.naming.*;
-
-import javax.naming.directory.SearchControls;
-import javax.naming.directory.DirContext;
-import javax.naming.Context;
-import javax.naming.directory.InitialDirContext;
-
-
-public class Worker extends Thread {
-
- Server server;
- Client client;
-
- public Worker (Client client, Server server) {
-
- super();
- try {
-
- this.server = server;
- this.client = client;
- this.start();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
-
- public void run () {
-
- String value="";
- String[] attributes = new String []{client.attr};
-
- String provider = "ldap://"+server.host+":"+server.port+"/";
- println ("INFO","provider = " + provider);
- try {
-
- Properties envLdap = System.getProperties();
- envLdap.put("java.naming.factory.initial",
- "com.sun.jndi.ldap.LdapCtxFactory");
-
- envLdap.put(Context.PROVIDER_URL, provider);
- envLdap.put(Context.SECURITY_AUTHENTICATION, "EXTERNAL");
- envLdap.put(Context.SECURITY_PROTOCOL, "ssl");
-
- while (true) {
-
- DirContext ctx = null;
- ctx = new InitialDirContext(envLdap);
-
-
- String filter = "(objectclass=*)";
-
- SearchControls constraints = new SearchControls();
-
- Exception exc = null;
- int count = 0;
-
-
- // client.inc_srchs_started();
- // value=(String) client.ValueList.get(client.random.nextInt(client.ValueList.size()));
- NamingEnumeration results = ctx.search(client.suffix, filter, constraints);
-
-
- try {
- while (results != null && results.hasMore()) {
- results.next();
- println ("INFO " ," res " + results.toString());
- count++;
- }
-
- } catch (Exception ex) {
- exc = ex;
- }
- if ( exc != null ) {
- throw exc;
- }
- // client.inc_srchs_done();
-
- ctx.close();
- }
- } catch (Exception e) {
-
- println ("INFO", "Failed: expected error code 3 ");
-
- e.printStackTrace();
- System.exit(1);
- }
- }
-
- private 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()) + "]");
- }
-
- private void println(String level, String msg) {
- System.out.println (getDate() + " - " + level + ": (" + server + ") " + msg );
- }
-
-}
diff --git a/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/secureSearch/src/Server.java b/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/secureSearch/src/Server.java
deleted file mode 100644
index dbf2405..0000000
--- a/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/secureSearch/src/Server.java
+++ /dev/null
@@ -1,46 +0,0 @@
-// 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
-// information:
-// Portions Copyright [yyyy] [name of copyright owner]
-//
-// CDDL HEADER END
-//
-//
-// Copyright 2008 Sun Microsystems, Inc.
-import java.util.*;
-
-
-public class Server {
- public String host;
- public int port;
-
- public Server (String host, int port) {
- this.host=host;
- this.port=port;
- }
-
- public Server (String hostPort) {
- StringTokenizer st = new StringTokenizer(hostPort, ":");
- this.host=st.nextToken();
- this.port=Integer.parseInt(st.nextToken());
- }
-
- public String toString() {
- return (host + ":" + port);
- }
-}
diff --git a/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/secureSearch/src/Worker.java b/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/secureSearch/src/Worker.java
deleted file mode 100644
index 9f20d76..0000000
--- a/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/secureSearch/src/Worker.java
+++ /dev/null
@@ -1,159 +0,0 @@
-// 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
-// information:
-// Portions Copyright [yyyy] [name of copyright owner]
-//
-// CDDL HEADER END
-//
-//
-// Copyright 2008 Sun Microsystems, Inc.
-
-import java.util.*;
-import java.io.*;
-import java.lang.Thread;
-import javax.naming.*;
-
-import javax.naming.directory.SearchControls;
-import javax.naming.directory.SearchResult;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.DirContext;
-import javax.naming.Context;
-import javax.naming.directory.InitialDirContext;
-
-
-public class Worker extends Thread {
-
- Server server;
- Client client;
- long myId = this.getId();
-
- public Worker(Client client2, Server server2) {
-
- super();
- try {
-
- server = server2;
- client = client2;
- start();
-
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
-
- public void run() {
-
- String value="";
-
- try {
-
- DirContext ctx = null;
-
- // Set the properties
- Hashtable envLdap = client.set_properties_LDAP();
-
- // the thread is waiting the main to wake up
- client.inc_thread_ready();
-
- println("INFO","THREAD " + myId + " is wake up for test");
-
- while (true) {
-
- // no sasl authentication
- // use a random DN to bind
- if ( client.authentication.equals("simple")) {
-
- String bindDN=(String) client.DNList.get(client.random.nextInt(client.DNList.size()));
- String bindPW="userpassword";
-
- envLdap.put(Context.SECURITY_PRINCIPAL, bindDN);
- envLdap.put(Context.SECURITY_CREDENTIALS, bindPW);
-
- }
- // bind
- ctx = new InitialDirContext(envLdap);
-
-
- //String filter = "(objectclass=*)";
- SearchControls constraints = new SearchControls();
- String[] returnattrs = {client.attributeName};
- constraints.setReturningAttributes(returnattrs);
- constraints.setSearchScope(SearchControls.SUBTREE_SCOPE);
-
-
- while (true) {
- try {
- String searchDN=(String) client.suffix;
- String filter="uid="+(String) client.uidList.get(client.random.nextInt(client.uidList.size()));
-
- // if the Max_nb_search is reached, counters are initialized
- // disconnect cnx
- // Wait the main to wake up
-
- if ( client.nb_srchs_started_reached() == false) {
-
- // Search entries
- NamingEnumeration results = ctx.search(searchDN, filter, constraints);
- while (results != null && results.hasMore()) {
- SearchResult res = (SearchResult) results.next();
- Attributes uidAttrs = res.getAttributes();
- }
- results.close();
-
- client.inc_srchs_done();
- } else {
- ctx.close();
- client.thread_go_to_sleep();
- break;
- }
- } catch (Exception ex) {
-
- println("INFO","THREAD " + myId + " CATCH " + ex);
-
- }
-
- // update the total number of searchs
- client.inc_srchs_done();
- }
-
- }
- } catch (Exception e) {
- println("INFO", "Failed: expected error code 3 ");
-
- e.printStackTrace();
- System.exit(1);
- }
- }
-
- private 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()) + "]");
- }
-
- private void println(String level, String msg) {
- System.out.println(getDate() + " - " + level + ": (" + server + ") " + msg );
- }
-
-}
diff --git a/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/secureUserpasswordModify/build.ksh b/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/secureUserpasswordModify/build.ksh
deleted file mode 100644
index 7790e8c..0000000
--- a/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/secureUserpasswordModify/build.ksh
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/bin/ksh
-
-# 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
-# information:
-# Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2008 Sun Microsystems, Inc.
-
-export CLASSPATH=$CLASSPATH:.
-
-mkdir -p $COMPILDIR
-echo "Compiling classes..."
-javac src/*.java -d $COMPILDIR
-[ $? -ne 0 ] && return 1
-echo "Creating jarfile"
-cd $COMPILDIR
-jar cvf secureUserpasswordModify.jar *.class
-[ $? -ne 0 ] && return 1
-echo "Cleanup"
-rm -f *.class
diff --git a/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/secureUserpasswordModify/run.ksh b/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/secureUserpasswordModify/run.ksh
deleted file mode 100644
index 95effcf..0000000
--- a/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/secureUserpasswordModify/run.ksh
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/bin/ksh
-
-# 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
-# information:
-# Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# Copyright 2008 Sun Microsystems, Inc.
-
-suffix="dc=com"
-hostname=nott
-maxDuration=50
-nb_threads=1
-NB_MAX_mod=100
-keystorePath=/tmp/sylvie
-LDAPSport=1235
-
-bindDN="cn=directory manager"
-bindPW=password
-
-#java -client -Xmx1G -Xms1G -XX:NewRatio=1 -XX:SurvivorRatio=100 -cp ../LDAPjdk/ldapjdk.jar:search.jar Client $@
-
-#java -client -Xmx1G -Xms1G -XX:NewRatio=1 -XX:SurvivorRatio=100 -cp ../LDAPjdk/ldapjdk.jar:search.jar -Djavax.net.ssl.keyStore=/tmp/shared/data/CERT_1111/keystore -Djavax.net.ssl.trustStorePassword=password -Djavax.net.ssl.keyStorePassword=password -Djavax.net.ssl.trustStore=/tmp/shared/data/CERT_1111/keystore -Djava.security.debug=ALL -Djava.security.auth.debug=ALL -Djavax.net.debug=ALL -Djavax.security.sasl.level=FINEST Client $@
-
-## SSL
-java -client -Xmx1G -Xms1G -XX:NewRatio=1 -XX:SurvivorRatio=100 -cp secureModifyEntries.jar -Djavax.net.ssl.keyStore=$keystorePath/keystore -Djavax.net.ssl.trustStorePassword=password -Djavax.net.ssl.keyStorePassword=password -Djavax.net.ssl.trustStore=$keystorePath/keystore -Djavax.security.sasl.level=FINEST -Dport=$LDAPSport -DmaxDuration=$maxDuration -DNB_MAX_mod=$NB_MAX_mod -Dsuffix=$suffix -Dnb_threads=$nb_threads -Dhostname=$hostname Client $@
-#
-
-
-## CLEAR
-#java -client -Xmx1G -Xms1G -XX:NewRatio=1 -XX:SurvivorRatio=100 -cp search.jar -Djavax.net.ssl.keyStore=/tmp/shared/data/CERT_1111/keystore -Djavax.net.ssl.trustStorePassword=password -Djavax.net.ssl.keyStorePassword=password -Djavax.net.ssl.trustStore=/tmp/shared/data/CERT_1111/keystore -Djavax.security.sasl.level=FINEST -Dport=1111 -DmaxDuration=$maxDuration -DNB_MAX_mod=$NB_MAX_mod -Dsuffix=$suffix -Dnb_threads=$nb_threads -Dhostname=$hostname -DbindDN="$bindDN" -DbindPW=$bindPW Client $@
-
diff --git a/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/secureUserpasswordModify/secureUserpasswordModify.xml b/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/secureUserpasswordModify/secureUserpasswordModify.xml
deleted file mode 100644
index 9530410..0000000
--- a/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/secureUserpasswordModify/secureUserpasswordModify.xml
+++ /dev/null
@@ -1,330 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!DOCTYPE stax SYSTEM "../../../shared/stax.dtd">
-<!--
- ! 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 2008 Sun Microsystems, Inc.
- ! -->
-<stax>
-
- <defaultcall function="secureUserpasswordModify"/>
-
- <!-- ************************************************************ -->
- <function name="secureUserpasswordModify" scope="local">
-
- <function-map-args>
- <function-arg-def name="workingDir" type="required"/>
- <function-arg-def name="client" type="required"/>
- <function-arg-def name="instances" type="required"/>
- <function-arg-def name="duration" type="required"/>
- <function-arg-def name="suffix" type="required"/>
- <function-arg-def name="outFile" type="required"/>
- <function-arg-def name="fileFd" type="required"/>
- </function-map-args>
-
-
- <sequence>
- <!-- =================== Comments =================== -->
- <!-- client is run under paralleliterate tag -->
- <!-- each variables defined are internal -->
- <!-- client should have its own err_num variable in order -->
- <!-- to inform scheduler if it has pass/fail status -->
- <script>
- errNum = 0
- msg = ''
- </script>
-
- <!-- ================== Preamble =================== -->
- <!-- parse the client parameters : -->
- <!-- params is [[param1,val1],[param2,val2],...] -->
- <!-- get the ldap instance parameters -->
-
-
- <script>
- compilDir = '%s/%s_%s' % (workingDir,client.getHost(),client.getId())
-
- outFile = '%s/client_secureUserpasswordModify_id%s.txt' % \
- (client.getLogDir(),client.getId())
-
- #
- # Extract client parameters from client.getParams()
- #
- cParams = client.getParams()
- try:
- serverInstanceFromClient = cParams[0][1]
- except IndexError:
- serverInstanceFromClient = NOT_DEFINED
- msg = '%s\nERROR: serverInstanceFromClient undefined,mandatory' % msg
- try:
- baseDn = cParams[1][1]
- except IndexError:
- baseDn = NOT_DEFINED
- msg = '%s\nERROR: baseDn undefined,mandatory' % msg
- try:
- nbCnx = cParams[2][1]
- except IndexError:
- nbCnx = NOT_DEFINED
- msg = '%s\nERROR: nbCnx undefined,mandatory' % msg
- try:
- nbMaxOp = cParams[3][1]
- except IndexError:
- nbMaxOp = NOT_DEFINED
- msg = '%s\nERROR: nbMaxOperations undefined,mandatory' % msg
- try:
- attributeName = cParams[4][1]
- except IndexError:
- attributeName = NOT_DEFINED
- try:
- protocol = cParams[5][1]
- except IndexError:
- protocol = NOT_DEFINED
- try:
- certAlias = cParams[6][1]
- except IndexError:
- certAlias = NOT_DEFINED
- try:
- delaySec = cParams[7][1]
- except IndexError:
- delaySec = NOT_DEFINED
- #
- # setup parms to run the client
- #
- if serverInstanceFromClient != NOT_DEFINED:
- sys.path.append("%s/phases/scheduler" % TESTS_DIR )
- from scheduler import getInstance
- serverInstance = getInstance(serverInstanceFromClient,instances)
- if (serverInstance == 'ERROR'):
- msg = '%s\nERROR: cant find client instance named' % msg
- msg = '%s %s in server instance list' % \
- (msg,serverInstanceFromClient)
-
- else:
- # remove sec, try to finish before timer kill -9 the client
- duration = duration - 120
-
- # keystorePath
- keystorePath = "%s/CERT_%s_%s/config" % (client.getLogDir(),client.getName(),client.getId())
-
- parms=[]
- if (protocol == 'ssl'):
- parms.append('-Dhostname=%s -Dport=%s' % \
- (serverInstance.getHost(),serverInstance.getLDAPSPort()))
- else:
- parms.append('-Dhostname=%s -Dport=%s' % \
- (serverInstance.getHost(),serverInstance.getLDAPPort()))
-
- parms.append('-Dsuffix="%s"' % baseDn)
-
- parms.append('-Dnb_threads=%s -DNB_MAX_mod=%s -DmaxDuration=%s' % (nbCnx,nbMaxOp,duration))
- parms.append('-Dprotocol="%s"' % protocol)
- if attributeName != NOT_DEFINED:
- parms.append('-DattributeName="%s"' % attributeName)
-
- parms.append('-DbindDN="%s"' % DIRECTORY_INSTANCE_DN)
- parms.append('-DbindPW="%s"' % DIRECTORY_INSTANCE_PSWD)
-
- if delaySec != NOT_DEFINED:
- parms.append('-DdelaySec="%s"' % delaySec)
- parms = ' '.join(parms)
- </script>
-
- <if expr="msg.find('ERROR') != -1">
- <sequence>
- <message>'%s' % msg</message>
- <call function="'writeOperationResult'">
- {
- 'returncode' : '1',
- 'expected' : '0',
- 'result' : msg,
- 'status' : 'ERROR',
- 'fileFd' : fileFd
- }
- </call>
- <script>
- errNum += 1
- </script>
- </sequence>
- <else>
- <sequence>
-
- <!-- ==== Add execute permission to build.ksh file ==== -->
- <call function="'writeStartTagOperation'">
- { 'tagName' : 'chmod',
- 'fileFd' : fileFd }
- </call>
- <call function="'writeMessage'">
- {'content' : 'Add execute permission to build.ksh file',
- 'fileFd' : fileFd}
- </call>
-
-
- <process name="'%s: chmod +x build.ksh' % client.getHost()">
- <location>client.getHost()</location>
- <command mode="'shell'">'chmod +x build.ksh'</command>
- <parms/>
- <workdir>workingDir</workdir>
- <envs>['PATH=/bin:/usr/bin']</envs>
- <stderr mode="'stdout'"/>
- <stdout/>
- <returnstdout/>
- </process>
- <call function="'checkRC'">
- { 'returncode' : RC,
- 'result' : STAXResult[0][1],
- 'fileFd' : fileFd }
- </call>
- <script>
- errNum += STAXResult
- </script>
- <call function="'writeEndTagOperation'">{'fileFd' : fileFd}</call>
-
-
- <!-- ==== Build client : run build.ksh file ==== -->
- <call function="'writeStartTagOperation'">
- { 'tagName' : 'build',
- 'fileFd' : fileFd }
- </call>
-
-
- <!-- Build Client in unique directory (compilDir), avoid -->
- <!-- conflict if same client is run several time at the same time -->
- <process name="'%s: build %s' % (client.getHost(),client.getName())">
- <location>client.getHost()</location>
- <command mode="'shell'">'./build.ksh'</command>
- <parms/>
- <workdir>workingDir</workdir>
- <envs>['PATH=%s/bin:/bin:/usr/bin' % JAVA_HOME,'COMPILDIR=%s' % compilDir ]</envs>
- <stderr mode="'stdout'"/>
- <stdout/>
- <returnstdout/>
- </process>
- <call function="'checkRC'">
- { 'returncode' : RC,
- 'result' : STAXResult[0][1],
- 'fileFd' : fileFd }
- </call>
- <if expr="RC != 0">
- <message>
- 'FAILED to build client %s on %s' % \
- (client.getName(),client.getHost())
- </message>
- </if>
- <script>
- errNum += STAXResult
- </script>
- <call function="'writeEndTagOperation'">{'fileFd' : fileFd}</call>
-
-
- <!-- ========== Run the client ========== -->
- <call function="'writeStartTagOperation'">
- { 'tagName' : 'run',
- 'fileFd' : fileFd }
- </call>
- <call function="'writeMessage'">
- { 'fileFd' : fileFd,
- 'content' : 'Do ldapmodify on %s:%s' % \
- (serverInstance.getHost(),serverInstance.getLDAPSPort())
- }
- </call>
-
- <script>
- cParam = '-client -Xmx1G -Xms1G'
- cParam = '%s -XX:NewRatio=1 -XX:SurvivorRatio=100' % cParam
- cParam = '%s -cp %s/secureUserpasswordModify.jar' % (cParam,compilDir)
- cParam = '%s -Djavax.net.ssl.keyStore=%s/keystore' % (cParam,keystorePath)
- cParam = '%s -Djavax.net.ssl.trustStore=%s/keystore' % (cParam,keystorePath)
- cParam = '%s -Djavax.security.sasl.level=FINEST' % cParam
- cParam = '%s -Djavax.net.ssl.trustStorePassword=password' % cParam
- cParam = '%s -Djavax.net.ssl.keyStorePassword=password' % cParam
- cParam = '%s %s Client' % (cParam,parms)
-
- titleName = '%s: run %s on %s' % \
- (client.getHost(),client.getName(),
- serverInstance.getName())
- </script>
- <call function="'writeMessage'">
- { 'fileFd' : fileFd,
- 'content' : 'DEBUG %s' % cParam
- }
- </call>
- <process name="'%s' % titleName">
- <location>client.getHost()</location>
- <command>'%s/bin/java' % JAVA_HOME</command>
- <parms>cParam </parms>
- <workdir>workingDir</workdir>
- <envs>['PATH=%s/bin:/bin:/usr/bin' % JAVA_HOME]</envs>
- <stderr mode="'stdout'"/>
- <stdout>outFile</stdout>
- <returnstdout/>
- </process>
- <!-- TBD : result should be STAXResult[0][1] : problem when
- javaexception, with carac " and < >-->
- <call function="'checkRC'">
- { 'returncode' : RC ,
- 'result' : '',
- 'fileFd' : fileFd }
- </call>
- <script>
- errNum += STAXResult
- </script>
- <call function="'writeEndTagOperation'">{'fileFd' : fileFd}</call>
-
- <!-- ========== Postamble ========== -->
- <call function="'writeMessage'">
- {'content' : 'Output file %s' % outFile,
- 'fileFd' : fileFd}
- </call>
-
-
- <process name="'%s:%s: Grep' % (client.getHost(),client.getName())">
- <location>client.getHost()</location>
- <command mode="'shell'">
- "grep 'TOTAL' %s | cut -d ' ' -f3-" % outFile
- </command>
- <envs>['PATH=/bin:/usr/bin']</envs>
- <stderr mode="'stdout'"/>
- <stdout/>
- <returnstdout/>
- </process>
- <script>
- summary = STAXResult[0][1]
- </script>
-
-
- <call function="'writeMessage'">
- {'content' : 'Summary %s' % (summary),
- 'fileFd' : fileFd}
- </call>
-
- </sequence>
- </else>
- </if>
-
- <return> errNum </return>
-
- </sequence>
-
- </function>
-
-</stax>
-
diff --git a/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/secureUserpasswordModify/src/Client.java b/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/secureUserpasswordModify/src/Client.java
deleted file mode 100644
index 89b3a77..0000000
--- a/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/secureUserpasswordModify/src/Client.java
+++ /dev/null
@@ -1,489 +0,0 @@
-// 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
-// information:
-// Portions Copyright [yyyy] [name of copyright owner]
-//
-// CDDL HEADER END
-//
-//
-// Copyright 2008 Sun Microsystems, Inc.
-
-import java.util.*;
-import java.io.*;
-import java.lang.Thread;
-import javax.naming.*;
-import javax.naming.directory.InitialDirContext;
-import javax.naming.directory.SearchControls;
-import javax.naming.directory.DirContext;
-import javax.naming.directory.SearchResult;
-import javax.naming.directory.Attributes;
-
-
-public class Client {
-
-
- static int NB_MAX_mod=100;
- static int nb_mod_started=0;
- static int nb_mod_done=0;
- static int total_nb_mod=0;
- static int nb_threads=3;
- static int nb_thread_ready=0;
-
- static Random random;
- static String hostname ;
- static int portnumber;
- static String bindDN;
- static String bindPW;
- static String suffix;
- static Server server;
- static String protocol;
- static String attributeName;
- static String time= new String ("0 sec.");
- static long timeTostopTest=0;
- static long maxDuration=0;
- static long duration=0;
- static long startup=0;
- static ArrayList<String> DNList;
- static long delayCnx=1000;
- static long delaySec=1;
-
-
- public Client()
- {
-
- random= new Random();
- DNList=new ArrayList<String>();
-
- try {
-
- /*
- * bind as directory manager to get the full list of DN
- * create a list of DN
- */
- Hashtable envLdap = set_properties_LDAP_simpleBind();
-
- DirContext ctx = null;
- ctx = new InitialDirContext(envLdap);
-
- // Search options
- String filter = "(objectclass=inetorgperson)";
- String[] attrs = { "uid"};
-
- SearchControls constraints = new SearchControls();
- constraints.setSearchScope(SearchControls.SUBTREE_SCOPE);
- constraints.setReturningAttributes(attrs);
-
- NamingEnumeration results = ctx.search(suffix, filter, constraints);
- Exception exc = null;
- int count = 0;
-
- try {
- while (results != null && results.hasMore()) {
- SearchResult res = (SearchResult) results.next();
- DNList.add (res.getNameInNamespace());
-
- count++;
- }
-
- DNList.trimToSize();
- if ( DNList.size() == 0) {
- println("ERROR", "No entry found in \"" + suffix + "\"");
- System.exit(1);
- }
- } catch (Exception ex) {
- exc = ex;
- }
- if ( exc != null ) {
- throw exc;
- }
- } catch (Exception e) {
-
- println ("INFO", "ERROR Failed to establish connection ");
- e.printStackTrace();
- System.exit(1);
- }
-
- try {
-
-
- // execute the threads
- for (int i=0; i < nb_threads; i++ ) {
- Worker w = new Worker(this, server);
- }
- println ("INFO", nb_threads + " threads connected to server " + server );
- //println ("INFO", "Will search using filter \"(" + attr + " = <value> )\" (MAX =" + NB_MAX_mod + ")" );
-
- // Wait until all the threads have initialized their context
- // and are ready to bind
- try {
- while ( nb_thread_ready() < nb_threads) {
- // wait
- }
- // All the threads are ready, wake up all the threads
- synchronized(this) {
- nb_thread_ready=0;
- notifyAll();
- }
- }
- catch ( Exception e1 ) {
- System.out.println ("E1");
- e1.printStackTrace();
- }
-
- int seconds=0;
- // initialize startup
- long t1=System.currentTimeMillis();
-
- // work until Max duration is reached
- while (true) {
-
- long new_t1=System.currentTimeMillis();
-
- // end of the system test. Exit
- if ( ( timeTostopTest != 0 ) && ( new_t1 > timeTostopTest ) ) {
-
- // inform all the threads it's the end
- synchronized (this) {
- nb_mod_started=NB_MAX_mod;
- }
- break;
- }
-
- // status every delayCnx
- if ( (new_t1 - t1) >= delayCnx) {
-
- println("INFO", (nb_mod_done/delaySec) + " mod/sec.");
-
- // inform all the threads the max nb searchs has been reached
- synchronized (this) {
- nb_mod_started=NB_MAX_mod;
- }
-
- // Wait all the threads to close their cnx and sleep
- try {
- total_nb_mod+=nb_mod_done;
- while ( nb_thread_ready() < nb_threads) {
- // wait
- }
- // All the threads are ready, wake up all the threads
- synchronized(this) {
- nb_thread_ready=0;
- nb_mod_started=0;
- nb_mod_done=0;
-
- notifyAll();
- }
- }
- catch ( Exception e1 ) {
- System.out.println ("E1");
- e1.printStackTrace();
- }
-
- if ( (seconds++) >= 9 ) {
- duration=((new_t1-startup)/1000);
- println("INFO", "Avg rate: " + (total_nb_mod/duration) + " mod/sec. after " + getTime(duration));
- seconds=0;
- }
- t1=new_t1;
- }
- }
- println ("INFO", "End of the client");
- System.exit(0);
- }
- catch( Exception e ) {
-
- e.printStackTrace();
- System.exit(1);
- }
-
-
- }
-
-
-/* =========================================
- * MAIN
- * ======================================= */
-
- public static void main( String[] args )
-
- {
-
- startup=System.currentTimeMillis();
-
- // ===========================================
- // Get the arguments specified for each option.
- //
-
- // Ldap port
- String sport = System.getProperty("port");
- portnumber = Integer.parseInt(sport);
-
- // BaseDN
- suffix = System.getProperty("suffix");
- println ("INFO" , "suffix " + suffix);
-
- // nb_threads
- String snb_threads = System.getProperty("nb_threads");
- nb_threads = Integer.parseInt(snb_threads);
-
- println ("INFO" , "nb_threads " + snb_threads);
-
- // test duration
- String sMaxDuration = System.getProperty("maxDuration");
- maxDuration = Long.parseLong(sMaxDuration);
- println ("INFO" , "maxDuration " + maxDuration);
-
- // credential for simple bind
- bindDN = System.getProperty("bindDN");
- bindPW = System.getProperty("bindPW");
- println ("INFO" , "bindDN " + bindDN);
-
- // Max number of searchs
- String sNB_MAX_mod = System.getProperty("NB_MAX_mod");
- NB_MAX_mod = Integer.parseInt(sNB_MAX_mod);
- println ("INFO" , "sNB_MAX_mod " + sNB_MAX_mod);
-
- // attribute to modify or add
- attributeName = System.getProperty("attributeName");
- println ("INFO" , "attributeName " + attributeName);
-
- // hostname
- hostname = System.getProperty("hostname");
-
- // protocol : SSL or TLS
- protocol = System.getProperty("protocol");
- println ("INFO" , "protocol " + protocol);
-
- // delay Sec before closing conx
- String sdelaySec = System.getProperty("delaySec");
- delaySec = Long.parseLong(sdelaySec);
- delayCnx = delaySec * 1000;
- println ("INFO" , "delayCnx " + delayCnx);
-
- if ( maxDuration != 0 ) {
- maxDuration= maxDuration * 1000;
- }
- timeTostopTest=( startup + maxDuration);
- println("INFO", "the test will finish at " + timeTostopTest );
-
- // ===========================================
- // Initialize the Server
- server=new Server (hostname,portnumber);
-
- System.out.println ("DEBUG declare server " + portnumber + " " + hostname);
-
- Runtime.getRuntime().addShutdownHook(new Thread() {
-
- public void run() {
- }
- });
-
- Client c = new Client();
- }
-
-/* =========================================
- * Get Date
- * ======================================= */
- public static String getTime(long d) {
- String time=new String (d + " sec.");
- if ( d > 10000 ) {
- time=new String ((d/3600) + " hours");
- } else if ( d > 300 ) {
- time=new String ((d/60) + " min.");
- }
- return time;
- }
-
-/* =========================================
- * return true if the number of NB_MAX_mod has been reached
- * else, increase nb_mod_started
- * ======================================= */
-
- public boolean nb_mod_started_reached() {
-
- synchronized (this) {
- if ( nb_mod_started>=NB_MAX_mod ) {
- return true;
-
- } else {
- nb_mod_started++;
- return false;
- }
- }
- }
-
-
-/* =========================================
- * thread is waiting for a notify from the main thread
- * ======================================= */
-
- public void thread_go_to_sleep() {
-
- synchronized (this) {
- try {
- nb_thread_ready++;
-
- this.wait();
- } catch ( Exception e ) {
- e.printStackTrace();
- }
- }
- }
-
-
-/* =========================================
- * increase the number of mod started
- * ======================================= */
- public void inc_mod_started() {
-
- synchronized (this) {
- if ( nb_mod_started>=NB_MAX_mod ) {
- try {
- this.wait();
- } catch ( Exception e ) {
- e.printStackTrace();
- }
-
- } else {
- nb_mod_started++;
- }
- }
- }
-
-
-
-/* =========================================
- * increase the number of mod done
- * ======================================= */
- public void inc_mod_done() {
- synchronized (this) {
- try {
- nb_mod_done++;
- } catch ( Exception e ) {
- e.printStackTrace();
- }
- }
- }
-
-
-/* =========================================
- * Configure the Properties
- * authentication : simple
- * protocol ssl, tls or clear
- * ======================================= */
- public static Hashtable set_properties_LDAP() {
-
- String provider ;
-
- Hashtable envLdap = new Hashtable();
- envLdap.put("java.naming.factory.initial",
- "com.sun.jndi.ldap.LdapCtxFactory");
-
- envLdap.put(Context.SECURITY_AUTHENTICATION, "simple");
-
- if ( protocol.equals("ssl")) {
- provider = "ldaps://"+server.host+":"+server.port+"/";
- envLdap.put(Context.SECURITY_PROTOCOL, protocol);
-
- } else {
- provider = "ldap://"+server.host+":"+server.port+"/";
- }
- envLdap.put(Context.PROVIDER_URL, provider);
-
- return envLdap;
- }
-
-
-/* =========================================
- * Configure the Properties for a simple Bind
- * bind as directory manager
- * use the selected protocol : ssl, tls or clear
- * ======================================= */
-
- public static Hashtable set_properties_LDAP_simpleBind() {
-
- String provider ;
-
- Hashtable envLdap = new Hashtable();
- envLdap.put("java.naming.factory.initial",
- "com.sun.jndi.ldap.LdapCtxFactory");
-
- envLdap.put(Context.SECURITY_AUTHENTICATION, "simple");
-
- envLdap.put(Context.SECURITY_PRINCIPAL, bindDN);
- envLdap.put(Context.SECURITY_CREDENTIALS, bindPW);
-
- if ( protocol.equals("ssl")) {
- provider = "ldaps://"+server.host+":"+server.port+"/";
- envLdap.put(Context.SECURITY_PROTOCOL, protocol);
-
- } else {
- provider = "ldap://"+server.host+":"+server.port+"/";
- }
-
- envLdap.put(Context.PROVIDER_URL, provider);
- return envLdap;
- }
-
-/* =========================================
- * Get Date
- * ======================================= */
- 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()) + "]");
- }
-
-
-/* =========================================
- * Print
- * ======================================= */
- public static void println(String level, String msg) {
- System.out.println (getDate() + " - " + level + ": " + msg );
- }
-
-
-/* =========================================
- * increase the number of threads ready
- * ======================================= */
- public void inc_thread_ready() {
- synchronized (this) {
- nb_thread_ready++;
-
- try {
- this.wait();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- }
-
-
-/* =========================================
- * return the number of threads ready
- * ======================================= */
- public static int nb_thread_ready() {
- return nb_thread_ready;
- }
-}
-
diff --git a/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/secureUserpasswordModify/src/Server.java b/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/secureUserpasswordModify/src/Server.java
deleted file mode 100644
index dbf2405..0000000
--- a/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/secureUserpasswordModify/src/Server.java
+++ /dev/null
@@ -1,46 +0,0 @@
-// 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
-// information:
-// Portions Copyright [yyyy] [name of copyright owner]
-//
-// CDDL HEADER END
-//
-//
-// Copyright 2008 Sun Microsystems, Inc.
-import java.util.*;
-
-
-public class Server {
- public String host;
- public int port;
-
- public Server (String host, int port) {
- this.host=host;
- this.port=port;
- }
-
- public Server (String hostPort) {
- StringTokenizer st = new StringTokenizer(hostPort, ":");
- this.host=st.nextToken();
- this.port=Integer.parseInt(st.nextToken());
- }
-
- public String toString() {
- return (host + ":" + port);
- }
-}
diff --git a/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/secureUserpasswordModify/src/Worker.java b/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/secureUserpasswordModify/src/Worker.java
deleted file mode 100644
index 7b21eab..0000000
--- a/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/secureUserpasswordModify/src/Worker.java
+++ /dev/null
@@ -1,165 +0,0 @@
-// 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
-// information:
-// Portions Copyright [yyyy] [name of copyright owner]
-//
-// CDDL HEADER END
-//
-//
-// Copyright 2008 Sun Microsystems, Inc.
-
-import java.util.*;
-import java.io.*;
-import java.lang.Thread;
-import javax.naming.*;
-
-import javax.naming.directory.SearchControls;
-import javax.naming.directory.SearchResult;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.DirContext;
-import javax.naming.Context;
-import javax.naming.directory.InitialDirContext;
-import javax.naming.directory.BasicAttributes;
-
-
-public class Worker extends Thread {
-
- Server server;
- Client client;
- long myId = this.getId();
-
- /**
- ** Constructor for Worker thread
- **/
- public Worker(Client client2, Server server2) {
-
- super();
- try {
-
- server = server2;
- client = client2;
- start();
-
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- * Connect to the server
- * wait a notify from the main thread to startthe modify operations
- **/
- public void run() {
-
- String value="";
- String initBindPW;
- String newBindPW;
- Random random_cpt= new Random();
- String bindDN;
- try {
-
- DirContext ctx = null;
-
- // Set the properties
- Hashtable envLdap = client.set_properties_LDAP();
-
- println("INFO","THREAD " + myId + " is waiting ");
- // Waiting a notify from the main thread
- client.inc_thread_ready();
-
- /*
- * Start modify operations
- */
- String[] attrIds = { (String)client.attributeName };
- initBindPW = "userpassword";
- newBindPW = "new_userpassword";
-
- Attributes initAttrs = new BasicAttributes(attrIds[0], initBindPW, true);
- Attributes newAttrs = new BasicAttributes(attrIds[0], newBindPW, true);
-
- while (true) {
-
- while (true) {
-
- bindDN=(String) client.DNList.get(client.random.nextInt(client.DNList.size()));
- try {
-
- // if the Max_nb_mod is reached, counters are initialized
- // disconnect cnx
- // Wait the main to wake up
- if ( client.nb_mod_started_reached() == false) {
-
- // bind
- // use a random DN to bind
- envLdap.put(Context.SECURITY_PRINCIPAL, bindDN);
- envLdap.put(Context.SECURITY_CREDENTIALS, initBindPW);
-
- ctx = new InitialDirContext(envLdap);
- ctx.modifyAttributes(bindDN, DirContext.REPLACE_ATTRIBUTE, newAttrs);
- ctx.close();
-
- // restore the old password
- // bind
-
- envLdap.put(Context.SECURITY_PRINCIPAL, bindDN);
- envLdap.put(Context.SECURITY_CREDENTIALS, newBindPW);
-
- ctx = new InitialDirContext(envLdap);
- ctx.modifyAttributes(bindDN, DirContext.REPLACE_ATTRIBUTE, initAttrs);
- ctx.close();
-
-
- client.inc_mod_done();
- } else {
- client.thread_go_to_sleep();
- break;
- }
- } catch (Exception ex) {
-
- println("INFO","THREAD " + myId + " ERROR " + ex);
-
- }
- // update the total number of searchs
- client.inc_mod_done();
- }
- }
- } catch (Exception e) {
-
- println("INFO", "ERROR Failed: expected error code 3 ");
-
- e.printStackTrace();
- System.exit(1);
- }
- }
-
- private 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()) + "]");
- }
-
- private void println(String level, String msg) {
- System.out.println(getDate() + " - " + level + ": (" + server + ") " + msg );
- }
-
-}
diff --git a/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/tasks/tasks.xml b/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/tasks/tasks.xml
deleted file mode 100644
index 4e25ac1..0000000
--- a/opendj-sdk/opends/tests/system-tests/scenario/sample/clients/tasks/tasks.xml
+++ /dev/null
@@ -1,223 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!DOCTYPE stax SYSTEM "../../../shared/stax.dtd">
-<!--
- ! 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 2008 Sun Microsystems, Inc.
- ! -->
-<stax>
-
- <defaultcall function="tasks"/>
-
- <!-- ************************************************************ -->
- <function name="tasks" scope="local">
-
- <function-map-args>
- <function-arg-def name="workingDir" type="required"/>
- <function-arg-def name="client" type="required"/>
- <function-arg-def name="instances" type="required"/>
- <function-arg-def name="duration" type="required"/>
- <function-arg-def name="suffix" type="required"/>
- <function-arg-def name="outFile" type="required"/>
- <function-arg-def name="fileFd" type="required"/>
- </function-map-args>
-
-
- <sequence>
- <!-- =================== Comments =================== -->
- <!-- client is run under paralleliterate tag -->
- <!-- each variables defined are internal -->
- <!-- client should have its own err_num variable in order -->
- <!-- to inform scheduler if it has pass/fail status -->
- <script>
- errNum = 0
- msg = ''
- </script>
-
- <!-- ================== Preamble =================== -->
- <!-- parse the client parameters : -->
- <!-- params is [[param1,val1],[param2,val2],...] -->
- <!-- get the ldap instance parameters -->
-
- <script>
- compilDir = '%s/%s_%s' % (workingDir,client.getHost(),client.getId())
-
- outFile = '%s/client_tasks_id%s.txt' % \
- (client.getLogDir(),client.getId())
-
- #
- # Extract client parameters from client.getParams()
- #
- cParams = client.getParams()
- try:
- serverInstanceFromClient = cParams[0][1]
- except IndexError:
- serverInstanceFromClient = NOT_DEFINED
- msg = '%s\nERROR: serverInstanceFromClient undefined,mandatory' % msg
- try:
- nbTasks = cParams[1][1]
- except IndexError:
- nbTasks = NOT_DEFINED
- msg = '%s\nERROR: nbTasks undefined,mandatory' % msg
- try:
- delaySec = cParams[2][1]
- except IndexError:
- delaySec = NOT_DEFINED
- msg = '%s\nERROR: delaySec undefined,mandatory' % msg
-
- #
- # setup parms to run the client
- #
- if serverInstanceFromClient != NOT_DEFINED:
- sys.path.append("%s/phases/scheduler" % TESTS_DIR )
- from scheduler import getInstance
- serverInstance = getInstance(serverInstanceFromClient,instances)
- if (serverInstance == 'ERROR'):
- msg = '%s\nERROR: cant find client instance named' % msg
- msg = '%s %s in server instance list' % \
- (msg,serverInstanceFromClient)
-
- else:
- # remove sec, try to finish before timer kill -9 the client
- duration = duration - 60
- </script>
-
- <call function="'writeMessage'">
- {'content' : 'Executing backup in tasks mode every %s secondes' % delaySec,
- 'fileFd' : fileFd}
- </call>
-
- <if expr="msg.find('ERROR') != -1">
- <sequence>
- <message>'%s' % msg</message>
- <call function="'writeOperationResult'">
- {
- 'returncode' : '1',
- 'expected' : '0',
- 'result' : msg,
- 'status' : 'ERROR',
- 'fileFd' : fileFd
- }
- </call>
- <script>
- errNum += 1
- </script>
- </sequence>
- <else>
- <sequence>
- <call function="'writeStartTagOperation'">
- { 'tagName' : 'Backup task',
- 'fileFd' : fileFd }
- </call>
-
- <script>
- cpt=0
- intdelaySec= int(delaySec)
- intnbTasks= int(nbTasks)
- allowednbTasks= duration / intdelaySec
- listBackupFolder = []
- </script>
-
- <call function="'writeMessage'">
- {'content' : 'Execute %s tasks every %s sec ' % (allowednbTasks,intdelaySec),
- 'fileFd' : fileFd}
- </call>
-
- <call function="'writeEndTagOperation'">{'fileFd' : fileFd}</call>
-
- <loop from="1" to="allowednbTasks" >
- <sequence>
- <call function="'writeStartTagOperation'">
- { 'tagName' : 'Execute a backup task',
- 'fileFd' : fileFd }
- </call>
- <call function="'backup'">
- { 'location' : serverInstance.getHost(),
- 'dsPath' : serverInstance.getInstallDir(),
- 'dsInstanceHost' : serverInstance.getHost(),
- 'dsInstancePort' : serverInstance.getLDAPPort(),
- 'dsInstanceDn' : DIRECTORY_INSTANCE_DN,
- 'dsInstancePswd' : DIRECTORY_INSTANCE_PSWD,
- 'startTask' : '0',
- 'backupDir' : '%s/backup_schedule_asynchronous_%s' % (serverInstance.getInstallDir(),cpt),
- 'backEnd' : 'userRoot',
- 'fileFd' : fileFd}
- </call>
-
- <script>
- BackupFolder = '%s/backup_schedule_asynchronous_%s' % (serverInstance.getInstallDir(),cpt)
- listBackupFolder.append(BackupFolder)
- </script>
-
- <!--=== Sleep and wait to start the client when specified ===-->
- <call function="'sleep'">
- { 'location' : serverInstance.getHost(),
- 'sleepForMilliSeconds' : intdelaySec,
- 'fileFd' : fileFd
- }
- </call>
-
- <script>cpt += 1</script>
- <call function="'writeEndTagOperation'">{'fileFd' : fileFd}</call>
- </sequence>
- </loop>
-
-
- <iterate in="listBackupFolder" var="backupFolder">
- <sequence>
- <call function="'deleteFolder'">
- {
- 'location' : serverInstance.getHost(),
- 'foldername' : backupFolder,
- 'fileFd' : fileFd
- }
- </call>
- <script>
- errNum += STAXResult
- </script>
- </sequence>
- </iterate>
-
- <call function="'writeStartTagOperation'">
- { 'tagName' : 'End Backup task',
- 'fileFd' : fileFd }
- </call>
- <!-- ========== Postamble ========== -->
- <call function="'writeMessage'">
- {'content' : 'Output file %s' % outFile,
- 'fileFd' : fileFd}
- </call>
-
- <call function="'writeEndTagOperation'">{'fileFd' : fileFd}</call>
-
- </sequence>
- </else>
- </if>
- <return> errNum </return>
-
- </sequence>
-
- </function>
-
-</stax>
-
--
Gitblit v1.10.0