Merge pull request #9227 from rokii:master

* pr/9227:
  Polish
  Display unconditional classes in auto-config endpoint
pull/9291/head
Stephane Nicoll 8 years ago
commit 4cae7eb3af

@ -20,6 +20,7 @@ import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
@ -64,7 +65,7 @@ public class AutoConfigurationReportEndpoint extends AbstractEndpoint<Report> {
/**
* Adapts {@link ConditionEvaluationReport} to a JSON friendly structure.
*/
@JsonPropertyOrder({ "positiveMatches", "negativeMatches", "exclusions" })
@JsonPropertyOrder({ "positiveMatches", "negativeMatches", "exclusions", "unconditionalClasses" })
@JsonInclude(Include.NON_EMPTY)
public static class Report {
@ -74,12 +75,15 @@ public class AutoConfigurationReportEndpoint extends AbstractEndpoint<Report> {
private final List<String> exclusions;
private final Set<String> unconditionalClasses;
private final Report parent;
public Report(ConditionEvaluationReport report) {
this.positiveMatches = new LinkedMultiValueMap<>();
this.negativeMatches = new LinkedHashMap<>();
this.exclusions = report.getExclusions();
this.unconditionalClasses = report.getUnconditionalClasses();
for (Map.Entry<String, ConditionAndOutcomes> entry : report
.getConditionAndOutcomesBySource().entrySet()) {
if (entry.getValue().isFullMatch()) {
@ -119,6 +123,10 @@ public class AutoConfigurationReportEndpoint extends AbstractEndpoint<Report> {
return this.exclusions;
}
public Set<String> getUnconditionalClasses() {
return this.unconditionalClasses;
}
public Report getParent() {
return this.parent;
}

@ -17,6 +17,7 @@
package org.springframework.boot.actuate.endpoint;
import java.util.Arrays;
import java.util.Collections;
import javax.annotation.PostConstruct;
@ -58,6 +59,7 @@ public class AutoConfigurationReportEndpointTests
Report report = getEndpointBean().invoke();
assertThat(report.getPositiveMatches()).isEmpty();
assertThat(report.getNegativeMatches()).containsKey("a");
assertThat(report.getUnconditionalClasses()).contains("b");
assertThat(report.getExclusions()).contains("com.foo.Bar");
}
@ -75,9 +77,10 @@ public class AutoConfigurationReportEndpointTests
public void setupAutoConfigurationReport() {
ConditionEvaluationReport report = ConditionEvaluationReport
.get(this.context.getBeanFactory());
report.recordEvaluationCandidates(Arrays.asList("a", "b"));
report.recordConditionEvaluation("a", mock(Condition.class),
mock(ConditionOutcome.class));
report.recordExclusions(Arrays.asList("com.foo.Bar"));
report.recordExclusions(Collections.singletonList("com.foo.Bar"));
}
@Bean

Loading…
Cancel
Save