Skip to content

Commit

Permalink
Cherry pick fixed.
Browse files Browse the repository at this point in the history
  • Loading branch information
QilongZhang authored and caojie09 committed Sep 20, 2018
1 parent 3af0686 commit c6c05e7
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ public SofaBootReadinessCheckEndpoint(String id, boolean sensitive) {
public Health invoke() {
boolean healthCheckerStatus = readinessCheckListener.getHealthCheckerStatus();
Map<String, Health> healthCheckerDetails = readinessCheckListener.getHealthCheckerDetails();

boolean healthIndicatorStatus = readinessCheckListener.getHealthIndicatorStatus();
Map<String, Health> healthIndicatorDetails = readinessCheckListener
.getHealthIndicatorDetails();

Expand All @@ -63,7 +61,7 @@ public Health invoke() {

Builder builder;
Map<String, Health> healths = new HashMap<>();
if (healthCheckerStatus && healthIndicatorStatus && afterHealthCheckCallbackStatus) {
if (healthCheckerStatus && afterHealthCheckCallbackStatus) {
builder = Health.up();
} else {
builder = Health.down();
Expand All @@ -75,6 +73,8 @@ public Health invoke() {
builder = builder.withDetail("ReadinessCheckCallback", afterHealthCheckCallbackDetails);
}
healths.put("SOFABootReadinessHealthCheckInfo", builder.build());

// HealthIndicator
healths.putAll(healthIndicatorDetails);
return this.healthAggregator.aggregate(healths);
}
Expand Down
16 changes: 16 additions & 0 deletions healthcheck-sofa-boot-starter/src/test/resources/logback.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>

<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>
%d{dd-MM-yyyy HH:mm:ss.SSS} %magenta([%thread]) %highlight(%-5level) %logger{36}.%M - %msg%n
</pattern>
</encoder>
</appender>

<root level="info">
<appender-ref ref="STDOUT"/>
</root>

</configuration>
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,5 @@ public void testInfoGetLogger() {
logger2.info("test2 info ok");

assertTrue(logger.isInfoEnabled());
assertTrue(logger.isDebugEnabled());
}
}
16 changes: 16 additions & 0 deletions infra-sofa-boot-starter/src/test/resources/logback.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>

<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>
%d{dd-MM-yyyy HH:mm:ss.SSS} %magenta([%thread]) %highlight(%-5level) %logger{36}.%M - %msg%n
</pattern>
</encoder>
</appender>

<root level="info">
<appender-ref ref="STDOUT"/>
</root>

</configuration>
2 changes: 1 addition & 1 deletion isle-sofa-boot-starter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-test</artifactId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.context.annotation.ConfigurationClassPostProcessor;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
Expand Down Expand Up @@ -54,8 +56,9 @@ private Map<String, BeanDefinition> getBeanDefinitionsForType(ConfigurableListab
Map<String, BeanDefinition> map = new HashMap<>();
for (Class type : types) {
String[] beanNamesForType = beanFactory.getBeanNamesForType(type);
List<String> beanDefinitionNames = Arrays.asList(beanFactory.getBeanDefinitionNames());
for (String beanName : beanNamesForType) {
if (notInWhiteNameList(beanName)) {
if (notInWhiteNameList(beanName) && beanDefinitionNames.contains(beanName)) {
map.put(beanName, beanFactory.getBeanDefinition(beanName));
}
}
Expand Down
16 changes: 16 additions & 0 deletions isle-sofa-boot-starter/src/test/resources/logback.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>

<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>
%d{dd-MM-yyyy HH:mm:ss.SSS} %magenta([%thread]) %highlight(%-5level) %logger{36}.%M - %msg%n
</pattern>
</encoder>
</appender>

<root level="info">
<appender-ref ref="STDOUT"/>
</root>

</configuration>
16 changes: 16 additions & 0 deletions runtime-sofa-boot-starter/src/test/resources/logback.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>

<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>
%d{dd-MM-yyyy HH:mm:ss.SSS} %magenta([%thread]) %highlight(%-5level) %logger{36}.%M - %msg%n
</pattern>
</encoder>
</appender>

<root level="info">
<appender-ref ref="STDOUT"/>
</root>

</configuration>

0 comments on commit c6c05e7

Please sign in to comment.