Search in sources :

Example 6 with OpenSecurityProvider

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

the class OakTest method commitContextInCommitInfo.

@Test
public void commitContextInCommitInfo() throws Exception {
    CommitInfoCapturingStore store = new CommitInfoCapturingStore();
    Oak oak = new Oak(store);
    ContentRepository repo = oak.with(new OpenSecurityProvider()).createContentRepository();
    assertThat(store.infos, is(not(empty())));
    for (CommitInfo ci : store.infos) {
        assertNotNull(ci.getInfo().get(CommitContext.NAME));
    }
    ((Closeable) repo).close();
}
Also used : Closeable(java.io.Closeable) ContentRepository(org.apache.jackrabbit.oak.api.ContentRepository) OpenSecurityProvider(org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider) CommitInfo(org.apache.jackrabbit.oak.spi.commit.CommitInfo) Test(org.junit.Test)

Example 7 with OpenSecurityProvider

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

the class NodeTypeRegistryTest method setUp.

@Before
public void setUp() throws LoginException, NoSuchWorkspaceException {
    repository = new Oak().with(new InitialContent()).with(new OpenSecurityProvider()).with(new TypeEditorProvider()).createContentRepository();
    session = repository.login(null, null);
    root = session.getLatestRoot();
}
Also used : InitialContent(org.apache.jackrabbit.oak.InitialContent) TypeEditorProvider(org.apache.jackrabbit.oak.plugins.nodetype.TypeEditorProvider) Oak(org.apache.jackrabbit.oak.Oak) OpenSecurityProvider(org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider) Before(org.junit.Before)

Example 8 with OpenSecurityProvider

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

the class CommitContextTest method attributeAddedByCommitHook.

@Test
public void attributeAddedByCommitHook() throws Exception {
    repository = new Oak(store).with(new OpenSecurityProvider()).with(observer).with(new CommitHook() {

        @Nonnull
        @Override
        public NodeState processCommit(NodeState before, NodeState after, CommitInfo info) throws CommitFailedException {
            CommitContext attrs = (CommitContext) info.getInfo().get(CommitContext.NAME);
            assertNotNull(attrs);
            attrs.set("foo", "bar");
            return after;
        }
    }).createContentRepository();
    session = newSession();
    Root root = session.getLatestRoot();
    Tree tree = root.getTree("/");
    tree.setProperty("a", 1);
    root.commit();
    assertNotNull(observer.info);
    CommitContext attrs = (CommitContext) observer.info.getInfo().get(CommitContext.NAME);
    assertNotNull(attrs.get("foo"));
}
Also used : NodeState(org.apache.jackrabbit.oak.spi.state.NodeState) Root(org.apache.jackrabbit.oak.api.Root) Nonnull(javax.annotation.Nonnull) Oak(org.apache.jackrabbit.oak.Oak) Tree(org.apache.jackrabbit.oak.api.Tree) OpenSecurityProvider(org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider) CommitFailedException(org.apache.jackrabbit.oak.api.CommitFailedException) Test(org.junit.Test) OakBaseTest(org.apache.jackrabbit.oak.OakBaseTest)

Example 9 with OpenSecurityProvider

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

the class SubtreeSolrIndexIT method createRepository.

@Override
protected ContentRepository createRepository() {
    try {
        DefaultSolrServerProvider solrServerProvider = new DefaultSolrServerProvider();
        DefaultSolrConfigurationProvider oakSolrConfigurationProvider = new DefaultSolrConfigurationProvider();
        return new Oak().with(new InitialContent()).with(new OpenSecurityProvider()).with(new SolrQueryIndexProvider(solrServerProvider, oakSolrConfigurationProvider)).with(new SolrIndexEditorProvider(solrServerProvider, oakSolrConfigurationProvider)).createContentRepository();
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
Also used : DefaultSolrServerProvider(org.apache.jackrabbit.oak.plugins.index.solr.server.DefaultSolrServerProvider) InitialContent(org.apache.jackrabbit.oak.InitialContent) DefaultSolrConfigurationProvider(org.apache.jackrabbit.oak.plugins.index.solr.configuration.DefaultSolrConfigurationProvider) Oak(org.apache.jackrabbit.oak.Oak) OpenSecurityProvider(org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider) SolrIndexEditorProvider(org.apache.jackrabbit.oak.plugins.index.solr.index.SolrIndexEditorProvider)

Example 10 with OpenSecurityProvider

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

the class SolrIndexIT method createRepository.

@Override
protected ContentRepository createRepository() {
    try {
        DefaultSolrServerProvider solrServerProvider = new DefaultSolrServerProvider();
        DefaultSolrConfigurationProvider oakSolrConfigurationProvider = new DefaultSolrConfigurationProvider();
        return new Oak().with(new InitialContent()).with(new OpenSecurityProvider()).with(new SolrQueryIndexProvider(solrServerProvider, oakSolrConfigurationProvider)).with(new SolrIndexEditorProvider(solrServerProvider, oakSolrConfigurationProvider)).createContentRepository();
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
Also used : DefaultSolrServerProvider(org.apache.jackrabbit.oak.plugins.index.solr.server.DefaultSolrServerProvider) InitialContent(org.apache.jackrabbit.oak.InitialContent) DefaultSolrConfigurationProvider(org.apache.jackrabbit.oak.plugins.index.solr.configuration.DefaultSolrConfigurationProvider) Oak(org.apache.jackrabbit.oak.Oak) OpenSecurityProvider(org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider) SolrIndexEditorProvider(org.apache.jackrabbit.oak.plugins.index.solr.index.SolrIndexEditorProvider)

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