Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 86689 invoked from network); 1 Oct 2006 16:53:53 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 1 Oct 2006 16:53:53 -0000 Received: (qmail 30988 invoked by uid 500); 1 Oct 2006 16:53:53 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 30934 invoked by uid 500); 1 Oct 2006 16:53:53 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 30923 invoked by uid 99); 1 Oct 2006 16:53:52 -0000 Received: from idunn.apache.osuosl.org (HELO idunn.apache.osuosl.org) (140.211.166.84) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 01 Oct 2006 09:53:52 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=5.0 tests=ALL_TRUSTED,NO_REAL_NAME Received: from [140.211.166.113] ([140.211.166.113:56427] helo=eris.apache.org) by idunn.apache.osuosl.org (ecelerity 2.1.1.8 r(12930)) with ESMTP id F7/10-05102-0A2FF154 for ; Sun, 01 Oct 2006 09:53:52 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 787F31A981A; Sun, 1 Oct 2006 09:53:50 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r451766 - /directory/branches/apacheds/1.0/server-tools/src/main/java/org/apache/directory/server/tools/CapacityTestCommand.java Date: Sun, 01 Oct 2006 16:53:50 -0000 To: commits@directory.apache.org From: akarasulu@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20061001165350.787F31A981A@eris.apache.org> X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: akarasulu Date: Sun Oct 1 09:53:49 2006 New Revision: 451766 URL: http://svn.apache.org/viewvc?view=rev&rev=451766 Log: making capacity command create ou=users under example partition if it does not already exist Modified: directory/branches/apacheds/1.0/server-tools/src/main/java/org/apache/directory/server/tools/CapacityTestCommand.java Modified: directory/branches/apacheds/1.0/server-tools/src/main/java/org/apache/directory/server/tools/CapacityTestCommand.java URL: http://svn.apache.org/viewvc/directory/branches/apacheds/1.0/server-tools/src/main/java/org/apache/directory/server/tools/CapacityTestCommand.java?view=diff&rev=451766&r1=451765&r2=451766 ============================================================================== --- directory/branches/apacheds/1.0/server-tools/src/main/java/org/apache/directory/server/tools/CapacityTestCommand.java (original) +++ directory/branches/apacheds/1.0/server-tools/src/main/java/org/apache/directory/server/tools/CapacityTestCommand.java Sun Oct 1 09:53:49 2006 @@ -24,6 +24,8 @@ import java.io.PrintWriter; import java.util.Hashtable; +import javax.naming.NameAlreadyBoundException; +import javax.naming.NamingException; import javax.naming.directory.Attribute; import javax.naming.directory.Attributes; import javax.naming.directory.BasicAttributes; @@ -97,6 +99,9 @@ LdapContext ctx = new InitialLdapContext( env, null ); + // create the base dn if it does not exist + createBase( ctx ); + StringBuffer dnBuf = new StringBuffer(); StringBuffer outBuf = new StringBuffer(); int counter = 0; @@ -128,6 +133,23 @@ } + private boolean createBase( LdapContext ctx ) throws NamingException + { + Attributes attrs = new BasicAttributes( "objectClass", "organizationalUnit", true ); + attrs.put( "ou", "users" ); + + try + { + ctx.createSubcontext( "ou=users,dc=example,dc=com", attrs ); + return true; + } + catch( NameAlreadyBoundException e ) + { + return false; + } + } + + private Attributes generateLdif( int counter ) { BasicAttributes attrs = new BasicAttributes( "objectClass", "top", true );