use of org.springframework.data.mongodb.core.MongoClientFactoryBean in project spring-data-mongodb by spring-projects.
the class MongoNamespaceTests method testMongoSingleton.
@Test
public void testMongoSingleton() throws Exception {
assertTrue(ctx.containsBean("noAttrMongo"));
MongoClientFactoryBean mfb = (MongoClientFactoryBean) ctx.getBean("&noAttrMongo");
assertNull(getField(mfb, "host"));
assertNull(getField(mfb, "port"));
}
use of org.springframework.data.mongodb.core.MongoClientFactoryBean in project spring-data-mongodb by spring-projects.
the class MongoNamespaceTests method testMongoSingletonWithSslEnabled.
// DATAMONGO-764
@Test
public void testMongoSingletonWithSslEnabled() throws Exception {
assertTrue(ctx.containsBean("mongoSsl"));
MongoClientFactoryBean mfb = (MongoClientFactoryBean) ctx.getBean("&mongoSsl");
MongoClientOptions options = (MongoClientOptions) getField(mfb, "mongoClientOptions");
assertTrue("socketFactory should be a SSLSocketFactory", options.getSocketFactory() instanceof SSLSocketFactory);
}
use of org.springframework.data.mongodb.core.MongoClientFactoryBean in project spring-data-mongodb by spring-projects.
the class MongoNamespaceTests method testMongoSingletonWithAttributes.
@Test
public void testMongoSingletonWithAttributes() throws Exception {
assertTrue(ctx.containsBean("defaultMongo"));
MongoClientFactoryBean mfb = (MongoClientFactoryBean) ctx.getBean("&defaultMongo");
String host = (String) getField(mfb, "host");
Integer port = (Integer) getField(mfb, "port");
assertEquals("localhost", host);
assertEquals(new Integer(27017), port);
MongoClientOptions options = (MongoClientOptions) getField(mfb, "mongoClientOptions");
assertFalse("By default socketFactory should not be a SSLSocketFactory", options.getSocketFactory() instanceof SSLSocketFactory);
}
Aggregations