SF.net SVN: mx4j:[2282] trunk/mx4j/jsr160/src/test/java/test/javax/ management/remote/JMXNotificationsTestCase.java

[email protected] Wed, 30 Dec 2009 06:19:39 +0000
Newsgroups gmane.comp.java.mx4j.cvs
Message-ID <[email protected]>
Revision: 2282
          http://mx4j.svn.sourceforge.net/mx4j/?rev=2282&view=rev
Author:   altheengineer
Date:     2009-12-30 06:19:39 +0000 (Wed, 30 Dec 2009)

Log Message:
-----------
Fixing Hessian and Burlap notification test cases by passing an object as the handback that they cannot deserialize (they can deserialize an instance Object which is what was being used).

Modified Paths:
--------------
    trunk/mx4j/jsr160/src/test/java/test/javax/management/remote/JMXNotificationsTestCase.java

Modified: trunk/mx4j/jsr160/src/test/java/test/javax/management/remote/JMXNotificationsTestCase.java
===================================================================
--- trunk/mx4j/jsr160/src/test/java/test/javax/management/remote/JMXNotificationsTestCase.java	2009-12-30 04:42:43 UTC (rev 2281)
+++ trunk/mx4j/jsr160/src/test/java/test/javax/management/remote/JMXNotificationsTestCase.java	2009-12-30 06:19:39 UTC (rev 2282)
@@ -390,6 +390,14 @@
         }
     }
 
+    private final NotificationFilter notificationFilter = new NotificationFilter()
+    {
+        public boolean isNotificationEnabled(Notification notification)
+        {
+            return false;
+        }
+    };
+
     public void testAddRemoveMBeanListener() throws Exception
     {
         JMXConnectorServer cntorServer = null;
@@ -421,39 +429,37 @@
             // Non-serializable filter
             try
             {
-                mbsc.addNotificationListener(emitterName, listenerName, new NotificationFilter()
-                {
-                    public boolean isNotificationEnabled(Notification notification)
-                    {
-                        return false;
-                    }
-                }, null);
+				mbsc.addNotificationListener(emitterName, listenerName, notificationFilter, null);
                 fail();
             }
             catch (IOException x)
             {
             }
 
-            // Non-serializable handback
+            /* 
+             * Non-serializable handback - sending notification filter as handback since 
+             * Hessian and Burlap are able to deserialize an instance of Object. So, instead
+             * of getting fancy and adding an object that can't be deserialized to the main API,
+             * I am just reusing one that is demonstrated to fail.
+             */
             try
             {
-                mbsc.addNotificationListener(emitterName, listenerName, null, new Object());
+                mbsc.addNotificationListener(emitterName, listenerName, null, notificationFilter);
                 fail();
             }
             catch (IOException x)
             {
             }
 
-            // Non-serializable filter and non serializable handback
+            /* 
+             * Non-serializable filter and non serializable handback - sending notification filter as 
+             * handback since Hessian and Burlap are able to deserialize an instance of Object. 
+             * So, instead of getting fancy and adding an object that can't be deserialized to the 
+             * main API, I am just reusing one that is demonstrated to fail.
+             */
             try
             {
-                mbsc.addNotificationListener(emitterName, listenerName, new NotificationFilter()
-                {
-                    public boolean isNotificationEnabled(Notification notification)
-                    {
-                        return false;
-                    }
-                }, new Object());
+                mbsc.addNotificationListener(emitterName, listenerName, notificationFilter, notificationFilter);
                 fail();
             }
             catch (IOException x)


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev