Clean up after Ieaa18566d and I343425abd

The changes introduced some methods and fields which weren't used in
the patchsets which were merged in the end.

In addition, move an introduced overload of a method next to its
original version as overloads should be in one place.

Change-Id: I6d8aec463d2c0e385d7663faae301010af703563
This commit is contained in:
Alice Kober-Sotzek
2020-09-16 11:08:10 +02:00
parent c5a486c2d5
commit ab9e50dac2
3 changed files with 6 additions and 50 deletions

View File

@@ -131,11 +131,11 @@ public class PerPatchsetOperationsImpl implements PerPatchsetOperations {
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 @@ public class PerPatchsetOperationsImpl implements PerPatchsetOperations {
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 @@ public class PerPatchsetOperationsImpl implements PerPatchsetOperations {
}
}
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;

View File

@@ -31,7 +31,6 @@ import com.google.gerrit.extensions.restapi.Url;
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 @@ public class PutDraftComment implements RestModifyView<DraftCommentResource, Dra
private final PatchSetUtil psUtil;
private final Provider<CommentJson> commentJson;
private final PatchListCache patchListCache;
private final ChangeNotes.Factory changeNotesFactory;
@Inject
PutDraftComment(
@@ -65,15 +63,13 @@ public class PutDraftComment implements RestModifyView<DraftCommentResource, Dra
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

View File

@@ -58,7 +58,6 @@ import com.google.gerrit.extensions.restapi.BadRequestException;
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.ChangesCollection;
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 @@ public class CommentsIT extends AbstractDaemonTest {
@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 @@ public class CommentsIT extends AbstractDaemonTest {
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 @@ public class CommentsIT extends AbstractDaemonTest {
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 @@ public class CommentsIT extends AbstractDaemonTest {
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);
}