directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r964114 - in /directory/apacheds/trunk: core/src/main/java/org/apache/directory/server/core/collective/ server-annotations/src/test/java/org/apache/directory/server/factory/ server-integ/src/test/java/org/apache/directory/server/operations/...
Date Wed, 14 Jul 2010 18:10:02 GMT
Author: elecharny
Date: Wed Jul 14 18:10:02 2010
New Revision: 964114

URL: http://svn.apache.org/viewvc?rev=964114&view=rev
Log:
o Small improvement in the CollectiveAttributeInterceptor
o Port numbers are now selected to avoid a collision in the server-annotation tests
o Modified the printing of perf tests results
o Minor refactoring on CursorBuider
 

Modified:
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeInterceptor.java
    directory/apacheds/trunk/server-annotations/src/test/java/org/apache/directory/server/factory/CreateKdcServerAnnotationTest.java
    directory/apacheds/trunk/server-annotations/src/test/java/org/apache/directory/server/factory/DirectoryServiceAnnotationTest.java
    directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchPerfIT.java
    directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/CursorBuilder.java

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeInterceptor.java?rev=964114&r1=964113&r2=964114&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeInterceptor.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeInterceptor.java
Wed Jul 14 18:10:02 2010
@@ -60,12 +60,15 @@ import org.apache.directory.shared.ldap.
  */
 public class CollectiveAttributeInterceptor extends BaseInterceptor
 {
-    /** The SchemaManager */
+    /** The SchemaManager instance */
     private SchemaManager schemaManager;
 
     private PartitionNexus nexus;
 
     private CollectiveAttributesSchemaChecker collectiveAttributesSchemaChecker;
+    
+    /** The CollectiveAttributeSubentries AttributeType */
+    private static AttributeType COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT;
 
     /**
      * the search result filter to use for collective attribute injection
@@ -94,6 +97,8 @@ public class CollectiveAttributeIntercep
         schemaManager = directoryService.getSchemaManager();
         nexus = directoryService.getPartitionNexus();
         collectiveAttributesSchemaChecker = new CollectiveAttributesSchemaChecker( nexus,
schemaManager );
+        
+        COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT = schemaManager.getAttributeType( SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT
);
     }
 
 
@@ -112,7 +117,7 @@ public class CollectiveAttributeIntercep
     private void addCollectiveAttributes( OperationContext opContext, Entry entry, String[]
retAttrs ) throws LdapException
     {
         EntryAttribute collectiveAttributeSubentries = ( ( ClonedServerEntry ) entry ).getOriginalEntry().get(
-            SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT );
+            COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT );
 
         /*
          * If there are no collective attribute subentries referenced then we 

Modified: directory/apacheds/trunk/server-annotations/src/test/java/org/apache/directory/server/factory/CreateKdcServerAnnotationTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-annotations/src/test/java/org/apache/directory/server/factory/CreateKdcServerAnnotationTest.java?rev=964114&r1=964113&r2=964114&view=diff
==============================================================================
--- directory/apacheds/trunk/server-annotations/src/test/java/org/apache/directory/server/factory/CreateKdcServerAnnotationTest.java
(original)
+++ directory/apacheds/trunk/server-annotations/src/test/java/org/apache/directory/server/factory/CreateKdcServerAnnotationTest.java
Wed Jul 14 18:10:02 2010
@@ -28,6 +28,7 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.annotations.CreateDS;
 import org.apache.directory.server.core.factory.DSAnnotationProcessor;
 import org.apache.directory.server.kerberos.kdc.KdcServer;
+import org.apache.mina.util.AvailablePortFinder;
 import org.junit.Test;
 
 /**
@@ -54,7 +55,7 @@ public class CreateKdcServerAnnotationTe
         
         assertEquals( "CreateKdcServerAnnotationTest-class", directoryService.getInstanceId()
);
         
-        KdcServer server = ServerAnnotationProcessor.getKdcServer( directoryService, 1024
);
+        KdcServer server = ServerAnnotationProcessor.getKdcServer( directoryService, AvailablePortFinder.getNextAvailable(
1024 ) );
 
         assertEquals( 2, server.getTransports().length );
         

Modified: directory/apacheds/trunk/server-annotations/src/test/java/org/apache/directory/server/factory/DirectoryServiceAnnotationTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-annotations/src/test/java/org/apache/directory/server/factory/DirectoryServiceAnnotationTest.java?rev=964114&r1=964113&r2=964114&view=diff
==============================================================================
--- directory/apacheds/trunk/server-annotations/src/test/java/org/apache/directory/server/factory/DirectoryServiceAnnotationTest.java
(original)
+++ directory/apacheds/trunk/server-annotations/src/test/java/org/apache/directory/server/factory/DirectoryServiceAnnotationTest.java
Wed Jul 14 18:10:02 2010
@@ -49,6 +49,7 @@ import org.apache.directory.server.ldap.
 import org.apache.directory.shared.ldap.jndi.JndiUtils;
 import org.apache.directory.shared.ldap.message.control.Control;
 import org.apache.directory.shared.ldap.name.DN;
+import org.apache.mina.util.AvailablePortFinder;
 import org.junit.Test;
 
 
@@ -229,7 +230,7 @@ public class DirectoryServiceAnnotationT
         assertTrue( service.getAdminSession().exists( new DN( "dc=example,dc=com" ) ) );
 
         // Now, get the server
-        LdapServer ldapServer = ServerAnnotationProcessor.getLdapServer( service, 1024 );
+        LdapServer ldapServer = ServerAnnotationProcessor.getLdapServer( service, AvailablePortFinder.getNextAvailable(
1024 ) );
 
         // Check that the server is running
         assertTrue( ldapServer.isStarted() );

Modified: directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchPerfIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchPerfIT.java?rev=964114&r1=964113&r2=964114&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchPerfIT.java
(original)
+++ directory/apacheds/trunk/server-integ/src/test/java/org/apache/directory/server/operations/search/SearchPerfIT.java
Wed Jul 14 18:10:02 2010
@@ -94,8 +94,9 @@ public class SearchPerfIT extends Abstra
             }
 
             long t0 = System.currentTimeMillis();
-            
-            for ( int j = 0; j < 200000; j++ )
+            int nbIterations = 200000;
+
+            for ( int j = 0; j < nbIterations; j++ )
             {
                 if ( j % 10000 == 0 )
                 {
@@ -109,7 +110,8 @@ public class SearchPerfIT extends Abstra
             
             long t1 = System.currentTimeMillis();
             
-            System.out.println( "Delta = " + ( t1 - t0 ) );
+            Long deltaWarmed = ( t1 - t0 );
+            System.out.println( "Delta : " + deltaWarmed + "( " + ( ( nbIterations * 1000
) / deltaWarmed ) + " per s ) /" + ( t1 - t0 ) );
         }
         catch ( LdapException e )
         {

Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/CursorBuilder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/CursorBuilder.java?rev=964114&r1=964113&r2=964114&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/CursorBuilder.java
(original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/CursorBuilder.java
Wed Jul 14 18:10:02 2010
@@ -160,7 +160,6 @@ public class CursorBuilder<ID extends Co
     {
         int minIndex = 0;
         long minValue = Long.MAX_VALUE;
-        //noinspection UnusedAssignment
         long value = Long.MAX_VALUE;
 
         /*
@@ -170,20 +169,22 @@ public class CursorBuilder<ID extends Co
          */
         final List<ExprNode> children = node.getChildren();
 
-        for ( int ii = 0; ii < children.size(); ii++ )
+        for ( int i = 0; i < children.size(); i++ )
         {
-            ExprNode child = children.get( ii );
+            ExprNode child = children.get( i );
             Object count = child.get( "count" );
+            
             if ( count == null )
             {
                 continue;
             }
+            
             value = ( Long ) count;
             minValue = Math.min( minValue, value );
 
             if ( minValue == value )
             {
-                minIndex = ii;
+                minIndex = i;
             }
         }
 
@@ -191,6 +192,7 @@ public class CursorBuilder<ID extends Co
         ExprNode minChild = children.get( minIndex );
         List<Evaluator<? extends ExprNode, Entry, ID>> childEvaluators = new
ArrayList<Evaluator<? extends ExprNode, Entry, ID>>(
             children.size() - 1 );
+        
         for ( ExprNode child : children )
         {
             if ( child == minChild )
@@ -203,6 +205,7 @@ public class CursorBuilder<ID extends Co
 
         // Do recursive call to build min child Cursor then create AndCursor
         IndexCursor<?, Entry, ID> childCursor = build( minChild );
+        
         return new AndCursor( childCursor, childEvaluators );
     }
 }



Mime
View raw message