Search in sources :

Example 41 with OpenSecurityProvider

use of org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider in project jackrabbit-oak by apache.

the class PrivateStoreValidatorProviderTest method setUp.

private void setUp(String... readOnlyPaths) {
    configureMountInfoProvider(readOnlyPaths);
    repository = new Oak().with(new OpenSecurityProvider()).with(new InitialContent()).with(privateStoreValidatorProvider).createContentRepository();
}
Also used : InitialContent(org.apache.jackrabbit.oak.InitialContent) Oak(org.apache.jackrabbit.oak.Oak) OpenSecurityProvider(org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider)

Example 42 with OpenSecurityProvider

use of org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider in project jackrabbit-oak by apache.

the class CommitContextTest method basicSetup.

@Test
public void basicSetup() throws Exception {
    repository = new Oak(store).with(new OpenSecurityProvider()).with(observer).createContentRepository();
    session = newSession();
    Root root = session.getLatestRoot();
    Tree tree = root.getTree("/");
    tree.setProperty("a", 1);
    root.commit(ImmutableMap.<String, Object>of("foo", "bar"));
    assertNotNull(observer.info);
    assertTrue(observer.info.getInfo().containsKey("foo"));
    assertTrue(observer.info.getInfo().containsKey(CommitContext.NAME));
    try {
        observer.info.getInfo().put("x", "y");
        fail("Info map should be immutable");
    } catch (Exception ignore) {
    }
}
Also used : Root(org.apache.jackrabbit.oak.api.Root) Oak(org.apache.jackrabbit.oak.Oak) Tree(org.apache.jackrabbit.oak.api.Tree) OpenSecurityProvider(org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider) LoginException(javax.security.auth.login.LoginException) CommitFailedException(org.apache.jackrabbit.oak.api.CommitFailedException) NoSuchWorkspaceException(javax.jcr.NoSuchWorkspaceException) IOException(java.io.IOException) Test(org.junit.Test) OakBaseTest(org.apache.jackrabbit.oak.OakBaseTest)

Example 43 with OpenSecurityProvider

use of org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider in project jackrabbit-oak by apache.

the class HybridIndexTest method createRepository.

@Override
protected ContentRepository createRepository() {
    IndexCopier copier;
    try {
        copier = new IndexCopier(executorService, temporaryFolder.getRoot());
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
    MountInfoProvider mip = defaultMountInfoProvider();
    nrtIndexFactory = new NRTIndexFactory(copier, clock, TimeUnit.MILLISECONDS.toSeconds(refreshDelta), StatisticsProvider.NOOP);
    nrtIndexFactory.setAssertAllResourcesClosed(true);
    LuceneIndexReaderFactory indexReaderFactory = new DefaultIndexReaderFactory(mip, copier);
    IndexTracker tracker = new IndexTracker(indexReaderFactory, nrtIndexFactory);
    luceneIndexProvider = new LuceneIndexProvider(tracker);
    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);
    nodeStore = new MemoryNodeStore();
    Oak oak = new Oak(nodeStore).with(new InitialContent()).with(new OpenSecurityProvider()).with((QueryIndexProvider) luceneIndexProvider).with((Observer) luceneIndexProvider).with(localIndexObserver).with(editorProvider).with(new PropertyIndexEditorProvider()).with(new NodeTypeIndexProvider()).with(optionalEditorProvider).with(new NodeCounterEditorProvider()).withAsyncIndexing("async", TimeUnit.DAYS.toSeconds(1));
    wb = oak.getWhiteboard();
    return oak.createContentRepository();
}
Also used : NodeTypeIndexProvider(org.apache.jackrabbit.oak.plugins.index.nodetype.NodeTypeIndexProvider) IndexTracker(org.apache.jackrabbit.oak.plugins.index.lucene.IndexTracker) OpenSecurityProvider(org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider) PropertyIndexEditorProvider(org.apache.jackrabbit.oak.plugins.index.property.PropertyIndexEditorProvider) IOException(java.io.IOException) LuceneIndexReaderFactory(org.apache.jackrabbit.oak.plugins.index.lucene.reader.LuceneIndexReaderFactory) IndexCopier(org.apache.jackrabbit.oak.plugins.index.lucene.IndexCopier) InitialContent(org.apache.jackrabbit.oak.InitialContent) LuceneIndexEditorProvider(org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexEditorProvider) MemoryNodeStore(org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore) Observer(org.apache.jackrabbit.oak.spi.commit.Observer) Oak(org.apache.jackrabbit.oak.Oak) DefaultIndexReaderFactory(org.apache.jackrabbit.oak.plugins.index.lucene.reader.DefaultIndexReaderFactory) LuceneIndexProvider(org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexProvider) Mounts.defaultMountInfoProvider(org.apache.jackrabbit.oak.spi.mount.Mounts.defaultMountInfoProvider) MountInfoProvider(org.apache.jackrabbit.oak.spi.mount.MountInfoProvider) NodeCounterEditorProvider(org.apache.jackrabbit.oak.plugins.index.counter.NodeCounterEditorProvider)

