Exemple #1
0
  public static Injector getBotInjector(Version v, boolean login) {
    final String wikiUrl = getWikiUrl(v, LiveTestFather.getValue("localwikihost"));
    TestHelper.assumeReachable(wikiUrl);
    Injector injector =
        masterInjector.createChildInjector(
            new AbstractModule() {

              @Override
              protected void configure() {
                bind(CacheActionClient.class) //
                    .toInstance(Mockito.spy(new CacheActionClient(wikiUrl, new WireRegister())));
                bind(HttpBot.class).to(CacheHttpBot.class);
                bind(MediaWikiBot.class).asEagerSingleton();
              }
            });
    MediaWikiBot bot = injector.getInstance(MediaWikiBot.class);
    if (login) {
      bot.login(getWikiUser(v), getWikiPass(v));
    }
    return injector;
  }