@ -28,6 +28,7 @@ import org.springframework.boot.actuate.info.GitInfoContributor;
@@ -28,6 +28,7 @@ import org.springframework.boot.actuate.info.GitInfoContributor;
import org.springframework.boot.actuate.info.InfoContributor ;
import org.springframework.boot.actuate.info.InfoEndpoint ;
import org.springframework.boot.actuate.info.OsInfoContributor ;
import org.springframework.boot.actuate.info.ProcessInfoContributor ;
import org.springframework.boot.info.BuildProperties ;
import org.springframework.boot.info.GitProperties ;
import org.springframework.context.annotation.Bean ;
@ -50,9 +51,16 @@ import static org.springframework.restdocs.payload.PayloadDocumentation.response
@@ -50,9 +51,16 @@ import static org.springframework.restdocs.payload.PayloadDocumentation.response
class InfoEndpointDocumentationTests extends MockMvcEndpointDocumentationTests {
@Test
< < < < < < < HEAD
void info ( ) {
assertThat ( this . mvc . get ( ) . uri ( "/actuator/info" ) ) . hasStatusOk ( )
. apply ( MockMvcRestDocumentation . document ( "info" , gitInfo ( ) , buildInfo ( ) , osInfo ( ) ) ) ;
= = = = = = =
void info ( ) throws Exception {
this . mockMvc . perform ( get ( "/actuator/info" ) )
. andExpect ( status ( ) . isOk ( ) )
. andDo ( MockMvcRestDocumentation . document ( "info" , gitInfo ( ) , buildInfo ( ) , osInfo ( ) , processInfo ( ) ) ) ;
> > > > > > > 3 . 3 . x
}
private ResponseFieldsSnippet gitInfo ( ) {
@ -88,6 +96,15 @@ class InfoEndpointDocumentationTests extends MockMvcEndpointDocumentationTests {
@@ -88,6 +96,15 @@ class InfoEndpointDocumentationTests extends MockMvcEndpointDocumentationTests {
. optional ( ) ;
}
private ResponseFieldsSnippet processInfo ( ) {
return responseFields ( beneathPath ( "process" ) ,
fieldWithPath ( "pid" ) . description ( "Process ID." ) . type ( JsonFieldType . NUMBER ) ,
fieldWithPath ( "parentPid" ) . description ( "Parent Process ID (or -1)." ) . type ( JsonFieldType . NUMBER ) ,
fieldWithPath ( "owner" ) . description ( "Process owner." ) . type ( JsonFieldType . STRING ) ,
fieldWithPath ( "cpus" ) . description ( "Number of CPUs available to the process." )
. type ( JsonFieldType . NUMBER ) ) ;
}
@Configuration ( proxyBeanMethods = false )
static class TestConfiguration {
@ -122,6 +139,11 @@ class InfoEndpointDocumentationTests extends MockMvcEndpointDocumentationTests {
@@ -122,6 +139,11 @@ class InfoEndpointDocumentationTests extends MockMvcEndpointDocumentationTests {
return new OsInfoContributor ( ) ;
}
@Bean
ProcessInfoContributor processInfoContributor ( ) {
return new ProcessInfoContributor ( ) ;
}
}
}