Closes gh-7030
This commit is contained in:
Johnny Lim
2016-09-27 20:37:32 +09:00
committed by Stephane Nicoll
parent 73f153daca
commit 30a677646f
6 changed files with 11 additions and 16 deletions

View File

@@ -224,16 +224,16 @@ public class DataSourceAutoConfiguration {
public ConditionOutcome getMatchOutcome(ConditionContext context,
AnnotatedTypeMetadata metadata) {
ConditionMessage.Builder message = ConditionMessage
.forCondition("EmbeddedDataAvailable");
.forCondition("DataSourceAvailable");
if (hasBean(context, DataSource.class)
|| hasBean(context, XADataSource.class)) {
return ConditionOutcome
.match(message.foundExactly("existing database bean"));
.match(message.foundExactly("existing data source bean"));
}
if (anyMatches(context, metadata, this.pooledCondition,
this.embeddedCondition)) {
return ConditionOutcome
.match(message.foundExactly("existing auto-configured database"));
.match(message.foundExactly("existing auto-configured data source bean"));
}
return ConditionOutcome
.noMatch(message.didNotFind("any existing data source bean").atAll());

View File

@@ -127,7 +127,7 @@ public class OAuth2ResourceServerConfiguration {
}
if (StringUtils.hasText(resolver.getProperty("user-info-uri"))) {
return ConditionOutcome
.match(message.foundExactly("user-info-url property"));
.match(message.foundExactly("user-info-uri property"));
}
if (ClassUtils.isPresent(AUTHORIZATION_ANNOTATION, null)) {
if (AuthorizationServerEndpointsConfigurationBeanCondition

View File

@@ -36,7 +36,7 @@ import org.springframework.util.ClassUtils;
*/
class OnEnabledResourceChainCondition extends SpringBootCondition {
private static final String WEBJAR_ASSERT_LOCATOR = "org.webjars.WebJarAssetLocator";
private static final String WEBJAR_ASSET_LOCATOR = "org.webjars.WebJarAssetLocator";
@Override
public ConditionOutcome getMatchOutcome(ConditionContext context,
@@ -50,13 +50,13 @@ class OnEnabledResourceChainCondition extends SpringBootCondition {
ConditionMessage.Builder message = ConditionMessage
.forCondition(ConditionalOnEnabledResourceChain.class);
if (match == null) {
if (ClassUtils.isPresent(WEBJAR_ASSERT_LOCATOR,
if (ClassUtils.isPresent(WEBJAR_ASSET_LOCATOR,
getClass().getClassLoader())) {
return ConditionOutcome
.match(message.found("class").items(WEBJAR_ASSERT_LOCATOR));
.match(message.found("class").items(WEBJAR_ASSET_LOCATOR));
}
return ConditionOutcome
.noMatch(message.didNotFind("class").items(WEBJAR_ASSERT_LOCATOR));
.noMatch(message.didNotFind("class").items(WEBJAR_ASSET_LOCATOR));
}
if (match) {
return ConditionOutcome.match(message.because("enabled"));

View File

@@ -45,13 +45,13 @@ public class ConditionMessageTests {
}
@Test
public void toStringWhenHasMessageShouldReturnMessage() throws Exception {
public void toStringWhenEmptyShouldReturnEmptyString() throws Exception {
ConditionMessage message = ConditionMessage.empty();
assertThat(message.toString()).isEqualTo("");
}
@Test
public void toStringWhenEmptyShouldReturnEmptyString() throws Exception {
public void toStringWhenHasMessageShouldReturnMessage() throws Exception {
ConditionMessage message = ConditionMessage.of("Test");
assertThat(message.toString()).isEqualTo("Test");
}