Search in sources :

Example 1 with WebEndpointTest

use of org.springframework.boot.actuate.endpoint.web.test.WebEndpointTest in project spring-boot by spring-projects.

the class LoggersEndpointWebIntegrationTests method logLevelForLoggerWithNameThatCouldBeMistakenForAPathExtension.

@WebEndpointTest
void logLevelForLoggerWithNameThatCouldBeMistakenForAPathExtension() {
    given(this.loggingSystem.getLoggerConfiguration("com.png")).willReturn(new LoggerConfiguration("com.png", null, LogLevel.DEBUG));
    this.client.get().uri("/actuator/loggers/com.png").exchange().expectStatus().isOk().expectBody().jsonPath("$.length()").isEqualTo(2).jsonPath("configuredLevel").isEqualTo(null).jsonPath("effectiveLevel").isEqualTo("DEBUG");
}
Also used : LoggerConfiguration(org.springframework.boot.logging.LoggerConfiguration) WebEndpointTest(org.springframework.boot.actuate.endpoint.web.test.WebEndpointTest)

Example 2 with WebEndpointTest

use of org.springframework.boot.actuate.endpoint.web.test.WebEndpointTest in project spring-boot by spring-projects.

the class LoggersEndpointWebIntegrationTests method getLoggerShouldReturnLogLevels.

@WebEndpointTest
void getLoggerShouldReturnLogLevels() {
    setLogLevelToDebug("test");
    given(this.loggingSystem.getLoggerConfiguration("ROOT")).willReturn(new LoggerConfiguration("ROOT", null, LogLevel.DEBUG));
    this.client.get().uri("/actuator/loggers/ROOT").exchange().expectStatus().isOk().expectBody().jsonPath("$.length()").isEqualTo(2).jsonPath("configuredLevel").isEqualTo(null).jsonPath("effectiveLevel").isEqualTo("DEBUG");
}
Also used : LoggerConfiguration(org.springframework.boot.logging.LoggerConfiguration) WebEndpointTest(org.springframework.boot.actuate.endpoint.web.test.WebEndpointTest)

Example 3 with WebEndpointTest

use of org.springframework.boot.actuate.endpoint.web.test.WebEndpointTest in project spring-boot by spring-projects.

the class PrometheusScrapeEndpointIntegrationTests method scrapePrefersToProduceOpenMetrics100.

@WebEndpointTest
void scrapePrefersToProduceOpenMetrics100(WebTestClient client) {
    MediaType openMetrics = MediaType.parseMediaType(TextFormat.CONTENT_TYPE_OPENMETRICS_100);
    MediaType textPlain = MediaType.parseMediaType(TextFormat.CONTENT_TYPE_004);
    client.get().uri("/actuator/prometheus").accept(openMetrics, textPlain).exchange().expectStatus().isOk().expectHeader().contentType(openMetrics);
}
Also used : MediaType(org.springframework.http.MediaType) WebEndpointTest(org.springframework.boot.actuate.endpoint.web.test.WebEndpointTest)

Example 4 with WebEndpointTest

use of org.springframework.boot.actuate.endpoint.web.test.WebEndpointTest in project spring-boot by spring-projects.

the class EnvironmentEndpointWebIntegrationTests method nestedPathMatchedByRegexWhenPlaceholderCannotBeResolvedShouldReturnUnresolvedProperty.

@WebEndpointTest
void nestedPathMatchedByRegexWhenPlaceholderCannotBeResolvedShouldReturnUnresolvedProperty() {
    Map<String, Object> map = new HashMap<>();
    map.put("my.foo", "${my.bar}");
    this.context.getEnvironment().getPropertySources().addFirst(new MapPropertySource("unresolved-placeholder", map));
    this.client.get().uri("/actuator/env?pattern=my.*").exchange().expectStatus().isOk().expectBody().jsonPath("propertySources[?(@.name=='unresolved-placeholder')].properties.['my.foo'].value").isEqualTo("${my.bar}");
}
Also used : HashMap(java.util.HashMap) MapPropertySource(org.springframework.core.env.MapPropertySource) WebEndpointTest(org.springframework.boot.actuate.endpoint.web.test.WebEndpointTest)

Example 5 with WebEndpointTest

use of org.springframework.boot.actuate.endpoint.web.test.WebEndpointTest in project spring-boot by spring-projects.

the class EnvironmentEndpointWebIntegrationTests method nestedPathWithSensitivePlaceholderShouldSanitize.

@WebEndpointTest
void nestedPathWithSensitivePlaceholderShouldSanitize() {
    Map<String, Object> map = new HashMap<>();
    map.put("my.foo", "${my.password}");
    map.put("my.password", "hello");
    this.context.getEnvironment().getPropertySources().addFirst(new MapPropertySource("placeholder", map));
    this.client.get().uri("/actuator/env/my.foo").exchange().expectStatus().isOk().expectBody().jsonPath("property.value").isEqualTo("******").jsonPath(forPropertyEntry("placeholder")).isEqualTo("******");
}
Also used : HashMap(java.util.HashMap) MapPropertySource(org.springframework.core.env.MapPropertySource) WebEndpointTest(org.springframework.boot.actuate.endpoint.web.test.WebEndpointTest)

Aggregations

WebEndpointTest (org.springframework.boot.actuate.endpoint.web.test.WebEndpointTest)10 HashMap (java.util.HashMap)5 MapPropertySource (org.springframework.core.env.MapPropertySource)5 LoggerConfiguration (org.springframework.boot.logging.LoggerConfiguration)2 MediaType (org.springframework.http.MediaType)2 Cache (org.springframework.cache.Cache)1 CacheManager (org.springframework.cache.CacheManager)1 ConcurrentMapCacheManager (org.springframework.cache.concurrent.ConcurrentMapCacheManager)1