use of org.apache.jackrabbit.oak.spi.mount.MountInfoProvider in project jackrabbit-oak by apache.
the class CugUtilTest method testGetSupportedPathsMountsBelowSupportedPath.
@Test(expected = IllegalStateException.class)
public void testGetSupportedPathsMountsBelowSupportedPath() {
MountInfoProvider mip = Mounts.newBuilder().mount("private", "/libs", "/apps").build();
CugUtil.getSupportedPaths(ConfigurationParameters.of(PARAM_CUG_SUPPORTED_PATHS, new String[] { "/" }), mip);
}
use of org.apache.jackrabbit.oak.spi.mount.MountInfoProvider in project jackrabbit-oak by apache.
the class CugUtilTest method testGetSupportedPathsMountsAboveSupportedPath2.
@Test(expected = IllegalStateException.class)
public void testGetSupportedPathsMountsAboveSupportedPath2() {
MountInfoProvider mip = Mounts.newBuilder().mount("private", PathUtils.getAncestorPath(SUPPORTED_PATH3, 2)).build();
CugUtil.getSupportedPaths(CUG_CONFIG, mip);
}
use of org.apache.jackrabbit.oak.spi.mount.MountInfoProvider in project jackrabbit-oak by apache.
the class CugUtilTest method testGetSupportedPathsMountsAtSupportedPath.
@Test(expected = IllegalStateException.class)
public void testGetSupportedPathsMountsAtSupportedPath() {
MountInfoProvider mip = Mounts.newBuilder().mount("private", "/libs", SUPPORTED_PATH3).build();
CugUtil.getSupportedPaths(CUG_CONFIG, mip);
}
use of org.apache.jackrabbit.oak.spi.mount.MountInfoProvider in project jackrabbit-oak by apache.
the class CompositeNodeStoreTest method initStore.
@Before
public void initStore() throws Exception {
MountInfoProvider mip = Mounts.newBuilder().mount("temp", "/tmp").mount("deep", "/libs/mount").mount("empty", "/nowhere").readOnlyMount("readOnly", "/readOnly").build();
globalStore = register(root.create(null));
mountedStore = register(mounts.create("temp"));
deepMountedStore = register(mounts.create("deep"));
readOnlyStore = register(mounts.create("readOnly"));
// this NodeStore will always be empty
NodeStore emptyStore = register(mounts.create("empty"));
// create a property on the root node
NodeBuilder builder = globalStore.getRoot().builder();
builder.setProperty("prop", "val");
globalStore.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY);
assertTrue(globalStore.getRoot().hasProperty("prop"));
// create a different sub-tree on the root store
builder = globalStore.getRoot().builder();
NodeBuilder libsBuilder = builder.child("libs");
libsBuilder.child("first");
libsBuilder.child("second");
// create an empty /apps node with a property
builder.child("apps").setProperty("prop", "val");
globalStore.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY);
assertThat(globalStore.getRoot().getChildNodeCount(10), equalTo(2l));
// create a /tmp child on the mounted store and set a property
builder = mountedStore.getRoot().builder();
NodeBuilder tmpBuilder = builder.child("tmp");
tmpBuilder.setProperty("prop1", "val1");
tmpBuilder.child("child1").setProperty("prop1", "val1");
tmpBuilder.child("child2");
mountedStore.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY);
assertTrue(mountedStore.getRoot().hasChildNode("tmp"));
assertThat(mountedStore.getRoot().getChildNode("tmp").getChildNodeCount(10), equalTo(2l));
// populate /libs/mount/third in the deep mount, and include a property
builder = deepMountedStore.getRoot().builder();
builder.child("libs").child("mount").child("third").setProperty("mounted", "true");
deepMountedStore.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY);
assertTrue(deepMountedStore.getRoot().getChildNode("libs").getChildNode("mount").getChildNode("third").hasProperty("mounted"));
// populate /readonly with a single node
builder = readOnlyStore.getRoot().builder();
builder.child("readOnly");
readOnlyStore.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY);
// don't use the builder since it would fail due to too many read-write stores
// but for the purposes of testing the general correctness it's fine
List<MountedNodeStore> nonDefaultStores = Lists.newArrayList();
nonDefaultStores.add(new MountedNodeStore(mip.getMountByName("temp"), mountedStore));
nonDefaultStores.add(new MountedNodeStore(mip.getMountByName("deep"), deepMountedStore));
nonDefaultStores.add(new MountedNodeStore(mip.getMountByName("empty"), emptyStore));
nonDefaultStores.add(new MountedNodeStore(mip.getMountByName("readOnly"), readOnlyStore));
store = new CompositeNodeStore(mip, globalStore, nonDefaultStores);
}
use of org.apache.jackrabbit.oak.spi.mount.MountInfoProvider in project jackrabbit-oak by apache.
the class HybridIndexClusterIT method customize.
@Override
protected Jcr customize(Jcr jcr) {
IndexCopier copier;
try {
copier = new IndexCopier(executorService, temporaryFolder.getRoot());
} catch (IOException e) {
throw new RuntimeException(e);
}
MountInfoProvider mip = defaultMountInfoProvider();
NRTIndexFactory nrtIndexFactory = new NRTIndexFactory(copier, clock, TimeUnit.MILLISECONDS.toSeconds(refreshDelta), StatisticsProvider.NOOP);
LuceneIndexReaderFactory indexReaderFactory = new DefaultIndexReaderFactory(mip, copier);
IndexTracker tracker = new IndexTracker(indexReaderFactory, nrtIndexFactory);
LuceneIndexProvider provider = new LuceneIndexProvider(tracker);
DocumentQueue queue = new DocumentQueue(100, tracker, sameThreadExecutor());
LuceneIndexEditorProvider editorProvider = new LuceneIndexEditorProvider(copier, tracker, null, null, mip);
editorProvider.setIndexingQueue(queue);
LocalIndexObserver localIndexObserver = new LocalIndexObserver(queue, StatisticsProvider.NOOP);
ExternalIndexObserver externalIndexObserver = new ExternalIndexObserver(queue, tracker, StatisticsProvider.NOOP);
QueryEngineSettings qs = new QueryEngineSettings();
qs.setFailTraversal(true);
jcr.with((QueryIndexProvider) provider).with((Observer) provider).with(localIndexObserver).with(externalIndexObserver).with(editorProvider).with(qs).withAsyncIndexing("async", TimeUnit.DAYS.toSeconds(1));
return jcr;
}
Aggregations