Search in sources :

Example 6 with ChangeApi

use of com.google.gerrit.extensions.api.changes.ChangeApi in project gerrit by GerritCodeReview.

the class CheckMergeabilityIT method checkContentMergedCommit.

@Test
public void checkContentMergedCommit() throws Exception {
    testRepo.branch("HEAD").commit().insertChangeId().message("first commit").add("a.txt", "a contents ").create();
    testRepo.git().push().setRemote("origin").setRefSpecs(new RefSpec("HEAD:refs/heads/master")).call();
    // create a change, and cherrypick into master
    PushOneCommit.Result cId = createChange();
    RevCommit commitId = cId.getCommit();
    CherryPickInput cpi = new CherryPickInput();
    cpi.destination = "master";
    cpi.message = "cherry pick the commit";
    ChangeApi orig = gApi.changes().id(cId.getChangeId());
    ChangeApi cherry = orig.current().cherryPick(cpi);
    cherry.current().review(ReviewInput.approve());
    cherry.current().submit();
    ObjectId remoteId = getRemoteHead();
    assertThat(remoteId).isNotEqualTo(commitId);
    assertContentMerged("master", commitId.getName(), "recursive");
}
Also used : RefSpec(org.eclipse.jgit.transport.RefSpec) ChangeApi(com.google.gerrit.extensions.api.changes.ChangeApi) ObjectId(org.eclipse.jgit.lib.ObjectId) CherryPickInput(com.google.gerrit.extensions.api.changes.CherryPickInput) PushOneCommit(com.google.gerrit.acceptance.PushOneCommit) RevCommit(org.eclipse.jgit.revwalk.RevCommit) Test(org.junit.Test) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest)

Example 7 with ChangeApi

use of com.google.gerrit.extensions.api.changes.ChangeApi in project gerrit by GerritCodeReview.

the class ChangeIdIT method projectChangeNumberReturnsChange.

@Test
public void projectChangeNumberReturnsChange() throws Exception {
    ChangeApi cApi = gApi.changes().id(project.get(), changeInfo._number);
    assertThat(cApi.get().changeId).isEqualTo(changeInfo.changeId);
}
Also used : ChangeApi(com.google.gerrit.extensions.api.changes.ChangeApi) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest) Test(org.junit.Test)

Example 8 with ChangeApi

use of com.google.gerrit.extensions.api.changes.ChangeApi in project gerrit by GerritCodeReview.

the class ChangeIdIT method tripletChangeIdReturnsChange.

@Test
public void tripletChangeIdReturnsChange() throws Exception {
    ChangeApi cApi = gApi.changes().id(project.get(), changeInfo.branch, changeInfo.changeId);
    assertThat(cApi.get().changeId).isEqualTo(changeInfo.changeId);
}
Also used : ChangeApi(com.google.gerrit.extensions.api.changes.ChangeApi) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest) Test(org.junit.Test)

Example 9 with ChangeApi

use of com.google.gerrit.extensions.api.changes.ChangeApi in project gerrit by GerritCodeReview.

the class ChangeIdIT method changeNumberReturnsChange.

@Test
public void changeNumberReturnsChange() throws Exception {
    ChangeApi cApi = gApi.changes().id(changeInfo._number);
    assertThat(cApi.get().changeId).isEqualTo(changeInfo.changeId);
}
Also used : ChangeApi(com.google.gerrit.extensions.api.changes.ChangeApi) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest) Test(org.junit.Test)

Example 10 with ChangeApi

use of com.google.gerrit.extensions.api.changes.ChangeApi in project gerrit by GerritCodeReview.

the class ChangeIdIT method projectChangeNumberReturnsChangeWhenProjectContainsSlashes.

@Test
public void projectChangeNumberReturnsChangeWhenProjectContainsSlashes() throws Exception {
    Project.NameKey p = createProject("foo/bar");
    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.reviewdb.client.Project) ChangeInfo(com.google.gerrit.extensions.common.ChangeInfo) ChangeApi(com.google.gerrit.extensions.api.changes.ChangeApi) ChangeInput(com.google.gerrit.extensions.common.ChangeInput) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest) Test(org.junit.Test)

Aggregations

ChangeApi (com.google.gerrit.extensions.api.changes.ChangeApi)17 Test (org.junit.Test)17 AbstractDaemonTest (com.google.gerrit.acceptance.AbstractDaemonTest)15 PushOneCommit (com.google.gerrit.acceptance.PushOneCommit)12 CherryPickInput (com.google.gerrit.extensions.api.changes.CherryPickInput)10 BranchInput (com.google.gerrit.extensions.api.projects.BranchInput)7 ChangeInfo (com.google.gerrit.extensions.common.ChangeInfo)5 RefSpec (org.eclipse.jgit.transport.RefSpec)4 ChangeInput (com.google.gerrit.extensions.common.ChangeInput)3 ChangeMessageInfo (com.google.gerrit.extensions.common.ChangeMessageInfo)3 RevCommit (org.eclipse.jgit.revwalk.RevCommit)3 RevisionInfo (com.google.gerrit.extensions.common.RevisionInfo)2 BinaryResult (com.google.gerrit.extensions.restapi.BinaryResult)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 ObjectId (org.eclipse.jgit.lib.ObjectId)2 Result (com.google.gerrit.acceptance.PushOneCommit.Result)1 RevisionApi (com.google.gerrit.extensions.api.changes.RevisionApi)1 Project (com.google.gerrit.reviewdb.client.Project)1 DateFormat (java.text.DateFormat)1 SimpleDateFormat (java.text.SimpleDateFormat)1