use of com.mongodb.reactivestreams.client.MongoClient in project spring-boot by spring-projects.
the class ReactiveMongoRepositoriesAutoConfigurationTests method testNoRepositoryConfiguration.
@Test
public void testNoRepositoryConfiguration() throws Exception {
prepareApplicationContext(EmptyConfiguration.class);
MongoClient client = this.context.getBean(MongoClient.class);
assertThat(client).isInstanceOf(MongoClient.class);
}
use of com.mongodb.reactivestreams.client.MongoClient in project spring-boot by spring-projects.
the class ReactiveMongoAutoConfigurationTests method optionsSslConfig.
@Test
public void optionsSslConfig() {
this.context = new AnnotationConfigApplicationContext();
EnvironmentTestUtils.addEnvironment(this.context, "spring.data.mongodb.uri:mongodb://localhost/test");
this.context.register(SslOptionsConfig.class, PropertyPlaceholderAutoConfiguration.class, ReactiveMongoAutoConfiguration.class);
this.context.refresh();
MongoClient mongo = this.context.getBean(MongoClient.class);
MongoClientSettings settings = mongo.getSettings();
assertThat(settings.getApplicationName()).isEqualTo("test-config");
assertThat(settings.getStreamFactoryFactory()).isSameAs(this.context.getBean("myStreamFactoryFactory"));
}
use of com.mongodb.reactivestreams.client.MongoClient in project spring-boot by spring-projects.
the class ReactiveMongoClientFactoryTests method authenticationDatabaseCanBeCustomized.
@Test
public void authenticationDatabaseCanBeCustomized() throws UnknownHostException {
MongoProperties properties = new MongoProperties();
properties.setAuthenticationDatabase("foo");
properties.setUsername("user");
properties.setPassword("secret".toCharArray());
MongoClient client = createMongoClient(properties);
assertMongoCredential(extractMongoCredentials(client).get(0), "user", "secret", "foo");
}
use of com.mongodb.reactivestreams.client.MongoClient in project spring-boot by spring-projects.
the class ReactiveMongoClientFactoryTests method databaseCanBeCustomized.
@Test
public void databaseCanBeCustomized() throws UnknownHostException {
MongoProperties properties = new MongoProperties();
properties.setDatabase("foo");
properties.setUsername("user");
properties.setPassword("secret".toCharArray());
MongoClient client = createMongoClient(properties);
assertMongoCredential(extractMongoCredentials(client).get(0), "user", "secret", "foo");
}
use of com.mongodb.reactivestreams.client.MongoClient in project spring-boot by spring-projects.
the class ReactiveMongoClientFactoryTests method hostCanBeCustomized.
@Test
public void hostCanBeCustomized() throws UnknownHostException {
MongoProperties properties = new MongoProperties();
properties.setHost("mongo.example.com");
MongoClient client = createMongoClient(properties);
List<ServerAddress> allAddresses = extractServerAddresses(client);
assertThat(allAddresses).hasSize(1);
assertServerAddress(allAddresses.get(0), "mongo.example.com", 27017);
}
Aggregations