directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r952700 - in /directory/apacheds/trunk: core-api/src/main/java/org/apache/directory/server/core/interceptor/context/ core-integ/src/test/java/org/apache/directory/server/core/operations/move/ core-integ/src/test/java/org/apache/directory/se...
Date Tue, 08 Jun 2010 15:43:52 GMT
Author: elecharny
Date: Tue Jun  8 15:43:52 2010
New Revision: 952700

URL: http://svn.apache.org/viewvc?rev=952700&view=rev
Log:
o Adding some perf tests for the move operation
o Modified some error message

Added:
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/move/
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/move/MovePerfIT.java
Modified:
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/context/MoveOperationContext.java
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/rename/RenamePerfIT.java
    directory/apacheds/trunk/i18n/src/main/java/org/apache/directory/server/i18n/I18n.java
    directory/apacheds/trunk/i18n/src/main/resources/org/apache/directory/server/i18n/errors.properties

Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/context/MoveOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/context/MoveOperationContext.java?rev=952700&r1=952699&r2=952700&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/context/MoveOperationContext.java
(original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/context/MoveOperationContext.java
Tue Jun  8 15:43:52 2010
@@ -66,14 +66,14 @@ public class MoveOperationContext extend
         
         if ( parent == null )
         {
-            throw new IllegalArgumentException( I18n.err( I18n.ERR_326, modifyDnRequest )
);
+            throw new IllegalArgumentException( I18n.err( I18n.ERR_326_NEW_SUPERIROR_CANNOT_BE_NULL,
modifyDnRequest ) );
         }
         
         this.requestControls = modifyDnRequest.getControls();
         
         if ( modifyDnRequest.getNewRdn() != null )
         {
-            throw new IllegalArgumentException( I18n.err( I18n.ERR_327, modifyDnRequest )
);
+            throw new IllegalArgumentException( I18n.err( I18n.ERR_327_MOVE_AND_RENAME_OPERATION,
modifyDnRequest ) );
         }
         
         if ( requestControls.containsKey( ManageDsaITControl.CONTROL_OID ) )

Added: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/move/MovePerfIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/move/MovePerfIT.java?rev=952700&view=auto
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/move/MovePerfIT.java
(added)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/move/MovePerfIT.java
Tue Jun  8 15:43:52 2010
@@ -0,0 +1,125 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ *
+ */
+package org.apache.directory.server.core.operations.move;
+
+import org.apache.directory.ldap.client.api.LdapConnection;
+import org.apache.directory.server.core.annotations.ContextEntry;
+import org.apache.directory.server.core.annotations.CreateDS;
+import org.apache.directory.server.core.annotations.CreateIndex;
+import org.apache.directory.server.core.annotations.CreatePartition;
+import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
+import org.apache.directory.server.core.integ.FrameworkRunner;
+import org.apache.directory.server.core.integ.IntegrationUtils;
+import org.apache.directory.shared.ldap.entry.DefaultEntry;
+import org.apache.directory.shared.ldap.entry.Entry;
+import org.apache.directory.shared.ldap.name.DN;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * Test the move operation performances
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+@RunWith(FrameworkRunner.class)
+@CreateDS(name = "MovePerfDS", 
+    partitions = 
+    { 
+        @CreatePartition( 
+            name = "example", 
+            suffix = "dc=example,dc=com", 
+            contextEntry = 
+                @ContextEntry(
+                    entryLdif = 
+                        "dn: dc=example,dc=com\n" +
+                        "dc: example\n" + 
+                        "objectClass: top\n" + 
+                        "objectClass: domain\n\n"), 
+            indexes =
+            { 
+                @CreateIndex(attribute = "objectClass", cacheSize = 1000), 
+                @CreateIndex(attribute = "sn", cacheSize = 1000),
+                @CreateIndex(attribute = "cn", cacheSize = 1000) 
+            })
+    }, 
+    enableChangeLog = false)
+public class MovePerfIT extends AbstractLdapTestUnit
+{
+    /**
+     * Test a move operation performance
+     */
+    @Test
+    public void testMovePerf() throws Exception
+    {
+        LdapConnection connection = IntegrationUtils.getAdminConnection( service );
+
+        String oldDn = "cn=test,ou=system";
+        String newDn = "cn=test,dc=example,dc=com";
+
+        DN dn = new DN( oldDn );
+        Entry entry = new DefaultEntry( service.getSchemaManager(), dn );
+        entry.add( "ObjectClass", "top", "person" );
+        entry.add( "sn", "TEST" );
+        entry.add( "cn", "test0" );
+
+        connection.add( entry );
+        int nbIterations = 15000;
+
+        long t0 = System.currentTimeMillis();
+        long t00 = 0L;
+        long tt0 = System.currentTimeMillis();
+        
+        for ( int i = 0; i < nbIterations; i++ )
+        {
+            if ( i % 100 == 0 )
+            {
+                long tt1 = System.currentTimeMillis();
+
+                System.out.println( i + ", " + ( tt1 - tt0 ) );
+                tt0 = tt1;
+            }
+
+            if ( i == 5000 )
+            {
+                t00 = System.currentTimeMillis();
+            }
+
+            String newRdn = "cn=test" + i;
+            
+            long ttt0 = System.nanoTime();
+            connection.move( oldDn, newDn );
+            long ttt1 = System.nanoTime();
+
+            // Swap the dn
+            String tmpDn = newDn;
+            newDn = oldDn;
+            oldDn = tmpDn;
+            //System.out.println("added " + i + ", delta = " + (ttt1-ttt0)/1000);
+        }
+
+        long t1 = System.currentTimeMillis();
+
+        Long deltaWarmed = ( t1 - t00 );
+        System.out.println( "Delta : " + deltaWarmed + "( " + ( ( ( nbIterations - 5000 )
* 1000 ) / deltaWarmed ) + " per s ) /" + ( t1 - t0 ) );
+        connection.close();
+    }
+
+}

Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/rename/RenamePerfIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/rename/RenamePerfIT.java?rev=952700&r1=952699&r2=952700&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/rename/RenamePerfIT.java
(original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/rename/RenamePerfIT.java
Tue Jun  8 15:43:52 2010
@@ -40,7 +40,7 @@ import org.junit.runner.RunWith;
  * @version $Rev$
  */
 @RunWith(FrameworkRunner.class)
-@CreateDS(name = "EnamePerfDS", 
+@CreateDS(name = "RenamePerfDS", 
     partitions = 
     { 
         @CreatePartition( 
@@ -67,7 +67,7 @@ public class RenamePerfIT extends Abstra
      * Test a rename operation performance
      */
     @Test
-    public void testModifyPerf() throws Exception
+    public void testRenamePerf() throws Exception
     {
         LdapConnection connection = IntegrationUtils.getAdminConnection( service );
 

Modified: directory/apacheds/trunk/i18n/src/main/java/org/apache/directory/server/i18n/I18n.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/i18n/src/main/java/org/apache/directory/server/i18n/I18n.java?rev=952700&r1=952699&r2=952700&view=diff
==============================================================================
--- directory/apacheds/trunk/i18n/src/main/java/org/apache/directory/server/i18n/I18n.java
(original)
+++ directory/apacheds/trunk/i18n/src/main/java/org/apache/directory/server/i18n/I18n.java
Tue Jun  8 15:43:52 2010
@@ -359,8 +359,8 @@ public enum I18n
     ERR_323("ERR_323"),
     ERR_324("ERR_324"),
     ERR_325("ERR_325"),
-    ERR_326("ERR_326"),
-    ERR_327("ERR_327"),
+    ERR_326_NEW_SUPERIROR_CANNOT_BE_NULL("ERR_326_NEW_SUPERIROR_CANNOT_BE_NULL"),
+    ERR_327_MOVE_AND_RENAME_OPERATION("ERR_327_MOVE_AND_RENAME_OPERATION"),
     ERR_328("ERR_328"),
     ERR_329("ERR_329"),
     ERR_330("ERR_330"),

Modified: directory/apacheds/trunk/i18n/src/main/resources/org/apache/directory/server/i18n/errors.properties
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/i18n/src/main/resources/org/apache/directory/server/i18n/errors.properties?rev=952700&r1=952699&r2=952700&view=diff
==============================================================================
--- directory/apacheds/trunk/i18n/src/main/resources/org/apache/directory/server/i18n/errors.properties
(original)
+++ directory/apacheds/trunk/i18n/src/main/resources/org/apache/directory/server/i18n/errors.properties
Tue Jun  8 15:43:52 2010
@@ -347,8 +347,8 @@ ERR_322=The ignoreReferral method is not
 ERR_323=The isReferralIgnored method is not implemented for a Bind operation
 ERR_324=Cannot set the empty operation context to anything other than the EmptyDN
 ERR_325=NewSuperior must not be null: {0}
-ERR_326=The new superior cannot be null for {0}
-ERR_327={0} represents a move and rename operation.
+ERR_326_NEW_SUPERIROR_CANNOT_BE_NULL=The new superior cannot be null for {0}
+ERR_327_MOVE_AND_RENAME_OPERATION={0} represents a move and rename operation.
 ERR_328=newRdn must not be null for a rename: {0}
 ERR_329=Failed to initialize interceptor chain.
 ERR_330=Interceptor not found: {0}



Mime
View raw message