INT-1675: add illegal bean id check for clash with core mbean exporter
This commit is contained in:
@@ -21,6 +21,6 @@
|
||||
|
||||
<si:control-bus input-channel="controlChannel"/>
|
||||
|
||||
<jmx:mbean-export id="mbeanExporter" server="mbs" default-domain="tests.ControlBusParser"/>
|
||||
<jmx:mbean-export id="integrationMbeanExporter" server="mbs" default-domain="tests.ControlBusParser"/>
|
||||
|
||||
</beans>
|
||||
|
||||
@@ -41,7 +41,7 @@ public class ControlBusParserTests {
|
||||
MessageChannel control = this.context.getBean("controlChannel", MessageChannel.class);
|
||||
MessagingTemplate messagingTemplate = new MessagingTemplate();
|
||||
Object value = messagingTemplate.convertSendAndReceive(control,
|
||||
"@mbeanExporter.getChannelSendRate('testChannel').count");
|
||||
"@integrationMbeanExporter.getChannelSendRate('testChannel').count");
|
||||
assertEquals(new Integer(0), value);
|
||||
MBeanExporter exporter = this.context.getBean(MBeanExporter.class);
|
||||
exporter.destroy();
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
<?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"
|
||||
xmlns:jmx="http://www.springframework.org/schema/integration/jmx"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/context
|
||||
http://www.springframework.org/schema/context/spring-context.xsd
|
||||
http://www.springframework.org/schema/integration
|
||||
http://www.springframework.org/schema/integration/spring-integration.xsd
|
||||
http://www.springframework.org/schema/integration/jmx
|
||||
http://www.springframework.org/schema/integration/jmx/spring-integration-jmx.xsd">
|
||||
|
||||
<jmx:mbean-export id="mbeanExporter" server="mbs" default-domain="test.MBeanExporterName"/>
|
||||
|
||||
<context:mbean-server id="mbs" />
|
||||
|
||||
<context:mbean-export server="mbs" default-domain="test.MBeanExporterName"/>
|
||||
|
||||
<int:channel id="testChannel" />
|
||||
|
||||
<int:service-activator id="service" input-channel="testChannel" method="get">
|
||||
<bean class="org.springframework.integration.jmx.config.MBeanExporterNameTests$Source"/>
|
||||
</int:service-activator>
|
||||
|
||||
<int:logging-channel-adapter id="logger" channel="testChannel"/>
|
||||
|
||||
</beans>
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright 2002-2010 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
|
||||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.integration.jmx.config;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.beans.factory.parsing.BeanDefinitionParsingException;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
* @since 2.0
|
||||
*/
|
||||
public class MBeanExporterNameTests {
|
||||
|
||||
@Test(expected = BeanDefinitionParsingException.class)
|
||||
public void testHandlerMBeanRegistration() throws Exception {
|
||||
new ClassPathXmlApplicationContext(getClass().getSimpleName() + "-context.xml", getClass());
|
||||
}
|
||||
|
||||
public static class Source {
|
||||
public String get() {
|
||||
return "foo";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -17,6 +17,6 @@
|
||||
|
||||
<si:channel id="testChannel"/>
|
||||
|
||||
<jmx:mbean-export id="mbeanExporter" server="mbs" default-domain="tests.MBeanExpoerterParser"/>
|
||||
<jmx:mbean-export id="integratioMbeanExporter" server="mbs" default-domain="tests.MBeanExpoerterParser"/>
|
||||
|
||||
</beans>
|
||||
|
||||
@@ -12,11 +12,13 @@
|
||||
http://www.springframework.org/schema/integration/jmx
|
||||
http://www.springframework.org/schema/integration/jmx/spring-integration-jmx.xsd">
|
||||
|
||||
<jmx:mbean-export id="integrationMbeanExporter" server="mbs" default-domain="test.MBeanRegistration"/>
|
||||
|
||||
<context:mbean-server id="mbs" />
|
||||
|
||||
<context:mbean-export server="mbs" default-domain="test.MBeanRegistration"/>
|
||||
|
||||
<int:publish-subscribe-channel id="testChannel" />
|
||||
<int:channel id="testChannel" />
|
||||
|
||||
<int:service-activator id="service" input-channel="testChannel" method="get">
|
||||
<bean class="org.springframework.integration.jmx.config.MBeanRegistrationTests$Source"/>
|
||||
@@ -24,6 +26,4 @@
|
||||
|
||||
<int:logging-channel-adapter id="logger" channel="testChannel"/>
|
||||
|
||||
<jmx:mbean-export id="integrationMbeanExporter" server="mbs" default-domain="test.MBeanRegistration"/>
|
||||
|
||||
</beans>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<?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"
|
||||
<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"
|
||||
xmlns:jmx="http://www.springframework.org/schema/integration/jmx"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
@@ -12,19 +11,19 @@
|
||||
http://www.springframework.org/schema/integration/jmx
|
||||
http://www.springframework.org/schema/integration/jmx/spring-integration-jmx.xsd">
|
||||
|
||||
<jmx:mbean-export server="mbs" default-domain="test.RouterMBean" />
|
||||
|
||||
<context:mbean-export server="mbs" default-domain="test.RouterMBean" />
|
||||
|
||||
<context:mbean-server id="mbs" />
|
||||
|
||||
<int:channel id="testChannel" />
|
||||
<int:channel id="intChannel" />
|
||||
<int:channel id="stringChannel" />
|
||||
|
||||
<int:payload-type-router id="ptRouter"
|
||||
input-channel="testChannel">
|
||||
<int:payload-type-router id="ptRouter" input-channel="testChannel">
|
||||
<int:mapping type="java.lang.String" channel="stringChannel" />
|
||||
<int:mapping type="java.lang.Integer" channel="intChannel" />
|
||||
</int:payload-type-router>
|
||||
|
||||
<jmx:mbean-export id="mbeanExporter" server="mbs"
|
||||
default-domain="test.RouterMBean" />
|
||||
|
||||
</beans>
|
||||
|
||||
@@ -39,6 +39,7 @@ public class RouterMBeanTests {
|
||||
|
||||
@Test
|
||||
public void testRouterMBeanExists() throws Exception {
|
||||
// System.err.println(server.queryNames(new ObjectName("test.RouterMBean:*"), null));
|
||||
Set<ObjectName> names = server.queryNames(new ObjectName("test.RouterMBean:type=MessageHandler,name=ptRouter,*"), null);
|
||||
assertEquals(1, names.size());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user