Search in sources :

Example 1 with ProjectIndexCollection

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();
    }
}
Also used : Project(com.google.gerrit.entities.Project) ProjectIndexCollection(com.google.gerrit.index.project.ProjectIndexCollection) QueryOptions(com.google.gerrit.index.QueryOptions) ProjectData(com.google.gerrit.index.project.ProjectData) StandaloneSiteTest(com.google.gerrit.acceptance.StandaloneSiteTest) Test(org.junit.Test)

Aggregations

StandaloneSiteTest (com.google.gerrit.acceptance.StandaloneSiteTest)1 Project (com.google.gerrit.entities.Project)1 QueryOptions (com.google.gerrit.index.QueryOptions)1 ProjectData (com.google.gerrit.index.project.ProjectData)1 ProjectIndexCollection (com.google.gerrit.index.project.ProjectIndexCollection)1 Test (org.junit.Test)1