1 22 package org.jboss.test.jmx.test; 23 24 import javax.management.MBeanServerConnection ; 25 import javax.management.ObjectName ; 26 27 import org.jboss.logging.Logger; 28 import org.jboss.test.JBossTestCase; 29 30 36 public class ListenerServiceMBeanUnitTestCase extends JBossTestCase 37 { 38 public ListenerServiceMBeanUnitTestCase(String name) 39 { 40 super(name); 41 } 42 43 46 public void testDeploymentInfoNotificationFilterFactory() throws Exception 47 { 48 Logger log = getLog(); 49 log.info("+++ testDeploymentInfoNotificationFilterFactory"); 50 51 String listenerService = "listener-deploymentinfo.sar"; 52 String testService = "listener-simpletest.sar"; 53 54 try 55 { 56 ObjectName listener = new ObjectName ("jboss.test:service=NotificationListener"); 57 MBeanServerConnection server = super.getServer(); 58 Integer notifCount; 59 60 deploy(listenerService); 64 notifCount = (Integer )server.getAttribute(listener, "NotificationCount"); 65 assertTrue("NotifCount == 0, got " + notifCount.intValue(), notifCount.intValue() == 0); 66 67 deploy(testService); 68 notifCount = (Integer )server.getAttribute(listener, "NotificationCount"); 69 assertTrue("NotifCount == 1, got " + notifCount.intValue(), notifCount.intValue() == 1); 70 71 undeploy(testService); 72 notifCount = (Integer )server.getAttribute(listener, "NotificationCount"); 73 assertTrue("NotifCount == 2, got " + notifCount.intValue(), notifCount.intValue() == 2); 74 } 75 catch (Exception e) 76 { 77 getLog().warn("Caught exception", e); 78 fail("Unexcepted Exception, see the Log file"); 79 } 80 finally 81 { 82 undeploy(testService); 83 undeploy(listenerService); 84 } 85 } 86 } | Popular Tags |