gerrit/gerrit-acceptance-framework
David Ostrovsky 9ebfce95b7 LightweightPluginDaemonTest: Expose plugin guice injectors
Plugin integration test infrastructure was added in: I689bb71413. For
test purpose there should be access to the plugin guice injectors to
allow to test plugin specific functionality.

Non plugin tests can achieve this by injecting needed classes in the
test class and the acceptance test framework ensures that the instances
of those classes are injected in the test class. This is possible, while
the GerritServer is started before the test class instance is created.

Given that the plugin loading, and guice injector creation initiated
from LightweightPluginDaemonTest#setUp method, plugin test classes
cannot use that nice feature and just inject the needed plugin class
instances, because the plugin specific guice injectors were not created
at the class instantiation time.

To overcome this problem, we expose TestServerPlugin instance from the
base class that has access to system, http and ssh guice injectors.

When a plugin test needs access to some plugin class instances, say
from system injector, the right idiom is (reviewers plugin example):

  private ReviewersConfig reviewersConfig() {
    return plugin.getSysInjector().getInstance(ReviewersConfig.class);
  }

Change-Id: I8a4c1db92d65f49bd5c0fbc265944a16a619f714
2018-03-17 21:37:03 +01:00
..
src/test/java/com/google/gerrit/acceptance LightweightPluginDaemonTest: Expose plugin guice injectors 2018-03-17 21:37:03 +01:00
BUILD Format BUILD and WORKSPACE files with buildifier 2017-02-28 17:32:44 +09:00
pom.xml Set version to 2.14.8-SNAPSHOT 2018-03-12 12:54:03 +09:00