Search in sources :

Example 61 with ChangeInfo

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

the class GetMetaDiffIT method metaDiffWithOptionIncludesExtraInformation.

@Test
public void metaDiffWithOptionIncludesExtraInformation() throws Exception {
    PushOneCommit.Result ch = createChange();
    ChangeApi chApi = gApi.changes().id(ch.getChangeId());
    ChangeInfo oldInfo = chApi.get(ListChangesOption.CURRENT_REVISION);
    amendChange(ch.getChangeId());
    ChangeInfo newInfo = chApi.get(ListChangesOption.CURRENT_REVISION);
    ChangeInfoDifference difference = chApi.metaDiff(oldInfo.metaRevId, newInfo.metaRevId, ImmutableSet.of(ListChangesOption.CURRENT_REVISION));
    assertThat(newInfo.currentRevision).isNotNull();
    assertThat(oldInfo.currentRevision).isNotNull();
    assertThat(difference.added().currentRevision).isEqualTo(newInfo.currentRevision);
    assertThat(difference.removed().currentRevision).isEqualTo(oldInfo.currentRevision);
}
Also used : ChangeInfoDifference(com.google.gerrit.extensions.common.ChangeInfoDifference) ChangeInfo(com.google.gerrit.extensions.common.ChangeInfo) ChangeApi(com.google.gerrit.extensions.api.changes.ChangeApi) PushOneCommit(com.google.gerrit.acceptance.PushOneCommit) Test(org.junit.Test) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest)

Example 62 with ChangeInfo

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

the class GetMetaDiffIT method metaDiffUnreachableNewSha1.

@Test
public void metaDiffUnreachableNewSha1() throws Exception {
    PushOneCommit.Result ch1 = createChange();
    PushOneCommit.Result ch2 = createChange();
    ChangeInfo info2 = gApi.changes().id(ch2.getChangeId()).get();
    RestResponse resp = adminRestSession.get("/changes/" + ch1.getChangeId() + "/meta_diff/?meta=" + info2.metaRevId);
    resp.assertStatus(412);
}
Also used : ChangeInfo(com.google.gerrit.extensions.common.ChangeInfo) RestResponse(com.google.gerrit.acceptance.RestResponse) PushOneCommit(com.google.gerrit.acceptance.PushOneCommit) Test(org.junit.Test) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest)

Example 63 with ChangeInfo

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

the class GetMetaDiffIT method metaDiffWithoutOptionDoesNotIncludeExtraInformation.

@Test
public void metaDiffWithoutOptionDoesNotIncludeExtraInformation() throws Exception {
    PushOneCommit.Result ch = createChange();
    ChangeApi chApi = gApi.changes().id(ch.getChangeId());
    ChangeInfo oldInfo = chApi.get();
    amendChange(ch.getChangeId());
    ChangeInfo newInfo = chApi.get();
    ChangeInfoDifference difference = chApi.metaDiff(oldInfo.metaRevId, newInfo.metaRevId);
    assertThat(difference.added().currentRevision).isNull();
    assertThat(difference.removed().currentRevision).isNull();
}
Also used : ChangeInfoDifference(com.google.gerrit.extensions.common.ChangeInfoDifference) ChangeInfo(com.google.gerrit.extensions.common.ChangeInfo) ChangeApi(com.google.gerrit.extensions.api.changes.ChangeApi) PushOneCommit(com.google.gerrit.acceptance.PushOneCommit) Test(org.junit.Test) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest)

Example 64 with ChangeInfo

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

the class GetMetaDiffIT method metaDiffWithOldSha1NotInRepoUsesDefault.

@Test
public void metaDiffWithOldSha1NotInRepoUsesDefault() throws Exception {
    PushOneCommit.Result ch = createChange();
    gApi.changes().id(ch.getChangeId()).topic("intermediate-topic");
    gApi.changes().id(ch.getChangeId()).topic(TOPIC);
    ChangeInfo info = gApi.changes().id(ch.getChangeId()).get();
    ChangeInfoDifference difference = gApi.changes().id(ch.getChangeId()).metaDiff(UNSAVED_REV_ID, info.metaRevId);
    assertThat(difference.added().topic).isEqualTo(TOPIC);
    assertThat(difference.removed().topic).isNull();
}
Also used : ChangeInfoDifference(com.google.gerrit.extensions.common.ChangeInfoDifference) ChangeInfo(com.google.gerrit.extensions.common.ChangeInfo) PushOneCommit(com.google.gerrit.acceptance.PushOneCommit) Test(org.junit.Test) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest)

Example 65 with ChangeInfo

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

the class CreateChangeIT method createNewChange.

@Test
public void createNewChange() throws Exception {
    ChangeInfo info = assertCreateSucceeds(newChangeInput(ChangeStatus.NEW));
    assertThat(info.revisions.get(info.currentRevision).commit.message).contains("Change-Id: " + info.changeId);
    // Verify the message that has been posted on the change.
    List<ChangeMessageInfo> messages = gApi.changes().id(info._number).messages();
    assertThat(messages).hasSize(1);
    assertThat(Iterables.getOnlyElement(messages).message).isEqualTo("Uploaded patch set 1.");
}
Also used : ChangeInfo(com.google.gerrit.extensions.common.ChangeInfo) ChangeMessageInfo(com.google.gerrit.extensions.common.ChangeMessageInfo) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest) Test(org.junit.Test)

Aggregations

ChangeInfo (com.google.gerrit.extensions.common.ChangeInfo)504 Test (org.junit.Test)434 AbstractDaemonTest (com.google.gerrit.acceptance.AbstractDaemonTest)393 PushOneCommit (com.google.gerrit.acceptance.PushOneCommit)276 Change (com.google.gerrit.entities.Change)73 RevCommit (org.eclipse.jgit.revwalk.RevCommit)67 ChangeMessageInfo (com.google.gerrit.extensions.common.ChangeMessageInfo)52 ReviewInput (com.google.gerrit.extensions.api.changes.ReviewInput)50 Project (com.google.gerrit.entities.Project)45 InMemoryRepository (org.eclipse.jgit.internal.storage.dfs.InMemoryRepository)45 ChangeInput (com.google.gerrit.extensions.common.ChangeInput)36 RevisionInfo (com.google.gerrit.extensions.common.RevisionInfo)36 Registration (com.google.gerrit.acceptance.ExtensionRegistry.Registration)35 Repository (org.eclipse.jgit.lib.Repository)35 CommitInfo (com.google.gerrit.extensions.common.CommitInfo)32 LabelInfo (com.google.gerrit.extensions.common.LabelInfo)32 TestRepository (org.eclipse.jgit.junit.TestRepository)32 ObjectId (org.eclipse.jgit.lib.ObjectId)30 AccountInfo (com.google.gerrit.extensions.common.AccountInfo)29 List (java.util.List)29