Search in sources :

Example 51 with ChangeInput

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

the class CreateChangeIT method createChangeOnInvisibleBranchFails.

@Test
public void createChangeOnInvisibleBranchFails() throws Exception {
    changeInTwoBranches("invisible-branch", "a.txt", "branchB", "b.txt");
    block(project, "refs/heads/invisible-branch", READ, REGISTERED_USERS);
    ChangeInput in = newChangeInput(ChangeStatus.NEW);
    in.branch = "invisible-branch";
    assertCreateFails(in, AuthException.class, "cannot upload review");
}
Also used : ChangeInput(com.google.gerrit.extensions.common.ChangeInput) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest) Test(org.junit.Test)

Example 52 with ChangeInput

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

the class AgreementsIT method newChangeInput.

private ChangeInput newChangeInput() {
    ChangeInput in = new ChangeInput();
    in.branch = "master";
    in.subject = "test";
    in.project = project.get();
    return in;
}
Also used : ChangeInput(com.google.gerrit.extensions.common.ChangeInput)

Example 53 with ChangeInput

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

the class ChangeIdIT method projectChangeNumberReturnsChangeWhenProjectContainsSlashes.

@Test
public void projectChangeNumberReturnsChangeWhenProjectContainsSlashes() throws Exception {
    Project.NameKey p = projectOperations.newProject().create();
    ChangeInfo ci = gApi.changes().create(new ChangeInput(p.get(), "master", "msg")).get();
    ChangeApi cApi = gApi.changes().id(p.get(), ci._number);
    assertThat(cApi.get().changeId).isEqualTo(ci.changeId);
}
Also used : Project(com.google.gerrit.entities.Project) ChangeInfo(com.google.gerrit.extensions.common.ChangeInfo) ChangeApi(com.google.gerrit.extensions.api.changes.ChangeApi) ChangeInput(com.google.gerrit.extensions.common.ChangeInput) Test(org.junit.Test) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest)

Example 54 with ChangeInput

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

the class ChangeIdIT method changeIdReturnsChange.

@Test
public void changeIdReturnsChange() throws Exception {
    // ChangeId is not unique and this method needs a unique changeId to work.
    // Hence we generate a new change with a different content.
    ChangeInfo ci = gApi.changes().create(new ChangeInput(project.get(), "master", "different message")).get();
    ChangeApi cApi = gApi.changes().id(ci.changeId);
    assertThat(cApi.get()._number).isEqualTo(ci._number);
}
Also used : ChangeInfo(com.google.gerrit.extensions.common.ChangeInfo) ChangeApi(com.google.gerrit.extensions.api.changes.ChangeApi) ChangeInput(com.google.gerrit.extensions.common.ChangeInput) Test(org.junit.Test) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest)

Example 55 with ChangeInput

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

the class DisablePrivateChangesIT method createPrivateChangeWithDisablePrivateChangesTrue.

@Test
@GerritConfig(name = "change.disablePrivateChanges", value = "true")
public void createPrivateChangeWithDisablePrivateChangesTrue() throws Exception {
    ChangeInput input = new ChangeInput(project.get(), "master", "empty change");
    input.isPrivate = true;
    MethodNotAllowedException thrown = assertThrows(MethodNotAllowedException.class, () -> gApi.changes().create(input));
    assertThat(thrown).hasMessageThat().contains("private changes are disabled");
}
Also used : MethodNotAllowedException(com.google.gerrit.extensions.restapi.MethodNotAllowedException) ChangeInput(com.google.gerrit.extensions.common.ChangeInput) GerritConfig(com.google.gerrit.acceptance.config.GerritConfig) 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