Hi,

I am confused how hidden trees work in MutableTree and ImmutableTree.

The ImmutableTreeTesttestHiddenExists asserts that a hidden node from an
ImmutableTree will return true() to exists, and yet the same node from a
MuttableTree is hard coded to return false to exists().


Is this correct ? If so, why ?


Some checks I added to the test to investigate are below.

assume I have a node ':hidden' which I believe has been committed to the
NodeStore in use.

--------- check1 ----------------------

        NodeState testNode2 = store.getRoot().getChildNode(":hidden");
        boolean testNode2Exists = testNode2.exists();


testNode2 is a DocumentNodeState "{ path: '/:hidden', rev:
'r14db8ebf37d-0-1', properties: '{}' }"
testNode2Exists == true


--------- check2 ----------------------

        Tree mutableTree  = session.getLatestRoot().getTree("/");
       Tree hiddenTree = mutableTree.getChild(":hidden");
       boolean hiddenTreeExists = hiddenTree.exists();

hiddenTree is a HiddenTree "/:hidden: {}"
hiddenTreeExists == false

hiddenTree is a HiddenTree because mutableTree.getChild looks at the name
and hard codes a HiddenTree for anything beginning with ':'


----------- check3 --------------------

       ImmutableTree immutable = new ImmutableTree(state);
       ImmutableTree hiddenChild = immutable.getChild(":hidden");
       boolean childExists = hiddenChild.exists();
hiddenChild is an ImmutableTree,
childExists == true

The unit test does:

    @Test
    public void testHiddenExists() {
        ImmutableTree hidden = immutable.getChild(":hidden");
        assertTrue(hidden.exists());
    }

BTW: I the modified NodeStore I am working on, check3 childExists returns
false, failing the test, hence the question. I would like to understand why
the test is correct so I can find the bug in my code.


Best Regards
Ian

Reply via email to