@ -27,6 +27,7 @@ import org.springframework.boot.actuate.info.BuildInfoContributor;
@@ -27,6 +27,7 @@ import org.springframework.boot.actuate.info.BuildInfoContributor;
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.JavaInfoContributor ;
import org.springframework.boot.actuate.info.OsInfoContributor ;
import org.springframework.boot.actuate.info.ProcessInfoContributor ;
import org.springframework.boot.info.BuildProperties ;
@ -53,7 +54,8 @@ class InfoEndpointDocumentationTests extends MockMvcEndpointDocumentationTests {
@@ -53,7 +54,8 @@ class InfoEndpointDocumentationTests extends MockMvcEndpointDocumentationTests {
@Test
void info ( ) {
assertThat ( this . mvc . get ( ) . uri ( "/actuator/info" ) ) . hasStatusOk ( )
. apply ( MockMvcRestDocumentation . document ( "info" , gitInfo ( ) , buildInfo ( ) , osInfo ( ) , processInfo ( ) ) ) ;
. apply ( MockMvcRestDocumentation . document ( "info" , gitInfo ( ) , buildInfo ( ) , osInfo ( ) , processInfo ( ) ,
javaInfo ( ) ) ) ;
}
private ResponseFieldsSnippet gitInfo ( ) {
@ -111,6 +113,35 @@ class InfoEndpointDocumentationTests extends MockMvcEndpointDocumentationTests {
@@ -111,6 +113,35 @@ class InfoEndpointDocumentationTests extends MockMvcEndpointDocumentationTests {
. description ( "The maximum number of bytes that can be used by the JVM (or -1)." ) ) ;
}
private ResponseFieldsSnippet javaInfo ( ) {
return responseFields ( beneathPath ( "java" ) ,
fieldWithPath ( "version" ) . description ( "Java version, if available." )
. type ( JsonFieldType . STRING )
. optional ( ) ,
fieldWithPath ( "vendor" ) . description ( "Vendor details." ) ,
fieldWithPath ( "vendor.name" ) . description ( "Vendor name, if available." )
. type ( JsonFieldType . STRING )
. optional ( ) ,
fieldWithPath ( "vendor.version" ) . description ( "Vendor version, if available." )
. type ( JsonFieldType . STRING )
. optional ( ) ,
fieldWithPath ( "runtime" ) . description ( "Runtime details." ) ,
fieldWithPath ( "runtime.name" ) . description ( "Runtime name, if available." )
. type ( JsonFieldType . STRING )
. optional ( ) ,
fieldWithPath ( "runtime.version" ) . description ( "Runtime version, if available." )
. type ( JsonFieldType . STRING )
. optional ( ) ,
fieldWithPath ( "jvm" ) . description ( "JVM details." ) ,
fieldWithPath ( "jvm.name" ) . description ( "JVM name, if available." ) . type ( JsonFieldType . STRING ) . optional ( ) ,
fieldWithPath ( "jvm.vendor" ) . description ( "JVM vendor, if available." )
. type ( JsonFieldType . STRING )
. optional ( ) ,
fieldWithPath ( "jvm.version" ) . description ( "JVM version, if available." )
. type ( JsonFieldType . STRING )
. optional ( ) ) ;
}
@Configuration ( proxyBeanMethods = false )
static class TestConfiguration {
@ -150,6 +181,11 @@ class InfoEndpointDocumentationTests extends MockMvcEndpointDocumentationTests {
@@ -150,6 +181,11 @@ class InfoEndpointDocumentationTests extends MockMvcEndpointDocumentationTests {
return new ProcessInfoContributor ( ) ;
}
@Bean
JavaInfoContributor javaInfoContributor ( ) {
return new JavaInfoContributor ( ) ;
}
}
}