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

lutoff
12.44.2007 0a3a1f1060a2f94800dcc0fd70e53713d7fad6c8
- Enable the checkPostconnectDisconnectPlugin test case in the
postConnectedDisconnectTest class: Daily builds aren't failed due to this test

- remove hard-coded sleeps removed and increase the wait time

- marked as a "slow" test case.
1 files modified
33 ■■■■ changed files
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/protocols/jmx/postConnectedDisconnectTest.java 33 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/protocols/jmx/postConnectedDisconnectTest.java
@@ -62,7 +62,7 @@
   * Perform a simple connect.
   * @throws Exception If something wrong occurs.
   */
  @Test(enabled = false)
  @Test(enabled = true, groups = {"slow"})
  public void checkPostconnectDisconnectPlugin() throws Exception
  {
    // Before the test, how many time postconnect and postdisconnect
@@ -81,20 +81,39 @@
    assertNotNull(opendsConnector);
    // Check that number of postconnect has been incremented.
    Thread.sleep(3000);
    int postConnectAfter = InvocationCounterPlugin.getPostConnectCount();
    int postDisconnectAfter = InvocationCounterPlugin.getPostDisconnectCount();
    // Don't wait more than 5 seconds
    long endTime = System.currentTimeMillis() + 5000;
    int postConnectAfter = postConnectBefore;
    while ((System.currentTimeMillis() < endTime)
        && (postConnectAfter == postConnectAfter))
    {
      Thread.sleep(10);
      postConnectAfter = InvocationCounterPlugin.getPostConnectCount();
    }
    assertEquals(postConnectBefore +1, postConnectAfter);
    // Check that postDisconnect is not incremented.
    int postDisconnectAfter = InvocationCounterPlugin.getPostDisconnectCount();
    assertEquals(postDisconnectBefore, postDisconnectAfter);
    // Close the client connection
    opendsConnector.close();
    Thread.sleep(3000);
    // Check that number of postdisconnect has been incremented.
    postConnectAfter = InvocationCounterPlugin.getPostConnectCount();
    // Don't wait more than 5 seconds
    endTime = System.currentTimeMillis() + 5000;
    postDisconnectAfter = postDisconnectBefore;
    while ((System.currentTimeMillis() < endTime)
        && (postDisconnectAfter == postDisconnectBefore))
    {
      Thread.sleep(10);
    postDisconnectAfter = InvocationCounterPlugin.getPostDisconnectCount();
    assertEquals(postConnectBefore +1 , postConnectAfter);
    }
    assertEquals(postDisconnectBefore +1 , postDisconnectAfter);
    // Check that postDisconnect is not incremented again.
    postConnectAfter = InvocationCounterPlugin.getPostConnectCount();
    assertEquals(postConnectBefore +1 , postConnectAfter);
  }
}