use of org.springframework.data.mongodb.gridfs.ReactiveGridFsTemplate in project spring-boot by spring-projects.
the class MongoReactiveDataAutoConfigurationTests method whenGridFsBucketIsConfiguredThenGridFsTemplateUsesIt.
@Test
void whenGridFsBucketIsConfiguredThenGridFsTemplateUsesIt() {
this.contextRunner.withPropertyValues("spring.data.mongodb.gridfs.bucket:test-bucket").run((context) -> {
assertThat(context).hasSingleBean(ReactiveGridFsTemplate.class);
ReactiveGridFsTemplate template = context.getBean(ReactiveGridFsTemplate.class);
assertThat(template).hasFieldOrPropertyWithValue("bucket", "test-bucket");
});
}
use of org.springframework.data.mongodb.gridfs.ReactiveGridFsTemplate in project spring-boot by spring-projects.
the class MongoReactiveDataAutoConfigurationTests method grisFsTemplateDatabaseName.
private String grisFsTemplateDatabaseName(AssertableApplicationContext context) {
assertThat(context).hasSingleBean(ReactiveGridFsTemplate.class);
ReactiveGridFsTemplate template = context.getBean(ReactiveGridFsTemplate.class);
ReactiveMongoDatabaseFactory factory = (ReactiveMongoDatabaseFactory) ReflectionTestUtils.getField(template, "dbFactory");
return factory.getMongoDatabase().block().getName();
}
Aggregations