use of com.google.gerrit.extensions.api.projects.CheckProjectResultInfo in project gerrit by GerritCodeReview.
the class CheckProjectIT method detectAutoCloseableChangeByChangeId.
@Test
public void detectAutoCloseableChangeByChangeId() throws Exception {
PushOneCommit.Result r = createChange("refs/for/master");
String branch = r.getChange().change().getDest().branch();
RevCommit amendedCommit = serverSideTestRepo.amend(r.getCommit()).create();
serverSideTestRepo.branch(branch).update(amendedCommit);
ChangeInfo info = change(r).info();
assertThat(info.status).isEqualTo(ChangeStatus.NEW);
CheckProjectResultInfo checkResult = gApi.projects().name(project.get()).check(checkProjectInputForAutoCloseableCheck(branch));
assertThat(checkResult.autoCloseableChangesCheckResult.autoCloseableChanges.stream().map(i -> i._number).collect(toSet())).containsExactly(r.getChange().getId().get());
info = change(r).info();
assertThat(info.status).isEqualTo(ChangeStatus.NEW);
}
use of com.google.gerrit.extensions.api.projects.CheckProjectResultInfo in project gerrit by GerritCodeReview.
the class CheckProjectIT method maxCommits.
@Test
public void maxCommits() throws Exception {
PushOneCommit.Result r = createChange("refs/for/master");
String branch = r.getChange().change().getDest().branch();
RevCommit amendedCommit = serverSideTestRepo.amend(r.getCommit()).create();
serverSideTestRepo.branch(branch).update(amendedCommit);
serverSideTestRepo.commit(amendedCommit);
ChangeInfo info = change(r).info();
assertThat(info.status).isEqualTo(ChangeStatus.NEW);
CheckProjectInput input = checkProjectInputForAutoCloseableCheck(branch);
input.autoCloseableChangesCheck.fix = true;
input.autoCloseableChangesCheck.maxCommits = 1;
CheckProjectResultInfo checkResult = gApi.projects().name(project.get()).check(input);
assertThat(checkResult.autoCloseableChangesCheckResult.autoCloseableChanges).isEmpty();
info = change(r).info();
assertThat(info.status).isEqualTo(ChangeStatus.NEW);
input.autoCloseableChangesCheck.maxCommits = 2;
checkResult = gApi.projects().name(project.get()).check(input);
assertThat(checkResult.autoCloseableChangesCheckResult.autoCloseableChanges.stream().map(i -> i._number).collect(toSet())).containsExactly(r.getChange().getId().get());
info = change(r).info();
assertThat(info.status).isEqualTo(ChangeStatus.MERGED);
}
use of com.google.gerrit.extensions.api.projects.CheckProjectResultInfo in project gerrit by GerritCodeReview.
the class CheckProjectIT method noProblem.
@Test
public void noProblem() throws Exception {
PushOneCommit.Result r = createChange("refs/for/master");
String branch = r.getChange().change().getDest().branch();
ChangeInfo info = change(r).info();
assertThat(info.status).isEqualTo(ChangeStatus.NEW);
CheckProjectResultInfo checkResult = gApi.projects().name(project.get()).check(checkProjectInputForAutoCloseableCheck(branch));
assertThat(checkResult.autoCloseableChangesCheckResult.autoCloseableChanges).isEmpty();
info = change(r).info();
assertThat(info.status).isEqualTo(ChangeStatus.NEW);
}
use of com.google.gerrit.extensions.api.projects.CheckProjectResultInfo in project gerrit by GerritCodeReview.
the class CheckProjectIT method fixAutoCloseableChangeByChangeId.
@Test
public void fixAutoCloseableChangeByChangeId() throws Exception {
PushOneCommit.Result r = createChange("refs/for/master");
String branch = r.getChange().change().getDest().branch();
RevCommit amendedCommit = serverSideTestRepo.amend(r.getCommit()).create();
serverSideTestRepo.branch(branch).update(amendedCommit);
ChangeInfo info = change(r).info();
assertThat(info.status).isEqualTo(ChangeStatus.NEW);
CheckProjectInput input = checkProjectInputForAutoCloseableCheck(branch);
input.autoCloseableChangesCheck.fix = true;
CheckProjectResultInfo checkResult = gApi.projects().name(project.get()).check(input);
assertThat(checkResult.autoCloseableChangesCheckResult.autoCloseableChanges.stream().map(i -> i._number).collect(toSet())).containsExactly(r.getChange().getId().get());
info = change(r).info();
assertThat(info.status).isEqualTo(ChangeStatus.MERGED);
}
use of com.google.gerrit.extensions.api.projects.CheckProjectResultInfo in project gerrit by GerritCodeReview.
the class CheckProjectIT method detectAutoCloseableChangeByCommit.
@Test
public void detectAutoCloseableChangeByCommit() throws Exception {
RevCommit commit = pushCommitWithoutChangeIdForReview();
ChangeInfo change = Iterables.getOnlyElement(gApi.changes().query("commit:" + commit.name()).get());
String branch = "refs/heads/master";
serverSideTestRepo.branch(branch).update(testRepo.getRevWalk().parseCommit(commit));
ChangeInfo info = gApi.changes().id(change._number).info();
assertThat(info.status).isEqualTo(ChangeStatus.NEW);
CheckProjectResultInfo checkResult = gApi.projects().name(project.get()).check(checkProjectInputForAutoCloseableCheck(branch));
assertThat(checkResult.autoCloseableChangesCheckResult.autoCloseableChanges.stream().map(i -> i._number).collect(toList())).containsExactly(change._number);
info = gApi.changes().id(change._number).info();
assertThat(info.status).isEqualTo(ChangeStatus.NEW);
}
Aggregations