Resubmitting pull request for SPR-8097 (#12752) with some test case fixes and squashed commits.

I have signed and agree to the terms of the SpringSource Individual Contributor License Agreement.

Comment From: pivotal-issuemaster

@twicksell Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

Comment From: pivotal-issuemaster

@twicksell Thank you for signing the Contributor License Agreement!