add unit test to org.modeshape.jcr.TransactionsTest.java
@FixFor("MODE-2627") @Test public void shouldUpdateACLOnMovedNode() throws Exception { AccessControlManager acm = session.getAccessControlManager(); final String childPath2 = "/parent/child2"; final String childDestinationNode = "/parent/child/child2"; JcrAccessControlList acl = new JcrAccessControlList(childDestinationNode); Privileges privileges = new Privileges(session); Privilege[] privilegeArray = new Privilege[]
; acl.addAccessControlEntry(SimplePrincipal.newInstance("anonymous"), privilegeArray); startTransaction(); Node parent = session.getRootNode().addNode("parent"); parent.addNode("child"); parent.addNode("child2"); session.save(); commitTransaction(); startTransaction(); session.getWorkspace().move(childPath2, childDestinationNode); session.save(); commitTransaction(); startTransaction(); acm.setPolicy(childDestinationNode, acl); session.save(); Node movedNode = session.getNode(childDestinationNode); assertEquals(childDestinationNode, movedNode.getPath()); assertEquals(1, acm.getPolicies(childDestinationNode).length); assertEquals(acm.getPolicies(childDestinationNode)[0], acl); assertNoNode(childPath2); session.logout(); commitTransaction(); }
getPolicies returns empty array, but acl was set before.