use of org.apache.jackrabbit.oak.segment.file.FileStore in project jackrabbit-oak by apache.
the class FileStoreBackupTest method compare.
private static void compare(FileStore store, File destination) throws Exception {
FileStore backup = fileStoreBuilder(destination).build();
assertEquals(store.getHead(), backup.getHead());
backup.close();
}
use of org.apache.jackrabbit.oak.segment.file.FileStore 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();
}
use of org.apache.jackrabbit.oak.segment.file.FileStore in project jackrabbit-oak by apache.
the class OakDirectoryTest method dirNameInException_Writes.
@Test
public void dirNameInException_Writes() throws Exception {
FailOnDemandBlobStore blobStore = new FailOnDemandBlobStore();
FileStore store = FileStoreBuilder.fileStoreBuilder(tempFolder.getRoot()).withMemoryMapping(false).withBlobStore(blobStore).build();
SegmentNodeStore nodeStore = SegmentNodeStoreBuilders.builder(store).build();
String indexPath = "/foo/bar";
int minFileSize = SegmentTestConstants.MEDIUM_LIMIT;
int blobSize = minFileSize + 1000;
builder = nodeStore.getRoot().builder();
builder.setProperty(LuceneIndexConstants.BLOB_SIZE, blobSize);
Directory dir = createDir(builder, false, indexPath);
blobStore.startFailing();
IndexOutput o = dir.createOutput("test1.txt", IOContext.DEFAULT);
try {
o.writeBytes(randomBytes(blobSize + 10), blobSize + 10);
fail();
} catch (IOException e) {
assertThat(e.getMessage(), containsString(indexPath));
assertThat(e.getMessage(), containsString("test1.txt"));
}
blobStore.reset();
IndexOutput o3 = dir.createOutput("test3.txt", IOContext.DEFAULT);
o3.writeBytes(randomBytes(minFileSize), minFileSize);
blobStore.startFailing();
try {
o3.flush();
fail();
} catch (IOException e) {
assertThat(e.getMessage(), containsString(indexPath));
assertThat(e.getMessage(), containsString("test3.txt"));
}
store.close();
}
use of org.apache.jackrabbit.oak.segment.file.FileStore in project jackrabbit-oak by apache.
the class ReadOnlyStoreTest method initStoreAt.
private static void initStoreAt(File path) throws InvalidFileStoreVersionException, IOException {
FileStore store = fileStoreBuilder(path).build();
store.close();
}
use of org.apache.jackrabbit.oak.segment.file.FileStore in project jackrabbit-oak by apache.
the class NodeRecordTest method unreferencedNodeRecordShouldBeRoot.
@Test
public void unreferencedNodeRecordShouldBeRoot() throws Exception {
try (FileStore store = newFileStore()) {
SegmentWriter writer = SegmentWriterBuilder.segmentWriterBuilder("test").build(store);
SegmentNodeState state = writer.writeNode(EmptyNodeState.EMPTY_NODE);
writer.flush();
}
}
Aggregations