[ 
https://issues.apache.org/jira/browse/SLING-11789?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eric Norman closed SLING-11789.
-------------------------------

Closing with the 1.6.4 release

> MockNode#orderBefore incorrectly removes commonly prefixed child nodes
> ----------------------------------------------------------------------
>
>                 Key: SLING-11789
>                 URL: https://issues.apache.org/jira/browse/SLING-11789
>             Project: Sling
>          Issue Type: Bug
>          Components: Testing
>            Reporter: Eric Norman
>            Assignee: Eric Norman
>            Priority: Major
>             Fix For: Testing JCR Mock 1.6.4
>
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> The MockNode#orderBefore implementation is using a simple "startsWith" check 
> on path strings to find the items to move.  This will match too many items if 
> the sibling nodes have names with a common prefix.
> For example, for the following scenario child10 should be ordered before 
> child100, but what actually happens is both child10 and child100 get removed 
> from the parent.
>  
> {code:java}
> Node foo = this.session.getRootNode().addNode("foo");
> foo.addNode("child100");
> foo.addNode("child10");
> foo.addNode("child1");
> foo.orderBefore("child10", "child100"); 
> {code}
> Expected:
> The "find all items matching the source" logic in MockSession#orderBefore 
> should be changed to match paths that equal the source path exactly or starts 
> with the source path with a trailing slash.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to