5252public class Issue295Test extends GrpcServerTestBase {
5353
5454
55-
5655 @ Autowired
5756 private TestRestTemplate restTemplate ;
5857
@@ -63,46 +62,4 @@ public void configPropertiesTest() throws ExecutionException, InterruptedExcepti
6362 assertEquals (HttpStatus .OK , response .getStatusCode ());
6463 }
6564
66- @ Test
67- public void actuatorGrpcTest () throws ExecutionException , InterruptedException {
68- ResponseEntity <String > response = restTemplate .getForEntity ("/actuator/grpc" , String .class );
69- assertEquals (HttpStatus .OK , response .getStatusCode ());
70- final DocumentContext json = JsonPath .parse (response .getBody (), Configuration .builder ()
71- .mappingProvider (new JacksonMappingProvider ())
72- .jsonProvider (new JacksonJsonProvider ())
73- .build ());
74- final String [] statuses = json .read ("services.*name" , new TypeRef <String []>() {});
75- assertThat (statuses ,Matchers .arrayWithSize (Matchers .greaterThan (0 )));
76- for (String s :statuses ) {
77- assertThat (s , Matchers .not (Matchers .blankOrNullString ()));
78- }
79-
80- final Integer port = json .read ("port" , Integer .class );
81- assertThat (port ,Matchers .greaterThan (0 ));
82- }
83-
84- @ Test
85- public void actuatorHealthTest () throws ExecutionException , InterruptedException {
86- ResponseEntity <String > response = restTemplate .getForEntity ("/actuator/health/grpc" , String .class );
87- assertEquals (HttpStatus .OK , response .getStatusCode ());
88-
89- final DocumentContext json = JsonPath .parse (response .getBody (), Configuration .builder ()
90- .mappingProvider (new JacksonMappingProvider ())
91- .jsonProvider (new JacksonJsonProvider ())
92- .build ());
93- final TypeRef <Set <String >> setOfString = new TypeRef <Set <String >>() {
94- };
95- final Set <String > services = json .read ("components.keys()" , setOfString );
96- assertThat (services ,Matchers .containsInAnyOrder ( super .appServicesNames ().toArray (new String []{})));
97-
98- final Set <String > statuses = json .read ("components.*status" , setOfString );
99- assertThat (statuses ,Matchers .contains (Status .UP .getCode ()));
100-
101-
102-
103- }
104-
105-
106-
107-
10865}
0 commit comments