ModeShape/modeshape — pull request #749 by rhauch (2013-03-19 16:07:19+00:00)
Title: MODE-1856 Attempt to index changes only when there are real changes

The internal session nodes that track transient changes were not correctly recording how a property was removed. If a property were added and immediately removed (all before saving), the add was cleared from the transient state but the remove was still kept. (This was due to the fact that it's more difficult to track removes, since we're using a single structure to track adds and sets, so it's not really easy to tell when a property was added and then removed.) This change works around that constraint by using the persisted state of the node to determine if any added/set property already exists in the persisted state. If not, then the remove is considered to undo the prior add/set.

A single test was added to perform the add/remove prior to a save. However, due to the eventing mechanism, it's not possible for the test to verify that the node was not re-indexed. (Simple debugging and trace logging was used to verify that such changes no longer cause an update to the node's indexes. If there are better ideas for how the test can verify, please say so.)