Replace deprecated ChangeApi#comments

Change-Id: I3532636f082409b956c6da06d58699ac8089b6c3
This commit is contained in:
Matthias Sohn
2020-10-11 09:23:21 +02:00
committed by Luca Milanesio
parent 605ba11bc9
commit d6340b481c
6 changed files with 8 additions and 6 deletions

View File

@@ -1557,7 +1557,8 @@ public abstract class AbstractDaemonTest {
protected List<CommentInfo> getChangeSortedComments(int changeNum) throws Exception { protected List<CommentInfo> getChangeSortedComments(int changeNum) throws Exception {
List<CommentInfo> comments = new ArrayList<>(); List<CommentInfo> comments = new ArrayList<>();
Map<String, List<CommentInfo>> commentsMap = gApi.changes().id(changeNum).comments(); Map<String, List<CommentInfo>> commentsMap =
gApi.changes().id(changeNum).commentsRequest().get();
for (Map.Entry<String, List<CommentInfo>> e : commentsMap.entrySet()) { for (Map.Entry<String, List<CommentInfo>> e : commentsMap.entrySet()) {
for (CommentInfo c : e.getValue()) { for (CommentInfo c : e.getValue()) {
c.path = e.getKey(); // Set the comment's path field. c.path = e.getKey(); // Set the comment's path field.

View File

@@ -65,7 +65,7 @@ public class TestCommentHelper {
} }
public Collection<CommentInfo> getPublishedComments(String changeId) throws Exception { public Collection<CommentInfo> getPublishedComments(String changeId) throws Exception {
return gApi.changes().id(changeId).comments().values().stream() return gApi.changes().id(changeId).commentsRequest().get().values().stream()
.flatMap(Collection::stream) .flatMap(Collection::stream)
.collect(toList()); .collect(toList());
} }

View File

@@ -3769,7 +3769,7 @@ public class ChangeIT extends AbstractDaemonTest {
.startsWith(subject); .startsWith(subject);
List<CommentInfo> comments = List<CommentInfo> comments =
Iterables.getOnlyElement(gApi.changes().id(id).comments().values()); Iterables.getOnlyElement(gApi.changes().id(id).commentsRequest().get().values());
assertThat(Iterables.getOnlyElement(comments).message).isEqualTo(ci.message); assertThat(Iterables.getOnlyElement(comments).message).isEqualTo(ci.message);
} }

View File

@@ -2731,7 +2731,7 @@ public abstract class AbstractPushForReview extends AbstractDaemonTest {
} }
private Collection<CommentInfo> getPublishedComments(String changeId) throws Exception { private Collection<CommentInfo> getPublishedComments(String changeId) throws Exception {
return gApi.changes().id(changeId).comments().values().stream() return gApi.changes().id(changeId).commentsRequest().get().values().stream()
.flatMap(Collection::stream) .flatMap(Collection::stream)
.collect(toList()); .collect(toList());
} }

View File

@@ -506,7 +506,8 @@ public class ImpersonationIT extends AbstractDaemonTest {
assertThat(m.author._accountId).isEqualTo(user.id().get()); assertThat(m.author._accountId).isEqualTo(user.id().get());
CommentInfo c = CommentInfo c =
Iterables.getOnlyElement(gApi.changes().id(r.getChangeId()).comments().get(di.path)); Iterables.getOnlyElement(
gApi.changes().id(r.getChangeId()).commentsRequest().get().get(di.path));
assertThat(c.author._accountId).isEqualTo(user.id().get()); assertThat(c.author._accountId).isEqualTo(user.id().get());
assertThat(c.message).isEqualTo(di.message); assertThat(c.message).isEqualTo(di.message);

View File

@@ -459,7 +459,7 @@ public class MailProcessorIT extends AbstractMailIT {
private ImmutableSet<CommentInfo> getCommentsAndRobotComments(String changeId) private ImmutableSet<CommentInfo> getCommentsAndRobotComments(String changeId)
throws RestApiException { throws RestApiException {
return Streams.concat( return Streams.concat(
gApi.changes().id(changeId).comments().values().stream(), gApi.changes().id(changeId).commentsRequest().get().values().stream(),
gApi.changes().id(changeId).robotComments().values().stream()) gApi.changes().id(changeId).robotComments().values().stream())
.flatMap(Collection::stream) .flatMap(Collection::stream)
.collect(toImmutableSet()); .collect(toImmutableSet());