TRUNK-6450: Deleting a role with a parent temporarily breaks some parts of the application #5554
+45
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of what I changed
This PR fixes a caching issue where deleting a Child Role left the Parent Role with a stale reference to the deleted child in its
childRolescollection. This caused UI breakages when trying to view the Parent Role immediately after deletion.I modified
UserServiceImpl.purgeRole()to fix a cache incoherency where a parent role retains a stale reference to a deleted child role.Changes:
purgeRole_shouldUpdateParentRoleCacheWhenChildRoleIsDeletedinUserServiceTestto verify that the parent's child collection is empty after the delete.Issue I worked on
see https://issues.openmrs.org/browse/TRUNK-6450
Checklist: I completed these to help reviewers :)
My IDE is configured to follow the code style of this project.
I have added tests to cover my changes.
I ran
mvn clean packageright before creating this pull request and added all formatting changes to my commit.All new and existing tests passed.
My pull request is based on the latest changes of the master branch.