Return-Path: X-Original-To: apmail-directory-commits-archive@www.apache.org Delivered-To: apmail-directory-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9C1ED9197 for ; Sat, 13 Oct 2012 11:04:20 +0000 (UTC) Received: (qmail 9180 invoked by uid 500); 13 Oct 2012 11:04:19 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 9007 invoked by uid 500); 13 Oct 2012 11:04:13 -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 8952 invoked by uid 99); 13 Oct 2012 11:04:11 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 13 Oct 2012 11:04:11 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 13 Oct 2012 11:04:10 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id C67BE23888CD for ; Sat, 13 Oct 2012 11:03:26 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1397811 - in /directory/apacheds/trunk/ldap-client-test: pom.xml src/test/java/org/apache/directory/shared/client/api/operations/ClientAbandonRequestTest.java Date: Sat, 13 Oct 2012 11:03:26 -0000 To: commits@directory.apache.org From: seelmann@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20121013110326.C67BE23888CD@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: seelmann Date: Sat Oct 13 11:03:26 2012 New Revision: 1397811 URL: http://svn.apache.org/viewvc?rev=1397811&view=rev Log: * Moved code that injects 100 entries to setup * Added MultiThreadedMultiInvoker to demonstrate occasional failures of testAbandonSearch() Modified: directory/apacheds/trunk/ldap-client-test/pom.xml directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/ClientAbandonRequestTest.java Modified: directory/apacheds/trunk/ldap-client-test/pom.xml URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/ldap-client-test/pom.xml?rev=1397811&r1=1397810&r2=1397811&view=diff ============================================================================== --- directory/apacheds/trunk/ldap-client-test/pom.xml (original) +++ directory/apacheds/trunk/ldap-client-test/pom.xml Sat Oct 13 11:03:26 2012 @@ -86,6 +86,12 @@ org.apache.directory.shared shared-ldap-client-api + + + org.apache.directory.junit + junit-addons + test + Modified: directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/ClientAbandonRequestTest.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/ClientAbandonRequestTest.java?rev=1397811&r1=1397810&r2=1397811&view=diff ============================================================================== --- directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/ClientAbandonRequestTest.java (original) +++ directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/ClientAbandonRequestTest.java Sat Oct 13 11:03:26 2012 @@ -24,6 +24,7 @@ package org.apache.directory.shared.clie import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; +import org.apache.directory.junit.tools.MultiThreadedMultiInvoker; import org.apache.directory.ldap.client.api.LdapNetworkConnection; import org.apache.directory.ldap.client.api.future.SearchFuture; import org.apache.directory.server.annotations.CreateLdapServer; @@ -47,6 +48,7 @@ import org.apache.directory.shared.ldap. import org.apache.directory.shared.ldap.model.name.Dn; import org.junit.After; import org.junit.Before; +import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -61,35 +63,28 @@ import org.junit.runner.RunWith; { @CreateTransport(protocol = "LDAP"), @CreateTransport(protocol = "LDAPS") }) public class ClientAbandonRequestTest extends AbstractLdapTestUnit { - + @Rule + public MultiThreadedMultiInvoker i = new MultiThreadedMultiInvoker( MultiThreadedMultiInvoker.NOT_THREADSAFE ); + private static final int numEntries = 100; private LdapNetworkConnection connection; @Before public void setup() throws Exception { - connection = (LdapNetworkConnection)LdapApiIntegrationUtils.getPooledAdminConnection( getLdapServer() ); - } - - - @After - public void shutdown() throws Exception - { - LdapApiIntegrationUtils.releasePooledAdminConnection( connection, getLdapServer() ); - } + connection = ( LdapNetworkConnection ) LdapApiIntegrationUtils.getPooledAdminConnection( getLdapServer() ); - - @Test - public void testCancelSearch() throws Exception - { // injecting some values to keep the // followed search operation to run for a while - final int numEntries = 100; - for ( int i = 0; i < numEntries; i++ ) { String s = String.valueOf( i ); Dn dn = new Dn( "cn=" + s + ",ou=system" ); + if ( connection.exists( dn ) ) + { + break; + } + Entry entry = new DefaultEntry( dn ); entry.add( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.PERSON_OC ); entry.add( SchemaConstants.CN_AT, s ); @@ -97,7 +92,19 @@ public class ClientAbandonRequestTest ex connection.add( entry ); } + } + + @After + public void shutdown() throws Exception + { + LdapApiIntegrationUtils.releasePooledAdminConnection( connection, getLdapServer() ); + } + + + @Test + public void testCancelSearch() throws Exception + { SearchRequest sr = new SearchRequestImpl(); sr.setFilter( "(cn=*)" ); sr.setBase( new Dn( "ou=system" ) ); @@ -145,22 +152,6 @@ public class ClientAbandonRequestTest ex @Test public void testAbandonSearch() throws Exception { - // injecting some values to keep the - // followed search operation to run for a while - final int numEntries = 100; - - for ( int i = 0; i < numEntries; i++ ) - { - String s = String.valueOf( i ); - Dn dn = new Dn( "cn=" + s + ",ou=system" ); - Entry entry = new DefaultEntry( dn ); - entry.add( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.PERSON_OC ); - entry.add( SchemaConstants.CN_AT, s ); - entry.add( SchemaConstants.SN_AT, s ); - - connection.add( entry ); - } - // Launch the search now EntryCursor cursor = connection.search( new Dn( "ou=system" ), "(cn=*)", SearchScope.ONELEVEL, "*" );