INT-1416: replace control-bus with mbean-exporter

This commit is contained in:
David Syer
2010-09-03 12:39:00 +00:00
parent c7cfa6fdbc
commit 4c3287d2c3
9 changed files with 39 additions and 38 deletions

View File

@@ -87,6 +87,7 @@ public class ControlBusOperationChannelTests {
BeanDefinition controlBusDef = new RootBeanDefinition(ControlBus.class);
controlBusDef.getConstructorArgumentValues().addGenericArgumentValue(new RuntimeBeanReference("mbeanServer"));
controlBusDef.getConstructorArgumentValues().addGenericArgumentValue(new RuntimeBeanReference("exporter"));
controlBusDef.getConstructorArgumentValues().addGenericArgumentValue(new DirectChannel());
context.registerBeanDefinition("controlBus", controlBusDef);
return exporterDef;
}

View File

@@ -189,6 +189,7 @@ public class ControlBusTests {
BeanDefinition controlBusDef = new RootBeanDefinition(ControlBus.class);
controlBusDef.getConstructorArgumentValues().addGenericArgumentValue(new RuntimeBeanReference("mbeanServer"));
controlBusDef.getConstructorArgumentValues().addGenericArgumentValue(new RuntimeBeanReference("exporter"));
controlBusDef.getConstructorArgumentValues().addGenericArgumentValue(new DirectChannel());
context.registerBeanDefinition("controlBus", controlBusDef);
return exporterDef;
}

View File

@@ -5,6 +5,8 @@
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<int:channel id="controlChannel" />
<int:channel id="testDirectChannel" />
<int:channel id="testQueueChannel">
@@ -22,6 +24,7 @@
<bean id="controlBus" class="org.springframework.integration.control.ControlBus">
<constructor-arg ref="mbeanExporter" />
<constructor-arg ref="mbeanServer" />
<constructor-arg ref="controlChannel" />
</bean>
<bean id="mbeanExporter" class="org.springframework.integration.monitor.IntegrationMBeanExporter">

View File

@@ -17,6 +17,6 @@
<si:channel id="testChannel"/>
<jmx:control-bus id="controlBus" mbean-server="mbs" operation-channel="testChannel" domain="tests.ControlBusParser"/>
<jmx:mbean-exporter id="controlBus" mbean-server="mbs" operation-channel="testChannel" domain="tests.ControlBusParser"/>
</beans>

View File

@@ -36,15 +36,14 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
*/
@ContextConfiguration
@RunWith(SpringJUnit4ClassRunner.class)
public class ControlBusParserTests {
public class MBeanExporterParserTests {
@Autowired
private ApplicationContext context;
@Test
public void test() throws InterruptedException {
ControlBus controlBus = this.context.getBean("controlBus", ControlBus.class);
ControlBus controlBus = this.context.getBean(ControlBus.class);
assertEquals(controlBus.getOperationChannel(), this.context.getBean("testChannel"));
MBeanServer server = this.context.getBean("mbs", MBeanServer.class);
MBeanExporter exporter = (MBeanExporter) new DirectFieldAccessor(controlBus).getPropertyValue("exporter");