Search in sources :

Example 1 with InitialContent

use of org.apache.jackrabbit.oak.InitialContent in project jackrabbit-oak by apache.

the class UniquePropertyTest method testUniqueness.

@Test
public void testUniqueness() throws Exception {
    Root root = new Oak().with(new OpenSecurityProvider()).with(new PropertyIndexEditorProvider()).with(new InitialContent()).createRoot();
    NodeUtil node = new NodeUtil(root.getTree("/"));
    String uuid = UUID.randomUUID().toString();
    node.setString(JcrConstants.JCR_UUID, uuid);
    root.commit();
    NodeUtil child = new NodeUtil(root.getTree("/")).addChild("another", "rep:User");
    child.setString(JcrConstants.JCR_UUID, uuid);
    try {
        root.commit();
        fail("Duplicate jcr:uuid should be detected.");
    } catch (CommitFailedException e) {
    // expected
    }
}
Also used : InitialContent(org.apache.jackrabbit.oak.InitialContent) Root(org.apache.jackrabbit.oak.api.Root) Oak(org.apache.jackrabbit.oak.Oak) OpenSecurityProvider(org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider) CommitFailedException(org.apache.jackrabbit.oak.api.CommitFailedException) NodeUtil(org.apache.jackrabbit.oak.util.NodeUtil) Test(org.junit.Test)

Example 2 with InitialContent

use of org.apache.jackrabbit.oak.InitialContent in project jackrabbit-oak by apache.

the class PropertyIndexStatsTest method prepareStore.

private void prepareStore() throws CommitFailedException {
    activateMBean();
    NodeState root = store.getRoot();
    NodeBuilder builder = root.builder();
    new InitialContent().initialize(builder);
    store.merge(builder, HOOK, CommitInfo.EMPTY);
}
Also used : InitialContent(org.apache.jackrabbit.oak.InitialContent) NodeState(org.apache.jackrabbit.oak.spi.state.NodeState) NodeBuilder(org.apache.jackrabbit.oak.spi.state.NodeBuilder)

Example 3 with InitialContent

use of org.apache.jackrabbit.oak.InitialContent in project jackrabbit-oak by apache.

the class PropertyIndexInfoProviderTest method setUp.

@Before
public void setUp() throws CommitFailedException {
    NodeBuilder builder = store.getRoot().builder();
    new InitialContent().initialize(builder);
    store.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY);
}
Also used : InitialContent(org.apache.jackrabbit.oak.InitialContent) NodeBuilder(org.apache.jackrabbit.oak.spi.state.NodeBuilder) Before(org.junit.Before)

Example 4 with InitialContent

use of org.apache.jackrabbit.oak.InitialContent 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 5 with InitialContent

use of org.apache.jackrabbit.oak.InitialContent 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)

Aggregations

InitialContent (org.apache.jackrabbit.oak.InitialContent)43 Oak (org.apache.jackrabbit.oak.Oak)31 OpenSecurityProvider (org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider)25 PropertyIndexEditorProvider (org.apache.jackrabbit.oak.plugins.index.property.PropertyIndexEditorProvider)15 NodeBuilder (org.apache.jackrabbit.oak.spi.state.NodeBuilder)15 MemoryNodeStore (org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore)11 Before (org.junit.Before)11 Test (org.junit.Test)10 NodeTypeIndexProvider (org.apache.jackrabbit.oak.plugins.index.nodetype.NodeTypeIndexProvider)9 IOException (java.io.IOException)8 Root (org.apache.jackrabbit.oak.api.Root)8 TypeEditorProvider (org.apache.jackrabbit.oak.plugins.nodetype.TypeEditorProvider)7 NodeState (org.apache.jackrabbit.oak.spi.state.NodeState)7 SecurityProvider (org.apache.jackrabbit.oak.spi.security.SecurityProvider)6 ContentRepository (org.apache.jackrabbit.oak.api.ContentRepository)5 Observer (org.apache.jackrabbit.oak.spi.commit.Observer)5 QueryIndexProvider (org.apache.jackrabbit.oak.spi.query.QueryIndexProvider)5 NodeStore (org.apache.jackrabbit.oak.spi.state.NodeStore)5 Tree (org.apache.jackrabbit.oak.api.Tree)4 IndexCopier (org.apache.jackrabbit.oak.plugins.index.lucene.IndexCopier)4