throws Throwable {
EnvironmentConfig envConfig = TestUtils.initEnvConfig();
envConfig.setAllowCreate(true);
envConfig.setTransactional(true);
Environment env = new Environment(envHome, envConfig);
EnvironmentImpl envImpl = DbInternal.envGetEnvironmentImpl(env);
FileManager fileManager = envImpl.getFileManager();
DatabaseConfig dbConfig = new DatabaseConfig();
dbConfig.setAllowCreate(true);
Database exampleDb =
env.openDatabase(null, "simpleDb", dbConfig);
assertEquals("Should have 0 as current file", 0L,
fileManager.getCurrentFileNum());
long flipLsn = envImpl.forceLogFileFlip();
assertEquals("LSN should be 1 post-flip", 1L,
DbLsn.getFileNumber(flipLsn));
DatabaseEntry key = new DatabaseEntry();
DatabaseEntry data = new DatabaseEntry();
key.setData("key".getBytes());
data.setData("data".getBytes());
exampleDb.put(null, key, data);
assertEquals("Should have 1 as last file", 1L,
fileManager.getCurrentFileNum());
exampleDb.close();
env.close();
}