Commit f916e1a1 authored by Andy Wilkinson's avatar Andy Wilkinson

Document response structure for retrieving a logger group

Closes gh-17909
parent 3bc65f4f
...@@ -72,6 +72,17 @@ include::{snippets}loggers/group/http-response.adoc[] ...@@ -72,6 +72,17 @@ include::{snippets}loggers/group/http-response.adoc[]
[[loggers-group-response-structure]]
=== Response Structure
The response contains details of the requested group. The following table describes the
structure of the response:
[cols="3,1,3"]
include::{snippets}loggers/group/response-fields.adoc[]
[[loggers-setting-level]] [[loggers-setting-level]]
== Setting a Log Level == Setting a Log Level
......
...@@ -37,6 +37,7 @@ import org.springframework.context.annotation.Import; ...@@ -37,6 +37,7 @@ import org.springframework.context.annotation.Import;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.restdocs.mockmvc.MockMvcRestDocumentation; import org.springframework.restdocs.mockmvc.MockMvcRestDocumentation;
import org.springframework.restdocs.payload.FieldDescriptor; import org.springframework.restdocs.payload.FieldDescriptor;
import org.springframework.restdocs.payload.JsonFieldType;
import static org.mockito.BDDMockito.given; import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
...@@ -62,9 +63,9 @@ class LoggersEndpointDocumentationTests extends MockMvcEndpointDocumentationTest ...@@ -62,9 +63,9 @@ class LoggersEndpointDocumentationTests extends MockMvcEndpointDocumentationTest
static { static {
groupLevelFields = Arrays.asList( groupLevelFields = Arrays.asList(
fieldWithPath("configuredLevel").description("Configured level of the logger group") fieldWithPath("configuredLevel").description("Configured level of the logger group, if any.")
.type(LogLevel.class).optional(), .type(JsonFieldType.STRING).optional(),
fieldWithPath("members").description("Loggers that are part of this group").optional()); fieldWithPath("members").description("Loggers that are part of this group"));
} }
@MockBean @MockBean
...@@ -98,8 +99,11 @@ class LoggersEndpointDocumentationTests extends MockMvcEndpointDocumentationTest ...@@ -98,8 +99,11 @@ class LoggersEndpointDocumentationTests extends MockMvcEndpointDocumentationTest
@Test @Test
void loggerGroups() throws Exception { void loggerGroups() throws Exception {
this.loggerGroups.get("test").configureLogLevel(LogLevel.INFO, (member, level) -> {
});
this.mockMvc.perform(get("/actuator/loggers/test")).andExpect(status().isOk()) this.mockMvc.perform(get("/actuator/loggers/test")).andExpect(status().isOk())
.andDo(MockMvcRestDocumentation.document("loggers/group", responseFields(groupLevelFields))); .andDo(MockMvcRestDocumentation.document("loggers/group", responseFields(groupLevelFields)));
resetLogger();
} }
@Test @Test
......
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