use of com.google.gerrit.index.project.ProjectIndexCollection in project gerrit by GerritCodeReview.
the class InitIT method indexesAllProjectsAndAllUsers.
@Test
public void indexesAllProjectsAndAllUsers() throws Exception {
initSite();
try (ServerContext ctx = startServer()) {
ProjectIndexCollection projectIndex = ctx.getInjector().getInstance(ProjectIndexCollection.class);
Project.NameKey allProjects = ctx.getInjector().getInstance(AllProjectsName.class);
Project.NameKey allUsers = ctx.getInjector().getInstance(AllUsersName.class);
QueryOptions opts = QueryOptions.create(IndexConfig.createDefault(), 0, 1, ImmutableSet.of("name"));
Optional<ProjectData> allProjectsData = projectIndex.getSearchIndex().get(allProjects, opts);
assertThat(allProjectsData).isPresent();
Optional<ProjectData> allUsersData = projectIndex.getSearchIndex().get(allUsers, opts);
assertThat(allUsersData).isPresent();
}
}
Aggregations