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);
}
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);
}
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();
}
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();
}
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.");
}
Aggregations