当前位置: 首页>>代码示例>>Java>>正文


Java HealthAggregator类代码示例

本文整理汇总了Java中org.springframework.boot.actuate.health.HealthAggregator的典型用法代码示例。如果您正苦于以下问题:Java HealthAggregator类的具体用法?Java HealthAggregator怎么用?Java HealthAggregator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


HealthAggregator类属于org.springframework.boot.actuate.health包,在下文中一共展示了HealthAggregator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: downWithExceptionHandling

import org.springframework.boot.actuate.health.HealthAggregator; //导入依赖的package包/类
@Test
public void downWithExceptionHandling() throws Exception {

    HealthAggregator healthAggregator = mock(HealthAggregator.class);
    ApplicationAliveIndicator healthIndicator = mock(ApplicationAliveIndicator.class);
    when(healthIndicator.health()).thenThrow(new RuntimeException("fooException"));
    Map<String, ApplicationAliveIndicator> healthIndicators = new LinkedHashMap<>();
    healthIndicators.put("foo", healthIndicator);

    when(applicationContext.getBeansOfType(ApplicationAliveIndicator.class)).thenReturn(healthIndicators);


    extendedHealthEndpoint = new AliveHealthEndpoint("healthIndicatorfoo", healthAggregator);
    extendedHealthEndpoint.setApplicationContext(applicationContext);

    this.extendedHealthMvcEndpoint = new ExtendedHealthMvcEndpoint(this.extendedHealthEndpoint);

    ResponseEntity<Health> result = (ResponseEntity<Health>) this.extendedHealthMvcEndpoint.invoke(null);

    Map<String, Object> expectedHealthDetails = new LinkedHashMap<>();
    expectedHealthDetails.put("error", "java.lang.RuntimeException: fooException");
    assertThat(result.getBody().getDetails(), is(expectedHealthDetails));
    assertThat(result.getStatusCode(), is(HttpStatus.SERVICE_UNAVAILABLE));
    assertThat(result.getBody().getStatus(), is(Status.DOWN));
}
 
开发者ID:dm-drogeriemarkt,项目名称:extended-actuator-health-endpoints,代码行数:26,代码来源:ExtendedHealthMvcEndpointUnitTest.java

示例2: HealthService

import org.springframework.boot.actuate.health.HealthAggregator; //导入依赖的package包/类
public HealthService(HealthAggregator healthAggregator, Map<String, org.springframework.boot.actuate.health.HealthIndicator> healthIndicators) {
    Assert.notNull(healthAggregator, "HealthAggregator must not be null");
    Assert.notNull(healthIndicators, "HealthIndicators must not be null");
    CompositeHealthIndicator healthIndicator = new CompositeHealthIndicator(
        healthAggregator);
    for (Map.Entry<String, org.springframework.boot.actuate.health.HealthIndicator> entry : healthIndicators.entrySet()) {
        healthIndicator.addHealthIndicator(getKey(entry.getKey()), entry.getValue());
    }
    this.healthIndicators = healthIndicators;
    this.healthIndicator = healthIndicator;
}
 
开发者ID:cbornet,项目名称:generator-jhipster-grpc,代码行数:12,代码来源:_HealthService.java

示例3: EndpointAutoConfiguration

