use of com.google.gerrit.extensions.common.SuggestedReviewerInfo in project gerrit by GerritCodeReview.
the class SuggestReviewersIT method reviewerRankingProjectIsolation.
@Test
public void reviewerRankingProjectIsolation() throws Exception {
// Create new project
Project.NameKey newProject = createProject("test");
// Create users who review changes in both the default and the new project
String fullName = "Primum Finalis";
TestAccount userWhoOwns = user("customuser1", fullName);
TestAccount reviewer1 = user("customuser2", fullName);
TestAccount reviewer2 = user("customuser3", fullName);
setApiUser(userWhoOwns);
String changeId1 = createChangeFromApi();
setApiUser(reviewer1);
reviewChange(changeId1);
setApiUser(userWhoOwns);
String changeId2 = createChangeFromApi(newProject);
setApiUser(reviewer2);
reviewChange(changeId2);
setApiUser(userWhoOwns);
String changeId3 = createChangeFromApi(newProject);
setApiUser(reviewer2);
reviewChange(changeId3);
setApiUser(userWhoOwns);
List<SuggestedReviewerInfo> reviewers = suggestReviewers(createChangeFromApi(), "Prim", 4);
// Assert that reviewer1 is on top, even though reviewer2 has more reviews
// in other projects
assertThat(reviewers.stream().map(r -> r.account._accountId).collect(toList())).containsExactly(reviewer1.id.get(), reviewer2.id.get()).inOrder();
}
use of com.google.gerrit.extensions.common.SuggestedReviewerInfo in project gerrit by GerritCodeReview.
the class ReviewersUtil method loadAccounts.
private List<SuggestedReviewerInfo> loadAccounts(List<Account.Id> accountIds) throws OrmException {
try (Timer0.Context ctx = metrics.loadAccountsLatency.start()) {
List<SuggestedReviewerInfo> reviewer = accountIds.stream().map(accountLoader::get).filter(Objects::nonNull).map(a -> {
SuggestedReviewerInfo info = new SuggestedReviewerInfo();
info.account = a;
info.count = 1;
return info;
}).collect(toList());
accountLoader.fill();
return reviewer;
}
}
Aggregations