Search in sources :

Example 1 with MongoDbFactory

use of org.springframework.data.mongodb.MongoDbFactory in project spring-cloud-connectors by spring-cloud.

the class MongoDbFactoryConfigWithServiceConfig method withConfigAllOptionsSpecifiedWriteConcernSafe.

@Test
public void withConfigAllOptionsSpecifiedWriteConcernSafe() {
    ApplicationContext testContext = getTestApplicationContext(MongoDbFactoryConfigWithServiceConfig.class, createService("my-service"));
    MongoDbFactory connector = testContext.getBean("connectionPerHost50_MaxWait200_WriteConcernSafe", getConnectorType());
    MongoDbFactoryCloudConfigTestHelper.assertConfigProperties(connector, "safe", 50, 200);
}
Also used : ApplicationContext(org.springframework.context.ApplicationContext) MongoDbFactory(org.springframework.data.mongodb.MongoDbFactory) Test(org.junit.Test)

Example 2 with MongoDbFactory

use of org.springframework.data.mongodb.MongoDbFactory in project spring-cloud-connectors by spring-cloud.

the class MongoDbFactoryConfigWithServiceConfig method withConfigAllOptionsSpecifiedWriteConcernUnspecified.

@Test
public void withConfigAllOptionsSpecifiedWriteConcernUnspecified() {
    ApplicationContext testContext = getTestApplicationContext(MongoDbFactoryConfigWithServiceConfig.class, createService("my-service"));
    MongoDbFactory connector = testContext.getBean("connectionPerHost50_MaxWait200_WriteConcernUnspecified", getConnectorType());
    MongoDbFactoryCloudConfigTestHelper.assertConfigProperties(connector, null, 50, 200);
}
Also used : ApplicationContext(org.springframework.context.ApplicationContext) MongoDbFactory(org.springframework.data.mongodb.MongoDbFactory) Test(org.junit.Test)

Example 3 with MongoDbFactory

use of org.springframework.data.mongodb.MongoDbFactory in project spring-cloud-connectors by spring-cloud.

the class MongoDbFactoryConfigWithServiceConfig method withConfigOnlyMaxWaitSpecified.

@Test
public void withConfigOnlyMaxWaitSpecified() {
    ApplicationContext testContext = getTestApplicationContext(MongoDbFactoryConfigWithServiceConfig.class, createService("my-service"));
    MongoDbFactory connector = testContext.getBean("connectionPerHostUnspecified_MaxWait200_WriteConcernUnspecified", getConnectorType());
    MongoDbFactoryCloudConfigTestHelper.assertConfigProperties(connector, null, 100, /* default*/
    200);
}
Also used : ApplicationContext(org.springframework.context.ApplicationContext) MongoDbFactory(org.springframework.data.mongodb.MongoDbFactory) Test(org.junit.Test)

Example 4 with MongoDbFactory

use of org.springframework.data.mongodb.MongoDbFactory in project spring-cloud-connectors by spring-cloud.

the class MongoDbFactoryXmlConfigTest method withConfigAllOptionsSpecifiedWriteConcernUnspecified.

@Test
public void withConfigAllOptionsSpecifiedWriteConcernUnspecified() {
    ApplicationContext testContext = getTestApplicationContext("cloud-mongo-with-config.xml", createService("my-service"));
    MongoDbFactory connector = testContext.getBean("service-maxWait200-connectionPerHost50-WriteConcernUnspecified", getConnectorType());
    MongoDbFactoryCloudConfigTestHelper.assertConfigProperties(connector, null, 50, 200);
}
Also used : ApplicationContext(org.springframework.context.ApplicationContext) MongoDbFactory(org.springframework.data.mongodb.MongoDbFactory) Test(org.junit.Test)

Example 5 with MongoDbFactory

use of org.springframework.data.mongodb.MongoDbFactory in project spring-cloud-connectors by spring-cloud.

the class MongoDbFactoryXmlConfigTest method withConfigOnlyConnectionPerHostSpecified.

@Test
public void withConfigOnlyConnectionPerHostSpecified() {
    ApplicationContext testContext = getTestApplicationContext("cloud-mongo-with-config.xml", createService("my-service"));
    MongoDbFactory connector = testContext.getBean("service-maxWaitUnspecified-connectionPerHost50-WriteConcernUnspecified", getConnectorType());
    MongoDbFactoryCloudConfigTestHelper.assertConfigProperties(connector, null, 50, null);
}
Also used : ApplicationContext(org.springframework.context.ApplicationContext) MongoDbFactory(org.springframework.data.mongodb.MongoDbFactory) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)12 MongoDbFactory (org.springframework.data.mongodb.MongoDbFactory)12 ApplicationContext (org.springframework.context.ApplicationContext)10 MongoClient (com.mongodb.MongoClient)2 MongoCredential (com.mongodb.MongoCredential)2 ServerAddress (com.mongodb.ServerAddress)2 MongoServiceInfo (org.springframework.cloud.service.common.MongoServiceInfo)2