use of org.apache.jackrabbit.oak.segment.SegmentNodeStore in project jackrabbit-oak by apache.
the class IncludeExcludeSidegradeTest method upgradeRepository.
@Before
public synchronized void upgradeRepository() throws Exception {
if (targetNodeStore == null) {
File directory = getTestDirectory();
File source = new File(directory, "source");
source.mkdirs();
FileStore fileStore = fileStoreBuilder(source).build();
SegmentNodeStore segmentNodeStore = SegmentNodeStoreBuilders.builder(fileStore).build();
RepositoryImpl repository = (RepositoryImpl) new Jcr(new Oak(segmentNodeStore)).createRepository();
Session session = repository.login(CREDENTIALS);
try {
createSourceContent(session);
} finally {
session.save();
session.logout();
repository.shutdown();
fileStore.close();
}
final NodeStore target = getTargetNodeStore();
doUpgradeRepository(source, target);
targetNodeStore = target;
}
}
use of org.apache.jackrabbit.oak.segment.SegmentNodeStore in project jackrabbit-oak by apache.
the class IncludeExcludeSidegradeTest method doUpgradeRepository.
@Override
protected void doUpgradeRepository(File source, NodeStore target) throws RepositoryException, IOException {
FileStore fileStore;
try {
fileStore = fileStoreBuilder(source).build();
} catch (InvalidFileStoreVersionException e) {
throw new IllegalStateException(e);
}
SegmentNodeStore segmentNodeStore = SegmentNodeStoreBuilders.builder(fileStore).build();
try {
final RepositorySidegrade sidegrade = new RepositorySidegrade(segmentNodeStore, target);
sidegrade.setIncludes("/content/foo/en", "/content/assets/foo", "/content/other");
sidegrade.setExcludes("/content/assets/foo/2013", "/content/assets/foo/2012", "/content/assets/foo/2011", "/content/assets/foo/2010");
sidegrade.setExcludeFragments("oak-mount-libs-xyz");
sidegrade.setFragmentPaths("/content/other/path");
sidegrade.copy();
} finally {
fileStore.close();
}
}
use of org.apache.jackrabbit.oak.segment.SegmentNodeStore in project jackrabbit-oak by apache.
the class OakDirectoryTest method largeFile.
@Test
public void largeFile() throws Exception {
FileStore store = FileStoreBuilder.fileStoreBuilder(tempFolder.getRoot()).withMemoryMapping(false).withBlobStore(new BlackHoleBlobStore()).build();
SegmentNodeStore nodeStore = SegmentNodeStoreBuilders.builder(store).build();
IndexDefinition defn = new IndexDefinition(INITIAL_CONTENT, EmptyNodeState.EMPTY_NODE, "/foo");
Directory directory = new OakDirectory(nodeStore.getRoot().builder(), defn, false);
long expectedSize = ONE_GB * 2 + ONE_MB;
String fileName = "test";
writeFile(directory, fileName, expectedSize);
assertEquals(expectedSize, directory.fileLength(fileName));
IndexInput input = directory.openInput(fileName, IOContext.DEFAULT);
readInputToEnd(expectedSize, input);
store.close();
}
use of org.apache.jackrabbit.oak.segment.SegmentNodeStore in project jackrabbit-oak by apache.
the class RepeatedRepositorySidegradeTest method doUpgradeRepository.
@Override
protected void doUpgradeRepository(File source, NodeStore target, boolean skipInit) throws RepositoryException, IOException {
FileStore fileStore;
try {
fileStore = fileStoreBuilder(source).build();
} catch (InvalidFileStoreVersionException e) {
throw new IllegalStateException(e);
}
SegmentNodeStore segmentNodeStore = SegmentNodeStoreBuilders.builder(fileStore).build();
try {
final RepositorySidegrade repositoryUpgrade = new RepositorySidegrade(segmentNodeStore, target);
NodeBuilder builder = target.getRoot().builder();
builder.child("foo").child("bar");
target.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY);
repositoryUpgrade.copy();
} catch (CommitFailedException e) {
throw new RepositoryException(e);
} finally {
fileStore.close();
}
}
Aggregations