Client.java revision d81978a0815d5b8a75633c35e3e1f8708d36f017
// 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
// 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.
public class Client {
// static String dn="cn=Directory Manager";
// static String password="secret12";
static int NB_MAX_MODS=100;
static int nb_mods_started=0;
static int nb_mods_done=0;
static int total_nb_mods=0;
static int nb_threads=3;
// String dn="cn=admin,dc=com";
// String dn="cn=Directory Manager";
// String password="secret12";
static int portnumber;
static long duration=0;
static long maxDuration=0;
public Client()
{
// println("INFO", "Getting DN from file " + DNFileName);
try {
LDAPConnection c = new LDAPConnection();
// no bind
// bind if needed
}
else {
}
// no limit for nb of entries returned by a search
LDAPSearchResults results = c.search( suffix, LDAPv3.SCOPE_SUB, "(objectclass=*)" , new String[] {"dn"} , false );
while ( results.hasMoreElements() ) {
try {
o=results.nextElement();
// println("DEBUG", "DN="+entry.getDN());
}
e.printStackTrace();
}
}
DNList.trimToSize();
}
println("INFO", "Found " + DNList.size() + " entries in \"" + suffix + "\" on " + server.toString() );
c.disconnect();
} catch (LDAPException e) {
int errorCode = e.getLDAPResultCode();
if ( errorCode == 32) {
}
else {
e.printStackTrace();
}
}
/* try {
File DNFile= new File(DNFileName);
LineNumberReader in=new LineNumberReader (new FileReader(DNFile) );
while ( in.ready() ) {
DNList.add(in.readLine());
}
} catch (IOException e) {
println ("ERROR", e.toString());
System.exit(1);
}*/
// DNList.trimToSize();
//println("INFO", "Found " + DNList.size() + " DNs");
try {
// reinitialize startup
if ( maxDuration != 0 ) {
}
for (int i=0; i < nb_threads; i++ ) {
}
int seconds=0;
while (true) {
nb_mods_done=0;
synchronized (lock) {
}
if ( (seconds++) >= 9 ) {
seconds=0;
}
}
}
}
catch( Exception e ) {
e.printStackTrace();
}
}
if ( d > 10000 ) {
} else if ( d > 300 ) {
}
return time;
}
{
+ "[-D <bindDN> ] [-w <bindPW> ] [-t <nb_threads>] [-M <nb_max_mods>] [-a <attribute>] [-d duration (seconds)]";
// Check for these options. -H means to print out a usage message.
// Get the arguments specified for each option.
}
}
}
}
// option -DM to use default QA settings for Directory manager
bindDN="cn=Directory Manager";
bindPW="secret12";
}
// Check to see if the hostname (which is mandatory)
// is not specified or if the user simply wants to
// see the usage message (-H).
}
// If a port number was specified, convert the port value
// to an integer.
try {
}
}
else {
portnumber=1389;
}
public void run() {
if ( duration != 0 )
println("INFO", "TOTAL: " + total_nb_mods + " mods (Avg rate: " + (total_nb_mods/duration) + " mods/sec.) after " + getTime(duration));
}
});
}
public static void inc_mods_started() {
}
public static void inc_mods_done() {
nb_mods_done++;
}
public static void check_mods_started() {
if ( nb_mods_started>=NB_MAX_MODS ) {
//println("DEBUG", "Mods=" + nb_mods);
try {
synchronized (lock) {
}
} catch ( InterruptedException e ) {
e.printStackTrace();
}
}
}
public static void wait_after_error() {
try {
synchronized (lock) {
}
} catch ( InterruptedException e ) {
e.printStackTrace();
}
}
try {
}
catch ( InterruptedException e )
{
}
}
// Initialize the today's date string
}
}
}