Updates for boot 2.0 compatibility

parent 946a46f2
...@@ -44,4 +44,4 @@ feignClient: ...@@ -44,4 +44,4 @@ feignClient:
localappName: localapp localappName: localapp
methodLevelRequestMappingPath: /hello2 methodLevelRequestMappingPath: /hello2
myPlaceholderHeader: myPlaceholderHeaderValue myPlaceholderHeader: myPlaceholderHeaderValue
endpoints.default.web.enabled: true management.endpoints.web.expose: '*'
...@@ -93,7 +93,7 @@ public class EurekaClientAutoConfigurationTests { ...@@ -93,7 +93,7 @@ public class EurekaClientAutoConfigurationTests {
@Test @Test
public void shouldNotSetManagementAndJmxPortsInMetadataMap() throws Exception { public void shouldNotSetManagementAndJmxPortsInMetadataMap() throws Exception {
addEnvironment(this.context, "server.port=8989", "management.port=0"); addEnvironment(this.context, "server.port=8989", "management.server.port=0");
setupContext(RefreshAutoConfiguration.class); setupContext(RefreshAutoConfiguration.class);
EurekaInstanceConfigBean instance = this.context EurekaInstanceConfigBean instance = this.context
...@@ -105,7 +105,7 @@ public class EurekaClientAutoConfigurationTests { ...@@ -105,7 +105,7 @@ public class EurekaClientAutoConfigurationTests {
@Test @Test
public void shouldSetManagementAndJmxPortsInMetadataMap() throws Exception { public void shouldSetManagementAndJmxPortsInMetadataMap() throws Exception {
addEnvironment(this.context, "management.port=9999", addEnvironment(this.context, "management.server.port=9999",
"com.sun.management.jmxremote.port=6789"); "com.sun.management.jmxremote.port=6789");
setupContext(RefreshAutoConfiguration.class); setupContext(RefreshAutoConfiguration.class);
...@@ -117,7 +117,7 @@ public class EurekaClientAutoConfigurationTests { ...@@ -117,7 +117,7 @@ public class EurekaClientAutoConfigurationTests {
@Test @Test
public void shouldNotResetManagementAndJmxPortsInMetadataMap() throws Exception { public void shouldNotResetManagementAndJmxPortsInMetadataMap() throws Exception {
addEnvironment(this.context, "management.port=9999", addEnvironment(this.context, "management.server.port=9999",
"eureka.instance.metadata-map.jmx.port=9898", "eureka.instance.metadata-map.jmx.port=9898",
"eureka.instance.metadata-map.management.port=7878"); "eureka.instance.metadata-map.management.port=7878");
setupContext(RefreshAutoConfiguration.class); setupContext(RefreshAutoConfiguration.class);
...@@ -168,7 +168,7 @@ public class EurekaClientAutoConfigurationTests { ...@@ -168,7 +168,7 @@ public class EurekaClientAutoConfigurationTests {
@Test @Test
public void managementPort() { public void managementPort() {
TestPropertyValues.of("server.port=8989", TestPropertyValues.of("server.port=8989",
"management.port=9999").applyTo(this.context); "management.server.port=9999").applyTo(this.context);
setupContext(RefreshAutoConfiguration.class); setupContext(RefreshAutoConfiguration.class);
EurekaInstanceConfigBean instance = this.context EurekaInstanceConfigBean instance = this.context
.getBean(EurekaInstanceConfigBean.class); .getBean(EurekaInstanceConfigBean.class);
...@@ -179,7 +179,7 @@ public class EurekaClientAutoConfigurationTests { ...@@ -179,7 +179,7 @@ public class EurekaClientAutoConfigurationTests {
@Test @Test
public void statusPageUrlPathAndManagementPort() { public void statusPageUrlPathAndManagementPort() {
TestPropertyValues.of( "server.port=8989", TestPropertyValues.of( "server.port=8989",
"management.port=9999", "management.server.port=9999",
"eureka.instance.statusPageUrlPath=/myStatusPage").applyTo(this.context); "eureka.instance.statusPageUrlPath=/myStatusPage").applyTo(this.context);
setupContext(RefreshAutoConfiguration.class); setupContext(RefreshAutoConfiguration.class);
EurekaInstanceConfigBean instance = this.context EurekaInstanceConfigBean instance = this.context
...@@ -191,7 +191,7 @@ public class EurekaClientAutoConfigurationTests { ...@@ -191,7 +191,7 @@ public class EurekaClientAutoConfigurationTests {
@Test @Test
public void healthCheckUrlPathAndManagementPort() { public void healthCheckUrlPathAndManagementPort() {
TestPropertyValues.of( "server.port=8989", TestPropertyValues.of( "server.port=8989",
"management.port=9999", "management.server.port=9999",
"eureka.instance.healthCheckUrlPath=/myHealthCheck").applyTo(this.context); "eureka.instance.healthCheckUrlPath=/myHealthCheck").applyTo(this.context);
setupContext(RefreshAutoConfiguration.class); setupContext(RefreshAutoConfiguration.class);
EurekaInstanceConfigBean instance = this.context EurekaInstanceConfigBean instance = this.context
...@@ -203,7 +203,7 @@ public class EurekaClientAutoConfigurationTests { ...@@ -203,7 +203,7 @@ public class EurekaClientAutoConfigurationTests {
@Test @Test
public void statusPageUrl_and_healthCheckUrl_do_not_contain_server_context_path() throws Exception { public void statusPageUrl_and_healthCheckUrl_do_not_contain_server_context_path() throws Exception {
addEnvironment(this.context, "server.port=8989", addEnvironment(this.context, "server.port=8989",
"management.port=9999", "server.contextPath=/service"); "management.server.port=9999", "server.contextPath=/service");
setupContext(RefreshAutoConfiguration.class); setupContext(RefreshAutoConfiguration.class);
EurekaInstanceConfigBean instance = this.context EurekaInstanceConfigBean instance = this.context
...@@ -217,7 +217,7 @@ public class EurekaClientAutoConfigurationTests { ...@@ -217,7 +217,7 @@ public class EurekaClientAutoConfigurationTests {
@Test @Test
public void statusPageUrl_and_healthCheckUrl_contain_management_context_path() throws Exception { public void statusPageUrl_and_healthCheckUrl_contain_management_context_path() throws Exception {
addEnvironment(this.context, addEnvironment(this.context,
"server.port=8989", "management.contextPath=/management"); "server.port=8989", "management.server.context-path=/management");
setupContext(RefreshAutoConfiguration.class); setupContext(RefreshAutoConfiguration.class);
EurekaInstanceConfigBean instance = this.context EurekaInstanceConfigBean instance = this.context
...@@ -231,8 +231,8 @@ public class EurekaClientAutoConfigurationTests { ...@@ -231,8 +231,8 @@ public class EurekaClientAutoConfigurationTests {
@Test @Test
public void statusPageUrlPathAndManagementPortAndContextPath() { public void statusPageUrlPathAndManagementPortAndContextPath() {
TestPropertyValues.of( "server.port=8989", TestPropertyValues.of( "server.port=8989",
"management.port=9999", "management.contextPath=/manage", "management.server.port=9999", "management.server.context-path=/manage",
"eureka.instance.statusPageUrlPath=/myStatusPage").applyTo(this.context); "eureka.instance.status-page-url-path=/myStatusPage").applyTo(this.context);
setupContext(RefreshAutoConfiguration.class); setupContext(RefreshAutoConfiguration.class);
EurekaInstanceConfigBean instance = this.context EurekaInstanceConfigBean instance = this.context
.getBean(EurekaInstanceConfigBean.class); .getBean(EurekaInstanceConfigBean.class);
...@@ -243,8 +243,8 @@ public class EurekaClientAutoConfigurationTests { ...@@ -243,8 +243,8 @@ public class EurekaClientAutoConfigurationTests {
@Test @Test
public void healthCheckUrlPathAndManagementPortAndContextPath() { public void healthCheckUrlPathAndManagementPortAndContextPath() {
TestPropertyValues.of( "server.port=8989", TestPropertyValues.of( "server.port=8989",
"management.port=9999", "management.contextPath=/manage", "management.server.port=9999", "management.server.context-path=/manage",
"eureka.instance.healthCheckUrlPath=/myHealthCheck").applyTo(this.context); "eureka.instance.health-check-url-path=/myHealthCheck").applyTo(this.context);
setupContext(RefreshAutoConfiguration.class); setupContext(RefreshAutoConfiguration.class);
EurekaInstanceConfigBean instance = this.context EurekaInstanceConfigBean instance = this.context
.getBean(EurekaInstanceConfigBean.class); .getBean(EurekaInstanceConfigBean.class);
...@@ -255,8 +255,8 @@ public class EurekaClientAutoConfigurationTests { ...@@ -255,8 +255,8 @@ public class EurekaClientAutoConfigurationTests {
@Test @Test
public void statusPageUrlPathAndManagementPortAndContextPathKebobCase() { public void statusPageUrlPathAndManagementPortAndContextPathKebobCase() {
TestPropertyValues.of( "server.port=8989", TestPropertyValues.of( "server.port=8989",
"management.port=9999", "management.context-path=/manage", "management.server.port=9999", "management.server.context-path=/manage",
"eureka.instance.statusPageUrlPath=/myStatusPage").applyTo(this.context); "eureka.instance.status-page-url-path=/myStatusPage").applyTo(this.context);
setupContext(RefreshAutoConfiguration.class); setupContext(RefreshAutoConfiguration.class);
EurekaInstanceConfigBean instance = this.context EurekaInstanceConfigBean instance = this.context
.getBean(EurekaInstanceConfigBean.class); .getBean(EurekaInstanceConfigBean.class);
...@@ -267,8 +267,8 @@ public class EurekaClientAutoConfigurationTests { ...@@ -267,8 +267,8 @@ public class EurekaClientAutoConfigurationTests {
@Test @Test
public void healthCheckUrlPathAndManagementPortAndContextPathKebobCase() { public void healthCheckUrlPathAndManagementPortAndContextPathKebobCase() {
TestPropertyValues.of( "server.port=8989", TestPropertyValues.of( "server.port=8989",
"management.port=9999", "management.context-path=/manage", "management.server.port=9999", "management.server.context-path=/manage",
"eureka.instance.healthCheckUrlPath=/myHealthCheck").applyTo(this.context); "eureka.instance.health-check-url-path=/myHealthCheck").applyTo(this.context);
setupContext(RefreshAutoConfiguration.class); setupContext(RefreshAutoConfiguration.class);
EurekaInstanceConfigBean instance = this.context EurekaInstanceConfigBean instance = this.context
.getBean(EurekaInstanceConfigBean.class); .getBean(EurekaInstanceConfigBean.class);
...@@ -279,7 +279,7 @@ public class EurekaClientAutoConfigurationTests { ...@@ -279,7 +279,7 @@ public class EurekaClientAutoConfigurationTests {
@Test @Test
public void statusPageUrlPathAndManagementPortKabobCase() { public void statusPageUrlPathAndManagementPortKabobCase() {
TestPropertyValues.of( "server.port=8989", TestPropertyValues.of( "server.port=8989",
"management.port=9999", "management.server.port=9999",
"eureka.instance.status-page-url-path=/myStatusPage").applyTo(this.context); "eureka.instance.status-page-url-path=/myStatusPage").applyTo(this.context);
setupContext(RefreshAutoConfiguration.class); setupContext(RefreshAutoConfiguration.class);
EurekaInstanceConfigBean instance = this.context EurekaInstanceConfigBean instance = this.context
...@@ -291,7 +291,7 @@ public class EurekaClientAutoConfigurationTests { ...@@ -291,7 +291,7 @@ public class EurekaClientAutoConfigurationTests {
@Test @Test
public void statusPageUrlAndPreferIpAddress() { public void statusPageUrlAndPreferIpAddress() {
TestPropertyValues.of( "server.port=8989", TestPropertyValues.of( "server.port=8989",
"management.port=9999", "eureka.instance.hostname=foo", "management.server.port=9999", "eureka.instance.hostname=foo",
"eureka.instance.preferIpAddress:true").applyTo(this.context); "eureka.instance.preferIpAddress:true").applyTo(this.context);
setupContext(RefreshAutoConfiguration.class); setupContext(RefreshAutoConfiguration.class);
...@@ -305,7 +305,7 @@ public class EurekaClientAutoConfigurationTests { ...@@ -305,7 +305,7 @@ public class EurekaClientAutoConfigurationTests {
@Test @Test
public void healthCheckUrlPathAndManagementPortKabobCase() { public void healthCheckUrlPathAndManagementPortKabobCase() {
TestPropertyValues.of( "server.port=8989", TestPropertyValues.of( "server.port=8989",
"management.port=9999", "management.server.port=9999",
"eureka.instance.health-check-url-path=/myHealthCheck").applyTo(this.context); "eureka.instance.health-check-url-path=/myHealthCheck").applyTo(this.context);
setupContext(RefreshAutoConfiguration.class); setupContext(RefreshAutoConfiguration.class);
EurekaInstanceConfigBean instance = this.context EurekaInstanceConfigBean instance = this.context
...@@ -317,7 +317,7 @@ public class EurekaClientAutoConfigurationTests { ...@@ -317,7 +317,7 @@ public class EurekaClientAutoConfigurationTests {
@Test @Test
public void statusPageUrlPathAndManagementPortUpperCase() { public void statusPageUrlPathAndManagementPortUpperCase() {
TestPropertyValues.of( "server.port=8989", TestPropertyValues.of( "server.port=8989",
"management.port=9999").applyTo(this.context); "management.server.port=9999").applyTo(this.context);
addSystemEnvironment(this.context.getEnvironment(), "EUREKA_INSTANCE_STATUS_PAGE_URL_PATH=/myStatusPage"); addSystemEnvironment(this.context.getEnvironment(), "EUREKA_INSTANCE_STATUS_PAGE_URL_PATH=/myStatusPage");
setupContext(RefreshAutoConfiguration.class); setupContext(RefreshAutoConfiguration.class);
EurekaInstanceConfigBean instance = this.context EurekaInstanceConfigBean instance = this.context
...@@ -329,7 +329,7 @@ public class EurekaClientAutoConfigurationTests { ...@@ -329,7 +329,7 @@ public class EurekaClientAutoConfigurationTests {
@Test @Test
public void healthCheckUrlPathAndManagementPortUpperCase() { public void healthCheckUrlPathAndManagementPortUpperCase() {
TestPropertyValues.of( "server.port=8989", TestPropertyValues.of( "server.port=8989",
"management.port=9999").applyTo(this.context); "management.server.port=9999").applyTo(this.context);
addSystemEnvironment(this.context.getEnvironment(), "EUREKA_INSTANCE_HEALTH_CHECK_URL_PATH=/myHealthCheck"); addSystemEnvironment(this.context.getEnvironment(), "EUREKA_INSTANCE_HEALTH_CHECK_URL_PATH=/myHealthCheck");
setupContext(RefreshAutoConfiguration.class); setupContext(RefreshAutoConfiguration.class);
EurekaInstanceConfigBean instance = this.context EurekaInstanceConfigBean instance = this.context
...@@ -341,7 +341,7 @@ public class EurekaClientAutoConfigurationTests { ...@@ -341,7 +341,7 @@ public class EurekaClientAutoConfigurationTests {
@Test @Test
public void hostname() { public void hostname() {
TestPropertyValues.of( "server.port=8989", TestPropertyValues.of( "server.port=8989",
"management.port=9999", "eureka.instance.hostname=foo").applyTo(this.context); "management.server.port=9999", "eureka.instance.hostname=foo").applyTo(this.context);
setupContext(RefreshAutoConfiguration.class); setupContext(RefreshAutoConfiguration.class);
EurekaInstanceConfigBean instance = this.context EurekaInstanceConfigBean instance = this.context
.getBean(EurekaInstanceConfigBean.class); .getBean(EurekaInstanceConfigBean.class);
......
...@@ -44,7 +44,7 @@ import static org.junit.Assert.assertTrue; ...@@ -44,7 +44,7 @@ import static org.junit.Assert.assertTrue;
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class, webEnvironment = WebEnvironment.RANDOM_PORT, @SpringBootTest(classes = Application.class, webEnvironment = WebEnvironment.RANDOM_PORT,
properties = {"spring.application.name=eureka", "server.servlet.context-path=/context", properties = {"spring.application.name=eureka", "server.servlet.context-path=/context",
"management.security.enabled=false", "endpoints.default.web.enabled=true" }) "management.security.enabled=false", "management.endpoints.web.expose=*" })
public class ApplicationContextTests { public class ApplicationContextTests {
@LocalServerPort @LocalServerPort
......
...@@ -43,7 +43,7 @@ import static org.springframework.boot.test.context.SpringBootTest.WebEnvironmen ...@@ -43,7 +43,7 @@ import static org.springframework.boot.test.context.SpringBootTest.WebEnvironmen
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class, webEnvironment = RANDOM_PORT, properties = { @SpringBootTest(classes = Application.class, webEnvironment = RANDOM_PORT, properties = {
"spring.application.name=eureka", "server.servlet.path=/servlet", "spring.application.name=eureka", "server.servlet.path=/servlet",
"management.security.enabled=false", "endpoints.default.web.enabled=true" }) "management.security.enabled=false", "management.endpoints.web.expose=*" })
public class ApplicationServletPathTests { public class ApplicationServletPathTests {
@LocalServerPort @LocalServerPort
......
...@@ -52,7 +52,7 @@ import static org.springframework.boot.test.context.SpringBootTest.WebEnvironmen ...@@ -52,7 +52,7 @@ import static org.springframework.boot.test.context.SpringBootTest.WebEnvironmen
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class, webEnvironment = RANDOM_PORT, properties = { @SpringBootTest(classes = Application.class, webEnvironment = RANDOM_PORT, properties = {
"spring.jmx.enabled=true", "management.security.enabled=false", "endpoints.default.web.enabled=true" }) "spring.jmx.enabled=true", "management.security.enabled=false", "management.endpoints.web.expose=*" })
public class ApplicationTests { public class ApplicationTests {
@LocalServerPort @LocalServerPort
......
...@@ -51,7 +51,7 @@ import static org.springframework.boot.test.context.SpringBootTest.WebEnvironmen ...@@ -51,7 +51,7 @@ import static org.springframework.boot.test.context.SpringBootTest.WebEnvironmen
*/ */
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = RANDOM_PORT, @SpringBootTest(webEnvironment = RANDOM_PORT,
value = {"zuul.routes.sslservice.url=https://localhost:8443", "management.security.enabled=false"}) value = {"zuul.routes.sslservice.url=https://localhost:8443", "management.security.enabled=false", "management.endpoints.web.expose=*"})
@DirtiesContext @DirtiesContext
public class RoutesEndpointIntegrationTests { public class RoutesEndpointIntegrationTests {
...@@ -62,12 +62,14 @@ public class RoutesEndpointIntegrationTests { ...@@ -62,12 +62,14 @@ public class RoutesEndpointIntegrationTests {
private SimpleZuulProxyApplication.RoutesRefreshListener refreshListener; private SimpleZuulProxyApplication.RoutesRefreshListener refreshListener;
@Test @Test
@SuppressWarnings("unchecked")
public void getRoutesTest() { public void getRoutesTest() {
Map<String, String> routes = restTemplate.getForObject("/application/routes", Map.class); Map<String, String> routes = restTemplate.getForObject("/application/routes", Map.class);
assertEquals("https://localhost:8443", routes.get("/sslservice/**")); assertEquals("https://localhost:8443", routes.get("/sslservice/**"));
} }
@Test @Test
@SuppressWarnings("unchecked")
public void postRoutesTest() { public void postRoutesTest() {
Map<String, String> routes = restTemplate.postForObject("/application/routes", null, Map.class); Map<String, String> routes = restTemplate.postForObject("/application/routes", null, Map.class);
assertEquals("https://localhost:8443", routes.get("/sslservice/**")); assertEquals("https://localhost:8443", routes.get("/sslservice/**"));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment