INT-1789: Added 'managed-components' attribute to mbean-export
This commit is contained in:
@@ -129,6 +129,17 @@ public class MBeanExporterIntegrationTests {
|
||||
assertEquals("start", startName);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testComponentNames() throws Exception {
|
||||
context = new GenericXmlApplicationContext(getClass(), "excluded-components.xml");
|
||||
messageChannelsMonitor = context.getBean(IntegrationMBeanExporter.class);
|
||||
assertNotNull(messageChannelsMonitor);
|
||||
MBeanServer server = context.getBean(MBeanServer.class);
|
||||
Set<ObjectName> names = server.queryNames(ObjectName.getInstance("org.springframework.integration:type=*,*"), null);
|
||||
// Only one registered (out of >2 available)
|
||||
assertEquals(1, names.size());
|
||||
}
|
||||
|
||||
public static class DateFactoryBean implements FactoryBean<Date> {
|
||||
|
||||
private Date date;
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:context="http://www.springframework.org/schema/context" xmlns:int="http://www.springframework.org/schema/integration"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">
|
||||
|
||||
<bean id="integrationExecutions" class="org.springframework.integration.monitor.IntegrationMBeanExporter">
|
||||
<property name="server" ref="mbeanServer" />
|
||||
<property name="componentNamePatterns" value="input" />
|
||||
</bean>
|
||||
|
||||
<bean id="mbeanServer" class="org.springframework.jmx.support.MBeanServerFactoryBean">
|
||||
<property name="locateExistingServerIfPossible" value="false" />
|
||||
</bean>
|
||||
|
||||
<int:channel id="input">
|
||||
<int:queue />
|
||||
</int:channel>
|
||||
|
||||
<int:inbound-channel-adapter id="explicit" ref="service" method="execute" channel="input">
|
||||
<int:poller fixed-rate="200" />
|
||||
</int:inbound-channel-adapter>
|
||||
|
||||
<bean id="service" class="org.springframework.integration.monitor.MBeanExporterIntegrationTests$SimpleService" />
|
||||
|
||||
</beans>
|
||||
Reference in New Issue
Block a user