Search in sources :

Example 1 with InMemoryModule

use of com.google.gerrit.testutil.InMemoryModule in project gerrit by GerritCodeReview.

the class ElasticQueryAccountsTest method createInjector.

@Override
protected Injector createInjector() {
    Config elasticsearchConfig = new Config(config);
    InMemoryModule.setDefaults(elasticsearchConfig);
    ElasticTestUtils.configure(elasticsearchConfig, nodeInfo.port);
    return Guice.createInjector(new InMemoryModule(elasticsearchConfig, notesMigration));
}
Also used : Config(org.eclipse.jgit.lib.Config) InMemoryModule(com.google.gerrit.testutil.InMemoryModule)

Example 2 with InMemoryModule

use of com.google.gerrit.testutil.InMemoryModule in project gerrit by GerritCodeReview.

the class ElasticQueryChangesTest method createInjector.

@Override
protected Injector createInjector() {
    Config elasticsearchConfig = new Config(config);
    InMemoryModule.setDefaults(elasticsearchConfig);
    ElasticTestUtils.configure(elasticsearchConfig, nodeInfo.port);
    return Guice.createInjector(new InMemoryModule(elasticsearchConfig, notesMigration));
}
Also used : Config(org.eclipse.jgit.lib.Config) InMemoryModule(com.google.gerrit.testutil.InMemoryModule)

Example 3 with InMemoryModule

use of com.google.gerrit.testutil.InMemoryModule in project gerrit by GerritCodeReview.

the class ElasticQueryGroupsTest method createInjector.

@Override
protected Injector createInjector() {
    Config elasticsearchConfig = new Config(config);
    InMemoryModule.setDefaults(elasticsearchConfig);
    ElasticTestUtils.configure(elasticsearchConfig, nodeInfo.port);
    return Guice.createInjector(new InMemoryModule(elasticsearchConfig, notesMigration));
}
Also used : Config(org.eclipse.jgit.lib.Config) InMemoryModule(com.google.gerrit.testutil.InMemoryModule)

Example 4 with InMemoryModule

use of com.google.gerrit.testutil.InMemoryModule in project gerrit by GerritCodeReview.

the class Schema_150_to_151_Test method setUp.

@Before
public void setUp() throws Exception {
    Injector injector = Guice.createInjector(new InMemoryModule());
    injector.injectMembers(this);
    lifecycle = new LifecycleManager();
    lifecycle.add(injector);
    lifecycle.start();
    try (ReviewDb underlyingDb = inMemoryDatabase.getDatabase().open()) {
        schemaCreator.create(underlyingDb);
    }
    db = schemaFactory.open();
    Account.Id userId = accountManager.authenticate(AuthRequest.forUser("user")).getAccountId();
    IdentifiedUser user = userFactory.create(userId);
    requestContext.setContext(new RequestContext() {

        @Override
        public CurrentUser getUser() {
            return user;
        }

        @Override
        public Provider<ReviewDb> getReviewDbProvider() {
            return Providers.of(db);
        }
    });
}
Also used : Account(com.google.gerrit.reviewdb.client.Account) CurrentUser(com.google.gerrit.server.CurrentUser) Injector(com.google.inject.Injector) LifecycleManager(com.google.gerrit.lifecycle.LifecycleManager) RequestContext(com.google.gerrit.server.util.RequestContext) ThreadLocalRequestContext(com.google.gerrit.server.util.ThreadLocalRequestContext) InMemoryModule(com.google.gerrit.testutil.InMemoryModule) IdentifiedUser(com.google.gerrit.server.IdentifiedUser) ReviewDb(com.google.gerrit.reviewdb.server.ReviewDb) Provider(com.google.inject.Provider) Before(org.junit.Before)

Example 5 with InMemoryModule

use of com.google.gerrit.testutil.InMemoryModule in project gerrit by GerritCodeReview.

the class BatchUpdateTest method setUp.

@Before
public void setUp() throws Exception {
    Injector injector = Guice.createInjector(new InMemoryModule());
    injector.injectMembers(this);
    lifecycle = new LifecycleManager();
    lifecycle.add(injector);
    lifecycle.start();
    try (ReviewDb underlyingDb = inMemoryDatabase.getDatabase().open()) {
        schemaCreator.create(underlyingDb);
    }
    db = schemaFactory.open();
    Account.Id userId = accountManager.authenticate(AuthRequest.forUser("user")).getAccountId();
    user = userFactory.create(userId);
    project = new Project.NameKey("test");
    InMemoryRepository inMemoryRepo = repoManager.createRepository(project);
    repo = new TestRepository<>(inMemoryRepo);
    requestContext.setContext(new RequestContext() {

        @Override
        public CurrentUser getUser() {
            return user;
        }

        @Override
        public Provider<ReviewDb> getReviewDbProvider() {
            return Providers.of(db);
        }
    });
}
Also used : Account(com.google.gerrit.reviewdb.client.Account) InMemoryRepository(org.eclipse.jgit.internal.storage.dfs.InMemoryRepository) CurrentUser(com.google.gerrit.server.CurrentUser) LifecycleManager(com.google.gerrit.lifecycle.LifecycleManager) Provider(com.google.inject.Provider) Project(com.google.gerrit.reviewdb.client.Project) Injector(com.google.inject.Injector) RequestContext(com.google.gerrit.server.util.RequestContext) ThreadLocalRequestContext(com.google.gerrit.server.util.ThreadLocalRequestContext) InMemoryModule(com.google.gerrit.testutil.InMemoryModule) ReviewDb(com.google.gerrit.reviewdb.server.ReviewDb) Before(org.junit.Before)

Aggregations

InMemoryModule (com.google.gerrit.testutil.InMemoryModule)12 Config (org.eclipse.jgit.lib.Config)7 CurrentUser (com.google.gerrit.server.CurrentUser)6 RequestContext (com.google.gerrit.server.util.RequestContext)6 ThreadLocalRequestContext (com.google.gerrit.server.util.ThreadLocalRequestContext)6 Injector (com.google.inject.Injector)6 Provider (com.google.inject.Provider)6 Before (org.junit.Before)6 LifecycleManager (com.google.gerrit.lifecycle.LifecycleManager)5 Account (com.google.gerrit.reviewdb.client.Account)4 InMemoryRepository (org.eclipse.jgit.internal.storage.dfs.InMemoryRepository)4 Project (com.google.gerrit.reviewdb.client.Project)3 AccountGroup (com.google.gerrit.reviewdb.client.AccountGroup)2 ReviewDb (com.google.gerrit.reviewdb.server.ReviewDb)2 ProjectConfig (com.google.gerrit.server.git.ProjectConfig)2 LabelType (com.google.gerrit.common.data.LabelType)1 IdentifiedUser (com.google.gerrit.server.IdentifiedUser)1 AllProjectsNameProvider (com.google.gerrit.server.config.AllProjectsNameProvider)1 AllUsersNameProvider (com.google.gerrit.server.config.AllUsersNameProvider)1 InMemoryRepositoryManager (com.google.gerrit.testutil.InMemoryRepositoryManager)1