FilePersistenceClassNotFoundException,
FilePersistenceDataCorruptedException, TestException {
final String repertoireDonnees = TestConstant.getWinRamDiskRuntimeDir();
final int taillePageCacheDisque = 1024;
final int nombreDePageDuCacheDisque = 1024;
final IFilePersistence filePersistence;
final FilePersistenceBuilder builder = new FilePersistenceBuilder();
if (utiliserCacheDisque) {
// filePersistence = new FilePersistence(1, null, repertoireDonnees,
// /**/false /* efface pas les fichiers */,
// /**/taillePageCacheDisque/* page size */,
// /**/nombreDePageDuCacheDisque/* number of page */,
// /**/false /* pas de gestion garbage */,
// /**/crashSafeMode/* crash safe mode activé */);
builder.setFileAccessMode(EnumFileAccessMode.MAPPED_RANDOM_FILE_ACCESS);
builder.setMaxBufferSize(8 * 1024);
builder.setMaxNumberOfBuffer(32);
builder.setPathName(repertoireDonnees);
builder.setFileCache(taillePageCacheDisque,
nombreDePageDuCacheDisque);
builder.setProxyMode(true);
builder.setRemoveFiles(false);
builder.setGarbageManagement(true);
builder.setCrashSafeMode(crashSafeMode);
} else {
// filePersistence = new FilePersistence(1, null, repertoireDonnees,
// /**/true/* use proxy */,
// /**/false /* efface pas les fichiers */,
// /**/false /* pas de gestion garbage */,
// /**/crashSafeMode/* crash safe mode activé */);
builder.setFileAccessMode(EnumFileAccessMode.MAPPED_RANDOM_FILE_ACCESS);
builder.setMaxBufferSize(8 * 1024);
builder.setMaxNumberOfBuffer(32);
builder.setPathName(repertoireDonnees);
builder.setProxyMode(true);
builder.setRemoveFiles(false);
builder.setGarbageManagement(true);
builder.setCrashSafeMode(crashSafeMode);
}
filePersistence = builder.build();
filePersistence.setChangeLogEnabled(true, 1);
return filePersistence;
}