Search in sources :

Example 1 with InMemoryModule

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

the class LabelNormalizerTest method setUpInjector.

@Before
public void setUpInjector() throws Exception {
    Injector injector = Guice.createInjector(new InMemoryModule());
    injector.injectMembers(this);
    lifecycle = new LifecycleManager();
    lifecycle.add(injector);
    lifecycle.start();
    schemaCreator.create();
    userId = accountManager.authenticate(authRequestFactory.createForUser("user")).getAccountId();
    user = userFactory.create(userId);
    requestContext.setContext(() -> user);
    configureProject();
    setUpChange();
}
Also used : Injector(com.google.inject.Injector) LifecycleManager(com.google.gerrit.lifecycle.LifecycleManager) InMemoryModule(com.google.gerrit.testing.InMemoryModule) Before(org.junit.Before)

Example 2 with InMemoryModule

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

the class GerritPublicKeyCheckerTest method setUpInjector.

@Before
public void setUpInjector() throws Exception {
    Config cfg = InMemoryModule.newDefaultConfig();
    cfg.setInt("receive", null, "maxTrustDepth", 2);
    cfg.setStringList("receive", null, "trustedKey", ImmutableList.of(Fingerprint.toString(keyB().getPublicKey().getFingerprint()), Fingerprint.toString(keyD().getPublicKey().getFingerprint())));
    Injector injector = Guice.createInjector(new InMemoryModule(cfg));
    lifecycle = new LifecycleManager();
    lifecycle.add(injector);
    injector.injectMembers(this);
    lifecycle.start();
    schemaCreator.create();
    userId = accountManager.authenticate(authRequestFactory.createForUser("user")).getAccountId();
    // Note: does not match any key in TestKeys.
    accountsUpdateProvider.get().update("Set Preferred Email", userId, u -> u.setPreferredEmail("user@example.com"));
    user = reloadUser();
    requestContext.setContext(() -> user);
    storeRepo = new InMemoryRepository(new DfsRepositoryDescription("repo"));
    store = new PublicKeyStore(storeRepo);
}
Also used : InMemoryRepository(org.eclipse.jgit.internal.storage.dfs.InMemoryRepository) Config(org.eclipse.jgit.lib.Config) Injector(com.google.inject.Injector) LifecycleManager(com.google.gerrit.lifecycle.LifecycleManager) InMemoryModule(com.google.gerrit.testing.InMemoryModule) DfsRepositoryDescription(org.eclipse.jgit.internal.storage.dfs.DfsRepositoryDescription) Before(org.junit.Before)

Example 3 with InMemoryModule

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

the class LuceneQueryProjectsTest method createInjector.

@Override
protected Injector createInjector() {
    Config luceneConfig = new Config(config);
    InMemoryModule.setDefaults(luceneConfig);
    return Guice.createInjector(new InMemoryModule(luceneConfig));
}
Also used : Config(org.eclipse.jgit.lib.Config) IndexConfig(com.google.gerrit.testing.IndexConfig) InMemoryModule(com.google.gerrit.testing.InMemoryModule)

Example 4 with InMemoryModule

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

the class SchemaCreatorImplTest method setUp.

@Before
public void setUp() throws Exception {
    new InMemoryModule().inject(this);
    schemaCreator.create();
}
Also used : InMemoryModule(com.google.gerrit.testing.InMemoryModule) Before(org.junit.Before)

Example 5 with InMemoryModule

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

the class OAuthRealmTest method setUpInjector.

@Before
public void setUpInjector() throws Exception {
    Injector injector = Guice.createInjector(new InMemoryModule());
    injector.injectMembers(this);
}
Also used : Injector(com.google.inject.Injector) InMemoryModule(com.google.gerrit.testing.InMemoryModule) Before(org.junit.Before)

Aggregations

InMemoryModule (com.google.gerrit.testing.InMemoryModule)19 Before (org.junit.Before)11 Injector (com.google.inject.Injector)9 Config (org.eclipse.jgit.lib.Config)9 IndexConfig (com.google.gerrit.testing.IndexConfig)6 LifecycleManager (com.google.gerrit.lifecycle.LifecycleManager)2 Repository (org.eclipse.jgit.lib.Repository)2 ImmutableSet (com.google.common.collect.ImmutableSet)1 Account (com.google.gerrit.entities.Account)1 AccountGroup (com.google.gerrit.entities.AccountGroup)1 LabelType (com.google.gerrit.entities.LabelType)1 CacheModule (com.google.gerrit.server.cache.CacheModule)1 MetaDataUpdate (com.google.gerrit.server.git.meta.MetaDataUpdate)1 ProjectConfig (com.google.gerrit.server.project.ProjectConfig)1 TypeLiteral (com.google.inject.TypeLiteral)1 Optional (java.util.Optional)1 Set (java.util.Set)1 DfsRepositoryDescription (org.eclipse.jgit.internal.storage.dfs.DfsRepositoryDescription)1 InMemoryRepository (org.eclipse.jgit.internal.storage.dfs.InMemoryRepository)1 TestRepository (org.eclipse.jgit.junit.TestRepository)1