Merge pull request #14293 from izeye:polish-20180904
* pr/14293: Polish
This commit is contained in:
@@ -185,8 +185,9 @@ public class MongoDataAutoConfiguration {
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if either a {@link com.mongodb.MongoClient} or
|
||||
* {@link com.mongodb.client.MongoClient} bean is available.
|
||||
* Check if either a {@link MongoClient com.mongodb.MongoClient} or
|
||||
* {@link com.mongodb.client.MongoClient com.mongodb.client.MongoClient} bean is
|
||||
* available.
|
||||
*/
|
||||
static class AnyMongoClientAvailable extends AnyNestedCondition {
|
||||
|
||||
|
||||
@@ -220,7 +220,7 @@ class HibernateJpaConfiguration extends JpaBaseConfiguration {
|
||||
// Continue searching
|
||||
}
|
||||
}
|
||||
throw new IllegalStateException("No available JtaPlatform candidates amongst"
|
||||
throw new IllegalStateException("No available JtaPlatform candidates amongst "
|
||||
+ Arrays.toString(NO_JTA_PLATFORM_CLASSES));
|
||||
}
|
||||
|
||||
|
||||
@@ -50,26 +50,22 @@ public class MongoAutoConfigurationTests {
|
||||
|
||||
@Test
|
||||
public void optionsAdded() {
|
||||
this.contextRunner.withPropertyValues("spring.data.mongodb.host:localhost")
|
||||
.withUserConfiguration(OptionsConfig.class)
|
||||
this.contextRunner.withUserConfiguration(OptionsConfig.class)
|
||||
.run((context) -> assertThat(context.getBean(MongoClient.class)
|
||||
.getMongoClientOptions().getSocketTimeout()).isEqualTo(300));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void optionsAddedButNoHost() {
|
||||
this.contextRunner
|
||||
.withPropertyValues("spring.data.mongodb.uri:mongodb://localhost/test")
|
||||
.withUserConfiguration(OptionsConfig.class)
|
||||
this.contextRunner.withUserConfiguration(OptionsConfig.class)
|
||||
.run((context) -> assertThat(context.getBean(MongoClient.class)
|
||||
.getMongoClientOptions().getSocketTimeout()).isEqualTo(300));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void optionsSslConfig() {
|
||||
this.contextRunner
|
||||
.withPropertyValues("spring.data.mongodb.uri:mongodb://localhost/test")
|
||||
.withUserConfiguration(SslOptionsConfig.class).run((context) -> {
|
||||
this.contextRunner.withUserConfiguration(SslOptionsConfig.class)
|
||||
.run((context) -> {
|
||||
assertThat(context).hasSingleBean(MongoClient.class);
|
||||
MongoClient mongo = context.getBean(MongoClient.class);
|
||||
MongoClientOptions options = mongo.getMongoClientOptions();
|
||||
@@ -81,9 +77,8 @@ public class MongoAutoConfigurationTests {
|
||||
|
||||
@Test
|
||||
public void doesNotCreateMongoClientWhenAlreadyDefined() {
|
||||
this.contextRunner
|
||||
.withPropertyValues("spring.data.mongodb.uri:mongodb://localhost/test")
|
||||
.withUserConfiguration(FallbackMongoClientConfig.class).run((context) -> {
|
||||
this.contextRunner.withUserConfiguration(FallbackMongoClientConfig.class)
|
||||
.run((context) -> {
|
||||
assertThat(context).doesNotHaveBean(MongoClient.class);
|
||||
assertThat(context)
|
||||
.hasSingleBean(com.mongodb.client.MongoClient.class);
|
||||
|
||||
@@ -37,7 +37,7 @@ public class JacksonJsonParser extends AbstractJsonParser {
|
||||
private ObjectMapper objectMapper; // Late binding
|
||||
|
||||
/**
|
||||
* Creates a instance with the specified {@link ObjectMapper}.
|
||||
* Creates an instance with the specified {@link ObjectMapper}.
|
||||
* @param objectMapper the object mapper to use
|
||||
*/
|
||||
public JacksonJsonParser(ObjectMapper objectMapper) {
|
||||
|
||||
Reference in New Issue
Block a user