org.springframework.boot.actuate.endpoint.web.WebEndpointResponse Java Examples

The following examples show how to use org.springframework.boot.actuate.endpoint.web.WebEndpointResponse. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SimpleHttpCodeStatusMapperTest.java    From armeria with Apache License 2.0 5 votes vote down vote up
@Test
public void testGetStatusCode() {
    final SimpleHttpCodeStatusMapper mapper = new SimpleHttpCodeStatusMapper();
    assertThat(mapper.getStatusCode(Status.UNKNOWN)).isEqualTo(WebEndpointResponse.STATUS_OK);
    assertThat(mapper.getStatusCode(Status.UP)).isEqualTo(WebEndpointResponse.STATUS_OK);
    assertThat(mapper.getStatusCode(Status.DOWN)).isEqualTo(WebEndpointResponse.STATUS_SERVICE_UNAVAILABLE);
    assertThat(mapper.getStatusCode(Status.OUT_OF_SERVICE))
            .isEqualTo(WebEndpointResponse.STATUS_SERVICE_UNAVAILABLE);
}
 
Example #2
Source File: CustomEndpointWebExtension.java    From Spring-Boot-2.0-Projects with MIT License 4 votes vote down vote up
@ReadOperation
public WebEndpointResponse<String> getWeb() {
    meterRegistry.counter(CUSTOM_ENDPOINT_CALLS).increment();
    return new WebEndpointResponse<>("Custom Web Extension Hello, World!", 200);
}
 
Example #3
Source File: SimpleHttpCodeStatusMapper.java    From armeria with Apache License 2.0 4 votes vote down vote up
SimpleHttpCodeStatusMapper() {
    mappings = ImmutableMap.of(
            Status.DOWN.getCode(), WebEndpointResponse.STATUS_SERVICE_UNAVAILABLE,
            Status.OUT_OF_SERVICE.getCode(), WebEndpointResponse.STATUS_SERVICE_UNAVAILABLE
    );
}
 
Example #4
Source File: SimpleHttpCodeStatusMapper.java    From armeria with Apache License 2.0 4 votes vote down vote up
int getStatusCode(Status status) {
    return mappings.getOrDefault(status.getCode(), WebEndpointResponse.STATUS_OK);
}