Search in sources :

Example 26 with ChangeSet

use of org.apache.jackrabbit.oak.spi.observation.ChangeSet in project jackrabbit-oak by apache.

the class ChangeCollectorProviderTest method testAddSomeChildren.

@Test
public void testAddSomeChildren() throws CommitFailedException {
    Root root = session.getLatestRoot();
    Tree rootTree = root.getTree("/test");
    for (int i = 0; i < 10; i++) {
        Tree child = rootTree.addChild("x" + i);
        child.setProperty(JcrConstants.JCR_PRIMARYTYPE, "test:type" + i, Type.NAME);
        child.setProperty("foo" + i, "bar");
    }
    root.commit();
    ChangeSet changeSet = getSingleChangeSet();
    assertMatches("parentPaths", changeSet.getParentPaths(), "/test", "/test/x0", "/test/x1", "/test/x2", "/test/x3", "/test/x4", "/test/x5", "/test/x6", "/test/x7", "/test/x8", "/test/x9");
    assertMatches("parentNodeNames", changeSet.getParentNodeNames(), "test", "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7", "x8", "x9");
    assertMatches("parentNodeTypes", changeSet.getParentNodeTypes(), "test:parentType", "test:type0", "test:type1", "test:type2", "test:type3", "test:type4", "test:type5", "test:type6", "test:type7", "test:type8", "test:type9");
    assertMatches("allNodeTypes", changeSet.getAllNodeTypes(), "test:parentType", "test:type0", "test:type1", "test:type2", "test:type3", "test:type4", "test:type5", "test:type6", "test:type7", "test:type8", "test:type9");
    assertMatches("propertyNames", changeSet.getPropertyNames(), JcrConstants.JCR_PRIMARYTYPE, "foo0", "foo1", "foo2", "foo3", "foo4", "foo5", "foo6", "foo7", "foo8", "foo9");
}
Also used : Root(org.apache.jackrabbit.oak.api.Root) Tree(org.apache.jackrabbit.oak.api.Tree) ChangeSet(org.apache.jackrabbit.oak.spi.observation.ChangeSet) Test(org.junit.Test)

Aggregations

ChangeSet (org.apache.jackrabbit.oak.spi.observation.ChangeSet)26 Root (org.apache.jackrabbit.oak.api.Root)19 Tree (org.apache.jackrabbit.oak.api.Tree)19 Test (org.junit.Test)18 CommitContext (org.apache.jackrabbit.oak.spi.commit.CommitContext)5 SimpleCommitContext (org.apache.jackrabbit.oak.spi.commit.SimpleCommitContext)4 NodeBuilder (org.apache.jackrabbit.oak.spi.state.NodeBuilder)4 CommitInfo (org.apache.jackrabbit.oak.spi.commit.CommitInfo)3 HashSet (java.util.HashSet)2 LinkedList (java.util.LinkedList)2 Stopwatch (com.google.common.base.Stopwatch)1 PrivilegedExceptionAction (java.security.PrivilegedExceptionAction)1 InitialContent (org.apache.jackrabbit.oak.InitialContent)1 Oak (org.apache.jackrabbit.oak.Oak)1 CommitInfoCollector (org.apache.jackrabbit.oak.plugins.index.AsyncIndexUpdateTest.CommitInfoCollector)1 PropertyIndexEditorProvider (org.apache.jackrabbit.oak.plugins.index.property.PropertyIndexEditorProvider)1 ChangeSetBuilder (org.apache.jackrabbit.oak.spi.observation.ChangeSetBuilder)1 Before (org.junit.Before)1