Search in sources :

Example 6 with InitialContent

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

the class IdentifierManagerTest method setUp.

@Before
public void setUp() throws CommitFailedException {
    root = new Oak().with(new OpenSecurityProvider()).with(new InitialContent()).createContentSession().getLatestRoot();
    Tree tree = root.getTree("/");
    Tree x = tree.addChild("x");
    Tree y = tree.addChild("y");
    y.setProperty(JcrConstants.JCR_UUID, UUID_Y);
    Tree z = tree.addChild("z");
    x.addChild("x1");
    y.addChild("y1");
    z.addChild("z1").setProperty(JcrConstants.JCR_UUID, UUID_Z1);
    root.commit();
    identifierManager = new IdentifierManager(root);
}
Also used : InitialContent(org.apache.jackrabbit.oak.InitialContent) Oak(org.apache.jackrabbit.oak.Oak) Tree(org.apache.jackrabbit.oak.api.Tree) OpenSecurityProvider(org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider) Before(org.junit.Before)

Example 7 with InitialContent

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

the class NodeCounterIndexTest method createRepository.

protected ContentRepository createRepository() {
    nodeStore = new MemoryNodeStore();
    Oak oak = new Oak(nodeStore).with(new InitialContent()).with(new OpenSecurityProvider()).with(new PropertyIndexEditorProvider()).with(new NodeCounterEditorProvider()).withAsyncIndexing("async", TimeUnit.DAYS.toSeconds(1));
    wb = oak.getWhiteboard();
    return oak.createContentRepository();
}
Also used : InitialContent(org.apache.jackrabbit.oak.InitialContent) MemoryNodeStore(org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore) Oak(org.apache.jackrabbit.oak.Oak) OpenSecurityProvider(org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider) PropertyIndexEditorProvider(org.apache.jackrabbit.oak.plugins.index.property.PropertyIndexEditorProvider)

Example 8 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 9 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 10 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)

Aggregations

InitialContent (org.apache.jackrabbit.oak.InitialContent)32 Oak (org.apache.jackrabbit.oak.Oak)23 OpenSecurityProvider (org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider)17 NodeBuilder (org.apache.jackrabbit.oak.spi.state.NodeBuilder)11 PropertyIndexEditorProvider (org.apache.jackrabbit.oak.plugins.index.property.PropertyIndexEditorProvider)10 Before (org.junit.Before)9 Test (org.junit.Test)9 SecurityProviderImpl (org.apache.jackrabbit.oak.security.SecurityProviderImpl)7 Root (org.apache.jackrabbit.oak.api.Root)6 MemoryNodeStore (org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore)6 TypeEditorProvider (org.apache.jackrabbit.oak.plugins.nodetype.TypeEditorProvider)6 NodeState (org.apache.jackrabbit.oak.spi.state.NodeState)5 IOException (java.io.IOException)4 ContentRepository (org.apache.jackrabbit.oak.api.ContentRepository)4 AbstractSecurityTest (org.apache.jackrabbit.oak.AbstractSecurityTest)3 Tree (org.apache.jackrabbit.oak.api.Tree)3 NodeTypeIndexProvider (org.apache.jackrabbit.oak.plugins.index.nodetype.NodeTypeIndexProvider)3 QueryIndexProvider (org.apache.jackrabbit.oak.spi.query.QueryIndexProvider)3 HashMap (java.util.HashMap)2 Nonnull (javax.annotation.Nonnull)2