use of com.google.gerrit.extensions.client.ListGroupsOption.MEMBERS in project gerrit by GerritCodeReview.
the class AbstractReindexTests method reindexFromScratch.
@Test
public void reindexFromScratch() throws Exception {
setUpChange();
MoreFiles.deleteRecursively(sitePaths.index_dir, RecursiveDeleteOption.ALLOW_INSECURE);
Files.createDirectory(sitePaths.index_dir);
assertServerStartupFails();
runGerrit("reindex", "-d", sitePaths.site_path.toString(), "--show-stack-trace");
assertReady(ChangeSchemaDefinitions.INSTANCE.getLatest().getVersion());
try (ServerContext ctx = startServer()) {
GerritApi gApi = ctx.getInjector().getInstance(GerritApi.class);
// Query change index
assertThat(gApi.changes().query("message:Test").get().stream().map(c -> c.changeId)).containsExactly(changeId);
// Query account index
assertThat(gApi.accounts().query("admin").get().stream().map(a -> a._accountId)).containsExactly(admin.id().get());
// Query group index
assertThat(gApi.groups().query("Group").withOption(MEMBERS).get().stream().flatMap(g -> g.members.stream()).map(a -> a._accountId)).containsExactly(admin.id().get());
// Query project index
assertThat(gApi.projects().query(project.get()).get().stream().map(p -> p.name)).containsExactly(project.get());
}
}
Aggregations