You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2010/05/13 00:12:36 UTC
svn commit: r943717 - in /directory/apacheds/trunk/core-integ: ./
src/test/java/org/apache/directory/server/core/operations/add/
src/test/java/org/apache/directory/server/core/operations/lookup/
src/test/java/org/apache/directory/server/core/operations...
Author: elecharny
Date: Wed May 12 22:12:36 2010
New Revision: 943717
URL: http://svn.apache.org/viewvc?rev=943717&view=rev
Log:
o Added some performance tests
o Made the build not launching those performance tests
Added:
directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/add/
directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/add/AddPerfIT.java
directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/lookup/LookupPerfIT.java
directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchPerfIT.java
Modified:
directory/apacheds/trunk/core-integ/pom.xml
Modified: directory/apacheds/trunk/core-integ/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/pom.xml?rev=943717&r1=943716&r2=943717&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/pom.xml (original)
+++ directory/apacheds/trunk/core-integ/pom.xml Wed May 12 22:12:36 2010
@@ -103,6 +103,7 @@
</includes>
<excludes>
<exclude>**/ReferralIT.java</exclude>
+ <exclude>**/*PerfIT.java</exclude>
</excludes>
</configuration>
</plugin>
@@ -175,7 +176,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<excludes>
- <exclude>**/*PTest.java</exclude>
+ <exclude>**/*PerfTest.java</exclude>
<exclude>**/*ITest.java</exclude>
</excludes>
</configuration>
Added: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/add/AddPerfIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/add/AddPerfIT.java?rev=943717&view=auto
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/add/AddPerfIT.java (added)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/add/AddPerfIT.java Wed May 12 22:12:36 2010
@@ -0,0 +1,99 @@
+/*
+ * 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.add;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.directory.ldap.client.api.LdapConnection;
+import org.apache.directory.ldap.client.api.message.SearchResponse;
+import org.apache.directory.ldap.client.api.message.SearchResultEntry;
+import org.apache.directory.server.core.annotations.ApplyLdifs;
+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.Ignore;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+
+/**
+ * Test the add operation performances
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+@RunWith ( FrameworkRunner.class )
+public class AddPerfIT extends AbstractLdapTestUnit
+{
+
+ /**
+ * Test an add operation performance
+ */
+ @Test
+ //@Ignore
+ public void testAddPerf() throws Exception
+ {
+ LdapConnection connection = IntegrationUtils.getAdminConnection( service );
+
+ DN dn = new DN( "cn=test,ou=system" );
+ Entry entry = new DefaultEntry( service.getSchemaManager(), dn );
+ entry.add( "ObjectClass", "top", "person" );
+ entry.add( "sn", "TEST" );
+ entry.add( "cn", "test" );
+
+ connection.add(entry );
+
+ long t0 = System.currentTimeMillis();
+ long tt0 = System.currentTimeMillis();
+
+ for ( int i = 0; i < 10000; i++ )
+ {
+ if ( i% 100 == 0 )
+ {
+ long tt1 = System.currentTimeMillis();
+
+ System.out.println( i + ", " + ( tt1 - tt0 ) );
+ tt0 = tt1;
+ }
+
+ String name = "test" + i;
+ dn = new DN( "cn=" + name + ",ou=system" );
+ entry = new DefaultEntry( service.getSchemaManager(), dn );
+ entry.add( "ObjectClass", "top", "person" );
+ entry.add( "sn", name.toUpperCase() );
+ entry.add( "cn", name );
+
+ long ttt0 = System.nanoTime();
+ connection.add(entry );
+ long ttt1 = System.nanoTime();
+ //System.out.println("added " + i + ", delta = " + (ttt1-ttt0)/1000);
+ }
+
+ long t1 = System.currentTimeMillis();
+
+ System.out.println( "Delta : " + ( t1 - t0 ) );
+ connection.close();
+ }
+}
Added: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/lookup/LookupPerfIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/lookup/LookupPerfIT.java?rev=943717&view=auto
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/lookup/LookupPerfIT.java (added)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/lookup/LookupPerfIT.java Wed May 12 22:12:36 2010
@@ -0,0 +1,83 @@
+/*
+ * 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.lookup;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.directory.ldap.client.api.LdapConnection;
+import org.apache.directory.ldap.client.api.message.SearchResponse;
+import org.apache.directory.ldap.client.api.message.SearchResultEntry;
+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.Entry;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+
+/**
+ * Test the lookup operation
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+@RunWith ( FrameworkRunner.class )
+public class LookupPerfIT extends AbstractLdapTestUnit
+{
+ /**
+ * A lookup performance test
+ */
+ @Test
+ public void testPerfLookup() throws Exception
+ {
+ LdapConnection connection = IntegrationUtils.getAdminConnection( service );
+
+ SearchResponse response = connection.lookup( "uid=admin,ou=system", "+" );
+
+ assertNotNull( response );
+ assertTrue( response instanceof SearchResultEntry );
+
+ SearchResultEntry result = (SearchResultEntry)response;
+
+ assertNotNull( result );
+
+ Entry entry = result.getEntry();
+
+ assertNotNull( entry );
+
+ long t0 = System.currentTimeMillis();
+
+ for ( int i = 0; i < 100; i++ )
+ {
+ for ( int j = 0; j < 5000; j++ )
+ {
+ connection.lookup( "uid=admin,ou=system", "+" );
+ }
+
+ System.out.print( "." );
+ }
+
+ long t1 = System.currentTimeMillis();
+
+ System.out.println( "Delta : " + ( t1 - t0 ) );
+ connection.close();
+ }
+}
Added: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchPerfIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchPerfIT.java?rev=943717&view=auto
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchPerfIT.java (added)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/operations/search/SearchPerfIT.java Wed May 12 22:12:36 2010
@@ -0,0 +1,92 @@
+/*
+ * 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.search;
+
+
+import static org.junit.Assert.assertEquals;
+
+import org.apache.directory.ldap.client.api.LdapConnection;
+import org.apache.directory.ldap.client.api.message.SearchResponse;
+import org.apache.directory.server.core.annotations.CreateDS;
+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.cursor.Cursor;
+import org.apache.directory.shared.ldap.filter.SearchScope;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * Tests the search() methods of the provider.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 938842 $
+ */
+@RunWith ( FrameworkRunner.class )
+@CreateDS( name="SearchDS" )
+public class SearchPerfIT extends AbstractLdapTestUnit
+{
+ /**
+ * A basic search for one single entry
+ */
+ @Test
+ public void testSearchPerf() throws Exception
+ {
+ LdapConnection connection = IntegrationUtils.getAdminConnection( service );
+
+ Cursor<SearchResponse> cursor = connection.search( "uid=admin,ou=system", "(ObjectClass=*)", SearchScope.OBJECT, "*" );
+
+ int i = 0;
+
+ while ( cursor.next() )
+ {
+ SearchResponse response = cursor.get();
+ ++i;
+ }
+
+ cursor.close();
+
+ assertEquals( 1, i );
+
+ for ( int j = 0; j < 10000; j++ )
+ {
+ cursor = connection.search( "uid=admin,ou=system", "(ObjectClass=*)", SearchScope.OBJECT, "*" );
+ cursor.close();
+ }
+
+ long t0 = System.currentTimeMillis();
+
+ for ( int j = 0; j < 1000000; j++ )
+ {
+ if ( j % 10000 == 0 )
+ {
+ System.out.println(j);
+ }
+
+ cursor = connection.search( "uid=admin,ou=system", "(ObjectClass=*)", SearchScope.OBJECT, "*" );
+ cursor.close();
+ }
+
+ long t1 = System.currentTimeMillis();
+
+ System.out.println( "Delta = " + ( t1 - t0 ) );
+ connection.close();
+ }
+}