Wrap Repository and associated resources with try-with-resource
The lack of use of try-with-resource pattern caused the leak
of Repository and associated wrapper objects left open.
After the introduction of the Repository objects leak detector
in Gerrit master with I3037064 the tests were failing because
of the leaks left behind.
Wrap all the Repository objects created directly or indirectly
through one of its container objects and make sure that all tests
are executed without leaks.
Change-Id: Ia20fb505b3d8c9db04b8b50e16a9a3d41bba5d96
3 files changed