[
http://jira.jboss.com/jira/browse/JBAS-5691?page=comments#action_12420859 ]
Adrian Brock commented on JBAS-5691:
------------------------------------
I've fixed part of the JMXConnectorUnitTestCase, the test was making a bad assumption
that when addNotificationListener is done on the client, it will also occur on the
server.
The JDK RMIConnector uses one server side listener for all client listeners.
But the "testNotificatonWithBadListener" is still failing.
This is for the same reason as the bad assumption.
Although the server is issuing notification on different threads, they are being combined
onto one thread on the client.
If this is really a bug, then it is a bug in the JDK, not JBoss,
We should probably just remove this test.
NOTE: There is an "undocumented" way to change the JDK's JMXConnector
client
notification threading strategy, but I don't think we should be using such
"hacks" in the testsuite. ;-)
The following patch shows a workaround (using only documented java api) that makes the
test pass,
i.e. use a different JMXConnector for each listener such that messages are delivered on
different threads in the client:
Index: src/main/org/jboss/test/jmx/test/JMXConnectorUnitTestCase.java
===================================================================
--- src/main/org/jboss/test/jmx/test/JMXConnectorUnitTestCase.java (revision 75630)
+++ src/main/org/jboss/test/jmx/test/JMXConnectorUnitTestCase.java (working copy)
@@ -200,14 +200,25 @@
server.addNotificationListener(getObjectName(), badListener, null,
"BadListener");
Listener listener = new Listener(10);
// Add a good listener
- server.addNotificationListener(getObjectName(), listener, new RunTimerFilter(),
"runTimer");
- server.invoke(getObjectName(), "startTimer", null, null);
- // Wait 25 seconds for the good listener events to complete
- synchronized( listener )
+ String surl = "service:jmx:rmi://" + getServerHost() +
"/jndi/rmi://" + getServerHost() + ":1090/jmxconnector";
+ JMXServiceURL url = new JMXServiceURL(surl);
+ JMXConnector connector2 = JMXConnectorFactory.connect(url);
+ try
{
- listener.wait(25000);
+ MBeanServerConnection server2 = connector2.getMBeanServerConnection();
+ server2.addNotificationListener(getObjectName(), listener, new RunTimerFilter(),
"runTimer");
+ server.invoke(getObjectName(), "startTimer", null, null);
+ // Wait 25 seconds for the good listener events to complete
+ synchronized( listener )
+ {
+ listener.wait(25000);
+ }
+ server2.removeNotificationListener(getObjectName(), listener);
}
- server.removeNotificationListener(getObjectName(), listener);
+ finally
+ {
+ connector2.close();
+ }
int count = listener.getCount();
assertTrue("Received 10 notifications from Listener, count="+count,
count == 10);
org.jboss.test.jmx
------------------
Key: JBAS-5691
URL:
http://jira.jboss.com/jira/browse/JBAS-5691
Project: JBoss Application Server
Issue Type: Sub-task
Security Level: Public(Everyone can see)
Components: Test Suite
Affects Versions: JBossAS-5.0.0.CR1
Reporter: Shelly McGowan
Assigned To: Shelly McGowan
Fix For: JBossAS-5.0.0.CR2
Tests failing with CR1 release:
org.jboss.test.jmx.test.DeployXMBeanUnitTestCase.testPersistentJndiXMBean
org.jboss.test.jmx.test.DeployXMBeanUnitTestCase.testSecuredJndiXMBean
java.lang.SecurityException: Failed to authenticate principal: null
at org.jboss.test.jmx.interceptors.JNDISecurity.invoke(JNDISecurity.java:100)
org.jboss.test.jmx.test.JMXConnectorUnitTestCase.testNotification
org.jboss.test.jmx.test.JMXConnectorUnitTestCase.testNotificationWithBadListener
AssertionFailedError: Received 10 notifications from Listener, count=0
Not familiar with these tests so need to follow up. Will reassign if necessary.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira