From 4ef05575b54278d501c7cd3877b48bffa952ca51 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Fri, 14 Aug 2015 16:05:31 +0000
Subject: [PATCH] Fix randomness in JmxPrivilegeTestCase. Many thanks Fabio for finding the problem!!
---
opendj-server-legacy/src/test/java/org/opends/server/protocols/jmx/JmxTestCase.java | 20 +++++++++++++++++---
1 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/protocols/jmx/JmxTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/protocols/jmx/JmxTestCase.java
index 048861c..f12dac8 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/protocols/jmx/JmxTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/protocols/jmx/JmxTestCase.java
@@ -82,17 +82,31 @@
jmxConnectionHandler = getJmxConnectionHandler(handlers);
}
assertNotNull(jmxConnectionHandler);
+
+
+ final RmiConnector rmiConnector = jmxConnectionHandler.getRMIConnector();
int cnt = 0;
- while (cnt <= 30 && jmxConnectionHandler.getRMIConnector().jmxRmiConnectorNoClientCertificate == null)
+ while (cnt <= 30 && !isReady(rmiConnector))
{
Thread.sleep(200);
cnt++;
}
- assertNotNull(jmxConnectionHandler.getRMIConnector().jmxRmiConnectorNoClientCertificate,
- "jmxRmiConnectorNoClientCertificate should not be null");
+ if (!isReady(rmiConnector))
+ {
+ assertNotNull(rmiConnector.jmxRmiConnectorNoClientCertificate,
+ "jmxRmiConnectorNoClientCertificate should not be null");
+ assertTrue(rmiConnector.jmxRmiConnectorNoClientCertificate.isActive(),
+ "jmxRmiConnectorNoClientCertificate should be active");
+ }
return jmxConnectionHandler;
}
+ private boolean isReady(RmiConnector rmiConnector)
+ {
+ return rmiConnector.jmxRmiConnectorNoClientCertificate != null
+ && rmiConnector.jmxRmiConnectorNoClientCertificate.isActive();
+ }
+
private JmxConnectionHandler getJmxConnectionHandler(List<ConnectionHandler> handlers)
{
for (ConnectionHandler<?> handler : handlers)
--
Gitblit v1.10.0