[Jboss-cvs] JBossAS SVN: r56230 - trunk/testsuite/src/main/org/jboss/test/ha/jmx/test

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Aug 24 17:02:40 EDT 2006


Author: bstansberry at jboss.com
Date: 2006-08-24 17:02:39 -0400 (Thu, 24 Aug 2006)
New Revision: 56230

Modified:
   trunk/testsuite/src/main/org/jboss/test/ha/jmx/test/HAServiceMBeanSupportUnitTestCase.java
Log:
[JBAS-3194] Test that lifecycle notifications are suppressed if so configured

Modified: trunk/testsuite/src/main/org/jboss/test/ha/jmx/test/HAServiceMBeanSupportUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/ha/jmx/test/HAServiceMBeanSupportUnitTestCase.java	2006-08-24 20:59:35 UTC (rev 56229)
+++ trunk/testsuite/src/main/org/jboss/test/ha/jmx/test/HAServiceMBeanSupportUnitTestCase.java	2006-08-24 21:02:39 UTC (rev 56230)
@@ -22,6 +22,9 @@
 
 package org.jboss.test.ha.jmx.test;
 
+import java.util.EmptyStackException;
+
+import javax.management.AttributeChangeNotification;
 import javax.management.Notification;
 
 import junit.framework.TestCase;
@@ -97,5 +100,50 @@
     assertEquals("method not invoked as expected",
       haServiceMBeanSupportTester_.__invokationStack__.pop(), "sendNotificationToLocalListeners");      
   }
+  
+  public void testSendLifecycleNotifications()
+  {
+     Notification notification = new AttributeChangeNotification(
+           haServiceMBeanSupportTester_,
+           1, System.currentTimeMillis(), "test",
+           "State", "java.lang.Integer",
+           new Integer(0), new Integer(1)
+           );
+     
+     haServiceMBeanSupportTester_.setSendRemoteLifecycleNotifications(false);
+     
+     haServiceMBeanSupportTester_.sendNotification( notification );
+     
+     assertEquals("sendNotificationToLocalListeners() was handed the original notification", 
+                 haServiceMBeanSupportTester_.__invokationStack__.pop(), notification );
 
+     assertEquals("method invoked as expected",
+       haServiceMBeanSupportTester_.__invokationStack__.pop(), "sendNotificationToLocalListeners");      
+
+     try
+     {
+        haServiceMBeanSupportTester_.__invokationStack__.pop();
+        fail("sendNotificationRemote() was not handed the original notification");
+     }
+     catch (EmptyStackException good) {}
+     
+     haServiceMBeanSupportTester_.setSendRemoteLifecycleNotifications(true);
+     haServiceMBeanSupportTester_.setSendLocalLifecycleNotifications(false);
+     
+     haServiceMBeanSupportTester_.sendNotification( notification );     
+
+     assertEquals("sendNotificationRemote() was handed the original notification", 
+       haServiceMBeanSupportTester_.__invokationStack__.pop(), notification );
+     
+     assertEquals("method invoked as expected",
+       haServiceMBeanSupportTester_.__invokationStack__.pop(), "sendNotificationRemote");
+     
+     try
+     {
+        haServiceMBeanSupportTester_.__invokationStack__.pop();
+        fail("sendNotificationToLocalListeners() was not handed the original notification");
+     }
+     catch (EmptyStackException good) {}
+  }
+
 }




More information about the jboss-cvs-commits mailing list