Example 44 with OpenSecurityProvider

use of org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider in project jackrabbit-oak by apache.

the class LucenePropertyIndexTest method createRepository.

@Override
protected ContentRepository createRepository() {
    IndexCopier copier = createIndexCopier();
    editorProvider = new LuceneIndexEditorProvider(copier, new ExtractedTextCache(10 * FileUtils.ONE_MB, 100));
    provider = new LuceneIndexProvider(copier);
    queryIndexProvider = new ResultCountingIndexProvider(provider);
    nodeStore = new MemoryNodeStore();
    return new Oak(nodeStore).with(new InitialContent()).with(new OpenSecurityProvider()).with(queryIndexProvider).with((Observer) provider).with(editorProvider).with(optionalEditorProvider).with(new PropertyIndexEditorProvider()).with(new NodeTypeIndexProvider()).createContentRepository();
}
Also used : InitialContent(org.apache.jackrabbit.oak.InitialContent) NodeTypeIndexProvider(org.apache.jackrabbit.oak.plugins.index.nodetype.NodeTypeIndexProvider) MemoryNodeStore(org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore) Observer(org.apache.jackrabbit.oak.spi.commit.Observer) Oak(org.apache.jackrabbit.oak.Oak) OpenSecurityProvider(org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider) PropertyIndexEditorProvider(org.apache.jackrabbit.oak.plugins.index.property.PropertyIndexEditorProvider)

Example 45 with OpenSecurityProvider

use of org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider in project jackrabbit-oak by apache.

the class NodeStateCopyUtilsTest method copyToJcrAndHiddenProps.

@Test
public void copyToJcrAndHiddenProps() throws Exception {
    repository = new Jcr().with(new OpenSecurityProvider()).createRepository();
    Tree srcTree = TreeFactory.createTree(builder);
    srcTree.addChild("a").setProperty("foo", "y");
    srcTree.addChild("a").setProperty(JcrConstants.JCR_PRIMARYTYPE, NT_OAK_UNSTRUCTURED, Type.NAME);
    builder.child(":hidden-node").setProperty("x", "y");
    builder.setProperty(":hidden-prop", "y");
    Session session = repository.login(null, null);
    Node node = session.getRootNode();
    Node test = node.addNode("test", NT_OAK_UNSTRUCTURED);
    NodeStateCopyUtils.copyToNode(builder.getNodeState(), test);
    session.save();
    test = session.getNode("/test");
    assertEquals("y", test.getProperty("a/foo").getString());
}
Also used : Node(javax.jcr.Node) Jcr(org.apache.jackrabbit.oak.jcr.Jcr) Tree(org.apache.jackrabbit.oak.api.Tree) OpenSecurityProvider(org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider) Session(javax.jcr.Session) Test(org.junit.Test)

Aggregations

OpenSecurityProvider (org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider)51 Oak (org.apache.jackrabbit.oak.Oak)38 InitialContent (org.apache.jackrabbit.oak.InitialContent)25 Test (org.junit.Test)19 Root (org.apache.jackrabbit.oak.api.Root)16 Tree (org.apache.jackrabbit.oak.api.Tree)14 PropertyIndexEditorProvider (org.apache.jackrabbit.oak.plugins.index.property.PropertyIndexEditorProvider)14 ContentRepository (org.apache.jackrabbit.oak.api.ContentRepository)12 MemoryNodeStore (org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore)11 Before (org.junit.Before)11 IOException (java.io.IOException)8 NodeTypeIndexProvider (org.apache.jackrabbit.oak.plugins.index.nodetype.NodeTypeIndexProvider)8 QueryIndexProvider (org.apache.jackrabbit.oak.spi.query.QueryIndexProvider)8 ContentSession (org.apache.jackrabbit.oak.api.ContentSession)7 Nonnull (javax.annotation.Nonnull)6 Closeable (java.io.Closeable)5 LuceneIndexEditorProvider (org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexEditorProvider)5 LuceneIndexProvider (org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexProvider)5 Observer (org.apache.jackrabbit.oak.spi.commit.Observer)5 CommitFailedException (org.apache.jackrabbit.oak.api.CommitFailedException)4