mx4j/src/test/test/javax/management/monitor CounterMonitorTest.java,1.10,1.11
Jeremy Boynes <[email protected]> Sun, 13 Feb 2005 17:18:09 +0000
| Newsgroups | gmane.comp.java.mx4j.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/mx4j/mx4j/src/test/test/javax/management/monitor
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11990/src/test/test/javax/management/monitor
Modified Files:
CounterMonitorTest.java
Log Message:
Fix for [ 1121856 ] CounterMonitor should not notify if already able threshold
Fix for [ 1121854 ] CounterMonitor value can be negative
Index: CounterMonitorTest.java
===================================================================
RCS file: /cvsroot/mx4j/mx4j/src/test/test/javax/management/monitor/CounterMonitorTest.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** CounterMonitorTest.java 13 Nov 2004 16:38:42 -0000 1.10
--- CounterMonitorTest.java 13 Feb 2005 17:17:58 -0000 1.11
***************
*** 152,199 ****
}
- public void testMonitorNotificationForNegativeCounter() throws Exception
- {
- MBeanServer server = newMBeanServer();
- Monitor monitor = createMonitor();
- server.registerMBean(monitor, ObjectName.getInstance(":service=monitor"));
-
- Counter counter = new Counter();
- ObjectName counterName = ObjectName.getInstance(":mbean=counter");
- server.registerMBean(counter, counterName);
-
- monitor.addObservedObject(counterName);
- monitor.setGranularityPeriod(1000);
- monitor.setObservedAttribute("NegativeCounter");
-
- final MutableInteger times = new MutableInteger(0);
- final MutableObject holder = new MutableObject(null);
- monitor.addNotificationListener(new NotificationListener()
- {
- public void handleNotification(Notification notification, Object handback)
- {
- times.set(times.get() + 1);
- holder.set(notification);
- }
- }, null, null);
- monitor.start();
-
- try
- {
- // Wait for notification to arrive
- while (holder.get() == null) sleep(10);
-
- // Be sure only one arrived
- sleep(5000);
- assertEquals(times.get(), 1);
-
- MonitorNotification notification = (MonitorNotification)holder.get();
- assertEquals(notification.getType(), MonitorNotification.THRESHOLD_ERROR);
- }
- finally
- {
- monitor.stop();
- }
- }
-
public void testIntegerCounter() throws Exception
{
--- 152,155 ----
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click