From bb013e84e07c58b6bfbc822d1a55da4f1847dc04 Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Mon, 18 Dec 2006 02:35:20 +0000
Subject: [PATCH] Update a few test cases that count the number of times the post-response controls are invoked to eliminate a potential race condition between the post-response processing for the previous bind operation and the beginning of the operation for which the post-response count will be examined.
---
opends/tests/unit-tests-testng/src/server/org/opends/server/core/SearchOperationTestCase.java | 14 +++++++-------
opends/tests/unit-tests-testng/src/server/org/opends/server/core/TestModifyDNOperation.java | 13 ++++++-------
opends/tests/unit-tests-testng/src/server/org/opends/server/core/CompareOperationTestCase.java | 13 ++++++-------
3 files changed, 19 insertions(+), 21 deletions(-)
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/core/CompareOperationTestCase.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/core/CompareOperationTestCase.java
index a6f1979..2051d57 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/core/CompareOperationTestCase.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/core/CompareOperationTestCase.java
@@ -598,13 +598,6 @@
@Test(groups = "slow")
public void testCompareWriteLock() throws Exception
{
- // Since we are going to be watching the post-response count, we need to
- // wait for the server to become idle before kicking off the next request to
- // ensure that any remaining post-response processing from the previous
- // operation has completed.
- assertTrue(DirectoryServer.getWorkQueue().waitUntilIdle(10000));
-
-
// We need the operation to be run in a separate thread because we are going
// to write lock the entry in the test case thread and check that the
// compare operation does not proceed.
@@ -628,6 +621,12 @@
BindResponseProtocolOp bindResponse = message.getBindResponseProtocolOp();
assertEquals(bindResponse.getResultCode(), LDAPResultCode.SUCCESS);
+ // Since we are going to be watching the post-response count, we need to
+ // wait for the server to become idle before kicking off the next request
+ // to ensure that any remaining post-response processing from the previous
+ // operation has completed.
+ assertTrue(DirectoryServer.getWorkQueue().waitUntilIdle(10000));
+
Lock writeLock = LockManager.lockWrite(entry.getDN());
assertNotNull(writeLock);
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/core/SearchOperationTestCase.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/core/SearchOperationTestCase.java
index 0f7e260..3af728e 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/core/SearchOperationTestCase.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/core/SearchOperationTestCase.java
@@ -236,13 +236,6 @@
ArrayList<LDAPControl> controls)
throws IOException, LDAPException, ASN1Exception, InterruptedException
{
- // Since we are going to be watching the post-response count, we need to
- // wait for the server to become idle before kicking off the next request to
- // ensure that any remaining post-response processing from the previous
- // operation has completed.
- assertTrue(DirectoryServer.getWorkQueue().waitUntilIdle(10000));
-
-
// Establish a connection to the server.
Socket s = new Socket("127.0.0.1", (int) TestCaseUtils.getServerLdapPort());
try
@@ -253,6 +246,13 @@
bindAsManager(w, r);
+ // Since we are going to be watching the post-response count, we need to
+ // wait for the server to become idle before kicking off the next request
+ // to ensure that any remaining post-response processing from the previous
+ // operation has completed.
+ assertTrue(DirectoryServer.getWorkQueue().waitUntilIdle(10000));
+
+
InvocationCounterPlugin.resetAllCounters();
LDAPMessage message;
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/core/TestModifyDNOperation.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/core/TestModifyDNOperation.java
index 48b9106..ab7671f 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/core/TestModifyDNOperation.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/core/TestModifyDNOperation.java
@@ -1135,13 +1135,6 @@
@Test(groups = "slow")
public void testWriteLockModify() throws Exception
{
- // Since we are going to be watching the post-response count, we need to
- // wait for the server to become idle before kicking off the next request to
- // ensure that any remaining post-response processing from the previous
- // operation has completed.
- assertTrue(DirectoryServer.getWorkQueue().waitUntilIdle(10000));
-
-
// We need the operation to be run in a separate thread because we are going
// to write lock the entry in the test case thread and check that the
// modify DN operation does not proceed.
@@ -1165,6 +1158,12 @@
BindResponseProtocolOp bindResponse = message.getBindResponseProtocolOp();
assertEquals(bindResponse.getResultCode(), LDAPResultCode.SUCCESS);
+ // Since we are going to be watching the post-response count, we need to
+ // wait for the server to become idle before kicking off the next request
+ // to ensure that any remaining post-response processing from the previous
+ // operation has completed.
+ assertTrue(DirectoryServer.getWorkQueue().waitUntilIdle(10000));
+
Lock writeLock = LockManager.lockWrite(entry.getDN());
assertNotNull(writeLock);
--
Gitblit v1.10.0