Display unconditional classes in auto-config endpoint

Closes gh-9227
pull/9291/head
Rocky Shang 8 years ago committed by Stephane Nicoll
parent 9241f63d7a
commit 51d4e88537

@ -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;
}

@ -58,6 +58,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,6 +76,7 @@ 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"));

Loading…
Cancel
Save