Java 类org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter 实例源码

项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:RequestMappingEndpointTests.java   
@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();
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:RequestMappingEndpointTests.java   
@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();
}
项目:spring-boot-concourse    文件:RequestMappingEndpointTests.java   
@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();
}
项目:spring-boot-concourse    文件:RequestMappingEndpointTests.java   
@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();
}
项目:contestparser    文件:RequestMappingEndpointTests.java   
@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();
    assertEquals(1, result.size());
    assertTrue(result.keySet().iterator().next().contains("/dump"));
    @SuppressWarnings("unchecked")
    Map<String, Object> handler = (Map<String, Object>) result.values().iterator()
            .next();
    assertTrue(handler.containsKey("method"));
}
项目:contestparser    文件:RequestMappingEndpointTests.java   
@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();
    assertEquals(1, result.size());
    assertTrue(result.keySet().iterator().next().contains("/dump"));
    @SuppressWarnings("unchecked")
    Map<String, Object> handler = (Map<String, Object>) result.values().iterator()
            .next();
    assertTrue(handler.containsKey("method"));
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:MvcEndpointPathConfigurationTests.java   
private String getConfiguredPath() {
    if (MvcEndpoint.class.isAssignableFrom(this.endpointClass)) {
        return ((MvcEndpoint) this.context.getBean(this.endpointClass)).getPath();
    }
    for (MvcEndpoint endpoint : this.context.getBean(MvcEndpoints.class)
            .getEndpoints()) {
        if (endpoint instanceof EndpointMvcAdapter && this.endpointClass
                .isInstance(((EndpointMvcAdapter) endpoint).getDelegate())) {
            return ((EndpointMvcAdapter) endpoint).getPath();
        }
    }
    throw new IllegalStateException(
            "Could not get configured path for " + this.endpointClass);
}
项目:spring-boot-concourse    文件:MvcEndpointPathConfigurationTests.java   
private String getConfiguredPath() {
    if (MvcEndpoint.class.isAssignableFrom(this.endpointClass)) {
        return ((MvcEndpoint) this.context.getBean(this.endpointClass)).getPath();
    }
    for (MvcEndpoint endpoint : this.context.getBean(MvcEndpoints.class)
            .getEndpoints()) {
        if (endpoint instanceof EndpointMvcAdapter && this.endpointClass
                .isInstance(((EndpointMvcAdapter) endpoint).getDelegate())) {
            return ((EndpointMvcAdapter) endpoint).getPath();
        }
    }
    throw new IllegalStateException(
            "Could not get configured path for " + this.endpointClass);
}
项目:iris    文件:ActuatorConfig.java   
@Bean
@Autowired
public EndpointMvcAdapter infoMvcEndPoint(InfoEndpoint delegate) {

    return new EndpointMvcAdapter(delegate);
}