use of org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter in project spring-boot by spring-projects.
the class RequestMappingEndpointTests method beanMethodMappings.
@Test
public void beanMethodMappings() {
StaticApplicationContext context = new StaticApplicationContext();
EndpointHandlerMapping mapping = new EndpointHandlerMapping(Arrays.asList(new EndpointMvcAdapter(new DumpEndpoint())));
mapping.setApplicationContext(new StaticApplicationContext());
mapping.afterPropertiesSet();
context.getDefaultListableBeanFactory().registerSingleton("mapping", mapping);
this.endpoint.setApplicationContext(context);
Map<String, Object> result = this.endpoint.invoke();
assertThat(result).hasSize(1);
assertThat(result.keySet().iterator().next().contains("/dump")).isTrue();
@SuppressWarnings("unchecked") Map<String, Object> handler = (Map<String, Object>) result.values().iterator().next();
assertThat(handler.containsKey("method")).isTrue();
}
use of org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter in project spring-boot by spring-projects.
the class RequestMappingEndpointTests method concreteMethodMappings.
@Test
public void concreteMethodMappings() {
EndpointHandlerMapping mapping = new EndpointHandlerMapping(Arrays.asList(new EndpointMvcAdapter(new DumpEndpoint())));
mapping.setApplicationContext(new StaticApplicationContext());
mapping.afterPropertiesSet();
this.endpoint.setMethodMappings(Collections.<AbstractHandlerMethodMapping<?>>singletonList(mapping));
Map<String, Object> result = this.endpoint.invoke();
assertThat(result).hasSize(1);
assertThat(result.keySet().iterator().next().contains("/dump")).isTrue();
@SuppressWarnings("unchecked") Map<String, Object> handler = (Map<String, Object>) result.values().iterator().next();
assertThat(handler.containsKey("method")).isTrue();
}
Aggregations