You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by sa...@apache.org on 2012/07/02 08:43:43 UTC
svn commit: r1356079 - in /directory/apacheds/branches/apacheds-txns:
core-api/src/main/java/org/apache/directory/server/core/api/txn/
core-integ/src/test/java/org/apache/directory/server/core/txn/
core-shared/src/main/java/org/apache/directory/server/...
Author: saya
Date: Mon Jul 2 06:43:42 2012
New Revision: 1356079
URL: http://svn.apache.org/viewvc?rev=1356079&view=rev
Log:
tests for txn recovery and leaked cursor management.
Added:
directory/apacheds/branches/apacheds-txns/core-integ/src/test/java/org/apache/directory/server/core/txn/TxnRecoveryIT.java
Modified:
directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/txn/TxnManager.java
directory/apacheds/branches/apacheds-txns/core-integ/src/test/java/org/apache/directory/server/core/txn/TxnConflictIT.java
directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/DefaultLeakedCursorManager.java
directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/DefaultTxnManager.java
directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/RandomFileCursor.java
directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/logedit/DataChangeContainer.java
directory/apacheds/branches/apacheds-txns/server-integ/src/test/java/org/apache/directory/server/operations/search/PagedSearchIT.java
Modified: directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/txn/TxnManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/txn/TxnManager.java?rev=1356079&r1=1356078&r2=1356079&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/txn/TxnManager.java (original)
+++ directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/txn/TxnManager.java Mon Jul 2 06:43:42 2012
@@ -138,5 +138,10 @@ public interface TxnManager
* Recovers the given partition
*/
void recoverPartition( Partition partition );
+
+
+ void setDoNotFlush();
+
+ void unsetDoNotFlush();
}
Modified: directory/apacheds/branches/apacheds-txns/core-integ/src/test/java/org/apache/directory/server/core/txn/TxnConflictIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core-integ/src/test/java/org/apache/directory/server/core/txn/TxnConflictIT.java?rev=1356079&r1=1356078&r2=1356079&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core-integ/src/test/java/org/apache/directory/server/core/txn/TxnConflictIT.java (original)
+++ directory/apacheds/branches/apacheds-txns/core-integ/src/test/java/org/apache/directory/server/core/txn/TxnConflictIT.java Mon Jul 2 06:43:42 2012
@@ -1,4 +1,22 @@
-
+/*
+ * 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.txn;
import static org.apache.directory.server.core.integ.IntegrationUtils.getSystemContext;
Added: directory/apacheds/branches/apacheds-txns/core-integ/src/test/java/org/apache/directory/server/core/txn/TxnRecoveryIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core-integ/src/test/java/org/apache/directory/server/core/txn/TxnRecoveryIT.java?rev=1356079&view=auto
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core-integ/src/test/java/org/apache/directory/server/core/txn/TxnRecoveryIT.java (added)
+++ directory/apacheds/branches/apacheds-txns/core-integ/src/test/java/org/apache/directory/server/core/txn/TxnRecoveryIT.java Mon Jul 2 06:43:42 2012
@@ -0,0 +1,126 @@
+/*
+ * 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.txn;
+
+import static org.apache.directory.server.core.integ.IntegrationUtils.getSystemContext;
+import static org.junit.Assert.*;
+
+import javax.naming.directory.Attribute;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.BasicAttributes;
+import javax.naming.directory.DirContext;
+import javax.naming.ldap.LdapContext;
+
+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.model.entry.DefaultEntry;
+import org.apache.directory.shared.ldap.model.entry.Entry;
+import org.apache.directory.shared.ldap.model.name.Dn;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+
+@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"),
+ @CreateIndex(attribute = "sn"),
+ @CreateIndex(attribute = "cn")
+ })
+ },
+ enableChangeLog = false)
+
+public class TxnRecoveryIT extends AbstractLdapTestUnit
+{
+ @Test
+ public void testRecovery() throws Exception
+ {
+ getService().getTxnManager().setDoNotFlush();
+
+ LdapConnection connection = IntegrationUtils.getAdminConnection( getService() );
+
+ String oldDn = "cn=test,ou=system";
+
+ try
+ {
+ Dn dn = new Dn( oldDn );
+ Entry entry = new DefaultEntry( getService().getSchemaManager(), dn );
+ entry.add( "ObjectClass", "top", "person" );
+ entry.add( "sn", "TEST" );
+ entry.add( "cn", "test" );
+
+ // First add the entry
+ connection.add( entry );
+
+
+ // Do a move
+ String newDn = "cn=test,ou=users,ou=system";
+ String newSuperior = "ou=users,ou=system";
+ connection.move( oldDn, newSuperior );
+
+ // Do a modify
+ LdapContext sysRoot = getSystemContext( getService() );
+ Attributes attrs = new BasicAttributes( "telephoneNumber", "1 650 300 6088", true );
+ sysRoot.modifyAttributes( "cn=test,ou=users", DirContext.ADD_ATTRIBUTE, attrs );
+
+ //Restart the service
+ getService().shutdown();
+ getService().startup();
+
+ Entry oldEntry = connection.lookup( oldDn );
+ Entry newEntry = connection.lookup( newDn );
+
+ assertTrue( oldEntry == null );
+ assertTrue( newEntry != null );
+
+
+ attrs = sysRoot.getAttributes( "cn=test,ou=users" );
+ Attribute attr = attrs.get( "telephoneNumber" );
+ assertNotNull( attr );
+ assertTrue( attr.contains( "1 650 300 6088" ) );
+
+ }
+ catch ( Exception e )
+ {
+ e.printStackTrace();
+ throw e;
+ }
+ }
+}
Modified: directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/DefaultLeakedCursorManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/DefaultLeakedCursorManager.java?rev=1356079&r1=1356078&r2=1356079&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/DefaultLeakedCursorManager.java (original)
+++ directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/DefaultLeakedCursorManager.java Mon Jul 2 06:43:42 2012
@@ -42,7 +42,7 @@ public class DefaultLeakedCursorManager
private static int LEAK_CHECK_INTERVAL = 1000;
- private static int LEAK_TIMEOUT = 1000;
+ private static int LEAK_TIMEOUT = 60 * 1000;
private static final String CURSOR_SUFFIX = "cursor";
@@ -151,12 +151,14 @@ public class DefaultLeakedCursorManager
cursor = it.next();
if ( cursor.isClosed() )
- {
+ {
it.remove();
continue;
}
- if ( ( currentTimestamp - cursor.getTimestamp() ) >= LEAK_TIMEOUT )
+ long lifeTime = currentTimestamp - cursor.getTimestamp();
+
+ if ( lifeTime >= LEAK_TIMEOUT )
{
cursor.pinCursor();
Modified: directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/DefaultTxnManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/DefaultTxnManager.java?rev=1356079&r1=1356078&r2=1356079&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/DefaultTxnManager.java (original)
+++ directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/DefaultTxnManager.java Mon Jul 2 06:43:42 2012
@@ -135,6 +135,9 @@ class DefaultTxnManager implements TxnMa
/** last flushed log anchor */
private LogAnchor lastFlushedLogAnchor;
+
+ /** Whether to avoid flushing */
+ private boolean doNotFlush = false;
/** Per thread txn context */
static final ThreadLocal<Transaction> txnVar =
@@ -212,14 +215,16 @@ class DefaultTxnManager implements TxnMa
try
{
ReadWriteTxn latestCommitted = latestCommittedTxn.get();
- long latestFlushedLsn = latestFlushedTxnLSN.get();
- flushTxns();
+ if ( !doNotFlush )
+ {
+ flushTxns();
+ }
advanceCheckPoint( lastFlushedLogAnchor );
// System.out.println("latest committed txn " + latestCommitted.getCommitTime() +
- // " latest flushed " + latestFlushedLsn + " last flushed log anchor " +
+ // " last flushed log anchor " +
// lastFlushedLogAnchor );
}
catch ( Exception e )
@@ -1080,7 +1085,7 @@ class DefaultTxnManager implements TxnMa
{
if( dataChangeContainer.getPartitionDn().equals( partitionSuffix ) )
{
- System.out.println("Apply change to partition " + partitionSuffix);
+ //System.out.println("Apply change to partition " + partitionSuffix);
dataChangeContainer.setPartition( partition );
dataChangeContainer.apply( true );
recoveredChanges = true;
@@ -1102,6 +1107,16 @@ class DefaultTxnManager implements TxnMa
}
+ public void setDoNotFlush()
+ {
+ doNotFlush = true;
+ }
+
+ public void unsetDoNotFlush()
+ {
+ doNotFlush = false;
+ }
+
private ObjectInputStream buildStream( byte[] buffer ) throws IOException
{
ObjectInputStream oIn = null;
@@ -1131,7 +1146,11 @@ class DefaultTxnManager implements TxnMa
while ( true )
{
flushCondition.await( flushInterval, TimeUnit.MILLISECONDS );
- flushTxns();
+
+ if ( !doNotFlush )
+ {
+ flushTxns();
+ }
}
}
catch ( InterruptedException e )
Modified: directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/RandomFileCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/RandomFileCursor.java?rev=1356079&r1=1356078&r2=1356079&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/RandomFileCursor.java (original)
+++ directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/RandomFileCursor.java Mon Jul 2 06:43:42 2012
@@ -114,7 +114,7 @@ public class RandomFileCursor extends Ab
ObjectInputStream in = null;
ByteArrayInputStream bin = null;
-
+
try
{
if ( currentOffset >= raf.length() )
Modified: directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/logedit/DataChangeContainer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/logedit/DataChangeContainer.java?rev=1356079&r1=1356078&r2=1356079&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/logedit/DataChangeContainer.java (original)
+++ directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/logedit/DataChangeContainer.java Mon Jul 2 06:43:42 2012
@@ -139,8 +139,6 @@ public class DataChangeContainer extends
boolean entryExisted = false;
Entry originalEntry = null;
- // TODO find the partition from the dn if changeContainer doesn't have it.
-
if ( entryID != null )
{
MasterTable master = partition.getMasterTable();
@@ -283,8 +281,6 @@ public class DataChangeContainer extends
partitionDn = new Dn();
partitionDn.readExternal( in );
- // Here, we must find a way to find the Partition from its Dn
-
DataChange change = null;
int numChanges = in.readInt();
Modified: directory/apacheds/branches/apacheds-txns/server-integ/src/test/java/org/apache/directory/server/operations/search/PagedSearchIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/server-integ/src/test/java/org/apache/directory/server/operations/search/PagedSearchIT.java?rev=1356079&r1=1356078&r2=1356079&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/server-integ/src/test/java/org/apache/directory/server/operations/search/PagedSearchIT.java (original)
+++ directory/apacheds/branches/apacheds-txns/server-integ/src/test/java/org/apache/directory/server/operations/search/PagedSearchIT.java Mon Jul 2 06:43:42 2012
@@ -271,7 +271,8 @@ public class PagedSearchIT extends Abstr
* @throws EncoderException on codec failures
*/
private void doLoop( DirContext ctx, SearchControls controls, int pagedSizeLimit,
- int expectedLoop, int expectedNbEntries, boolean expectedException ) throws NamingException, EncoderException
+ int expectedLoop, int expectedNbEntries, boolean expectedException,
+ boolean doLongSleep ) throws NamingException, EncoderException
{
// Loop over all the elements
int loop = 0;
@@ -292,6 +293,19 @@ public class PagedSearchIT extends Abstr
SearchResult result = list.next();
results.add( result );
}
+
+
+ if ( doLongSleep && loop == 1 )
+ {
+ try
+ {
+ Thread.sleep( 70 * 1000 );
+ }
+ catch ( InterruptedException e )
+ {
+ //
+ }
+ }
}
catch ( SizeLimitExceededException e )
{
@@ -371,7 +385,7 @@ public class PagedSearchIT extends Abstr
DirContext ctx = getWiredContext( getLdapServer() );
SearchControls controls = createSearchControls( ctx, (int)LdapServer.NO_SIZE_LIMIT, 3 );
- doLoop( ctx, controls, 3, 4, 10, false );
+ doLoop( ctx, controls, 3, 4, 10, false, false );
}
@@ -390,7 +404,7 @@ public class PagedSearchIT extends Abstr
DirContext ctx = getWiredContext( getLdapServer() );
SearchControls controls = createSearchControls( ctx, (int)LdapServer.NO_SIZE_LIMIT, 5 );
- doLoop( ctx, controls, 5, 2, 10, false );
+ doLoop( ctx, controls, 5, 2, 10, false, false );
}
@@ -409,7 +423,7 @@ public class PagedSearchIT extends Abstr
DirContext ctx = getWiredContext( getLdapServer() );
SearchControls controls = createSearchControls( ctx, (int)LdapServer.NO_SIZE_LIMIT, 5 );
- doLoop( ctx, controls, 5, 2, 10, false );
+ doLoop( ctx, controls, 5, 2, 10, false, false );
}
@@ -428,7 +442,7 @@ public class PagedSearchIT extends Abstr
DirContext ctx = getWiredContext( getLdapServer() );
SearchControls controls = createSearchControls( ctx, 3, 5 );
- doLoop( ctx, controls, 5, 1, 3, true );
+ doLoop( ctx, controls, 5, 1, 3, true, false );
}
@@ -447,7 +461,7 @@ public class PagedSearchIT extends Abstr
DirContext ctx = getWiredContext( getLdapServer() );
SearchControls controls = createSearchControls( ctx, (int)LdapServer.NO_SIZE_LIMIT, 3 );
- doLoop( ctx, controls, 3, 4, 10, false );
+ doLoop( ctx, controls, 3, 4, 10, false, false );
}
@@ -466,7 +480,7 @@ public class PagedSearchIT extends Abstr
DirContext ctx = getWiredContext( getLdapServer() );
SearchControls controls = createSearchControls( ctx, 9, 5 );
- doLoop( ctx, controls, 5, 2, 9, true );
+ doLoop( ctx, controls, 5, 2, 9, true, false );
}
@@ -485,7 +499,7 @@ public class PagedSearchIT extends Abstr
DirContext ctx = getWiredContext( getLdapServer() );
SearchControls controls = createSearchControls( ctx, (int)LdapServer.NO_SIZE_LIMIT, 5 );
- doLoop( ctx, controls, 5, 2, 10, false );
+ doLoop( ctx, controls, 5, 2, 10, false, false );
}
@@ -504,7 +518,7 @@ public class PagedSearchIT extends Abstr
DirContext ctx = getWiredContext( getLdapServer() );
SearchControls controls = createSearchControls( ctx, 5, 5 );
- doLoop( ctx, controls, 5, 1, 5, true );
+ doLoop( ctx, controls, 5, 1, 5, true, false );
}
@@ -523,7 +537,7 @@ public class PagedSearchIT extends Abstr
DirContext ctx = getWiredContext( getLdapServer() );
SearchControls controls = createSearchControls( ctx, 4, 3 );
- doLoop( ctx, controls, 3, 2, 4, true );
+ doLoop( ctx, controls, 3, 2, 4, true, false );
}
@@ -542,7 +556,7 @@ public class PagedSearchIT extends Abstr
DirContext ctx = getWiredContext( getLdapServer() );
SearchControls controls = createSearchControls( ctx, 5, 3 );
- doLoop( ctx, controls, 3, 2, 5, true );
+ doLoop( ctx, controls, 3, 2, 5, true, false );
}
@@ -561,7 +575,7 @@ public class PagedSearchIT extends Abstr
DirContext ctx = getWiredContext( getLdapServer() );
SearchControls controls = createSearchControls( ctx, 3, 4 );
- doLoop( ctx, controls, 4, 1, 3, true );
+ doLoop( ctx, controls, 4, 1, 3, true, false );
}
@@ -580,7 +594,7 @@ public class PagedSearchIT extends Abstr
DirContext ctx = getWiredContext( getLdapServer() );
SearchControls controls = createSearchControls( ctx, 4, 3 );
- doLoop( ctx, controls, 3, 2, 4, true );
+ doLoop( ctx, controls, 3, 2, 4, true, false );
}
@@ -599,7 +613,7 @@ public class PagedSearchIT extends Abstr
DirContext ctx = getWiredContext( getLdapServer() );
SearchControls controls = createSearchControls( ctx, 5, 3 );
- doLoop( ctx, controls, 3, 2, 5, true );
+ doLoop( ctx, controls, 3, 2, 5, true, false );
}
@@ -618,7 +632,7 @@ public class PagedSearchIT extends Abstr
DirContext ctx = getWiredContext( getLdapServer() );
SearchControls controls = createSearchControls( ctx, 3, 5 );
- doLoop( ctx, controls, 5, 1, 3, true );
+ doLoop( ctx, controls, 5, 1, 3, true, false );
}
@@ -637,7 +651,7 @@ public class PagedSearchIT extends Abstr
DirContext ctx = getWiredContext( getLdapServer() );
SearchControls controls = createSearchControls( ctx, 5, 4 );
- doLoop( ctx, controls, 4, 2, 5, true );
+ doLoop( ctx, controls, 4, 2, 5, true, false );
}
@@ -656,7 +670,7 @@ public class PagedSearchIT extends Abstr
DirContext ctx = getWiredContext( getLdapServer() );
SearchControls controls = createSearchControls( ctx, 4, 5 );
- doLoop( ctx, controls, 5, 1, 4, true );
+ doLoop( ctx, controls, 5, 1, 4, true, false );
}
@@ -675,7 +689,7 @@ public class PagedSearchIT extends Abstr
DirContext ctx = getWiredContext( getLdapServer() );
SearchControls controls = createSearchControls( ctx, 5, 5 );
- doLoop( ctx, controls, 5, 1, 5, true );
+ doLoop( ctx, controls, 5, 1, 5, true, false );
}
@@ -694,7 +708,7 @@ public class PagedSearchIT extends Abstr
DirContext ctx = getWiredContext( getLdapServer(), "cn=user,ou=system", "secret" );
SearchControls controls = createSearchControls( ctx, (int)LdapServer.NO_SIZE_LIMIT, 3 );
- doLoop( ctx, controls, 3, 4, 10, false );
+ doLoop( ctx, controls, 3, 4, 10, false, false );
}
@@ -713,7 +727,7 @@ public class PagedSearchIT extends Abstr
DirContext ctx = getWiredContext( getLdapServer(), "cn=user,ou=system", "secret" );
SearchControls controls = createSearchControls( ctx, (int)LdapServer.NO_SIZE_LIMIT, 5 );
- doLoop( ctx, controls, 5, 2, 10, false );
+ doLoop( ctx, controls, 5, 2, 10, false, false );
}
@@ -732,7 +746,7 @@ public class PagedSearchIT extends Abstr
DirContext ctx = getWiredContext( getLdapServer(), "cn=user,ou=system", "secret" );
SearchControls controls = createSearchControls( ctx, (int)LdapServer.NO_SIZE_LIMIT, 5 );
- doLoop( ctx, controls, 5, 1, 3, true );
+ doLoop( ctx, controls, 5, 1, 3, true, false );
}
@@ -751,7 +765,7 @@ public class PagedSearchIT extends Abstr
DirContext ctx = getWiredContext( getLdapServer(), "cn=user,ou=system", "secret" );
SearchControls controls = createSearchControls( ctx, 3, 5 );
- doLoop( ctx, controls, 5, 1, 3, true );
+ doLoop( ctx, controls, 5, 1, 3, true, false );
}
@@ -770,7 +784,7 @@ public class PagedSearchIT extends Abstr
DirContext ctx = getWiredContext( getLdapServer(), "cn=user,ou=system", "secret" );
SearchControls controls = createSearchControls( ctx, (int)LdapServer.NO_SIZE_LIMIT, 3 );
- doLoop( ctx, controls, 3, 2, 5, true );
+ doLoop( ctx, controls, 3, 2, 5, true, false );
}
@@ -790,7 +804,7 @@ public class PagedSearchIT extends Abstr
SearchControls controls = createSearchControls( ctx, 9, 5 );
- doLoop( ctx, controls, 5, 2, 9, true );
+ doLoop( ctx, controls, 5, 2, 9, true, false );
}
@@ -809,7 +823,7 @@ public class PagedSearchIT extends Abstr
DirContext ctx = getWiredContext( getLdapServer(), "cn=user,ou=system", "secret" );
SearchControls controls = createSearchControls( ctx, (int)LdapServer.NO_SIZE_LIMIT, 5 );
- doLoop( ctx, controls, 5, 1, 5, true );
+ doLoop( ctx, controls, 5, 1, 5, true, false );
}
@@ -829,7 +843,7 @@ public class PagedSearchIT extends Abstr
SearchControls controls = createSearchControls( ctx, 5, 5 );
- doLoop( ctx, controls, 5, 1, 5, true );
+ doLoop( ctx, controls, 5, 1, 5, true, false );
}
@@ -848,7 +862,7 @@ public class PagedSearchIT extends Abstr
DirContext ctx = getWiredContext( getLdapServer(), "cn=user,ou=system", "secret" );
SearchControls controls = createSearchControls( ctx, 4, 3 );
- doLoop( ctx, controls, 3, 2, 4, true );
+ doLoop( ctx, controls, 3, 2, 4, true, false );
}
@@ -867,7 +881,7 @@ public class PagedSearchIT extends Abstr
DirContext ctx = getWiredContext( getLdapServer(), "cn=user,ou=system", "secret" );
SearchControls controls = createSearchControls( ctx, 5, 3 );
- doLoop( ctx, controls, 3, 2, 4, true );
+ doLoop( ctx, controls, 3, 2, 4, true, false );
}
@@ -886,7 +900,7 @@ public class PagedSearchIT extends Abstr
DirContext ctx = getWiredContext( getLdapServer(), "cn=user,ou=system", "secret" );
SearchControls controls = createSearchControls( ctx, 3, 4 );
- doLoop( ctx, controls, 4, 1, 3, true );
+ doLoop( ctx, controls, 4, 1, 3, true, false );
}
@@ -905,7 +919,7 @@ public class PagedSearchIT extends Abstr
DirContext ctx = getWiredContext( getLdapServer(), "cn=user,ou=system", "secret" );
SearchControls controls = createSearchControls( ctx, 4, 3 );
- doLoop( ctx, controls, 3, 2, 4, true );
+ doLoop( ctx, controls, 3, 2, 4, true, false );
}
@@ -924,7 +938,7 @@ public class PagedSearchIT extends Abstr
DirContext ctx = getWiredContext( getLdapServer(), "cn=user,ou=system", "secret" );
SearchControls controls = createSearchControls( ctx, 5, 3 );
- doLoop( ctx, controls, 3, 2, 4, true );
+ doLoop( ctx, controls, 3, 2, 4, true, false );
}
@@ -943,7 +957,7 @@ public class PagedSearchIT extends Abstr
DirContext ctx = getWiredContext( getLdapServer(), "cn=user,ou=system", "secret" );
SearchControls controls = createSearchControls( ctx, 3, 5 );
- doLoop( ctx, controls, 3, 1, 3, true );
+ doLoop( ctx, controls, 3, 1, 3, true, false );
}
@@ -962,7 +976,7 @@ public class PagedSearchIT extends Abstr
DirContext ctx = getWiredContext( getLdapServer(), "cn=user,ou=system", "secret" );
SearchControls controls = createSearchControls( ctx, 5, 4 );
- doLoop( ctx, controls, 3, 1, 3, true );
+ doLoop( ctx, controls, 3, 1, 3, true, false );
}
@@ -981,7 +995,7 @@ public class PagedSearchIT extends Abstr
DirContext ctx = getWiredContext( getLdapServer(), "cn=user,ou=system", "secret" );
SearchControls controls = createSearchControls( ctx, 4, 5 );
- doLoop( ctx, controls, 3, 1, 3, true );
+ doLoop( ctx, controls, 3, 1, 3, true, false );
}
@@ -1000,7 +1014,7 @@ public class PagedSearchIT extends Abstr
DirContext ctx = getWiredContext( getLdapServer(), "cn=user,ou=system", "secret" );
SearchControls controls = createSearchControls( ctx, 5, 5 );
- doLoop( ctx, controls, 5, 1, 5, true );
+ doLoop( ctx, controls, 5, 1, 5, true, false );
}
@@ -1019,7 +1033,7 @@ public class PagedSearchIT extends Abstr
DirContext ctx = getWiredContext( getLdapServer(), "cn=user,ou=system", "secret" );
SearchControls controls = createSearchControls( ctx, (int)LdapServer.NO_SIZE_LIMIT, -2 );
- doLoop( ctx, controls, -2, 1, 10, false );
+ doLoop( ctx, controls, -2, 1, 10, false, false );
}
@@ -1140,4 +1154,23 @@ public class PagedSearchIT extends Abstr
assertEquals( 4, loop );
checkResults( results, 10, false );
}
+
+
+ /**
+ * Admin = yes <br>
+ * SL = 5<br>
+ * RL = 4<br>
+ * PL = 3<br>
+ * expected exception : yes<br>
+ * expected number of entries returned : 2 ( 3 + 1 )<br>
+ */
+ @Test
+ public void testPagedSearchTest9Sleep() throws Exception
+ {
+ getLdapServer().setMaxSizeLimit( 5 );
+ DirContext ctx = getWiredContext( getLdapServer() );
+ SearchControls controls = createSearchControls( ctx, 4, 3 );
+
+ doLoop( ctx, controls, 3, 2, 4, true, true );
+ }
}
\ No newline at end of file