use of com.google.gerrit.server.change.ChangeInserter in project gerrit by GerritCodeReview.
the class AbstractQueryChangesTest method byDefault.
@Test
public void byDefault() throws Exception {
TestRepository<Repo> repo = createProject("repo");
Change change1 = insert(repo, newChange(repo));
RevCommit commit2 = repo.parseBody(repo.commit().message("foosubject").create());
Change change2 = insert(repo, newChangeForCommit(repo, commit2));
RevCommit commit3 = repo.parseBody(repo.commit().add("Foo.java", "foo contents").create());
Change change3 = insert(repo, newChangeForCommit(repo, commit3));
ChangeInserter ins4 = newChange(repo);
Change change4 = insert(repo, ins4);
ReviewInput ri4 = new ReviewInput();
ri4.message = "toplevel";
ri4.labels = ImmutableMap.<String, Short>of("Code-Review", (short) 1);
gApi.changes().id(change4.getId().get()).current().review(ri4);
ChangeInserter ins5 = newChangeWithTopic(repo, "feature5");
Change change5 = insert(repo, ins5);
Change change6 = insert(repo, newChangeForBranch(repo, "branch6"));
assertQuery(change1.getId().get(), change1);
assertQuery(ChangeTriplet.format(change1), change1);
assertQuery("foosubject", change2);
assertQuery("Foo.java", change3);
assertQuery("Code-Review+1", change4);
assertQuery("toplevel", change4);
assertQuery("feature5", change5);
assertQuery("branch6", change6);
assertQuery("refs/heads/branch6", change6);
Change[] expected = new Change[] { change6, change5, change4, change3, change2, change1 };
assertQuery("user@example.com", expected);
assertQuery("repo", expected);
}
Aggregations