INT-1429: tidy up JMX
- rename some classes and add Statistics abstraction - INT-1429: rename SimpleChannelMonitor
This commit is contained in:
@@ -12,8 +12,8 @@ import org.springframework.integration.jmx.OperationInvokingMessageHandlerTests;
|
||||
import org.springframework.integration.jmx.config.NotificationListeningChannelAdapterParserTests;
|
||||
import org.springframework.integration.jmx.config.OperationInvokingChannelAdapterParserTests;
|
||||
import org.springframework.integration.jmx.config.OperationInvokingOutboundGatewayTests;
|
||||
import org.springframework.integration.monitor.ExponentialMovingAverageCumulativeHistoryTests;
|
||||
import org.springframework.integration.monitor.ExponentialMovingAverageRatioCumulativeHistoryTests;
|
||||
import org.springframework.integration.monitor.ExponentialMovingAverageTests;
|
||||
import org.springframework.integration.monitor.ExponentialMovingAverageRatioTests;
|
||||
import org.springframework.integration.monitor.HandlerMonitoringIntegrationTests;
|
||||
import org.springframework.integration.monitor.MessageChannelsMonitorIntegrationTests;
|
||||
|
||||
@@ -41,10 +41,10 @@ import org.springframework.integration.monitor.MessageChannelsMonitorIntegration
|
||||
*/
|
||||
@RunWith(Suite.class)
|
||||
@SuiteClasses(value = { OperationInvokingMessageHandlerTests.class,
|
||||
ExponentialMovingAverageCumulativeHistoryTests.class, OperationInvokingChannelAdapterParserTests.class,
|
||||
ExponentialMovingAverageTests.class, OperationInvokingChannelAdapterParserTests.class,
|
||||
HandlerMonitoringIntegrationTests.class, NotificationListeningMessageProducerTests.class,
|
||||
OperationInvokingOutboundGatewayTests.class, NotificationListeningChannelAdapterParserTests.class,
|
||||
ControlBusXmlTests.class, ExponentialMovingAverageRatioCumulativeHistoryTests.class,
|
||||
ControlBusXmlTests.class, ExponentialMovingAverageRatioTests.class,
|
||||
AttributePollingMessageSourceTests.class, ControlBusTests.class, MessageChannelsMonitorIntegrationTests.class })
|
||||
@Ignore
|
||||
public class IgnoredTestSuite {
|
||||
|
||||
@@ -44,7 +44,7 @@ import org.springframework.integration.handler.BridgeHandler;
|
||||
import org.springframework.integration.monitor.IntegrationMBeanExporter;
|
||||
import org.springframework.integration.monitor.LifecycleMessageHandlerMonitor;
|
||||
import org.springframework.integration.monitor.QueueChannelMonitor;
|
||||
import org.springframework.integration.monitor.SimpleMessageChannelMonitor;
|
||||
import org.springframework.integration.monitor.DirectChannelMonitor;
|
||||
import org.springframework.jmx.support.MBeanServerFactoryBean;
|
||||
import org.springframework.jmx.support.ObjectNameManager;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
|
||||
@@ -86,7 +86,7 @@ public class ControlBusTests {
|
||||
MBeanServer mbeanServer = context.getBean("mbeanServer", MBeanServer.class);
|
||||
ObjectInstance instance = mbeanServer.getObjectInstance(ObjectNameManager
|
||||
.getInstance("domain.test1:type=MessageChannel,name=directChannel"));
|
||||
assertEquals(SimpleMessageChannelMonitor.class.getName(), instance.getClassName());
|
||||
assertEquals(DirectChannelMonitor.class.getName(), instance.getClassName());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -99,7 +99,7 @@ public class ControlBusTests {
|
||||
ObjectInstance instance = mbeanServer
|
||||
.getObjectInstance(ObjectNameManager
|
||||
.getInstance("domain.test1b:type=MessageChannel,name=org.springframework.integration.generated#0,source=anonymous"));
|
||||
assertEquals(SimpleMessageChannelMonitor.class.getName(), instance.getClassName());
|
||||
assertEquals(DirectChannelMonitor.class.getName(), instance.getClassName());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -111,7 +111,7 @@ public class ControlBusTests {
|
||||
MBeanServer mbeanServer = context.getBean("mbeanServer", MBeanServer.class);
|
||||
ObjectInstance instance = mbeanServer.getObjectInstance(ObjectNameManager
|
||||
.getInstance("domain.test1a:type=MessageChannel,name=directChannel,foo=bar"));
|
||||
assertEquals(SimpleMessageChannelMonitor.class.getName(), instance.getClassName());
|
||||
assertEquals(DirectChannelMonitor.class.getName(), instance.getClassName());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -28,7 +28,7 @@ import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.integration.monitor.LifecycleMessageHandlerMonitor;
|
||||
import org.springframework.integration.monitor.QueueChannelMonitor;
|
||||
import org.springframework.integration.monitor.SimpleMessageChannelMonitor;
|
||||
import org.springframework.integration.monitor.DirectChannelMonitor;
|
||||
import org.springframework.jmx.support.ObjectNameManager;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
@@ -51,7 +51,7 @@ public class ControlBusXmlTests {
|
||||
public void directChannelRegistered() throws Exception {
|
||||
ObjectInstance instance = mbeanServer.getObjectInstance(
|
||||
ObjectNameManager.getInstance(DOMAIN + ":type=MessageChannel,name=testDirectChannel"));
|
||||
assertEquals(SimpleMessageChannelMonitor.class.getName(), instance.getClassName());
|
||||
assertEquals(DirectChannelMonitor.class.getName(), instance.getClassName());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -42,11 +42,11 @@ public class ChannelIntegrationTests {
|
||||
|
||||
requests.send(new GenericMessage<String>("foo"));
|
||||
|
||||
double duration = messageChannelsMonitor.getChannelMeanSendDuration("" + requests);
|
||||
assertTrue("No statistics for requests channel", duration >= 0);
|
||||
double rate = messageChannelsMonitor.getChannelSendRate("" + requests).getMean();
|
||||
assertTrue("No statistics for requests channel", rate >= 0);
|
||||
|
||||
duration = messageChannelsMonitor.getChannelMeanSendDuration("" + intermediate);
|
||||
assertTrue("No statistics for intermediate channel", duration >= 0);
|
||||
rate = messageChannelsMonitor.getChannelSendRate("" + intermediate).getMean();
|
||||
assertTrue("No statistics for intermediate channel", rate >= 0);
|
||||
|
||||
assertNotNull(intermediate.receive(100L));
|
||||
double count = messageChannelsMonitor.getChannelReceiveCount("" + intermediate);
|
||||
|
||||
@@ -24,9 +24,9 @@ import org.junit.Test;
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class ExponentialMovingAverageRateCumulativeHistoryTests {
|
||||
public class ExponentialMovingAverageRateTests {
|
||||
|
||||
private ExponentialMovingAverageRateCumulativeHistory history = new ExponentialMovingAverageRateCumulativeHistory(
|
||||
private ExponentialMovingAverageRate history = new ExponentialMovingAverageRate(
|
||||
1., 10., 10);
|
||||
|
||||
@Test
|
||||
@@ -24,9 +24,9 @@ import org.junit.Test;
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class ExponentialMovingAverageRatioCumulativeHistoryTests {
|
||||
public class ExponentialMovingAverageRatioTests {
|
||||
|
||||
private ExponentialMovingAverageRatioCumulativeHistory history = new ExponentialMovingAverageRatioCumulativeHistory(
|
||||
private ExponentialMovingAverageRatio history = new ExponentialMovingAverageRatio(
|
||||
0.5, 10);
|
||||
|
||||
@Test
|
||||
@@ -23,9 +23,9 @@ import org.junit.Test;
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class ExponentialMovingAverageCumulativeHistoryTests {
|
||||
public class ExponentialMovingAverageTests {
|
||||
|
||||
private ExponentialMovingAverageCumulativeHistory history = new ExponentialMovingAverageCumulativeHistory(10);
|
||||
private ExponentialMovingAverage history = new ExponentialMovingAverage(10);
|
||||
|
||||
@Test
|
||||
public void testGetCount() {
|
||||
@@ -82,8 +82,8 @@ public class HandlerMonitoringIntegrationTests {
|
||||
channel.send(new GenericMessage<String>("bar"));
|
||||
assertEquals(before + 1, service.getCounter());
|
||||
|
||||
double duration = messageHandlersMonitor.getHandlerMeanDuration(monitor);
|
||||
assertTrue("No statistics for input channel", duration > 0);
|
||||
int count = messageHandlersMonitor.getHandlerDuration(monitor).getCount();
|
||||
assertTrue("No statistics for input channel", count > 0);
|
||||
|
||||
} finally {
|
||||
context.close();
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
package org.springframework.integration.monitor;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
@@ -70,11 +69,8 @@ public class MessageChannelsMonitorIntegrationTests {
|
||||
assertEquals(before + 50, service.getCounter());
|
||||
|
||||
// The handler monitor is registered under the endpoint id (since it is explicit)
|
||||
double sends = messageChannelsMonitor.getChannelSendCount("" + channel);
|
||||
int sends = messageChannelsMonitor.getChannelSendRate("" + channel).getCount();
|
||||
assertEquals("No send statistics for input channel", 50, sends, 0.01);
|
||||
double rate = messageChannelsMonitor.getChannelSendRate("" + channel);
|
||||
assertTrue(String.format("Unexpected rate statistics for input channel %f %f", 60000. / 20L, rate),
|
||||
60000. / 20L > rate && rate > 0);
|
||||
|
||||
}
|
||||
finally {
|
||||
@@ -106,13 +102,10 @@ public class MessageChannelsMonitorIntegrationTests {
|
||||
assertEquals(before + 10, service.getCounter());
|
||||
|
||||
// The handler monitor is registered under the endpoint id (since it is explicit)
|
||||
double sends = messageChannelsMonitor.getChannelSendCount("" + channel);
|
||||
int sends = messageChannelsMonitor.getChannelSendRate("" + channel).getCount();
|
||||
assertEquals("No send statistics for input channel", 11, sends, 0.01);
|
||||
double errors = messageChannelsMonitor.getChannelSendErrorCount("" + channel);
|
||||
int errors = messageChannelsMonitor.getChannelErrorRate("" + channel).getCount();
|
||||
assertEquals("No error statistics for input channel", 1, errors, 0.01);
|
||||
double rate = messageChannelsMonitor.getChannelErrorRate("" + channel);
|
||||
assertTrue(String.format("Unexpected error statistics for input channel %f %f", 60000. / 20L, rate),
|
||||
60000. / 20L > rate && rate > 0);
|
||||
}
|
||||
finally {
|
||||
context.close();
|
||||
@@ -143,11 +136,11 @@ public class MessageChannelsMonitorIntegrationTests {
|
||||
assertEquals(before + 10, service.getCounter());
|
||||
|
||||
// The handler monitor is registered under the endpoint id (since it is explicit)
|
||||
long sends = messageChannelsMonitor.getChannelSendCount("" + channel);
|
||||
int sends = messageChannelsMonitor.getChannelSendRate("" + channel).getCount();
|
||||
assertEquals("No send statistics for input channel", 11, sends);
|
||||
long receives = messageChannelsMonitor.getChannelReceiveCount("" + channel);
|
||||
int receives = messageChannelsMonitor.getChannelReceiveCount("" + channel);
|
||||
assertEquals("No send statistics for input channel", 11, receives);
|
||||
long errors = messageChannelsMonitor.getChannelSendErrorCount("" + channel);
|
||||
int errors = messageChannelsMonitor.getChannelErrorRate("" + channel).getCount();
|
||||
assertEquals("Expect no errors for input channel (handler fails)", 0, errors);
|
||||
}
|
||||
finally {
|
||||
@@ -167,7 +160,7 @@ public class MessageChannelsMonitorIntegrationTests {
|
||||
assertEquals(before + 1, service.getCounter());
|
||||
|
||||
// The handler monitor is registered under the endpoint id (since it is explicit)
|
||||
double sends = messageChannelsMonitor.getChannelSendCount("" + channel);
|
||||
int sends = messageChannelsMonitor.getChannelSendRate("" + channel).getCount();
|
||||
assertEquals("No statistics for input channel", 1, sends, 0.01);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user