|
|
@ -98,7 +98,8 @@ public class SampleActuatorApplicationTests {
|
|
|
|
testHome(); // makes sure some requests have been made
|
|
|
|
testHome(); // makes sure some requests have been made
|
|
|
|
@SuppressWarnings("rawtypes")
|
|
|
|
@SuppressWarnings("rawtypes")
|
|
|
|
ResponseEntity<Map> entity = this.restTemplate
|
|
|
|
ResponseEntity<Map> entity = this.restTemplate
|
|
|
|
.withBasicAuth("user", getPassword()).getForEntity("/application/metrics", Map.class);
|
|
|
|
.withBasicAuth("user", getPassword())
|
|
|
|
|
|
|
|
.getForEntity("/application/metrics", Map.class);
|
|
|
|
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
|
|
|
|
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
|
Map<String, Object> body = entity.getBody();
|
|
|
|
Map<String, Object> body = entity.getBody();
|
|
|
@ -109,17 +110,18 @@ public class SampleActuatorApplicationTests {
|
|
|
|
public void testEnv() throws Exception {
|
|
|
|
public void testEnv() throws Exception {
|
|
|
|
@SuppressWarnings("rawtypes")
|
|
|
|
@SuppressWarnings("rawtypes")
|
|
|
|
ResponseEntity<Map> entity = this.restTemplate
|
|
|
|
ResponseEntity<Map> entity = this.restTemplate
|
|
|
|
.withBasicAuth("user", getPassword()).getForEntity("/application/env", Map.class);
|
|
|
|
.withBasicAuth("user", getPassword())
|
|
|
|
|
|
|
|
.getForEntity("/application/env", Map.class);
|
|
|
|
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
|
|
|
|
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
|
Map<String, Object> body = entity.getBody();
|
|
|
|
Map<String, Object> body = entity.getBody();
|
|
|
|
assertThat(body).containsKey("systemProperties");
|
|
|
|
assertThat(body).containsKey("propertySources");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void testHealth() throws Exception {
|
|
|
|
public void testHealth() throws Exception {
|
|
|
|
ResponseEntity<String> entity = this.restTemplate.getForEntity("/application/health",
|
|
|
|
ResponseEntity<String> entity = this.restTemplate
|
|
|
|
String.class);
|
|
|
|
.getForEntity("/application/health", String.class);
|
|
|
|
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
|
|
|
|
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
|
|
|
|
assertThat(entity.getBody()).contains("\"status\":\"UP\"");
|
|
|
|
assertThat(entity.getBody()).contains("\"status\":\"UP\"");
|
|
|
|
assertThat(entity.getBody()).doesNotContain("\"hello\":\"1\"");
|
|
|
|
assertThat(entity.getBody()).doesNotContain("\"hello\":\"1\"");
|
|
|
@ -136,8 +138,8 @@ public class SampleActuatorApplicationTests {
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void testInfo() throws Exception {
|
|
|
|
public void testInfo() throws Exception {
|
|
|
|
ResponseEntity<String> entity = this.restTemplate.getForEntity("/application/info",
|
|
|
|
ResponseEntity<String> entity = this.restTemplate
|
|
|
|
String.class);
|
|
|
|
.getForEntity("/application/info", String.class);
|
|
|
|
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
|
|
|
|
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
|
|
|
|
assertThat(entity.getBody())
|
|
|
|
assertThat(entity.getBody())
|
|
|
|
.contains("\"artifact\":\"spring-boot-sample-actuator\"");
|
|
|
|
.contains("\"artifact\":\"spring-boot-sample-actuator\"");
|
|
|
@ -176,7 +178,8 @@ public class SampleActuatorApplicationTests {
|
|
|
|
this.restTemplate.getForEntity("/health", String.class);
|
|
|
|
this.restTemplate.getForEntity("/health", String.class);
|
|
|
|
@SuppressWarnings("rawtypes")
|
|
|
|
@SuppressWarnings("rawtypes")
|
|
|
|
ResponseEntity<List> entity = this.restTemplate
|
|
|
|
ResponseEntity<List> entity = this.restTemplate
|
|
|
|
.withBasicAuth("user", getPassword()).getForEntity("/application/trace", List.class);
|
|
|
|
.withBasicAuth("user", getPassword())
|
|
|
|
|
|
|
|
.getForEntity("/application/trace", List.class);
|
|
|
|
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
|
|
|
|
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
|
List<Map<String, Object>> list = entity.getBody();
|
|
|
|
List<Map<String, Object>> list = entity.getBody();
|
|
|
@ -192,7 +195,8 @@ public class SampleActuatorApplicationTests {
|
|
|
|
this.restTemplate.getForEntity("/application/health?param1=value1", String.class);
|
|
|
|
this.restTemplate.getForEntity("/application/health?param1=value1", String.class);
|
|
|
|
@SuppressWarnings("rawtypes")
|
|
|
|
@SuppressWarnings("rawtypes")
|
|
|
|
ResponseEntity<List> entity = this.restTemplate
|
|
|
|
ResponseEntity<List> entity = this.restTemplate
|
|
|
|
.withBasicAuth("user", getPassword()).getForEntity("/application/trace", List.class);
|
|
|
|
.withBasicAuth("user", getPassword())
|
|
|
|
|
|
|
|
.getForEntity("/application/trace", List.class);
|
|
|
|
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
|
|
|
|
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
|
List<Map<String, Object>> list = entity.getBody();
|
|
|
|
List<Map<String, Object>> list = entity.getBody();
|
|
|
@ -219,7 +223,8 @@ public class SampleActuatorApplicationTests {
|
|
|
|
public void testBeans() throws Exception {
|
|
|
|
public void testBeans() throws Exception {
|
|
|
|
@SuppressWarnings("rawtypes")
|
|
|
|
@SuppressWarnings("rawtypes")
|
|
|
|
ResponseEntity<List> entity = this.restTemplate
|
|
|
|
ResponseEntity<List> entity = this.restTemplate
|
|
|
|
.withBasicAuth("user", getPassword()).getForEntity("/application/beans", List.class);
|
|
|
|
.withBasicAuth("user", getPassword())
|
|
|
|
|
|
|
|
.getForEntity("/application/beans", List.class);
|
|
|
|
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
|
|
|
|
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
|
|
|
|
assertThat(entity.getBody()).hasSize(1);
|
|
|
|
assertThat(entity.getBody()).hasSize(1);
|
|
|
|
Map<String, Object> body = (Map<String, Object>) entity.getBody().get(0);
|
|
|
|
Map<String, Object> body = (Map<String, Object>) entity.getBody().get(0);
|
|
|
|