use of com.google.gerrit.extensions.common.ChangeInput in project gerrit by GerritCodeReview.
the class CreateChangeIT method sha1sOfTwoNewChangesDiffer.
@Test
@UseSystemTime
public void sha1sOfTwoNewChangesDiffer() throws Exception {
ChangeInput changeInput = newChangeInput(ChangeStatus.NEW);
ChangeInfo info1 = assertCreateSucceeds(changeInput);
ChangeInfo info2 = assertCreateSucceeds(changeInput);
assertThat(info1.currentRevision).isNotEqualTo(info2.currentRevision);
}
use of com.google.gerrit.extensions.common.ChangeInput in project gerrit by GerritCodeReview.
the class CreateChangeIT method createChangeWithParentCommit.
@Test
public void createChangeWithParentCommit() throws Exception {
Map<String, PushOneCommit.Result> setup = changeInTwoBranches("foo", "foo.txt", "bar", "bar.txt");
ChangeInput input = newChangeInput(ChangeStatus.NEW);
input.baseCommit = setup.get("master").getCommit().getId().name();
ChangeInfo result = assertCreateSucceeds(input);
assertThat(gApi.changes().id(result.id).current().commit(false).parents.get(0).commit).isEqualTo(input.baseCommit);
}
use of com.google.gerrit.extensions.common.ChangeInput in project gerrit by GerritCodeReview.
the class CreateChangeIT method createChangeWithValidationOptions.
@Test
public void createChangeWithValidationOptions() throws Exception {
ChangeInput changeInput = new ChangeInput();
changeInput.project = project.get();
changeInput.branch = "master";
changeInput.subject = "A change";
changeInput.status = ChangeStatus.NEW;
changeInput.validationOptions = ImmutableMap.of("key", "value");
TestCommitValidationListener testCommitValidationListener = new TestCommitValidationListener();
try (Registration registration = extensionRegistry.newRegistration().add(testCommitValidationListener)) {
assertCreateSucceeds(changeInput);
assertThat(testCommitValidationListener.receiveEvent.pushOptions).containsExactly("key", "value");
}
}
use of com.google.gerrit.extensions.common.ChangeInput in project gerrit by GerritCodeReview.
the class CreateChangeIT method canCreateChangeWithChangeIfOfExistingChangeOnOtherBranch.
@Test
public void canCreateChangeWithChangeIfOfExistingChangeOnOtherBranch() throws Exception {
String changeId = createChange().getChangeId();
createBranch(BranchNameKey.create(project, "other"));
ChangeInput ci = newChangeInput(ChangeStatus.NEW);
ci.subject = "Subject\n\nChange-Id: " + changeId;
ci.branch = "other";
ChangeInfo info = assertCreateSucceeds(ci);
assertThat(info.changeId).isEqualTo(changeId);
}
use of com.google.gerrit.extensions.common.ChangeInput in project gerrit by GerritCodeReview.
the class CreateChangeIT method createAuthorOverrideBadRequest.
@Test
public void createAuthorOverrideBadRequest() throws Exception {
ChangeInput input = newChangeInput(ChangeStatus.NEW);
input.author = new AccountInput();
input.author.name = "name";
assertCreateFails(input, BadRequestException.class, "email");
input.author.name = null;
input.author.email = "gerritlessjane@invalid";
assertCreateFails(input, BadRequestException.class, "email");
}
Aggregations