|
28 | 28 | import org.springframework.boot.actuate.info.InfoContributor;
|
29 | 29 | import org.springframework.boot.actuate.info.InfoEndpoint;
|
30 | 30 | import org.springframework.boot.actuate.info.OsInfoContributor;
|
| 31 | +import org.springframework.boot.actuate.info.ProcessInfoContributor; |
31 | 32 | import org.springframework.boot.info.BuildProperties;
|
32 | 33 | import org.springframework.boot.info.GitProperties;
|
33 | 34 | import org.springframework.context.annotation.Bean;
|
|
50 | 51 | class InfoEndpointDocumentationTests extends MockMvcEndpointDocumentationTests {
|
51 | 52 |
|
52 | 53 | @Test
|
| 54 | +<<<<<<< HEAD |
53 | 55 | void info() {
|
54 | 56 | assertThat(this.mvc.get().uri("/actuator/info")).hasStatusOk()
|
55 | 57 | .apply(MockMvcRestDocumentation.document("info", gitInfo(), buildInfo(), osInfo()));
|
| 58 | +======= |
| 59 | + void info() throws Exception { |
| 60 | + this.mockMvc.perform(get("/actuator/info")) |
| 61 | + .andExpect(status().isOk()) |
| 62 | + .andDo(MockMvcRestDocumentation.document("info", gitInfo(), buildInfo(), osInfo(), processInfo())); |
| 63 | +>>>>>>> 3.3.x |
56 | 64 | }
|
57 | 65 |
|
58 | 66 | private ResponseFieldsSnippet gitInfo() {
|
@@ -88,6 +96,15 @@ private FieldDescriptor osInfoField(String field, String desc) {
|
88 | 96 | .optional();
|
89 | 97 | }
|
90 | 98 |
|
| 99 | + private ResponseFieldsSnippet processInfo() { |
| 100 | + return responseFields(beneathPath("process"), |
| 101 | + fieldWithPath("pid").description("Process ID.").type(JsonFieldType.NUMBER), |
| 102 | + fieldWithPath("parentPid").description("Parent Process ID (or -1).").type(JsonFieldType.NUMBER), |
| 103 | + fieldWithPath("owner").description("Process owner.").type(JsonFieldType.STRING), |
| 104 | + fieldWithPath("cpus").description("Number of CPUs available to the process.") |
| 105 | + .type(JsonFieldType.NUMBER)); |
| 106 | + } |
| 107 | + |
91 | 108 | @Configuration(proxyBeanMethods = false)
|
92 | 109 | static class TestConfiguration {
|
93 | 110 |
|
@@ -122,6 +139,11 @@ OsInfoContributor osInfoContributor() {
|
122 | 139 | return new OsInfoContributor();
|
123 | 140 | }
|
124 | 141 |
|
| 142 | + @Bean |
| 143 | + ProcessInfoContributor processInfoContributor() { |
| 144 | + return new ProcessInfoContributor(); |
| 145 | + } |
| 146 | + |
125 | 147 | }
|
126 | 148 |
|
127 | 149 | }
|
0 commit comments