database = mongoClient.getDatabase(databaseName) .withReadPreference(readPreference) .withWriteConcern(writeConcern);
@NotNull @Override public MongoDatabase withReadPreference(@NotNull ReadPreference readPreference) { return new MongoTestDatabase(db.withReadPreference(readPreference), beforeQueryException, beforeUpdateException, afterUpdateException); }
@Before @Override public void setUp() throws Exception { mongoConnection = MongoUtils.getConnection(); MongoUtils.dropCollections(mongoConnection.getDatabase()); // Some tests assume read from the primary MongoDatabase db = mongoConnection.getDatabase() .withReadPreference(ReadPreference.primary()); MongoBlobStore blobStore = new MongoBlobStore(db); blobStore.setBlockSize(128); blobStore.setBlockSizeMin(48); this.store = blobStore; }