Final cleanup work.

Relates to #4879

This moves mustache back to being shaded - having guava (which is a needed
dependency of mustache) explicitly in the distribution files isn't an option:
Used by too many projects and thus likely to cause version conflicts downstream.

In addition this adds a rest test for the query templating feature.