use of com.google.gerrit.extensions.common.ChangeInput in project gerrit by GerritCodeReview.
the class CreateChangeIT method newMergeChangeInput.
private ChangeInput newMergeChangeInput(String targetBranch, String sourceRef, String strategy, boolean allowConflicts) {
// create a merge change from branchA to master in gerrit
ChangeInput in = new ChangeInput();
in.project = project.get();
in.branch = targetBranch;
in.subject = "merge " + sourceRef + " to " + targetBranch;
in.status = ChangeStatus.NEW;
MergeInput mergeInput = new MergeInput();
mergeInput.source = sourceRef;
in.merge = mergeInput;
if (!Strings.isNullOrEmpty(strategy)) {
in.merge.strategy = strategy;
}
in.merge.allowConflicts = allowConflicts;
return in;
}
use of com.google.gerrit.extensions.common.ChangeInput in project gerrit by GerritCodeReview.
the class CreateChangeIT method createAuthorAddedAsCcAndNotified.
@Test
public void createAuthorAddedAsCcAndNotified() throws Exception {
ChangeInput input = newChangeInput(ChangeStatus.NEW);
input.author = new AccountInput();
input.author.email = user.email();
input.author.name = user.fullName();
ChangeInfo info = assertCreateSucceeds(input);
assertThat(info.reviewers.get(ReviewerState.CC)).hasSize(1);
assertThat(Iterables.getOnlyElement(info.reviewers.get(ReviewerState.CC)).email).isEqualTo(user.email());
assertThat(Iterables.getOnlyElement(Iterables.getOnlyElement(sender.getMessages()).rcpt()).email()).isEqualTo(user.email());
}
use of com.google.gerrit.extensions.common.ChangeInput in project gerrit by GerritCodeReview.
the class PrivateByDefaultIT method createChangeWithPrivateByDefaultInherited.
@Test
public void createChangeWithPrivateByDefaultInherited() throws Exception {
setPrivateByDefault(project1, InheritableBoolean.TRUE);
ChangeInfo info = gApi.changes().create(new ChangeInput(project2.get(), "master", "empty change")).get();
assertThat(info.isPrivate).isTrue();
}
use of com.google.gerrit.extensions.common.ChangeInput in project gerrit by GerritCodeReview.
the class CreateChangeIT method createChangeWithBadParentCommitFails.
@Test
public void createChangeWithBadParentCommitFails() throws Exception {
ChangeInput input = newChangeInput(ChangeStatus.NEW);
input.baseCommit = "notasha1";
assertCreateFails(input, UnprocessableEntityException.class, "Base notasha1 doesn't represent a valid SHA-1");
}
use of com.google.gerrit.extensions.common.ChangeInput in project gerrit by GerritCodeReview.
the class CreateChangeIT method createNewChangeWithCommentsInCommitMessage.
@Test
public void createNewChangeWithCommentsInCommitMessage() throws Exception {
ChangeInput ci = newChangeInput(ChangeStatus.NEW);
ci.subject += "\n# Comment line";
ChangeInfo info = gApi.changes().create(ci).get();
assertThat(info.revisions.get(info.currentRevision).commit.message).doesNotContain("# Comment line");
}
Aggregations