Calling match() on the EqualsLabelPredicate returned from
ChangeQueryBuilder.parse() in a plugin fails when in the context of an
HTTP query. In HTTP query workflow, ChangeData lazyLoad flag is being
set to true when certain conditions are met. But in SSH workflow,
ChangeData lazyLoad flag is always set to true. Due to this reason,
we observe the issue only through a HTTP query. In [1], ChangeControl
was modified to use ChangeNotes, but EqualsLabelPredicate wasn't
updated to always load ChangeNotes in order to check permissions for
approvers. Fix this issue by setting ChangeData lazy load to true
within match() in EqualsLabelPredicate.
Also write integration tests for Label Predicate to ensure it continues
to work as expected. In this test setup, plugin named "my-plugin"
defines a --sample switch which calls match() on the predicate received
from ChangeQueryBuilder.parse() which parses a Label operator query.
[1] Iac176b8e55e https://gerrit-review.googlesource.com/246154
Change-Id: Icd2541fe26c18a8e61ce855862e0c9814a91f5ef