From ab9a7aa62819126e685e05281d5fa0d8ff94045c Mon Sep 17 00:00:00 2001
From: coulbeck <coulbeck@localhost>
Date: Mon, 09 Oct 2006 21:13:14 +0000
Subject: [PATCH] Tests that use the post-response plugin invocation counter are subject to race conditions. An earlier test can complete successfully with an operation still running in the server, and this operation changes the values of the invocation counters while subsequent tests are running.
---
opends/tests/unit-tests-testng/src/server/org/opends/server/plugins/InvocationCounterPlugin.java | 23 +++++++++++++++++++++--
1 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/plugins/InvocationCounterPlugin.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/plugins/InvocationCounterPlugin.java
index 8c910ec..ede844b 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/plugins/InvocationCounterPlugin.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/plugins/InvocationCounterPlugin.java
@@ -28,8 +28,6 @@
-import java.util.ArrayList;
-import java.util.List;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
@@ -1065,5 +1063,26 @@
{
shutdownCalled = false;
}
+
+
+
+ /**
+ * Waits up to five seconds until the post-response plugins have been called
+ * at least once since the last reset.
+ * @return The number of times that the post-response plugins have been
+ * called since the last reset. The return value may be zero if the
+ * wait timed out.
+ * @throws InterruptedException If another thread interrupts this thread.
+ */
+ public static int waitForPostResponse() throws InterruptedException
+ {
+ long timeout = System.currentTimeMillis() + 5000;
+ while (postResponseCounter.get() == 0 &&
+ System.currentTimeMillis() < timeout)
+ {
+ Thread.sleep(10);
+ }
+ return postResponseCounter.get();
+ }
}
--
Gitblit v1.10.0