use of org.springframework.data.mongodb.core.ReactiveMongoTemplate.NoOpDbRefResolver in project spring-data-mongodb by spring-projects.
the class ReactiveSessionBoundMongoTemplateUnitTests method setUp.
@Before
public void setUp() {
when(client.getDatabase(anyString())).thenReturn(database);
when(codecRegistry.get(any(Class.class))).thenReturn(new BsonValueCodec());
when(database.getCodecRegistry()).thenReturn(codecRegistry);
when(database.getCollection(anyString())).thenReturn(collection);
when(database.getCollection(anyString(), any())).thenReturn(collection);
when(database.listCollectionNames(any(ClientSession.class))).thenReturn(findPublisher);
when(database.createCollection(any(ClientSession.class), any(), any())).thenReturn(resultPublisher);
when(database.runCommand(any(ClientSession.class), any(), any(Class.class))).thenReturn(resultPublisher);
when(collection.find(any(ClientSession.class))).thenReturn(findPublisher);
when(collection.find(any(ClientSession.class), any(Document.class))).thenReturn(findPublisher);
when(collection.find(any(ClientSession.class), any(Class.class))).thenReturn(findPublisher);
when(collection.find(any(ClientSession.class), any(), any())).thenReturn(findPublisher);
when(collection.deleteMany(any(ClientSession.class), any(), any())).thenReturn(resultPublisher);
when(collection.insertOne(any(ClientSession.class), any(Document.class))).thenReturn(resultPublisher);
when(collection.aggregate(any(ClientSession.class), anyList(), any(Class.class))).thenReturn(aggregatePublisher);
when(collection.count(any(ClientSession.class), any(), any(CountOptions.class))).thenReturn(resultPublisher);
when(collection.drop(any(ClientSession.class))).thenReturn(resultPublisher);
when(collection.findOneAndUpdate(any(ClientSession.class), any(), any(), any())).thenReturn(resultPublisher);
when(collection.distinct(any(ClientSession.class), any(), any(), any())).thenReturn(distinctPublisher);
when(collection.updateOne(any(ClientSession.class), any(), any(), any(UpdateOptions.class))).thenReturn(resultPublisher);
when(collection.updateMany(any(ClientSession.class), any(), any(), any(UpdateOptions.class))).thenReturn(resultPublisher);
when(collection.dropIndex(any(ClientSession.class), anyString())).thenReturn(resultPublisher);
when(findPublisher.projection(any())).thenReturn(findPublisher);
when(findPublisher.limit(anyInt())).thenReturn(findPublisher);
when(findPublisher.collation(any())).thenReturn(findPublisher);
when(findPublisher.first()).thenReturn(resultPublisher);
when(aggregatePublisher.allowDiskUse(anyBoolean())).thenReturn(aggregatePublisher);
when(aggregatePublisher.useCursor(anyBoolean())).thenReturn(aggregatePublisher);
factory = new SimpleReactiveMongoDatabaseFactory(client, "foo");
this.mappingContext = new MongoMappingContext();
this.converter = new MappingMongoConverter(new NoOpDbRefResolver(), mappingContext);
this.template = new ReactiveSessionBoundMongoTemplate(clientSession, new ReactiveMongoTemplate(factory, converter));
}
use of org.springframework.data.mongodb.core.ReactiveMongoTemplate.NoOpDbRefResolver in project spring-data-mongodb by spring-projects.
the class ReactiveMongoTemplateUnitTests method setUp.
@Before
public void setUp() {
when(factory.getExceptionTranslator()).thenReturn(exceptionTranslator);
when(factory.getMongoDatabase()).thenReturn(db);
when(db.getCollection(any())).thenReturn(collection);
when(db.getCollection(any(), any())).thenReturn(collection);
when(db.runCommand(any(), any(Class.class))).thenReturn(runCommandPublisher);
when(collection.find(any(Class.class))).thenReturn(findPublisher);
when(collection.find(any(Document.class), any(Class.class))).thenReturn(findPublisher);
when(findPublisher.projection(any())).thenReturn(findPublisher);
when(findPublisher.limit(anyInt())).thenReturn(findPublisher);
when(findPublisher.collation(any())).thenReturn(findPublisher);
when(findPublisher.first()).thenReturn(findPublisher);
this.mappingContext = new MongoMappingContext();
this.converter = new MappingMongoConverter(new NoOpDbRefResolver(), mappingContext);
this.template = new ReactiveMongoTemplate(factory, converter);
}
Aggregations