use of org.springframework.data.mongodb.core.convert.UpdateMapper in project spring-data-mongodb by spring-projects.
the class DefaultBulkOperationsIntegrationTests method createBulkOps.
private BulkOperations createBulkOps(BulkMode mode, Class<?> entityType) {
Optional<? extends MongoPersistentEntity<?>> entity = entityType != null ? Optional.of(operations.getConverter().getMappingContext().getPersistentEntity(entityType)) : Optional.empty();
BulkOperationContext bulkOperationContext = new BulkOperationContext(mode, entity, new QueryMapper(operations.getConverter()), new UpdateMapper(operations.getConverter()));
DefaultBulkOperations bulkOps = new DefaultBulkOperations(operations, COLLECTION_NAME, bulkOperationContext);
bulkOps.setDefaultWriteConcern(WriteConcern.ACKNOWLEDGED);
return bulkOps;
}
use of org.springframework.data.mongodb.core.convert.UpdateMapper in project spring-data-mongodb by spring-projects.
the class DefaultBulkOperationsUnitTests method setUp.
@Before
public void setUp() {
mappingContext = new MongoMappingContext();
mappingContext.afterPropertiesSet();
converter = new MappingMongoConverter(dbRefResolver, mappingContext);
template = new MongoTemplate(factory, converter);
when(factory.getDb()).thenReturn(database);
when(database.getCollection(anyString(), eq(Document.class))).thenReturn(collection);
ops = new DefaultBulkOperations(template, "collection-1", new BulkOperationContext(BulkMode.ORDERED, Optional.of(mappingContext.getPersistentEntity(SomeDomainType.class)), new QueryMapper(converter), new UpdateMapper(converter)));
}
Aggregations