Search in sources :

Example 1 with FileStoreBackupImpl

use of org.apache.jackrabbit.oak.backup.impl.FileStoreBackupImpl in project jackrabbit-oak by apache.

the class FileStoreBackupTest method testBackup.

@Test
public void testBackup() throws Exception {
    FileStore source = newFileStore(src);
    SegmentNodeStore store = SegmentNodeStoreBuilders.builder(source).build();
    FileStoreBackup fsb = new FileStoreBackupImpl();
    try {
        init(store);
        source.flush();
        fsb.backup(source.getReader(), source.getRevisions(), destination);
        compare(source, destination);
        addTestContent(store);
        source.flush();
        fsb.backup(source.getReader(), source.getRevisions(), destination);
        compare(source, destination);
        source.compact();
        fsb.cleanup(source);
        fsb.backup(source.getReader(), source.getRevisions(), destination);
        compare(source, destination);
    } finally {
        source.close();
    }
}
Also used : FileStore(org.apache.jackrabbit.oak.segment.file.FileStore) SegmentNodeStore(org.apache.jackrabbit.oak.segment.SegmentNodeStore) FileStoreBackupImpl(org.apache.jackrabbit.oak.backup.impl.FileStoreBackupImpl) Test(org.junit.Test)

Example 2 with FileStoreBackupImpl

use of org.apache.jackrabbit.oak.backup.impl.FileStoreBackupImpl in project jackrabbit-oak by apache.

the class FileStoreBackupTest method testRestore.

@Test
public void testRestore() throws Exception {
    FileStore source = newFileStore(src);
    SegmentNodeStore store = SegmentNodeStoreBuilders.builder(source).build();
    FileStoreBackup fsb = new FileStoreBackupImpl();
    FileStoreRestore fsr = new FileStoreRestoreImpl();
    init(store);
    source.flush();
    fsb.backup(source.getReader(), source.getRevisions(), destination);
    source.close();
    fsr.restore(destination, src);
    source = newFileStore(src);
    compare(source, destination);
    source.close();
}
Also used : FileStore(org.apache.jackrabbit.oak.segment.file.FileStore) FileStoreRestoreImpl(org.apache.jackrabbit.oak.backup.impl.FileStoreRestoreImpl) SegmentNodeStore(org.apache.jackrabbit.oak.segment.SegmentNodeStore) FileStoreBackupImpl(org.apache.jackrabbit.oak.backup.impl.FileStoreBackupImpl) Test(org.junit.Test)

Aggregations

FileStoreBackupImpl (org.apache.jackrabbit.oak.backup.impl.FileStoreBackupImpl)2 SegmentNodeStore (org.apache.jackrabbit.oak.segment.SegmentNodeStore)2 FileStore (org.apache.jackrabbit.oak.segment.file.FileStore)2 Test (org.junit.Test)2 FileStoreRestoreImpl (org.apache.jackrabbit.oak.backup.impl.FileStoreRestoreImpl)1