Merge "Expose `reportLifeCycle` to plugins for reporting"
diff --git a/java/com/google/gerrit/acceptance/testsuite/change/PerPatchsetOperationsImpl.java b/java/com/google/gerrit/acceptance/testsuite/change/PerPatchsetOperationsImpl.java
index 9f2e1f4..20f9c49 100644
--- a/java/com/google/gerrit/acceptance/testsuite/change/PerPatchsetOperationsImpl.java
+++ b/java/com/google/gerrit/acceptance/testsuite/change/PerPatchsetOperationsImpl.java
@@ -131,11 +131,11 @@
return userFactory.create(authorId);
}
- /**
- * Both this and {@code toEntitiesCommentRange} is needed since there are two Comment.Range
- * entities, in different packages: {@code com.google.gerrit.entities.Comment.Range}, and {@code
- * com.google.gerrit.extensions.Comment.Range}
- */
+ private IdentifiedUser getAuthor(TestRobotCommentCreation robotCommentCreation) {
+ Account.Id authorId = robotCommentCreation.author().orElse(changeNotes.getChange().getOwner());
+ return userFactory.create(authorId);
+ }
+
private static Comment.Range toCommentRange(TestRange range) {
Comment.Range commentRange = new Range();
commentRange.startLine = range.start().line();
@@ -145,19 +145,6 @@
return commentRange;
}
- /**
- * Both this and {@code toCommentRange} is needed since there are two Comment.Range entities, in
- * different packages: {@code com.google.gerrit.entities.Comment.Range}, and {@code
- * com.google.gerrit.extensions.Comment.Range}
- */
- private static com.google.gerrit.entities.Comment.Range toEntitiesCommentRange(TestRange range) {
- return new com.google.gerrit.entities.Comment.Range(
- range.start().line(),
- range.start().charOffset(),
- range.end().line(),
- range.end().charOffset());
- }
-
private class CommentAdditionOp implements BatchUpdateOp {
private String createdCommentUuid;
private final TestCommentCreation commentCreation;
@@ -238,11 +225,6 @@
}
}
- private IdentifiedUser getAuthor(TestRobotCommentCreation robotCommentCreation) {
- Account.Id authorId = robotCommentCreation.author().orElse(changeNotes.getChange().getOwner());
- return userFactory.create(authorId);
- }
-
private class RobotCommentAdditionOp implements BatchUpdateOp {
private String createdRobotCommentUuid;
private final TestRobotCommentCreation robotCommentCreation;
diff --git a/java/com/google/gerrit/server/restapi/change/PutDraftComment.java b/java/com/google/gerrit/server/restapi/change/PutDraftComment.java
index 17a8ff4..39de43d 100644
--- a/java/com/google/gerrit/server/restapi/change/PutDraftComment.java
+++ b/java/com/google/gerrit/server/restapi/change/PutDraftComment.java
@@ -31,7 +31,6 @@
import com.google.gerrit.server.CommentsUtil;
import com.google.gerrit.server.PatchSetUtil;
import com.google.gerrit.server.change.DraftCommentResource;
-import com.google.gerrit.server.notedb.ChangeNotes;
import com.google.gerrit.server.notedb.ChangeUpdate;
import com.google.gerrit.server.patch.PatchListCache;
import com.google.gerrit.server.patch.PatchListNotAvailableException;
@@ -56,7 +55,6 @@
private final PatchSetUtil psUtil;
private final Provider<CommentJson> commentJson;
private final PatchListCache patchListCache;
- private final ChangeNotes.Factory changeNotesFactory;
@Inject
PutDraftComment(
@@ -65,15 +63,13 @@
CommentsUtil commentsUtil,
PatchSetUtil psUtil,
Provider<CommentJson> commentJson,
- PatchListCache patchListCache,
- ChangeNotes.Factory changeNotesFactory) {
+ PatchListCache patchListCache) {
this.updateFactory = updateFactory;
this.delete = delete;
this.commentsUtil = commentsUtil;
this.psUtil = psUtil;
this.commentJson = commentJson;
this.patchListCache = patchListCache;
- this.changeNotesFactory = changeNotesFactory;
}
@Override
diff --git a/javatests/com/google/gerrit/acceptance/server/change/CommentsIT.java b/javatests/com/google/gerrit/acceptance/server/change/CommentsIT.java
index 0cdff4e..4f61d79 100644
--- a/javatests/com/google/gerrit/acceptance/server/change/CommentsIT.java
+++ b/javatests/com/google/gerrit/acceptance/server/change/CommentsIT.java
@@ -58,7 +58,6 @@
import com.google.gerrit.extensions.restapi.IdString;
import com.google.gerrit.extensions.restapi.ResourceNotFoundException;
import com.google.gerrit.extensions.restapi.TopLevelResource;
-import com.google.gerrit.server.CommentsUtil;
import com.google.gerrit.server.change.ChangeResource;
import com.google.gerrit.server.change.RevisionResource;
import com.google.gerrit.server.notedb.ChangeNoteUtil;
@@ -67,7 +66,6 @@
import com.google.gerrit.server.restapi.change.PostReview;
import com.google.gerrit.testing.FakeEmailSender;
import com.google.gerrit.testing.FakeEmailSender.Message;
-import com.google.gerrit.testing.TestCommentHelper;
import com.google.inject.Inject;
import com.google.inject.Provider;
import java.sql.Timestamp;
@@ -99,8 +97,6 @@
@Inject private ChangeOperations changeOperations;
@Inject private AccountOperations accountOperations;
@Inject private RequestScopeOperations requestScopeOperations;
- @Inject private CommentsUtil commentsUtil;
- @Inject private TestCommentHelper testCommentHelper;
private final Integer[] lines = {0, 1};
@@ -1649,12 +1645,6 @@
gApi.changes().id(changeId).revision(revision).review(input);
}
- private void addComments(String changeId, CommentInput... commentInputs) throws Exception {
- ReviewInput input = new ReviewInput();
- input.comments = Arrays.stream(commentInputs).collect(groupingBy(c -> c.path));
- gApi.changes().id(changeId).current().review(input);
- }
-
/**
* All the commits, which contain the target comment before, should still contain the comment with
* the updated message. All the other metas of the commits should be exactly the same.
@@ -1748,14 +1738,6 @@
return gApi.changes().id(changeId).revision(revId).createDraft(in).get();
}
- private CommentInfo addDraft(Change.Id changeId, String revId, DraftInput in) throws Exception {
- return gApi.changes().id(changeId.get()).revision(revId).createDraft(in).get();
- }
-
- private CommentInfo addDraft(String changeId, DraftInput in) throws Exception {
- return gApi.changes().id(changeId).current().createDraft(in).get();
- }
-
private CommentInfo addDraft(Change.Id changeId, DraftInput in) throws Exception {
return gApi.changes().id(changeId.get()).current().createDraft(in).get();
}
@@ -1765,10 +1747,6 @@
gApi.changes().id(changeId).revision(revId).draft(uuid).update(in);
}
- private void updateDraft(String changeId, DraftInput in, String uuid) throws Exception {
- gApi.changes().id(changeId).current().draft(uuid).update(in);
- }
-
private void updateDraft(Change.Id changeId, DraftInput in, String uuid) throws Exception {
gApi.changes().id(changeId.get()).current().draft(uuid).update(in);
}