|
|
@ -55,28 +55,9 @@ public class IntegrationAutoConfigurationTests {
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void integrationIsAvailable() {
|
|
|
|
public void integrationIsAvailable() {
|
|
|
|
load();
|
|
|
|
load();
|
|
|
|
MBeanServer mBeanServer = this.context.getBean(MBeanServer.class);
|
|
|
|
|
|
|
|
assertDomains(mBeanServer, true, "org.springframework.integration",
|
|
|
|
|
|
|
|
"org.springframework.integration.monitor");
|
|
|
|
|
|
|
|
assertThat(this.context.getBean(HeaderChannelRegistry.class)).isNotNull();
|
|
|
|
assertThat(this.context.getBean(HeaderChannelRegistry.class)).isNotNull();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
|
|
|
public void disableIntegration() {
|
|
|
|
|
|
|
|
load("spring.jmx.enabled=false");
|
|
|
|
|
|
|
|
assertThat(this.context.getBeansOfType(MBeanServer.class)).hasSize(0);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
|
|
|
public void customizeDomain() {
|
|
|
|
|
|
|
|
load("spring.jmx.default-domain=org.foo");
|
|
|
|
|
|
|
|
MBeanServer mBeanServer = this.context.getBean(MBeanServer.class);
|
|
|
|
|
|
|
|
assertDomains(mBeanServer, true, "org.foo");
|
|
|
|
|
|
|
|
assertDomains(mBeanServer, false, "org.springframework.integration",
|
|
|
|
|
|
|
|
"org.springframework.integration.monitor");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void parentContext() {
|
|
|
|
public void parentContext() {
|
|
|
|
this.context = new AnnotationConfigApplicationContext();
|
|
|
|
this.context = new AnnotationConfigApplicationContext();
|
|
|
@ -92,6 +73,29 @@ public class IntegrationAutoConfigurationTests {
|
|
|
|
this.context.close();
|
|
|
|
this.context.close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
|
|
|
public void jmxIntegrationEnabledByDefault() {
|
|
|
|
|
|
|
|
load();
|
|
|
|
|
|
|
|
MBeanServer mBeanServer = this.context.getBean(MBeanServer.class);
|
|
|
|
|
|
|
|
assertDomains(mBeanServer, true, "org.springframework.integration",
|
|
|
|
|
|
|
|
"org.springframework.integration.monitor");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
|
|
|
public void disableJmxIntegration() {
|
|
|
|
|
|
|
|
load("spring.jmx.enabled=false");
|
|
|
|
|
|
|
|
assertThat(this.context.getBeansOfType(MBeanServer.class)).hasSize(0);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
|
|
|
public void customizeJmxDomain() {
|
|
|
|
|
|
|
|
load("spring.jmx.default-domain=org.foo");
|
|
|
|
|
|
|
|
MBeanServer mBeanServer = this.context.getBean(MBeanServer.class);
|
|
|
|
|
|
|
|
assertDomains(mBeanServer, true, "org.foo");
|
|
|
|
|
|
|
|
assertDomains(mBeanServer, false, "org.springframework.integration",
|
|
|
|
|
|
|
|
"org.springframework.integration.monitor");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private static void assertDomains(MBeanServer mBeanServer, boolean expected, String... domains) {
|
|
|
|
private static void assertDomains(MBeanServer mBeanServer, boolean expected, String... domains) {
|
|
|
|
List<String> actual = Arrays.asList(mBeanServer.getDomains());
|
|
|
|
List<String> actual = Arrays.asList(mBeanServer.getDomains());
|
|
|
|
for (String domain : domains) {
|
|
|
|
for (String domain : domains) {
|
|
|
|