use of com.google.gerrit.extensions.api.changes.RelatedChangeAndCommitInfo in project gerrit by GerritCodeReview.
the class GetRelatedIT method stateOfRelatedChangesMatchesDocumentedValues.
@Test
public void stateOfRelatedChangesMatchesDocumentedValues() throws Exception {
// Set up three related changes, one new, the other abandoned, and the third merged.
RevCommit commit1 = commitBuilder().add("a.txt", "File content 1").message("Subject 1").create();
RevCommit commit2 = commitBuilder().add("b.txt", "File content 2").message("Subject 2").create();
RevCommit commit3 = commitBuilder().add("c.txt", "File content 3").message("Subject 3").create();
pushHead(testRepo, "refs/for/master", false);
Change change1 = getChange(commit1).change();
Change change2 = getChange(commit2).change();
Change change3 = getChange(commit3).change();
gApi.changes().id(change1.getChangeId()).current().review(ReviewInput.approve());
gApi.changes().id(change1.getChangeId()).current().submit();
gApi.changes().id(change2.getChangeId()).abandon();
List<RelatedChangeAndCommitInfo> relatedChanges = gApi.changes().id(change3.getChangeId()).current().related().changes;
// Ensure that our REST API returns the states exactly as documented (and required by the
// frontend).
assertThat(relatedChanges).comparingElementsUsing(getRelatedChangeToStatusCorrespondence()).containsExactly("NEW", "ABANDONED", "MERGED");
}
use of com.google.gerrit.extensions.api.changes.RelatedChangeAndCommitInfo in project gerrit by GerritCodeReview.
the class GetRelatedIT method changeAndCommit.
private RelatedChangeAndCommitInfo changeAndCommit(PatchSet.Id psId, ObjectId commitId, int currentRevisionNum) {
RelatedChangeAndCommitInfo result = new RelatedChangeAndCommitInfo();
result.project = project.get();
result._changeNumber = psId.changeId().get();
result.commit = new CommitInfo();
result.commit.commit = commitId.name();
result._revisionNumber = psId.get();
result._currentRevisionNumber = currentRevisionNum;
result.status = "NEW";
return result;
}
Aggregations