Search in sources :

Example 1 with GerritServerConfig

use of com.google.gerrit.server.config.GerritServerConfig in project gerrit by GerritCodeReview.

the class GerritServer method createTestInjector.

private static Injector createTestInjector(Daemon daemon) throws Exception {
    Injector sysInjector = getInjector(daemon, "sysInjector");
    Module module = new FactoryModule() {

        @Override
        protected void configure() {
            bindConstant().annotatedWith(SshEnabled.class).to(daemon.getEnableSshd());
            bind(AccountCreator.class);
            bind(AccountOperations.class).to(AccountOperationsImpl.class);
            bind(GroupOperations.class).to(GroupOperationsImpl.class);
            bind(ProjectOperations.class).to(ProjectOperationsImpl.class);
            bind(RequestScopeOperations.class).to(RequestScopeOperationsImpl.class);
            bind(ChangeOperations.class).to(ChangeOperationsImpl.class);
            factory(PerPatchsetOperationsImpl.Factory.class);
            factory(PerCommentOperationsImpl.Factory.class);
            factory(PerDraftCommentOperationsImpl.Factory.class);
            factory(PerRobotCommentOperationsImpl.Factory.class);
            factory(PushOneCommit.Factory.class);
            install(InProcessProtocol.module());
            install(new NoSshModule());
            install(new AsyncReceiveCommitsModule());
            factory(ProjectResetter.Builder.Factory.class);
        }

        @Provides
        @Singleton
        @Nullable
        @TestSshServerAddress
        InetSocketAddress getSshAddress(@GerritServerConfig Config cfg) {
            String addr = cfg.getString("sshd", null, "listenAddress");
            // We do not use InitSshd.isOff to avoid coupling GerritServer to the SSH code.
            return !"off".equalsIgnoreCase(addr) ? SocketUtil.resolve(cfg.getString("sshd", null, "listenAddress"), 0) : null;
        }
    };
    return sysInjector.createChildInjector(module);
}
Also used : AccountOperations(com.google.gerrit.acceptance.testsuite.account.AccountOperations) GerritServerConfig(com.google.gerrit.server.config.GerritServerConfig) NoSshModule(com.google.gerrit.server.ssh.NoSshModule) FactoryModule(com.google.gerrit.extensions.config.FactoryModule) Config(org.eclipse.jgit.lib.Config) GlobalPluginConfig(com.google.gerrit.acceptance.config.GlobalPluginConfig) GerritServerConfig(com.google.gerrit.server.config.GerritServerConfig) GerritConfig(com.google.gerrit.acceptance.config.GerritConfig) AsyncReceiveCommitsModule(com.google.gerrit.server.git.receive.AsyncReceiveCommits.AsyncReceiveCommitsModule) ChangeOperations(com.google.gerrit.acceptance.testsuite.change.ChangeOperations) PerPatchsetOperationsImpl(com.google.gerrit.acceptance.testsuite.change.PerPatchsetOperationsImpl) PerDraftCommentOperationsImpl(com.google.gerrit.acceptance.testsuite.change.PerDraftCommentOperationsImpl) PerCommentOperationsImpl(com.google.gerrit.acceptance.testsuite.change.PerCommentOperationsImpl) GroupOperations(com.google.gerrit.acceptance.testsuite.group.GroupOperations) Injector(com.google.inject.Injector) PerRobotCommentOperationsImpl(com.google.gerrit.acceptance.testsuite.change.PerRobotCommentOperationsImpl) Module(com.google.inject.Module) FakeIndexModule(com.google.gerrit.index.testing.FakeIndexModule) ConfigExperimentFeaturesModule(com.google.gerrit.server.experiments.ConfigExperimentFeatures.ConfigExperimentFeaturesModule) LuceneIndexModule(com.google.gerrit.lucene.LuceneIndexModule) ReindexProjectsAtStartupModule(com.google.gerrit.acceptance.ReindexProjectsAtStartup.ReindexProjectsAtStartupModule) FactoryModule(com.google.gerrit.extensions.config.FactoryModule) FakeEmailSenderModule(com.google.gerrit.testing.FakeEmailSender.FakeEmailSenderModule) ReindexGroupsAtStartupModule(com.google.gerrit.acceptance.ReindexGroupsAtStartup.ReindexGroupsAtStartupModule) FakeGroupAuditServiceModule(com.google.gerrit.acceptance.FakeGroupAuditService.FakeGroupAuditServiceModule) NoSshModule(com.google.gerrit.server.ssh.NoSshModule) AsyncReceiveCommitsModule(com.google.gerrit.server.git.receive.AsyncReceiveCommits.AsyncReceiveCommitsModule) AbstractModule(com.google.inject.AbstractModule) ProjectOperations(com.google.gerrit.acceptance.testsuite.project.ProjectOperations) RequestScopeOperations(com.google.gerrit.acceptance.testsuite.request.RequestScopeOperations)

Aggregations

FakeGroupAuditServiceModule (com.google.gerrit.acceptance.FakeGroupAuditService.FakeGroupAuditServiceModule)1 ReindexGroupsAtStartupModule (com.google.gerrit.acceptance.ReindexGroupsAtStartup.ReindexGroupsAtStartupModule)1 ReindexProjectsAtStartupModule (com.google.gerrit.acceptance.ReindexProjectsAtStartup.ReindexProjectsAtStartupModule)1 GerritConfig (com.google.gerrit.acceptance.config.GerritConfig)1 GlobalPluginConfig (com.google.gerrit.acceptance.config.GlobalPluginConfig)1 AccountOperations (com.google.gerrit.acceptance.testsuite.account.AccountOperations)1 ChangeOperations (com.google.gerrit.acceptance.testsuite.change.ChangeOperations)1 PerCommentOperationsImpl (com.google.gerrit.acceptance.testsuite.change.PerCommentOperationsImpl)1 PerDraftCommentOperationsImpl (com.google.gerrit.acceptance.testsuite.change.PerDraftCommentOperationsImpl)1 PerPatchsetOperationsImpl (com.google.gerrit.acceptance.testsuite.change.PerPatchsetOperationsImpl)1 PerRobotCommentOperationsImpl (com.google.gerrit.acceptance.testsuite.change.PerRobotCommentOperationsImpl)1 GroupOperations (com.google.gerrit.acceptance.testsuite.group.GroupOperations)1 ProjectOperations (com.google.gerrit.acceptance.testsuite.project.ProjectOperations)1 RequestScopeOperations (com.google.gerrit.acceptance.testsuite.request.RequestScopeOperations)1 FactoryModule (com.google.gerrit.extensions.config.FactoryModule)1 FakeIndexModule (com.google.gerrit.index.testing.FakeIndexModule)1 LuceneIndexModule (com.google.gerrit.lucene.LuceneIndexModule)1 GerritServerConfig (com.google.gerrit.server.config.GerritServerConfig)1 ConfigExperimentFeaturesModule (com.google.gerrit.server.experiments.ConfigExperimentFeatures.ConfigExperimentFeaturesModule)1 AsyncReceiveCommitsModule (com.google.gerrit.server.git.receive.AsyncReceiveCommits.AsyncReceiveCommitsModule)1