Search in sources :

Example 6 with InMemoryRepositoryManager

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

the class StalenessCheckerTest method setUp.

@Before
public void setUp() throws Exception {
    repoManager = new InMemoryRepositoryManager();
    r1 = repoManager.createRepository(P1);
    tr1 = new TestRepository<>(r1);
    r2 = repoManager.createRepository(P2);
    tr2 = new TestRepository<>(r2);
}
Also used : InMemoryRepositoryManager(com.google.gerrit.testutil.InMemoryRepositoryManager) Before(org.junit.Before)

Example 7 with InMemoryRepositoryManager

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

the class AbstractChangeNotesTest method setUp.

@Before
public void setUp() throws Exception {
    setTimeForTesting();
    serverIdent = new PersonIdent("Gerrit Server", "noreply@gerrit.com", TimeUtil.nowTs(), TZ);
    project = new Project.NameKey("test-project");
    repoManager = new InMemoryRepositoryManager();
    repo = repoManager.createRepository(project);
    tr = new TestRepository<>(repo);
    rw = tr.getRevWalk();
    accountCache = new FakeAccountCache();
    Account co = new Account(new Account.Id(1), TimeUtil.nowTs());
    co.setFullName("Change Owner");
    co.setPreferredEmail("change@owner.com");
    accountCache.put(co);
    Account ou = new Account(new Account.Id(2), TimeUtil.nowTs());
    ou.setFullName("Other Account");
    ou.setPreferredEmail("other@account.com");
    accountCache.put(ou);
    injector = Guice.createInjector(new FactoryModule() {

        @Override
        public void configure() {
            install(new GitModule());
            install(NoteDbModule.forTest(testConfig));
            bind(AllUsersName.class).toProvider(AllUsersNameProvider.class);
            bind(String.class).annotatedWith(GerritServerId.class).toInstance("gerrit");
            bind(NotesMigration.class).toInstance(MIGRATION);
            bind(GitRepositoryManager.class).toInstance(repoManager);
            bind(ProjectCache.class).toProvider(Providers.<ProjectCache>of(null));
            bind(CapabilityControl.Factory.class).toProvider(Providers.<CapabilityControl.Factory>of(null));
            bind(Config.class).annotatedWith(GerritServerConfig.class).toInstance(testConfig);
            bind(String.class).annotatedWith(AnonymousCowardName.class).toProvider(AnonymousCowardNameProvider.class);
            bind(String.class).annotatedWith(CanonicalWebUrl.class).toInstance("http://localhost:8080/");
            bind(Boolean.class).annotatedWith(DisableReverseDnsLookup.class).toInstance(Boolean.FALSE);
            bind(Realm.class).to(FakeRealm.class);
            bind(GroupBackend.class).to(SystemGroupBackend.class).in(SINGLETON);
            bind(AccountCache.class).toInstance(accountCache);
            bind(PersonIdent.class).annotatedWith(GerritPersonIdent.class).toInstance(serverIdent);
            bind(GitReferenceUpdated.class).toInstance(GitReferenceUpdated.DISABLED);
            bind(MetricMaker.class).to(DisabledMetricMaker.class);
            bind(ReviewDb.class).toProvider(Providers.<ReviewDb>of(null));
        }
    });
    injector.injectMembers(this);
    repoManager.createRepository(allUsers);
    changeOwner = userFactory.create(co.getId());
    otherUser = userFactory.create(ou.getId());
    otherUserId = otherUser.getAccountId();
    internalUser = new InternalUser(null);
}
Also used : MetricMaker(com.google.gerrit.metrics.MetricMaker) DisabledMetricMaker(com.google.gerrit.metrics.DisabledMetricMaker) Account(com.google.gerrit.reviewdb.client.Account) InMemoryRepositoryManager(com.google.gerrit.testutil.InMemoryRepositoryManager) CapabilityControl(com.google.gerrit.server.account.CapabilityControl) InternalUser(com.google.gerrit.server.InternalUser) GerritServerId(com.google.gerrit.server.config.GerritServerId) DisableReverseDnsLookup(com.google.gerrit.server.config.DisableReverseDnsLookup) GitReferenceUpdated(com.google.gerrit.server.extensions.events.GitReferenceUpdated) FakeAccountCache(com.google.gerrit.testutil.FakeAccountCache) SystemGroupBackend(com.google.gerrit.server.group.SystemGroupBackend) FakeRealm(com.google.gerrit.server.account.FakeRealm) Realm(com.google.gerrit.server.account.Realm) ReviewDb(com.google.gerrit.reviewdb.server.ReviewDb) GerritPersonIdent(com.google.gerrit.server.GerritPersonIdent) GerritServerConfig(com.google.gerrit.server.config.GerritServerConfig) AnonymousCowardName(com.google.gerrit.server.config.AnonymousCowardName) CanonicalWebUrl(com.google.gerrit.server.config.CanonicalWebUrl) FactoryModule(com.google.gerrit.extensions.config.FactoryModule) GitModule(com.google.gerrit.server.git.GitModule) GitRepositoryManager(com.google.gerrit.server.git.GitRepositoryManager) TestNotesMigration(com.google.gerrit.testutil.TestNotesMigration) FakeAccountCache(com.google.gerrit.testutil.FakeAccountCache) AccountCache(com.google.gerrit.server.account.AccountCache) Project(com.google.gerrit.reviewdb.client.Project) ProjectCache(com.google.gerrit.server.project.ProjectCache) PersonIdent(org.eclipse.jgit.lib.PersonIdent) GerritPersonIdent(com.google.gerrit.server.GerritPersonIdent) AllUsersName(com.google.gerrit.server.config.AllUsersName) Before(org.junit.Before)

