use of com.google.gerrit.testing.InMemoryModule in project gerrit by GerritCodeReview.
the class LuceneQueryGroupsTest method createInjector.
@Override
protected Injector createInjector() {
Config luceneConfig = new Config(config);
InMemoryModule.setDefaults(luceneConfig);
return Guice.createInjector(new InMemoryModule(luceneConfig));
}
use of com.google.gerrit.testing.InMemoryModule in project gerrit by GerritCodeReview.
the class LuceneQueryChangesTest method createInjector.
@Override
protected Injector createInjector() {
Config luceneConfig = new Config(config);
InMemoryModule.setDefaults(luceneConfig);
return Guice.createInjector(new InMemoryModule(luceneConfig));
}
use of com.google.gerrit.testing.InMemoryModule in project gerrit by GerritCodeReview.
the class RefControlTest method setUp.
@Before
public void setUp() throws Exception {
Injector injector = Guice.createInjector(new InMemoryModule());
injector.injectMembers(this);
// Tests previously used ProjectConfig.Factory to create ProjectConfigs without going through
// the ProjectCache, which was wrong. Manually call getInstance so we don't store it in a
// field that is accessible to test methods.
ProjectConfig.Factory projectConfigFactory = injector.getInstance(ProjectConfig.Factory.class);
singleVersionListener.start();
try {
schemaCreator.create();
} finally {
singleVersionListener.stop();
}
// changing defaults in SchemaCreator or ProjectCreator.
try (Repository allProjectsRepo = repoManager.createRepository(allProjectsName);
TestRepository<Repository> tr = new TestRepository<>(allProjectsRepo)) {
tr.delete(REFS_CONFIG);
try (MetaDataUpdate md = metaDataUpdateFactory.create(allProjectsName)) {
ProjectConfig allProjectsConfig = projectConfigFactory.create(allProjectsName);
allProjectsConfig.load(md);
LabelType cr = TestLabels.codeReview();
allProjectsConfig.upsertLabelType(cr);
allProjectsConfig.commit(md);
}
}
repoManager.createRepository(parentKey).close();
repoManager.createRepository(localKey).close();
try (MetaDataUpdate md = metaDataUpdateFactory.create(localKey)) {
ProjectConfig newLocal = projectConfigFactory.create(localKey);
newLocal.load(md);
newLocal.updateProject(p -> p.setParent(parentKey));
newLocal.commit(md);
}
requestContext.setContext(() -> null);
}
use of com.google.gerrit.testing.InMemoryModule in project gerrit by GerritCodeReview.
the class PerformanceLogContextTest method setup.
@Before
public void setup() {
Injector injector = Guice.createInjector(new InMemoryModule());
injector.injectMembers(this);
testPerformanceLogger = new TestPerformanceLogger();
performanceLoggerRegistrationHandle = performanceLoggers.add("gerrit", testPerformanceLogger);
}
use of com.google.gerrit.testing.InMemoryModule in project gerrit by GerritCodeReview.
the class LoggingContextAwareExecutorServiceTest method setup.
@Before
public void setup() {
Injector injector = Guice.createInjector(new InMemoryModule());
injector.injectMembers(this);
testPerformanceLogger = new PerformanceLogger() {
@Override
public void log(String operation, long durationMs, Metadata metadata) {
// do nothing
}
};
performanceLoggerRegistrationHandle = performanceLoggers.add("gerrit", testPerformanceLogger);
}
Aggregations