Update tests for 2.0.x

This commit is contained in:
Spencer Gibb
2017-10-30 19:19:20 -04:00
parent f302c166a5
commit 8f9dfd38e3

View File

@@ -70,17 +70,18 @@ public class ContextRefresherTests {
public void parentContextIsClosed() {
// Use spring.cloud.bootstrap.name to switch off the defaults (which would pick up
// a bootstrapProperties immediately
context = SpringApplication.run(ContextRefresherTests.class,
try (ConfigurableApplicationContext context = SpringApplication.run(ContextRefresherTests.class,
"--spring.main.webEnvironment=false", "--debug=false",
"--spring.main.bannerMode=OFF", "--spring.cloud.bootstrap.name=refresh");
ContextRefresher refresher = new ContextRefresher(context, scope);
EnvironmentTestUtils.addEnvironment(context,
"spring.cloud.bootstrap.sources: org.springframework.cloud.context.refresh.ContextRefresherTests.PropertySourceConfiguration\n"
+ "");
ConfigurableApplicationContext refresherContext = refresher.addConfigFilesToEnvironment();
assertThat(refresherContext.getParent()).isNotNull().isInstanceOf(ConfigurableApplicationContext.class);
ConfigurableApplicationContext parent = (ConfigurableApplicationContext) refresherContext.getParent();
assertThat(parent.isActive()).isFalse();
"--spring.main.bannerMode=OFF", "--spring.cloud.bootstrap.name=refresh")) {
ContextRefresher refresher = new ContextRefresher(context, scope);
TestPropertyValues.of(
"spring.cloud.bootstrap.sources: org.springframework.cloud.context.refresh.ContextRefresherTests.PropertySourceConfiguration")
.applyTo(context);
ConfigurableApplicationContext refresherContext = refresher.addConfigFilesToEnvironment();
assertThat(refresherContext.getParent()).isNotNull().isInstanceOf(ConfigurableApplicationContext.class);
ConfigurableApplicationContext parent = (ConfigurableApplicationContext) refresherContext.getParent();
assertThat(parent.isActive()).isFalse();
}
}
private List<String> names(MutablePropertySources propertySources) {
List<String> list = new ArrayList<>();