This commit is contained in:
Phillip Webb 2016-03-29 21:45:11 -07:00
parent 1043239de0
commit 39140945b5
2 changed files with 7 additions and 4 deletions

View File

@ -77,23 +77,25 @@ public class IntegrationAutoConfigurationTests {
"org.springframework.integration.monitor");
}
@Test
public void parentContext() {
this.context = new AnnotationConfigApplicationContext();
this.context.register(JmxAutoConfiguration.class, IntegrationAutoConfiguration.class);
this.context.register(JmxAutoConfiguration.class,
IntegrationAutoConfiguration.class);
this.context.refresh();
AnnotationConfigApplicationContext parent = this.context;
this.context = new AnnotationConfigApplicationContext();
this.context.setParent(parent);
this.context.register(JmxAutoConfiguration.class, IntegrationAutoConfiguration.class);
this.context.register(JmxAutoConfiguration.class,
IntegrationAutoConfiguration.class);
this.context.refresh();
assertNotNull(this.context.getBean(HeaderChannelRegistry.class));
((ConfigurableApplicationContext) this.context.getParent()).close();
this.context.close();
}
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());
for (String domain : domains) {
assertEquals(expected, actual.contains(domain));

View File

@ -136,4 +136,5 @@ public class FindMainClassTask extends DefaultTask {
}
return null;
}
}