use of voldemort.server.protocol.admin.AsyncOperationStatus in project voldemort by voldemort.
the class BdbStorageEngineTest method testNativeBackup.
@Test
public void testNativeBackup() throws Exception {
File backupToDir = File.createTempFile("bdb-storage", "bkp");
backupToDir.delete();
backupToDir.mkdir();
try {
store.nativeBackup(backupToDir, false, false, new AsyncOperationStatus(0, "dummy"));
// Check that one file was copied
assertArrayEquals(backupToDir.list(), new String[] { "00000000.jdb" });
long backupFileModified = backupToDir.listFiles()[0].lastModified();
store.nativeBackup(backupToDir, false, false, new AsyncOperationStatus(0, "dummy"));
// Check that there are now two files, and the first one hasn't
// changed
String[] backedUp = backupToDir.list();
Arrays.sort(backedUp);
assertArrayEquals(backedUp, new String[] { "00000000.jdb", "00000001.jdb" });
FilenameFilter filter = new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
if (name.equals("00000000.jdb"))
return true;
return false;
}
};
assertEquals(backupFileModified, backupToDir.listFiles(filter)[0].lastModified());
} finally {
deleteDir(backupToDir);
}
}
Aggregations