Patrick Hiesel 809e8e108b Fix child collection bindings in RestApiServlet and add tests
The Gerrit Plugin injector and the RestApiServlet currently have
different bugs. This commit papers over the most pressing ones and adds
tests so that plugins can bind child collections and offer modifications
directly on the collections (e.g. postOnCollection).

When binding rest views from plugins, the plugin name is incorrectly set
to "gerrit" which is what we use for core Gerrit views. This does not
apply to collections though. These are bound with the correct plugin
name "plugin-name".

In RestApiServlet, this leads to a situation where the collection thinks
it belongs to a different part of Gerrit. For operations that modify the
collection (post, delete) this means we have to use "gerrit" as the
component name when looking up child views. For root collections, we
already do this and this is why it works for existing plugin root
collections. For subcollections, however, we did not - which is what
this commit changes. Now the two usages in RestApiServlet are
consistent.

To be clear: They are now consistently wrong across the different parts
of Gerrit, but they are consistent which means they work.

As future work, we want to fix this long standing issue by binding the
correct plugin names from the beginning. This is non-trivial though
because the DynamicMapProvider has no context on the plugin that is
performing the binding.

This commit adds the same logic that we have for core-collection
delegation to plugin-collections in RestApiServlet.

Change-Id: I954105155c4a354b6c577d8cc246d00998e33f57
2019-03-05 17:45:20 +01:00
..
2018-12-21 13:54:37 -08:00
2018-11-13 15:06:26 -08:00
2018-08-14 08:07:59 +02:00