import org.springframework.boot.actuate.health.HealthAggregator; //导入依赖的package包/类
public EndpointAutoConfiguration(
		ObjectProvider<HealthAggregator> healthAggregatorProvider,
		ObjectProvider<Map<String, HealthIndicator>> healthIndicatorsProvider,
		ObjectProvider<List<InfoContributor>> infoContributorsProvider,
		ObjectProvider<Collection<PublicMetrics>> publicMetricsProvider,
		ObjectProvider<TraceRepository> traceRepositoryProvider) {
	this.healthAggregator = healthAggregatorProvider.getIfAvailable();
	this.healthIndicators = healthIndicatorsProvider.getIfAvailable();
	this.infoContributors = infoContributorsProvider.getIfAvailable();
	this.publicMetrics = publicMetricsProvider.getIfAvailable();
	this.traceRepository = traceRepositoryProvider.getIfAvailable();
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:13,代码来源:EndpointAutoConfiguration.java

示例4: HealthEndpoint

import org.springframework.boot.actuate.health.HealthAggregator; //导入依赖的package包/类
/**
 * Create a new {@link HealthIndicator} instance.
 * @param healthAggregator the health aggregator
 * @param healthIndicators the health indicators
 */
public HealthEndpoint(HealthAggregator healthAggregator,
		Map<String, HealthIndicator> healthIndicators) {
	super("health", false);
	Assert.notNull(healthAggregator, "HealthAggregator must not be null");
	Assert.notNull(healthIndicators, "HealthIndicators must not be null");
	CompositeHealthIndicator healthIndicator = new CompositeHealthIndicator(
			healthAggregator);
	for (Map.Entry<String, HealthIndicator> entry : healthIndicators.entrySet()) {
		healthIndicator.addHealthIndicator(getKey(entry.getKey()), entry.getValue());
	}
	this.healthIndicator = healthIndicator;
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:18,代码来源:HealthEndpoint.java

示例5: PrometheusEndpoint

import org.springframework.boot.actuate.health.HealthAggregator; //导入依赖的package包/类
public PrometheusEndpoint(Collection<PublicMetrics> publicMetrics,
		PrometeusMetricNameConverter prometeusMetricNameConverter, Map<String, HealthIndicator> healthIndicators,
		HealthAggregator healthAggregator) {
	super("prometheus", false, true);
	this.publicMetrics = publicMetrics;
	this.prometeusMetricNameConverter = prometeusMetricNameConverter;
	this.healthIndicators = healthIndicators;
	this.healthAggregator = healthAggregator;

}
 
开发者ID:akaGelo,项目名称:spring-boot-starter-prometheus,代码行数:11,代码来源:PrometheusEndpoint.java

示例6: prometheusEndpoint

import org.springframework.boot.actuate.health.HealthAggregator; //导入依赖的package包/类
@Bean
@ConditionalOnMissingBean
@Autowired
public PrometheusEndpoint prometheusEndpoint(Collection<PublicMetrics> publicMetrics,
		PrometeusMetricNameConverter prometeusMetricNameConverter, Map<String, HealthIndicator> healthIndicators,
		HealthAggregator healthAggregator) {

	return new PrometheusEndpoint(publicMetrics, prometeusMetricNameConverter, healthIndicators, healthAggregator);
}
 
开发者ID:akaGelo,项目名称:spring-boot-starter-prometheus,代码行数:10,代码来源:PrometheusEndpointConfiguration.java

示例7: DiscoveryCompositeHealthIndicator

import org.springframework.boot.actuate.health.HealthAggregator; //导入依赖的package包/类
@Autowired
public DiscoveryCompositeHealthIndicator(HealthAggregator healthAggregator,
		List<DiscoveryHealthIndicator> indicators) {
	super(healthAggregator);
	for (DiscoveryHealthIndicator indicator : indicators) {
		Holder holder = new Holder(indicator);
		addHealthIndicator(indicator.getName(), holder);
		healthIndicators.add(holder);
	}
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-commons,代码行数:11,代码来源:DiscoveryCompositeHealthIndicator.java

示例8: discoveryCompositeHealthIndicator

import org.springframework.boot.actuate.health.HealthAggregator; //导入依赖的package包/类
@Bean
@ConditionalOnProperty(value = "spring.cloud.discovery.client.composite-indicator.enabled", matchIfMissing = true)
@ConditionalOnBean(DiscoveryHealthIndicator.class)
public DiscoveryCompositeHealthIndicator discoveryCompositeHealthIndicator(
		HealthAggregator aggregator, List<DiscoveryHealthIndicator> indicators) {
	return new DiscoveryCompositeHealthIndicator(aggregator, indicators);
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-commons,代码行数:8,代码来源:CommonsClientAutoConfiguration.java

示例9: SVNHealthIndicator

import org.springframework.boot.actuate.health.HealthAggregator; //导入依赖的package包/类
@Autowired
public SVNHealthIndicator(ConfigurationService<SVNConfiguration> configurationService, SecurityService securityService, HealthAggregator healthAggregator, SVNService svnService, TransactionService transactionService, SVNClient svnClient) {
    super(configurationService, securityService, healthAggregator);
    this.svnService = svnService;
    this.transactionService = transactionService;
    this.svnClient = svnClient;
}
 
开发者ID:nemerosa,项目名称:ontrack,代码行数:8,代码来源:SVNHealthIndicator.java

示例10: GitHubHealthIndicator

import org.springframework.boot.actuate.health.HealthAggregator; //导入依赖的package包/类
@Autowired
public GitHubHealthIndicator(
        ConfigurationService<GitHubEngineConfiguration> configurationService,
        SecurityService securityService,
        HealthAggregator healthAggregator,
        OntrackGitHubClientFactory gitHubClientFactory) {
    super(configurationService, securityService, healthAggregator);
    this.gitHubClientFactory = gitHubClientFactory;
}
 
开发者ID:nemerosa,项目名称:ontrack,代码行数:10,代码来源:GitHubHealthIndicator.java

示例11: GitLabHealthIndicator

import org.springframework.boot.actuate.health.HealthAggregator; //导入依赖的package包/类
@Autowired
public GitLabHealthIndicator(
        ConfigurationService<GitLabConfiguration> configurationService,
        SecurityService securityService,
        HealthAggregator healthAggregator,
        OntrackGitLabClientFactory gitLabClientFactory) {
    super(configurationService, securityService, healthAggregator);
    this.gitLabClientFactory = gitLabClientFactory;
}
 
开发者ID:nemerosa,项目名称:ontrack,代码行数:10,代码来源:GitLabHealthIndicator.java

示例12: zipkinHealthIndicator

import org.springframework.boot.actuate.health.HealthAggregator; //导入依赖的package包/类
/** Registers health for any components, even those not in this jar. */
@Bean ZipkinHealthIndicator zipkinHealthIndicator(HealthAggregator healthAggregator) {
  return new ZipkinHealthIndicator(healthAggregator);
}
 
开发者ID:liaominghua,项目名称:zipkin,代码行数:5,代码来源:ZipkinServerConfiguration.java

示例13: ZipkinHealthIndicator

import org.springframework.boot.actuate.health.HealthAggregator; //导入依赖的package包/类
ZipkinHealthIndicator(HealthAggregator healthAggregator) {
  super(healthAggregator);
}
 
开发者ID:liaominghua,项目名称:zipkin,代码行数:4,代码来源:ZipkinHealthIndicator.java

示例14: endpoint

import org.springframework.boot.actuate.health.HealthAggregator; //导入依赖的package包/类
@Bean
public HealthEndpoint endpoint(HealthAggregator healthAggregator,
		Map<String, HealthIndicator> healthIndicators) {
	return new HealthEndpoint(healthAggregator, healthIndicators);
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:6,代码来源:HealthEndpointTests.java

示例15: healthAggregator

import org.springframework.boot.actuate.health.HealthAggregator; //导入依赖的package包/类
@Bean
public HealthAggregator healthAggregator() {
	return new OrderedHealthAggregator();
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:5,代码来源:HealthEndpointTests.java


注:本文中的org.springframework.boot.actuate.health.HealthAggregator类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。