public Database createDatabase(Configuration config) throws IOException {
if (dbfile == null)
dbfile = tmpdir.newFile().getAbsolutePath(); // ensure same every time
MapDBBlockingDatabase db = new MapDBBlockingDatabase();
db.setConfiguration(config);
db.setOverwrite(false);
db.setFile(dbfile);
db.setAsync(false); // slows down tests too much
db.setWindowSize(0); // otherwise we'll find way too many candidates
Collection<KeyFunction> functions = new ArrayList();
functions.add(new TestKeyFunction());
db.setKeyFunctions(functions);
return db;
}