use of org.springframework.data.mongodb.core.SimpleReactiveMongoDatabaseFactory in project spring-data-mongodb by spring-projects.
the class ReactiveAggregationUnitTests method setUp.
@Before
public void setUp() {
factory = new SimpleReactiveMongoDatabaseFactory(mongoClient, "db");
template = new ReactiveMongoTemplate(factory);
when(mongoClient.getDatabase("db")).thenReturn(db);
when(db.getCollection(eq(INPUT_COLLECTION), any(Class.class))).thenReturn(collection);
when(collection.aggregate(anyList(), any(Class.class))).thenReturn(publisher);
when(publisher.allowDiskUse(any())).thenReturn(publisher);
when(publisher.useCursor(any())).thenReturn(publisher);
when(publisher.collation(any())).thenReturn(publisher);
}
use of org.springframework.data.mongodb.core.SimpleReactiveMongoDatabaseFactory in project spring-data-mongodb by spring-projects.
the class ReactivePerformanceTests method setUp.
@Before
public void setUp() throws Exception {
mongo = MongoClients.create();
SimpleReactiveMongoDatabaseFactory mongoDbFactory = new SimpleReactiveMongoDatabaseFactory(this.mongo, DATABASE_NAME);
MongoMappingContext context = new MongoMappingContext();
context.setInitialEntitySet(Collections.singleton(Person.class));
context.afterPropertiesSet();
converter = new MappingMongoConverter(new DbRefResolver() {
@Override
public Object resolveDbRef(MongoPersistentProperty property, DBRef dbref, DbRefResolverCallback callback, DbRefProxyHandler proxyHandler) {
return null;
}
@Override
public DBRef createDbRef(org.springframework.data.mongodb.core.mapping.DBRef annotation, MongoPersistentEntity<?> entity, Object id) {
return null;
}
@Override
public Document fetch(DBRef dbRef) {
return null;
}
@Override
public List<Document> bulkFetch(List<DBRef> dbRefs) {
return null;
}
}, context);
operations = new ReactiveMongoTemplate(mongoDbFactory, converter);
ReactiveMongoRepositoryFactory factory = new ReactiveMongoRepositoryFactory(operations);
repository = factory.getRepository(ReactivePersonRepository.class);
}
Aggregations