use of org.apache.jackrabbit.oak.segment.SegmentNodeStore 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();
}
}
use of org.apache.jackrabbit.oak.segment.SegmentNodeStore 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.SegmentNodeStore in project jackrabbit-oak by apache.
the class ReferenceBinaryIT method fixtures.
@Parameterized.Parameters(name = "{0}")
public static Collection<Object[]> fixtures() throws Exception {
File file = getTestDir("tar");
FileStore fileStore = FileStoreBuilder.fileStoreBuilder(file).withBlobStore(createBlobStore()).withMaxFileSize(256).withMemoryMapping(true).build();
SegmentNodeStore sns = SegmentNodeStoreBuilders.builder(fileStore).build();
List<Object[]> fixtures = Lists.newArrayList();
SegmentTarFixture segmentTarFixture = new SegmentTarFixture(sns);
if (segmentTarFixture.isAvailable()) {
fixtures.add(new Object[] { segmentTarFixture });
}
FileBlobStore fbs = new FileBlobStore(getTestDir("fbs1").getAbsolutePath());
fbs.setReferenceKeyPlainText("foobar");
FileStore fileStoreWithFBS = FileStoreBuilder.fileStoreBuilder(getTestDir("tar2")).withBlobStore(fbs).withMaxFileSize(256).withMemoryMapping(true).build();
SegmentNodeStore snsWithFBS = SegmentNodeStoreBuilders.builder(fileStoreWithFBS).build();
SegmentTarFixture segmentTarFixtureFBS = new SegmentTarFixture(snsWithFBS);
if (segmentTarFixtureFBS.isAvailable()) {
fixtures.add(new Object[] { segmentTarFixtureFBS });
}
DocumentMongoFixture documentFixture = new DocumentMongoFixture(MongoUtils.URL, createBlobStore());
if (documentFixture.isAvailable()) {
fixtures.add(new Object[] { documentFixture });
}
return fixtures;
}
use of org.apache.jackrabbit.oak.segment.SegmentNodeStore in project jackrabbit-oak by apache.
the class NodeStateTestUtils method createNodeStoreWithContent.
public static NodeStore createNodeStoreWithContent(String... paths) throws CommitFailedException, IOException {
final SegmentNodeStore store = SegmentNodeStoreBuilders.builder(new MemoryStore()).build();
final NodeBuilder builder = store.getRoot().builder();
for (String path : paths) {
create(builder, path);
}
commit(store, builder);
return store;
}
use of org.apache.jackrabbit.oak.segment.SegmentNodeStore 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();
}
Aggregations