Add tests to assert behaviour of actuator endpoints with context path

See gh-4401
pull/4632/head
Dave Syer 9 years ago
parent 77190f126a
commit dd7d587ea8

@ -166,6 +166,36 @@ public class EndpointWebMvcAutoConfigurationTests {
assertAllClosed(); assertAllClosed();
} }
@Test
public void onDifferentPortAndContext() throws Exception {
this.applicationContext.register(RootConfig.class, EndpointConfig.class,
DifferentPortConfig.class, BaseConfiguration.class,
EndpointWebMvcAutoConfiguration.class, ErrorMvcAutoConfiguration.class);
EnvironmentTestUtils.addEnvironment(this.applicationContext,
"management.context-path=/admin");
this.applicationContext.refresh();
assertContent("/controller", ports.get().server, "controlleroutput");
assertContent("/admin/endpoint", ports.get().management, "endpointoutput");
assertContent("/admin/error", ports.get().management, startsWith("{"));
this.applicationContext.close();
assertAllClosed();
}
@Test
public void onDifferentPortAndMainContext() throws Exception {
this.applicationContext.register(RootConfig.class, EndpointConfig.class,
DifferentPortConfig.class, BaseConfiguration.class,
EndpointWebMvcAutoConfiguration.class, ErrorMvcAutoConfiguration.class);
EnvironmentTestUtils.addEnvironment(this.applicationContext,
"management.context-path=/admin", "server.context-path=/spring");
this.applicationContext.refresh();
assertContent("/spring/controller", ports.get().server, "controlleroutput");
assertContent("/admin/endpoint", ports.get().management, "endpointoutput");
assertContent("/admin/error", ports.get().management, startsWith("{"));
this.applicationContext.close();
assertAllClosed();
}
@Test @Test
public void onDifferentPortWithoutErrorMvcAutoConfiguration() throws Exception { public void onDifferentPortWithoutErrorMvcAutoConfiguration() throws Exception {
this.applicationContext.register(RootConfig.class, EndpointConfig.class, this.applicationContext.register(RootConfig.class, EndpointConfig.class,

Loading…
Cancel
Save