use of com.mongodb.client.internal.MongoClientImpl in project spring-boot by spring-projects.
the class MongoAutoConfigurationTests method getSettings.
private MongoClientSettings getSettings(AssertableApplicationContext context) {
assertThat(context).hasSingleBean(MongoClient.class);
MongoClientImpl client = (MongoClientImpl) context.getBean(MongoClient.class);
return client.getSettings();
}
use of com.mongodb.client.internal.MongoClientImpl in project brave by openzipkin.
the class ITMongoDBTracing method getClusterId.
@Before
public void getClusterId() throws Exception {
// TODO: Figure out an easier way to get this!
Field clusterIdField = Class.forName("com.mongodb.internal.connection.BaseCluster").getDeclaredField("clusterId");
clusterIdField.setAccessible(true);
ClusterId clusterId = (ClusterId) clusterIdField.get(((MongoClientImpl) mongoClient).getCluster());
this.clusterId = clusterId.getValue();
}
use of com.mongodb.client.internal.MongoClientImpl in project drill by apache.
the class TestMongoStoragePluginUsesCredentialsStore method test.
private void test(String expectedUserName, String expectedPassword, String connection, String name) throws ExecutionSetupException {
MongoStoragePlugin plugin = new MongoStoragePlugin(new MongoStoragePluginConfig(connection, null, 100, false, PlainCredentialsProvider.EMPTY_CREDENTIALS_PROVIDER), null, name);
MongoClientImpl client = (MongoClientImpl) plugin.getClient();
MongoCredential cred = client.getSettings().getCredential();
if (expectedUserName == null) {
assertNull(cred);
} else {
assertNotNull(cred);
assertEquals(expectedUserName, cred.getUserName());
assertEquals(expectedPassword, new String(cred.getPassword()));
}
}
Aggregations