Search in sources :

Example 46 with ChangeInput

use of com.google.gerrit.extensions.common.ChangeInput in project gerrit by GerritCodeReview.

the class CommentContextIT method createChangeInNewBranch.

private ChangeInfo createChangeInNewBranch(String branchName) throws Exception {
    ChangeInput in = new ChangeInput();
    in.project = project.get();
    in.branch = branchName;
    in.newBranch = true;
    in.subject = "New changes";
    return gApi.changes().create(in).get();
}
Also used : ChangeInput(com.google.gerrit.extensions.common.ChangeInput)

Example 47 with ChangeInput

use of com.google.gerrit.extensions.common.ChangeInput in project gerrit by GerritCodeReview.

the class AbstractQueryChangesTest method revertOf.

@Test
public void revertOf() throws Exception {
    TestRepository<Repo> repo = createProject("repo");
    // Create two commits and revert second commit (initial commit can't be reverted)
    Change initial = insert(repo, newChange(repo));
    gApi.changes().id(initial.getChangeId()).current().review(ReviewInput.approve());
    gApi.changes().id(initial.getChangeId()).current().submit();
    ChangeInfo changeToRevert = gApi.changes().create(new ChangeInput("repo", "master", "commit to revert")).get();
    gApi.changes().id(changeToRevert.id).current().review(ReviewInput.approve());
    gApi.changes().id(changeToRevert.id).current().submit();
    ChangeInfo changeThatReverts = gApi.changes().id(changeToRevert.id).revert().get();
    assertQueryByIds("revertof:" + changeToRevert._number, Change.id(changeThatReverts._number));
}
Also used : Repo(com.google.gerrit.testing.InMemoryRepositoryManager.Repo) ChangeInfo(com.google.gerrit.extensions.common.ChangeInfo) ChangeInput(com.google.gerrit.extensions.common.ChangeInput) Change(com.google.gerrit.entities.Change) Test(org.junit.Test)

Example 48 with ChangeInput

use of com.google.gerrit.extensions.common.ChangeInput in project gerrit by GerritCodeReview.

the class AbstractQueryChangesTest method isPureRevert.

@Test
public void isPureRevert() throws Exception {
    assume().that(getSchema().hasField(ChangeField.IS_PURE_REVERT)).isTrue();
    TestRepository<Repo> repo = createProject("repo");
    // Create two commits and revert second commit (initial commit can't be reverted)
    Change initial = insert(repo, newChange(repo));
    gApi.changes().id(initial.getChangeId()).current().review(ReviewInput.approve());
    gApi.changes().id(initial.getChangeId()).current().submit();
    ChangeInfo changeToRevert = gApi.changes().create(new ChangeInput("repo", "master", "commit to revert")).get();
    gApi.changes().id(changeToRevert.id).current().review(ReviewInput.approve());
    gApi.changes().id(changeToRevert.id).current().submit();
    ChangeInfo changeThatReverts = gApi.changes().id(changeToRevert.id).revert().get();
    Change.Id changeThatRevertsId = Change.id(changeThatReverts._number);
    assertQueryByIds("is:pure-revert", changeThatRevertsId);
    // Update the change that reverts such that it's not a pure revert
    gApi.changes().id(changeThatReverts.id).edit().modifyFile("some-file.txt", RawInputUtil.create("newcontent".getBytes(UTF_8)));
    gApi.changes().id(changeThatReverts.id).edit().publish();
    assertQueryByIds("is:pure-revert");
}
Also used : Repo(com.google.gerrit.testing.InMemoryRepositoryManager.Repo) ChangeInfo(com.google.gerrit.extensions.common.ChangeInfo) ChangeInput(com.google.gerrit.extensions.common.ChangeInput) Change(com.google.gerrit.entities.Change) Test(org.junit.Test)

Example 49 with ChangeInput

use of com.google.gerrit.extensions.common.ChangeInput in project gerrit by GerritCodeReview.

the class AbstractQueryAccountsTest method createChange.

protected ChangeInfo createChange(Project.NameKey project) throws RestApiException {
    ChangeInput in = new ChangeInput();
    in.subject = "A change";
    in.project = project.get();
    in.branch = "master";
    return gApi.changes().create(in).get();
}
Also used : ChangeInput(com.google.gerrit.extensions.common.ChangeInput)

Example 50 with ChangeInput

use of com.google.gerrit.extensions.common.ChangeInput in project gerrit by GerritCodeReview.

the class CreateChangeIT method createNewDraftChangeNotAllowed.

@Test
public void createNewDraftChangeNotAllowed() throws Exception {
    assume().that(isAllowDrafts()).isFalse();
    ChangeInput ci = newChangeInput(ChangeStatus.DRAFT);
    assertCreateFails(ci, MethodNotAllowedException.class, "draft workflow is disabled");
}
Also used : ChangeInput(com.google.gerrit.extensions.common.ChangeInput) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest) Test(org.junit.Test)

Aggregations

ChangeInput (com.google.gerrit.extensions.common.ChangeInput)107 Test (org.junit.Test)94 AbstractDaemonTest (com.google.gerrit.acceptance.AbstractDaemonTest)89 ChangeInfo (com.google.gerrit.extensions.common.ChangeInfo)30 Project (com.google.gerrit.entities.Project)10 Result (com.google.gerrit.acceptance.PushOneCommit.Result)7 AccountInput (com.google.gerrit.extensions.api.accounts.AccountInput)7 MergeInput (com.google.gerrit.extensions.common.MergeInput)6 BinaryResult (com.google.gerrit.extensions.restapi.BinaryResult)6 Change (com.google.gerrit.entities.Change)5 ChangeApi (com.google.gerrit.extensions.api.changes.ChangeApi)5 TestAccount (com.google.gerrit.acceptance.TestAccount)4 StandaloneSiteTest (com.google.gerrit.acceptance.StandaloneSiteTest)3 GerritConfig (com.google.gerrit.acceptance.config.GerritConfig)3 GitPerson (com.google.gerrit.extensions.common.GitPerson)3 ObjectId (org.eclipse.jgit.lib.ObjectId)3 PushOneCommit (com.google.gerrit.acceptance.PushOneCommit)2 TestProjectInput (com.google.gerrit.acceptance.TestProjectInput)2 UseSystemTime (com.google.gerrit.acceptance.UseSystemTime)2 RevisionApi (com.google.gerrit.extensions.api.changes.RevisionApi)2