hi all
once again i found myself struggling with the way the commit hooks
identify new items. in the example test below there is in fact a
new node being created.
nevertheless the commit hook (in this case the VersionablePathHook)
will not see a new jcr:versionhistory property but only the modification
of an existing one... which is at least a bit confusing as this
protected property can't be modified and there was in fact a new
node created which get's a new version history, a new uuid and so forth.
>@Test
> public void testVersionableChildNode2() throws Exception {
> Node testNode =
>superuser.getNode(path).addNode("n1").addNode("n2").addNode("n3").addNode(
>"
>jcr:content");
> testNode.addMixin("mix:versionable");
> superuser.save();
>
>
> testNode.remove();
> testNode =
>superuser.getNode(path).getNode("n1").getNode("n2").getNode("n3").addNode(
>"
>jcr:content");
> testNode.addMixin("mix:versionable");
> superuser.save(); // does NOT trigger
>VersionablePathHook#propertyAdded
>
> assertTrue(testNode.isNodeType("mix:versionable"));
> VersionHistory vh = testNode.getVersionHistory();
> Property versionablePath =
>vh.getProperty(superuser.getWorkspace().getName()); // FAILS with
>PathNotFoundException!
> assertEquals(testNode.getPath(), versionablePath.getString());
> }
i can work around this by looking for modified jcr:versionHistory
properties.
but to be honest this looks quite wrong to me :-)
kind regards
angela