Search in sources :

Example 56 with ChangeInput

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

the class DisablePrivateChangesIT method createPrivateChangeWithDisablePrivateChangesFalse.

@Test
public void createPrivateChangeWithDisablePrivateChangesFalse() throws Exception {
    ChangeInput input = new ChangeInput(project.get(), "master", "empty change");
    input.isPrivate = true;
    assertThat(gApi.changes().create(input).get().isPrivate).isTrue();
}
Also used : ChangeInput(com.google.gerrit.extensions.common.ChangeInput) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest) Test(org.junit.Test)

Example 57 with ChangeInput

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

the class DisablePrivateChangesIT method createNonPrivateChangeWithDisablePrivateChangesTrue.

@Test
@GerritConfig(name = "change.disablePrivateChanges", value = "true")
public void createNonPrivateChangeWithDisablePrivateChangesTrue() throws Exception {
    ChangeInput input = new ChangeInput(project.get(), "master", "empty change");
    assertThat(gApi.changes().create(input).get().isPrivate).isNull();
}
Also used : ChangeInput(com.google.gerrit.extensions.common.ChangeInput) GerritConfig(com.google.gerrit.acceptance.config.GerritConfig) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest) Test(org.junit.Test)

Example 58 with ChangeInput

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

the class ChangeEditIT method sha1sOfTwoChangesWithSameContentAfterEditDiffer.

@Test
public void sha1sOfTwoChangesWithSameContentAfterEditDiffer() throws Exception {
    ChangeInput changeInput = new ChangeInput();
    changeInput.project = project.get();
    changeInput.branch = "master";
    changeInput.subject = "Empty change";
    changeInput.status = ChangeStatus.NEW;
    ChangeInfo info1 = gApi.changes().create(changeInput).get();
    gApi.changes().id(info1._number).edit().modifyFile(FILE_NAME, RawInputUtil.create(CONTENT_NEW));
    gApi.changes().id(info1._number).edit().publish(new PublishChangeEditInput());
    info1 = gApi.changes().id(info1._number).get();
    ChangeInfo info2 = gApi.changes().create(changeInput).get();
    gApi.changes().id(info2._number).edit().modifyFile(FILE_NAME, RawInputUtil.create(CONTENT_NEW));
    gApi.changes().id(info2._number).edit().publish(new PublishChangeEditInput());
    info2 = gApi.changes().id(info2._number).get();
    assertThat(info1.currentRevision).isNotEqualTo(info2.currentRevision);
}
Also used : ChangeInfo(com.google.gerrit.extensions.common.ChangeInfo) ChangeInput(com.google.gerrit.extensions.common.ChangeInput) PublishChangeEditInput(com.google.gerrit.extensions.api.changes.PublishChangeEditInput) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest) Test(org.junit.Test)

Example 59 with ChangeInput

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

the class ChangeIT method createEmptyChangeOnNonExistingBranch.

@Test
public void createEmptyChangeOnNonExistingBranch() throws Exception {
    ChangeInput in = new ChangeInput();
    in.branch = "foo";
    in.subject = "Create a change on new branch from the API";
    in.project = project.get();
    in.newBranch = true;
    ChangeInfo info = gApi.changes().create(in).get();
    assertThat(info.project).isEqualTo(in.project);
    assertThat(RefNames.fullName(info.branch)).isEqualTo(RefNames.fullName(in.branch));
    assertThat(info.subject).isEqualTo(in.subject);
    assertThat(Iterables.getOnlyElement(info.messages).message).isEqualTo("Uploaded patch set 1.");
}
Also used : ChangeInfo(com.google.gerrit.extensions.common.ChangeInfo) ChangeInput(com.google.gerrit.extensions.common.ChangeInput) Test(org.junit.Test) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest)

Example 60 with ChangeInput

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

the class ChangeIT method createEmptyChange.

@Test
public void createEmptyChange() throws Exception {
    ChangeInput in = new ChangeInput();
    in.branch = Constants.MASTER;
    in.subject = "Create a change from the API";
    in.project = project.get();
    ChangeInfo info = gApi.changes().create(in).get();
    assertThat(info.project).isEqualTo(in.project);
    assertThat(RefNames.fullName(info.branch)).isEqualTo(RefNames.fullName(in.branch));
    assertThat(info.subject).isEqualTo(in.subject);
    assertThat(Iterables.getOnlyElement(info.messages).message).isEqualTo("Uploaded patch set 1.");
}
Also used : ChangeInfo(com.google.gerrit.extensions.common.ChangeInfo) 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