use of org.springframework.data.mongodb.core.SimpleMongoDbFactory in project commons-dao by reportportal.
the class TestConfig method mongoDbFactory.
@Bean
@Primary
public MongoDbFactory mongoDbFactory() {
final Fongo fongo = new Fongo("InMemoryMongo");
SimpleMongoDbFactory mongoDbFactory = new SimpleMongoDbFactory(MockMongoClient.create(fongo), "reportportal");
mongoDbFactory.setWriteConcern(WriteConcern.ACKNOWLEDGED);
return mongoDbFactory;
}
use of org.springframework.data.mongodb.core.SimpleMongoDbFactory in project service-authorization by reportportal.
the class FakeMongoConfig method mongoDbFactory.
@Bean
@Primary
public MongoDbFactory mongoDbFactory() {
final Fongo fongo = new Fongo("InMemoryMongo");
SimpleMongoDbFactory mongoDbFactory = new SimpleMongoDbFactory(MockMongoClient.create(fongo), "reportportal");
mongoDbFactory.setWriteConcern(WriteConcern.ACKNOWLEDGED);
return mongoDbFactory;
}
use of org.springframework.data.mongodb.core.SimpleMongoDbFactory in project spring-data-mongodb by spring-projects.
the class DefaultMessageListenerContainerTests method setUp.
@Before
public void setUp() {
dbFactory = new SimpleMongoDbFactory(new MongoClient(), DATABASE_NAME);
template = new MongoTemplate(dbFactory);
template.dropCollection(COLLECTION_NAME);
collection = template.getCollection(COLLECTION_NAME);
messageListener = new CollectingMessageListener<>();
}
use of org.springframework.data.mongodb.core.SimpleMongoDbFactory in project spring-integration-samples by spring-projects.
the class DemoUtils method prepareMongoFactory.
public static MongoDbFactory prepareMongoFactory(String... additionalCollectionToDrop) throws Exception {
MongoDbFactory mongoDbFactory = new SimpleMongoDbFactory(new MongoClient(), "test");
MongoTemplate template = new MongoTemplate(mongoDbFactory);
template.dropCollection("messages");
template.dropCollection("data");
for (String additionalCollection : additionalCollectionToDrop) {
template.dropCollection(additionalCollection);
}
return mongoDbFactory;
}
use of org.springframework.data.mongodb.core.SimpleMongoDbFactory in project ocvn by devgateway.
the class MongoTemplateConfig method mongoTemplate.
@Bean(autowire = Autowire.BY_NAME, name = "mongoTemplate")
public MongoTemplate mongoTemplate() throws Exception {
MongoTemplate template = new MongoTemplate(new SimpleMongoDbFactory(new MongoClientURI(properties.getUri())));
((MappingMongoConverter) template.getConverter()).setCustomConversions(customConversions);
return template;
}
Aggregations