Move all actuators under /application

Context path can be configured via `management.context-path`.

Closes gh-6886
This commit is contained in:
Madhura Bhave
2016-10-13 10:32:38 -07:00
parent 92468d4ffc
commit bcd79dd992
47 changed files with 242 additions and 186 deletions

View File

@@ -69,7 +69,7 @@ public class InsecureManagementSampleActuatorApplicationTests {
// ignore;
}
@SuppressWarnings("rawtypes")
ResponseEntity<Map> entity = this.restTemplate.getForEntity("/metrics",
ResponseEntity<Map> entity = this.restTemplate.getForEntity("/application/metrics",
Map.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
@SuppressWarnings("unchecked")

View File

@@ -71,14 +71,14 @@ public class ManagementPortSampleActuatorApplicationTests {
testHome(); // makes sure some requests have been made
@SuppressWarnings("rawtypes")
ResponseEntity<Map> entity = new TestRestTemplate().getForEntity(
"http://localhost:" + this.managementPort + "/metrics", Map.class);
"http://localhost:" + this.managementPort + "/application/metrics", Map.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.UNAUTHORIZED);
}
@Test
public void testHealth() throws Exception {
ResponseEntity<String> entity = new TestRestTemplate().getForEntity(
"http://localhost:" + this.managementPort + "/health", String.class);
"http://localhost:" + this.managementPort + "/application/health", String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
assertThat(entity.getBody()).contains("\"status\":\"UP\"");
}

View File

@@ -46,7 +46,7 @@ public class NonSensitiveHealthTests {
@Test
public void testSecureHealth() throws Exception {
ResponseEntity<String> entity = this.restTemplate.getForEntity("/health",
ResponseEntity<String> entity = this.restTemplate.getForEntity("/application/health",
String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
assertThat(entity.getBody()).doesNotContain("\"hello\":1");

View File

@@ -98,7 +98,7 @@ public class SampleActuatorApplicationTests {
testHome(); // makes sure some requests have been made
@SuppressWarnings("rawtypes")
ResponseEntity<Map> entity = this.restTemplate
.withBasicAuth("user", getPassword()).getForEntity("/metrics", Map.class);
.withBasicAuth("user", getPassword()).getForEntity("/application/metrics", Map.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
@SuppressWarnings("unchecked")
Map<String, Object> body = entity.getBody();
@@ -109,7 +109,7 @@ public class SampleActuatorApplicationTests {
public void testEnv() throws Exception {
@SuppressWarnings("rawtypes")
ResponseEntity<Map> entity = this.restTemplate
.withBasicAuth("user", getPassword()).getForEntity("/env", Map.class);
.withBasicAuth("user", getPassword()).getForEntity("/application/env", Map.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
@SuppressWarnings("unchecked")
Map<String, Object> body = entity.getBody();
@@ -118,7 +118,7 @@ public class SampleActuatorApplicationTests {
@Test
public void testHealth() throws Exception {
ResponseEntity<String> entity = this.restTemplate.getForEntity("/health",
ResponseEntity<String> entity = this.restTemplate.getForEntity("/application/health",
String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
assertThat(entity.getBody()).contains("\"status\":\"UP\"");
@@ -129,14 +129,14 @@ public class SampleActuatorApplicationTests {
public void testSecureHealth() throws Exception {
ResponseEntity<String> entity = this.restTemplate
.withBasicAuth("user", getPassword())
.getForEntity("/health", String.class);
.getForEntity("/application/health", String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
assertThat(entity.getBody()).contains("\"hello\":1");
}
@Test
public void testInfo() throws Exception {
ResponseEntity<String> entity = this.restTemplate.getForEntity("/info",
ResponseEntity<String> entity = this.restTemplate.getForEntity("/application/info",
String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
assertThat(entity.getBody())
@@ -176,7 +176,7 @@ public class SampleActuatorApplicationTests {
this.restTemplate.getForEntity("/health", String.class);
@SuppressWarnings("rawtypes")
ResponseEntity<List> entity = this.restTemplate
.withBasicAuth("user", getPassword()).getForEntity("/trace", List.class);
.withBasicAuth("user", getPassword()).getForEntity("/application/trace", List.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
@SuppressWarnings("unchecked")
List<Map<String, Object>> list = entity.getBody();
@@ -189,10 +189,10 @@ public class SampleActuatorApplicationTests {
@Test
public void traceWithParameterMap() throws Exception {
this.restTemplate.getForEntity("/health?param1=value1", String.class);
this.restTemplate.getForEntity("/application/health?param1=value1", String.class);
@SuppressWarnings("rawtypes")
ResponseEntity<List> entity = this.restTemplate
.withBasicAuth("user", getPassword()).getForEntity("/trace", List.class);
.withBasicAuth("user", getPassword()).getForEntity("/application/trace", List.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
@SuppressWarnings("unchecked")
List<Map<String, Object>> list = entity.getBody();
@@ -219,7 +219,7 @@ public class SampleActuatorApplicationTests {
public void testBeans() throws Exception {
@SuppressWarnings("rawtypes")
ResponseEntity<List> entity = this.restTemplate
.withBasicAuth("user", getPassword()).getForEntity("/beans", List.class);
.withBasicAuth("user", getPassword()).getForEntity("/application/beans", List.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
assertThat(entity.getBody()).hasSize(1);
Map<String, Object> body = (Map<String, Object>) entity.getBody().get(0);
@@ -231,7 +231,7 @@ public class SampleActuatorApplicationTests {
@SuppressWarnings("rawtypes")
ResponseEntity<Map> entity = this.restTemplate
.withBasicAuth("user", getPassword())
.getForEntity("/configprops", Map.class);
.getForEntity("/application/configprops", Map.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
@SuppressWarnings("unchecked")
Map<String, Object> body = entity.getBody();

View File

@@ -62,7 +62,7 @@ public class ServletPathInsecureSampleActuatorApplicationTests {
@Test
public void testMetricsIsSecure() throws Exception {
@SuppressWarnings("rawtypes")
ResponseEntity<Map> entity = this.restTemplate.getForEntity("/spring/metrics",
ResponseEntity<Map> entity = this.restTemplate.getForEntity("/spring//application/metrics",
Map.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.UNAUTHORIZED);
}

View File

@@ -60,7 +60,7 @@ public class ServletPathSampleActuatorApplicationTests {
@Test
public void testHealth() throws Exception {
ResponseEntity<String> entity = this.restTemplate.getForEntity("/spring/health",
ResponseEntity<String> entity = this.restTemplate.getForEntity("/spring//application/health",
String.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
assertThat(entity.getBody()).contains("\"status\":\"UP\"");

View File

@@ -65,7 +65,7 @@ public class ShutdownSampleActuatorApplicationTests {
@SuppressWarnings("rawtypes")
ResponseEntity<Map> entity = this.restTemplate
.withBasicAuth("user", getPassword())
.postForEntity("/shutdown", null, Map.class);
.postForEntity("/application/shutdown", null, Map.class);
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
@SuppressWarnings("unchecked")
Map<String, Object> body = entity.getBody();