use of com.mongodb.MongoClientSettings in project spring-boot by spring-projects.
the class MongoPropertiesClientSettingsBuilderCustomizerTests method credentialsCanBeCustomized.
@Test
void credentialsCanBeCustomized() {
this.properties.setUsername("user");
this.properties.setPassword("secret".toCharArray());
MongoClientSettings settings = customizeSettings();
assertMongoCredential(settings.getCredential(), "user", "secret", "test");
}
use of com.mongodb.MongoClientSettings in project spring-boot by spring-projects.
the class MongoPropertiesClientSettingsBuilderCustomizerTests method uuidRepresentationCanBeCustomized.
@Test
void uuidRepresentationCanBeCustomized() {
this.properties.setUuidRepresentation(UuidRepresentation.STANDARD);
MongoClientSettings settings = customizeSettings();
assertThat(settings.getUuidRepresentation()).isEqualTo(UuidRepresentation.STANDARD);
}
use of com.mongodb.MongoClientSettings in project spring-boot by spring-projects.
the class MongoPropertiesClientSettingsBuilderCustomizerTests method uuidRepresentationDefaultToJavaLegacy.
@Test
void uuidRepresentationDefaultToJavaLegacy() {
MongoClientSettings settings = customizeSettings();
assertThat(settings.getUuidRepresentation()).isEqualTo(UuidRepresentation.JAVA_LEGACY);
}
use of com.mongodb.MongoClientSettings in project spring-boot by spring-projects.
the class MongoReactiveAutoConfigurationTests method settingsSslConfig.
@Test
void settingsSslConfig() {
this.contextRunner.withPropertyValues("spring.data.mongodb.uri:mongodb://localhost/test").withUserConfiguration(SslSettingsConfig.class).run((context) -> {
assertThat(context).hasSingleBean(MongoClient.class);
MongoClientSettings settings = getSettings(context);
assertThat(settings.getApplicationName()).isEqualTo("test-config");
assertThat(settings.getStreamFactoryFactory()).isSameAs(context.getBean("myStreamFactoryFactory"));
});
}
use of com.mongodb.MongoClientSettings in project spring-boot by spring-projects.
the class MongoReactiveAutoConfigurationTests method customizerOverridesAutoConfig.
@Test
void customizerOverridesAutoConfig() {
this.contextRunner.withPropertyValues("spring.data.mongodb.uri:mongodb://localhost/test?appname=auto-config").withUserConfiguration(SimpleCustomizerConfig.class).run((context) -> {
assertThat(context).hasSingleBean(MongoClient.class);
MongoClientSettings settings = getSettings(context);
assertThat(settings.getApplicationName()).isEqualTo("overridden-name");
assertThat(settings.getStreamFactoryFactory()).isEqualTo(SimpleCustomizerConfig.streamFactoryFactory);
});
}
Aggregations