use of com.google.gerrit.extensions.common.ChangeInput in project gerrit by GerritCodeReview.
the class RestApiQuotaIT method createChangePost.
@Test
public void createChangePost() throws Exception {
when(quotaBackendWithUser.requestToken("/restapi/changes:POST")).thenReturn(singletonAggregation(QuotaResponse.ok()));
ChangeInput changeInput = new ChangeInput(project.get(), "master", "test");
adminRestSession.post("/changes/", changeInput).assertCreated();
verify(quotaBackendWithUser).requestToken("/restapi/changes:POST");
}
use of com.google.gerrit.extensions.common.ChangeInput in project gerrit by GerritCodeReview.
the class CreateChangeIT method createChangeOnNonExistingBaseChangeFails.
@Test
public void createChangeOnNonExistingBaseChangeFails() throws Exception {
ChangeInput input = newChangeInput(ChangeStatus.NEW);
input.baseChange = "999999";
assertCreateFails(input, UnprocessableEntityException.class, "Base change not found: " + input.baseChange);
}
use of com.google.gerrit.extensions.common.ChangeInput in project gerrit by GerritCodeReview.
the class CreateChangeIT method cannotCreateChangeWithChangeIfOfExistingChangeOnSameBranch.
@Test
public void cannotCreateChangeWithChangeIfOfExistingChangeOnSameBranch() throws Exception {
String changeId = createChange().getChangeId();
ChangeInput ci = newChangeInput(ChangeStatus.NEW);
ci.subject = "Subject\n\nChange-Id: " + changeId;
assertCreateFails(ci, ResourceConflictException.class, "A change with Change-Id " + changeId + " already exists for this branch.");
}
use of com.google.gerrit.extensions.common.ChangeInput in project gerrit by GerritCodeReview.
the class CreateChangeIT method createEmptyChange_InvalidSubject.
@Test
public void createEmptyChange_InvalidSubject() throws Exception {
ChangeInput ci = newChangeInput(ChangeStatus.NEW);
ci.subject = "Change-Id: I1234000000000000000000000000000000000000";
assertCreateFails(ci, ResourceConflictException.class, "missing subject; Change-Id must be in message footer");
}
use of com.google.gerrit.extensions.common.ChangeInput in project gerrit by GerritCodeReview.
the class CreateChangeIT method createMergeChange_ConflictAllowedNotSupportedByMergeStrategy.
@Test
public void createMergeChange_ConflictAllowedNotSupportedByMergeStrategy() throws Exception {
String fileName = "shared.txt";
String sourceBranch = "sourceBranch";
String targetBranch = "targetBranch";
changeInTwoBranches(sourceBranch, "source change", fileName, "source content", targetBranch, "target change", fileName, "target content");
String mergeStrategy = "simple-two-way-in-core";
ChangeInput in = newMergeChangeInput(targetBranch, sourceBranch, mergeStrategy, true);
assertCreateFails(in, BadRequestException.class, "merge with conflicts is not supported with merge strategy: " + mergeStrategy);
}
Aggregations