From f8a4459aa1b4d013c6f3740c94fe40e117ed8ebd Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Tue, 3 May 2016 15:13:22 +0100 Subject: [PATCH] Ensure that logfile endpoint documentation has some log entries to use Closes gh-5848 --- spring-boot-actuator-docs/pom.xml | 2 +- .../boot/actuate/hypermedia/EndpointDocumentation.java | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/spring-boot-actuator-docs/pom.xml b/spring-boot-actuator-docs/pom.xml index 6ef2498e110..12927fbc862 100644 --- a/spring-boot-actuator-docs/pom.xml +++ b/spring-boot-actuator-docs/pom.xml @@ -21,7 +21,7 @@ org.springframework.boot - spring-boot-actuator + spring-boot-starter-actuator provided diff --git a/spring-boot-actuator-docs/src/restdoc/java/org/springframework/boot/actuate/hypermedia/EndpointDocumentation.java b/spring-boot-actuator-docs/src/restdoc/java/org/springframework/boot/actuate/hypermedia/EndpointDocumentation.java index 25f03fb4275..a3fb1650c77 100644 --- a/spring-boot-actuator-docs/src/restdoc/java/org/springframework/boot/actuate/hypermedia/EndpointDocumentation.java +++ b/spring-boot-actuator-docs/src/restdoc/java/org/springframework/boot/actuate/hypermedia/EndpointDocumentation.java @@ -28,6 +28,7 @@ import java.util.Map; import groovy.text.Template; import groovy.text.TemplateEngine; +import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; @@ -60,7 +61,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. "endpoints.health.sensitive=true", "endpoints.actuator.enabled=false" }) @DirtiesContext @AutoConfigureRestDocs(EndpointDocumentation.RESTDOCS_OUTPUT_DIR) -@AutoConfigureMockMvc +@AutoConfigureMockMvc(alwaysPrint = false) public class EndpointDocumentation { static final String RESTDOCS_OUTPUT_DIR = "target/generated-snippets"; @@ -74,6 +75,11 @@ public class EndpointDocumentation { @Autowired private MockMvc mockMvc; + @BeforeClass + public static void clearLog() { + new File("target/logs/spring.log").delete(); + } + @Test public void logfile() throws Exception { this.mockMvc.perform(get("/logfile").accept(MediaType.TEXT_PLAIN))