This repository was archived by the owner on Jun 29, 2018. It is now read-only.
File tree Expand file tree Collapse file tree
spring-boot-admin-server/src
main/java/de/codecentric/boot/admin/config
test/java/de/codecentric/boot/admin/registry Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2626import org .springframework .context .annotation .Bean ;
2727import org .springframework .context .annotation .Configuration ;
2828import org .springframework .context .annotation .Import ;
29+ import org .springframework .http .HttpStatus ;
2930import org .springframework .http .converter .HttpMessageConverter ;
3031import org .springframework .http .converter .json .Jackson2ObjectMapperBuilder ;
3132import org .springframework .http .converter .json .MappingJackson2HttpMessageConverter ;
3233import org .springframework .scheduling .config .ScheduledTaskRegistrar ;
34+ import org .springframework .web .client .DefaultResponseErrorHandler ;
3335import org .springframework .web .client .RestTemplate ;
3436import org .springframework .web .servlet .config .annotation .WebMvcConfigurerAdapter ;
3537
@@ -114,8 +116,13 @@ public ApplicationIdGenerator applicationIdGenerator() {
114116 @ ConfigurationProperties ("spring.boot.admin.monitor" )
115117 public StatusUpdater statusUpdater (ApplicationStore store ) {
116118 RestTemplate template = new RestTemplate ();
117- template .getMessageConverters ().add (
118- new MappingJackson2HttpMessageConverter ());
119+ template .getMessageConverters ().add (new MappingJackson2HttpMessageConverter ());
120+ template .setErrorHandler (new DefaultResponseErrorHandler () {
121+ @ Override
122+ protected boolean hasError (HttpStatus statusCode ) {
123+ return false ;
124+ }
125+ });
119126 return new StatusUpdater (template , store );
120127 }
121128
Original file line number Diff line number Diff line change @@ -84,7 +84,7 @@ public void test_update_noBody() {
8484
8585 // HTTP != 200 - DOWN
8686 when (template .getForEntity ("health" , Map .class )).thenReturn (
87- ResponseEntity .status (500 ).<Map > body (null ));
87+ ResponseEntity .status (503 ).<Map > body (null ));
8888
8989 updater .updateStatus (Application .create ("foo" ).withId ("id" )
9090 .withHealthUrl ("health" ).build ());
You can’t perform that action at this time.
0 commit comments