mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

coulbeck
09.13.2006 bae7bd860f5156e452d86c1667f009d63522c7d3
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/core/CompareOperationTestCase.java
@@ -647,7 +647,7 @@
        assertEquals(InvocationCounterPlugin.getPreOperationCount(), 0);
        assertEquals(InvocationCounterPlugin.getPostOperationCount(), 0);
        // The post response might not have been called yet.
//        assertEquals(InvocationCounterPlugin.getPostResponseCount(), 1);
        assertEquals(InvocationCounterPlugin.waitForPostResponse(), 1);
      } finally
      {
        LockManager.unlock(entry.getDN(), writeLock);
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/core/TestModifyDNOperation.java
@@ -1086,6 +1086,7 @@
        message.getModifyDNResponseProtocolOp();
    assertEquals(modifyResponse.getResultCode(), 80);
    assertEquals(InvocationCounterPlugin.waitForPostResponse(), 1);
    try
    {
@@ -1144,8 +1145,8 @@
        assertEquals(InvocationCounterPlugin.getPreParseCount(), 1);
        assertEquals(InvocationCounterPlugin.getPreOperationCount(), 0);
        assertEquals(InvocationCounterPlugin.getPostOperationCount(), 0);
        // The post response might not have been called yet.
//        assertEquals(InvocationCounterPlugin.getPostResponseCount(), 1);
        // The post response might not have been called yet.
        assertEquals(InvocationCounterPlugin.waitForPostResponse(), 1);
      } finally
      {
        LockManager.unlock(entry.getDN(), writeLock);
opendj-sdk/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();
  }
}