Search in sources :

Example 31 with ChangeInput

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

the class AutoMergeIT method autoMergeCreatedWhenNewPatchSetCreatedOnApi.

@Test
public void autoMergeCreatedWhenNewPatchSetCreatedOnApi() throws Exception {
    ChangeInput ci = new ChangeInput(project.get(), "master", "Merge commit");
    ci.merge = new MergeInput();
    ci.merge.source = parent1.name();
    String changeId = gApi.changes().create(ci).get().changeId;
    gApi.changes().id(changeId).setMessage("New Commit Message\n\nChange-Id: " + changeId);
    assertThat(gApi.changes().id(changeId).get().revisions.size()).isEqualTo(2);
    String newChangePatchSetSha1 = gApi.changes().id(changeId).get().currentRevision;
    assertAutoMergeCreated(ObjectId.fromString(newChangePatchSetSha1));
}
Also used : MergeInput(com.google.gerrit.extensions.common.MergeInput) ChangeInput(com.google.gerrit.extensions.common.ChangeInput) Test(org.junit.Test) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest)

Example 32 with ChangeInput

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

the class AutoMergeIT method autoMergeCreatedWhenChangeCreatedOnApi.

@Test
public void autoMergeCreatedWhenChangeCreatedOnApi() throws Exception {
    ChangeInput ci = new ChangeInput(project.get(), "master", "Merge commit");
    ci.merge = new MergeInput();
    ci.merge.source = parent1.name();
    String newChangePatchSetSha1 = gApi.changes().create(ci).get().currentRevision;
    assertAutoMergeCreated(ObjectId.fromString(newChangePatchSetSha1));
}
Also used : MergeInput(com.google.gerrit.extensions.common.MergeInput) ChangeInput(com.google.gerrit.extensions.common.ChangeInput) Test(org.junit.Test) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest)

Example 33 with ChangeInput

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

the class WorkInProgressByDefaultIT method createChangeBypassWorkInProgressByDefaultForProjectEnabled.

@Test
public void createChangeBypassWorkInProgressByDefaultForProjectEnabled() throws Exception {
    Project.NameKey project = projectOperations.newProject().create();
    setWorkInProgressByDefaultForProject(project);
    ChangeInput input = new ChangeInput(project.get(), "master", "empty change");
    input.workInProgress = false;
    assertThat(gApi.changes().create(input).get().workInProgress).isNull();
}
Also used : Project(com.google.gerrit.entities.Project) ChangeInput(com.google.gerrit.extensions.common.ChangeInput) Test(org.junit.Test) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest)

Example 34 with ChangeInput

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

the class WorkInProgressByDefaultIT method createChangeBypassWorkInProgressByDefaultForUserEnabled.

@Test
public void createChangeBypassWorkInProgressByDefaultForUserEnabled() throws Exception {
    Project.NameKey project = projectOperations.newProject().create();
    setWorkInProgressByDefaultForUser();
    ChangeInput input = new ChangeInput(project.get(), "master", "empty change");
    input.workInProgress = false;
    assertThat(gApi.changes().create(input).get().workInProgress).isNull();
}
Also used : Project(com.google.gerrit.entities.Project) ChangeInput(com.google.gerrit.extensions.common.ChangeInput) Test(org.junit.Test) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest)

Example 35 with ChangeInput

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

the class WorkInProgressByDefaultIT method createChangeWithWorkInProgressByDefaultForUserEnabled.

@Test
public void createChangeWithWorkInProgressByDefaultForUserEnabled() throws Exception {
    Project.NameKey project = projectOperations.newProject().create();
    setWorkInProgressByDefaultForUser();
    ChangeInput input = new ChangeInput(project.get(), "master", "empty change");
    assertThat(gApi.changes().create(input).get().workInProgress).isTrue();
}
Also used : Project(com.google.gerrit.entities.Project) ChangeInput(com.google.gerrit.extensions.common.ChangeInput) Test(org.junit.Test) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest)

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