Hi, Thanks for the clarification. If ImmutableTree is not exposed the Unit test makes sense. I have fixed my modified code, the test passes. Only a few more to go.
Best Regards Ian On 3 June 2015 at 12:43, Angela Schreiber <anch...@adobe.com> wrote: > hi ian > > here is my take on it: > > - the ImmutableTree is just a tiny wrapper around the regular > non-secured Nodestate for the sake of allowing to make use > of the hierarchy operations that are missing in the NodeState > interface. > those immutable (read-only) trees are meant to be used for > oak internal low-level usages where keeping track of the > parent and the path is required although the operations are > meant to be performed on the un-secured NodeState, which > usually requires access to hidden items as well. > > - the MutableTree is that actual implementation of the Tree > interface that is exposed when operating on the Oak API > s.str. This one *must never* expose the hidden items. > > hope that helps > angela > > On 03/06/15 12:50, "Ian Boston" <i...@tfd.co.uk> wrote: > > >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 > >