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

项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:EndpointAutoConfigurationTests.java   
@Test
public void testInfoEndpointOrdering() throws Exception {
    this.context = new AnnotationConfigApplicationContext();
    EnvironmentTestUtils.addEnvironment(this.context, "info.name:foo");
    this.context.register(CustomInfoContributorsConfig.class,
            ProjectInfoAutoConfiguration.class,
            InfoContributorAutoConfiguration.class, EndpointAutoConfiguration.class);
    this.context.refresh();

    InfoEndpoint endpoint = this.context.getBean(InfoEndpoint.class);
    Map<String, Object> info = endpoint.invoke();
    assertThat(info).isNotNull();
    assertThat(info.get("name")).isEqualTo("foo");
    assertThat(info.get("version")).isEqualTo("1.0");
    Object git = info.get("git");
    assertThat(git).isInstanceOf(Map.class);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:MvcEndpointPathConfigurationTests.java   
@Parameters(name = "{0}")
public static Object[] parameters() {
    return new Object[] { new Object[] { "actuator", HalJsonMvcEndpoint.class },
            new Object[] { "autoconfig", AutoConfigurationReportEndpoint.class },
            new Object[] { "beans", BeansEndpoint.class },
            new Object[] { "configprops",
                    ConfigurationPropertiesReportEndpoint.class },
            new Object[] { "docs", DocsMvcEndpoint.class },
            new Object[] { "dump", DumpEndpoint.class },
            new Object[] { "env", EnvironmentMvcEndpoint.class },
            new Object[] { "flyway", FlywayEndpoint.class },
            new Object[] { "health", HealthMvcEndpoint.class },
            new Object[] { "info", InfoEndpoint.class },
            new Object[] { "jolokia", JolokiaMvcEndpoint.class },
            new Object[] { "liquibase", LiquibaseEndpoint.class },
            new Object[] { "logfile", LogFileMvcEndpoint.class },
            new Object[] { "mappings", RequestMappingEndpoint.class },
            new Object[] { "metrics", MetricsMvcEndpoint.class },
            new Object[] { "shutdown", ShutdownEndpoint.class },
            new Object[] { "trace", TraceEndpoint.class } };
}
项目:spring-boot-concourse    文件:EndpointAutoConfigurationTests.java   
@Test
public void testInfoEndpointOrdering() throws Exception {
    this.context = new AnnotationConfigApplicationContext();
    EnvironmentTestUtils.addEnvironment(this.context, "info.name:foo");
    this.context.register(CustomInfoContributorsConfig.class,
            ProjectInfoAutoConfiguration.class,
            InfoContributorAutoConfiguration.class, EndpointAutoConfiguration.class);
    this.context.refresh();

    InfoEndpoint endpoint = this.context.getBean(InfoEndpoint.class);
    Map<String, Object> info = endpoint.invoke();
    assertThat(info).isNotNull();
    assertThat(info.get("name")).isEqualTo("foo");
    assertThat(info.get("version")).isEqualTo("1.0");
    Object git = info.get("git");
    assertThat(git).isInstanceOf(Map.class);
}
项目:spring-boot-concourse    文件:MvcEndpointPathConfigurationTests.java   
@Parameters(name = "{0}")
public static Object[] parameters() {
    return new Object[] { new Object[] { "actuator", HalJsonMvcEndpoint.class },
            new Object[] { "autoconfig", AutoConfigurationReportEndpoint.class },
            new Object[] { "beans", BeansEndpoint.class },
            new Object[] { "configprops",
                    ConfigurationPropertiesReportEndpoint.class },
            new Object[] { "docs", DocsMvcEndpoint.class },
            new Object[] { "dump", DumpEndpoint.class },
            new Object[] { "env", EnvironmentMvcEndpoint.class },
            new Object[] { "flyway", FlywayEndpoint.class },
            new Object[] { "health", HealthMvcEndpoint.class },
            new Object[] { "info", InfoEndpoint.class },
            new Object[] { "jolokia", JolokiaMvcEndpoint.class },
            new Object[] { "liquibase", LiquibaseEndpoint.class },
            new Object[] { "logfile", LogFileMvcEndpoint.class },
            new Object[] { "mappings", RequestMappingEndpoint.class },
            new Object[] { "metrics", MetricsMvcEndpoint.class },
            new Object[] { "shutdown", ShutdownEndpoint.class },
            new Object[] { "trace", TraceEndpoint.class } };
}
项目:booties    文件:ExtInfoEndpointConfiguration.java   
@Bean
public InfoEndpoint infoEndpoint() throws Exception {
    LinkedHashMap<String, Object> info = new LinkedHashMap<String, Object>();
    for (String filename : getAllPropertiesFiles()) {
        Resource resource = new ClassPathResource("/" + filename);
        Properties properties = new Properties();
        if (resource.exists()) {
            properties = PropertiesLoaderUtils.loadProperties(resource);
            String name = resource.getFilename();

            info.put(name.replace(PROPERTIES_SUFFIX, PROPERTIES_SUFFIX_REPLACEMENT), Maps.fromProperties(properties));
        } else {
            if (failWhenResourceNotExists()) {
                throw new RuntimeException("Resource : " + filename + " does not exist");
            } else {
                log.info("Resource {} does not exist", filename);
            }
        }
    }
    return new InfoEndpoint(info);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:EndpointAutoConfigurationTests.java   
@Test
public void endpoints() throws Exception {
    load(EndpointAutoConfiguration.class);
    assertThat(this.context.getBean(BeansEndpoint.class)).isNotNull();
    assertThat(this.context.getBean(DumpEndpoint.class)).isNotNull();
    assertThat(this.context.getBean(EnvironmentEndpoint.class)).isNotNull();
    assertThat(this.context.getBean(HealthEndpoint.class)).isNotNull();
    assertThat(this.context.getBean(InfoEndpoint.class)).isNotNull();
    assertThat(this.context.getBean(MetricsEndpoint.class)).isNotNull();
    assertThat(this.context.getBean(ShutdownEndpoint.class)).isNotNull();
    assertThat(this.context.getBean(TraceEndpoint.class)).isNotNull();
    assertThat(this.context.getBean(RequestMappingEndpoint.class)).isNotNull();
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:EndpointAutoConfigurationTests.java   
@Test
public void testInfoEndpoint() throws Exception {
    this.context = new AnnotationConfigApplicationContext();
    EnvironmentTestUtils.addEnvironment(this.context, "info.foo:bar");
    this.context.register(ProjectInfoAutoConfiguration.class,
            InfoContributorAutoConfiguration.class, EndpointAutoConfiguration.class);
    this.context.refresh();

    InfoEndpoint endpoint = this.context.getBean(InfoEndpoint.class);
    assertThat(endpoint).isNotNull();
    assertThat(endpoint.invoke().get("git")).isNotNull();
    assertThat(endpoint.invoke().get("foo")).isEqualTo("bar");
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:EndpointAutoConfigurationTests.java   
@Test
public void testInfoEndpointNoGitProperties() throws Exception {
    this.context = new AnnotationConfigApplicationContext();
    EnvironmentTestUtils.addEnvironment(this.context,
            "spring.info.git.location:classpath:nonexistent");
    this.context.register(InfoContributorAutoConfiguration.class,
            EndpointAutoConfiguration.class);
    this.context.refresh();
    InfoEndpoint endpoint = this.context.getBean(InfoEndpoint.class);
    assertThat(endpoint).isNotNull();
    assertThat(endpoint.invoke().get("git")).isNull();
}
项目:spring-boot-concourse    文件:EndpointAutoConfigurationTests.java   
@Test
public void endpoints() throws Exception {
    load(EndpointAutoConfiguration.class);
    assertThat(this.context.getBean(BeansEndpoint.class)).isNotNull();
    assertThat(this.context.getBean(DumpEndpoint.class)).isNotNull();
    assertThat(this.context.getBean(EnvironmentEndpoint.class)).isNotNull();
    assertThat(this.context.getBean(HealthEndpoint.class)).isNotNull();
    assertThat(this.context.getBean(InfoEndpoint.class)).isNotNull();
    assertThat(this.context.getBean(MetricsEndpoint.class)).isNotNull();
    assertThat(this.context.getBean(ShutdownEndpoint.class)).isNotNull();
    assertThat(this.context.getBean(TraceEndpoint.class)).isNotNull();
    assertThat(this.context.getBean(RequestMappingEndpoint.class)).isNotNull();
}
项目:spring-boot-concourse    文件:EndpointAutoConfigurationTests.java   
@Test
public void testInfoEndpoint() throws Exception {
    this.context = new AnnotationConfigApplicationContext();
    EnvironmentTestUtils.addEnvironment(this.context, "info.foo:bar");
    this.context.register(ProjectInfoAutoConfiguration.class,
            InfoContributorAutoConfiguration.class, EndpointAutoConfiguration.class);
    this.context.refresh();

    InfoEndpoint endpoint = this.context.getBean(InfoEndpoint.class);
    assertThat(endpoint).isNotNull();
    assertThat(endpoint.invoke().get("git")).isNotNull();
    assertThat(endpoint.invoke().get("foo")).isEqualTo("bar");
}
项目:spring-boot-concourse    文件:EndpointAutoConfigurationTests.java   
@Test
public void testInfoEndpointNoGitProperties() throws Exception {
    this.context = new AnnotationConfigApplicationContext();
    EnvironmentTestUtils.addEnvironment(this.context,
            "spring.info.git.location:classpath:nonexistent");
    this.context.register(InfoContributorAutoConfiguration.class,
            EndpointAutoConfiguration.class);
    this.context.refresh();
    InfoEndpoint endpoint = this.context.getBean(InfoEndpoint.class);
    assertThat(endpoint).isNotNull();
    assertThat(endpoint.invoke().get("git")).isNull();
}
项目:contestparser    文件:EndpointAutoConfiguration.java   
@Bean
@ConditionalOnMissingBean
public InfoEndpoint infoEndpoint() throws Exception {
    LinkedHashMap<String, Object> info = new LinkedHashMap<String, Object>();
    info.putAll(this.properties.infoMap());
    GitInfo gitInfo = this.properties.gitInfo();
    if (gitInfo.getBranch() != null) {
        info.put("git", gitInfo);
    }
    return new InfoEndpoint(info);
}
项目:contestparser    文件:EndpointAutoConfigurationTests.java   
@Test
public void endpoints() throws Exception {
    load(EndpointAutoConfiguration.class);
    assertNotNull(this.context.getBean(BeansEndpoint.class));
    assertNotNull(this.context.getBean(DumpEndpoint.class));
    assertNotNull(this.context.getBean(EnvironmentEndpoint.class));
    assertNotNull(this.context.getBean(HealthEndpoint.class));
    assertNotNull(this.context.getBean(InfoEndpoint.class));
    assertNotNull(this.context.getBean(MetricsEndpoint.class));
    assertNotNull(this.context.getBean(ShutdownEndpoint.class));
    assertNotNull(this.context.getBean(TraceEndpoint.class));
    assertNotNull(this.context.getBean(RequestMappingEndpoint.class));
}
项目:contestparser    文件:EndpointAutoConfigurationTests.java   
@Test
public void testInfoEndpointConfiguration() throws Exception {
    this.context = new AnnotationConfigApplicationContext();
    EnvironmentTestUtils.addEnvironment(this.context, "info.foo:bar");
    this.context.register(EndpointAutoConfiguration.class);
    this.context.refresh();
    InfoEndpoint endpoint = this.context.getBean(InfoEndpoint.class);
    assertNotNull(endpoint);
    assertNotNull(endpoint.invoke().get("git"));
    assertEquals("bar", endpoint.invoke().get("foo"));
}
项目:contestparser    文件:EndpointAutoConfigurationTests.java   
@Test
public void testNoGitProperties() throws Exception {
    this.context = new AnnotationConfigApplicationContext();
    EnvironmentTestUtils.addEnvironment(this.context,
            "spring.git.properties:classpath:nonexistent");
    this.context.register(EndpointAutoConfiguration.class);
    this.context.refresh();
    InfoEndpoint endpoint = this.context.getBean(InfoEndpoint.class);
    assertNotNull(endpoint);
    assertNull(endpoint.invoke().get("git"));
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:EndpointAutoConfiguration.java   
@Bean
@ConditionalOnMissingBean
public InfoEndpoint infoEndpoint() throws Exception {
    return new InfoEndpoint(this.infoContributors == null
            ? Collections.<InfoContributor>emptyList() : this.infoContributors);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:InfoMvcEndpointTests.java   
@Before
public void setUp() {
    this.context.getBean(InfoEndpoint.class).setEnabled(true);
    this.mvc = MockMvcBuilders.webAppContextSetup(this.context).build();
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:InfoMvcEndpointTests.java   
@Bean
public InfoEndpoint endpoint() {
    return new InfoEndpoint(Arrays.asList(beanName1(), beanName2()));
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:InfoMvcEndpointWithNoInfoContributorsTests.java   
@Before
public void setUp() {
    this.context.getBean(InfoEndpoint.class).setEnabled(true);
    this.mvc = MockMvcBuilders.webAppContextSetup(this.context).build();
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:InfoMvcEndpointWithNoInfoContributorsTests.java   
@Bean
public InfoEndpoint endpoint() {
    return new InfoEndpoint(Collections.<InfoContributor>emptyList());
}
项目:spring-boot-concourse    文件:EndpointAutoConfiguration.java   
@Bean
@ConditionalOnMissingBean
public InfoEndpoint infoEndpoint() throws Exception {
    return new InfoEndpoint(this.infoContributors == null
            ? Collections.<InfoContributor>emptyList() : this.infoContributors);
}
项目:spring-boot-concourse    文件:InfoMvcEndpointTests.java   
@Before
public void setUp() {
    this.context.getBean(InfoEndpoint.class).setEnabled(true);
    this.mvc = MockMvcBuilders.webAppContextSetup(this.context).build();
}
项目:spring-boot-concourse    文件:InfoMvcEndpointTests.java   
@Bean
public InfoEndpoint endpoint() {
    return new InfoEndpoint(Arrays.asList(beanName1(), beanName2()));
}
项目:spring-boot-concourse    文件:InfoMvcEndpointWithNoInfoContributorsTests.java   
@Before
public void setUp() {
    this.context.getBean(InfoEndpoint.class).setEnabled(true);
    this.mvc = MockMvcBuilders.webAppContextSetup(this.context).build();
}
项目:spring-boot-concourse    文件:InfoMvcEndpointWithNoInfoContributorsTests.java   
@Bean
public InfoEndpoint endpoint() {
    return new InfoEndpoint(Collections.<InfoContributor>emptyList());
}
项目:iris    文件:ActuatorConfig.java   
@Bean
@Autowired
public EndpointMvcAdapter infoMvcEndPoint(InfoEndpoint delegate) {

    return new EndpointMvcAdapter(delegate);
}