Search in sources :

Example 1 with AsyncOperationStatus

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);
    }
}
Also used : FilenameFilter(java.io.FilenameFilter) AsyncOperationStatus(voldemort.server.protocol.admin.AsyncOperationStatus) File(java.io.File) AbstractStorageEngineTest(voldemort.store.AbstractStorageEngineTest) Test(org.junit.Test)

Aggregations

File (java.io.File)1 FilenameFilter (java.io.FilenameFilter)1 Test (org.junit.Test)1 AsyncOperationStatus (voldemort.server.protocol.admin.AsyncOperationStatus)1 AbstractStorageEngineTest (voldemort.store.AbstractStorageEngineTest)1