Example 8 with InMemoryRepositoryManager

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

the class RepoViewTest method setUp.

@Before
public void setUp() throws Exception {
    InMemoryRepositoryManager repoManager = new InMemoryRepositoryManager();
    Project.NameKey project = new Project.NameKey("project");
    repo = repoManager.createRepository(project);
    tr = new TestRepository<>(repo);
    tr.branch(MASTER).commit().create();
    view = new RepoView(repoManager, project);
}
Also used : Project(com.google.gerrit.reviewdb.client.Project) InMemoryRepositoryManager(com.google.gerrit.testutil.InMemoryRepositoryManager) Before(org.junit.Before)

Aggregations

InMemoryRepositoryManager (com.google.gerrit.testutil.InMemoryRepositoryManager)8 Before (org.junit.Before)6 Project (com.google.gerrit.reviewdb.client.Project)5 FactoryModule (com.google.gerrit.extensions.config.FactoryModule)2 Account (com.google.gerrit.reviewdb.client.Account)2 ReviewDb (com.google.gerrit.reviewdb.server.ReviewDb)2 GerritPersonIdent (com.google.gerrit.server.GerritPersonIdent)2 AllUsersName (com.google.gerrit.server.config.AllUsersName)2 AnonymousCowardName (com.google.gerrit.server.config.AnonymousCowardName)2 GerritServerConfig (com.google.gerrit.server.config.GerritServerConfig)2 GitRepositoryManager (com.google.gerrit.server.git.GitRepositoryManager)2 AbstractDaemonTest (com.google.gerrit.acceptance.AbstractDaemonTest)1 LabelType (com.google.gerrit.common.data.LabelType)1 DisabledMetricMaker (com.google.gerrit.metrics.DisabledMetricMaker)1 MetricMaker (com.google.gerrit.metrics.MetricMaker)1 AccountGroup (com.google.gerrit.reviewdb.client.AccountGroup)1 SystemConfig (com.google.gerrit.reviewdb.client.SystemConfig)1 CurrentUser (com.google.gerrit.server.CurrentUser)1 InternalUser (com.google.gerrit.server.InternalUser)1 AccountCache (com.google.gerrit.server.account.AccountCache)1