commit
bfd62aba10
|
@ -224,16 +224,16 @@ public class DataSourceAutoConfiguration {
|
||||||
public ConditionOutcome getMatchOutcome(ConditionContext context,
|
public ConditionOutcome getMatchOutcome(ConditionContext context,
|
||||||
AnnotatedTypeMetadata metadata) {
|
AnnotatedTypeMetadata metadata) {
|
||||||
ConditionMessage.Builder message = ConditionMessage
|
ConditionMessage.Builder message = ConditionMessage
|
||||||
.forCondition("EmbeddedDataAvailable");
|
.forCondition("DataSourceAvailable");
|
||||||
if (hasBean(context, DataSource.class)
|
if (hasBean(context, DataSource.class)
|
||||||
|| hasBean(context, XADataSource.class)) {
|
|| hasBean(context, XADataSource.class)) {
|
||||||
return ConditionOutcome
|
return ConditionOutcome
|
||||||
.match(message.foundExactly("existing database bean"));
|
.match(message.foundExactly("existing data source bean"));
|
||||||
}
|
}
|
||||||
if (anyMatches(context, metadata, this.pooledCondition,
|
if (anyMatches(context, metadata, this.pooledCondition,
|
||||||
this.embeddedCondition)) {
|
this.embeddedCondition)) {
|
||||||
return ConditionOutcome
|
return ConditionOutcome
|
||||||
.match(message.foundExactly("existing auto-configured database"));
|
.match(message.foundExactly("existing auto-configured data source bean"));
|
||||||
}
|
}
|
||||||
return ConditionOutcome
|
return ConditionOutcome
|
||||||
.noMatch(message.didNotFind("any existing data source bean").atAll());
|
.noMatch(message.didNotFind("any existing data source bean").atAll());
|
||||||
|
|
|
@ -127,7 +127,7 @@ public class OAuth2ResourceServerConfiguration {
|
||||||
}
|
}
|
||||||
if (StringUtils.hasText(resolver.getProperty("user-info-uri"))) {
|
if (StringUtils.hasText(resolver.getProperty("user-info-uri"))) {
|
||||||
return ConditionOutcome
|
return ConditionOutcome
|
||||||
.match(message.foundExactly("user-info-url property"));
|
.match(message.foundExactly("user-info-uri property"));
|
||||||
}
|
}
|
||||||
if (ClassUtils.isPresent(AUTHORIZATION_ANNOTATION, null)) {
|
if (ClassUtils.isPresent(AUTHORIZATION_ANNOTATION, null)) {
|
||||||
if (AuthorizationServerEndpointsConfigurationBeanCondition
|
if (AuthorizationServerEndpointsConfigurationBeanCondition
|
||||||
|
|
|
@ -36,7 +36,7 @@ import org.springframework.util.ClassUtils;
|
||||||
*/
|
*/
|
||||||
class OnEnabledResourceChainCondition extends SpringBootCondition {
|
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
|
@Override
|
||||||
public ConditionOutcome getMatchOutcome(ConditionContext context,
|
public ConditionOutcome getMatchOutcome(ConditionContext context,
|
||||||
|
@ -50,13 +50,13 @@ class OnEnabledResourceChainCondition extends SpringBootCondition {
|
||||||
ConditionMessage.Builder message = ConditionMessage
|
ConditionMessage.Builder message = ConditionMessage
|
||||||
.forCondition(ConditionalOnEnabledResourceChain.class);
|
.forCondition(ConditionalOnEnabledResourceChain.class);
|
||||||
if (match == null) {
|
if (match == null) {
|
||||||
if (ClassUtils.isPresent(WEBJAR_ASSERT_LOCATOR,
|
if (ClassUtils.isPresent(WEBJAR_ASSET_LOCATOR,
|
||||||
getClass().getClassLoader())) {
|
getClass().getClassLoader())) {
|
||||||
return ConditionOutcome
|
return ConditionOutcome
|
||||||
.match(message.found("class").items(WEBJAR_ASSERT_LOCATOR));
|
.match(message.found("class").items(WEBJAR_ASSET_LOCATOR));
|
||||||
}
|
}
|
||||||
return ConditionOutcome
|
return ConditionOutcome
|
||||||
.noMatch(message.didNotFind("class").items(WEBJAR_ASSERT_LOCATOR));
|
.noMatch(message.didNotFind("class").items(WEBJAR_ASSET_LOCATOR));
|
||||||
}
|
}
|
||||||
if (match) {
|
if (match) {
|
||||||
return ConditionOutcome.match(message.because("enabled"));
|
return ConditionOutcome.match(message.because("enabled"));
|
||||||
|
|
|
@ -45,13 +45,13 @@ public class ConditionMessageTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void toStringWhenHasMessageShouldReturnMessage() throws Exception {
|
public void toStringWhenEmptyShouldReturnEmptyString() throws Exception {
|
||||||
ConditionMessage message = ConditionMessage.empty();
|
ConditionMessage message = ConditionMessage.empty();
|
||||||
assertThat(message.toString()).isEqualTo("");
|
assertThat(message.toString()).isEqualTo("");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void toStringWhenEmptyShouldReturnEmptyString() throws Exception {
|
public void toStringWhenHasMessageShouldReturnMessage() throws Exception {
|
||||||
ConditionMessage message = ConditionMessage.of("Test");
|
ConditionMessage message = ConditionMessage.of("Test");
|
||||||
assertThat(message.toString()).isEqualTo("Test");
|
assertThat(message.toString()).isEqualTo("Test");
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,9 +21,7 @@ import java.lang.annotation.RetentionPolicy;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Rule;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.rules.ExpectedException;
|
|
||||||
import org.mockito.ArgumentCaptor;
|
import org.mockito.ArgumentCaptor;
|
||||||
import org.mockito.Captor;
|
import org.mockito.Captor;
|
||||||
import org.mockito.Mock;
|
import org.mockito.Mock;
|
||||||
|
@ -47,9 +45,6 @@ import static org.mockito.Mockito.verify;
|
||||||
*/
|
*/
|
||||||
public class QualifierDefinitionTests {
|
public class QualifierDefinitionTests {
|
||||||
|
|
||||||
@Rule
|
|
||||||
public ExpectedException thrown = ExpectedException.none();
|
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
private ConfigurableListableBeanFactory beanFactory;
|
private ConfigurableListableBeanFactory beanFactory;
|
||||||
|
|
||||||
|
|
|
@ -2,5 +2,5 @@ import static org.junit.Assert.assertTrue
|
||||||
|
|
||||||
def file = new File(basedir, "build.log")
|
def file = new File(basedir, "build.log")
|
||||||
assertTrue 'Devtools should have been detected', file.text.contains('Fork mode disabled, devtools will be disabled')
|
assertTrue 'Devtools should have been detected', file.text.contains('Fork mode disabled, devtools will be disabled')
|
||||||
assertTrue 'Application should have ran', file.text.contains("I haz been run")
|
assertTrue 'Application should have run', file.text.contains("I haz been run")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue