Revision API: Prepare to expose comments and drafts

This is a refactoring change to expose comments and drafts to plugin API.

- remove own DraftInput class from server package and reuse existing one
from the extensions package
- remove Side enum and reuse the existing enum from extensions package
- replace CommentRange with Range in CommentInfo class

This is needed to simplify mapping from server side CommentInfo class
to one from extensions package.  It cannot be used directly because
of AccountInfo class and needs to be mapped in plugin API layer.

Change-Id: If6c4cbce715f89f84459a6cd97073d1de31b0312
This commit is contained in:
David Ostrovsky
2014-06-19 23:43:25 +02:00
committed by David Pursehouse
parent e488cab11e
commit d52c47240a
16 changed files with 84 additions and 57 deletions

View File

@@ -27,8 +27,8 @@ import com.google.common.base.MoreObjects;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
import com.google.gerrit.common.TimeUtil;
import com.google.gerrit.common.changes.Side;
import com.google.gerrit.extensions.common.AccountInfo;
import com.google.gerrit.extensions.common.Side;
import com.google.gerrit.extensions.registration.DynamicMap;
import com.google.gerrit.extensions.restapi.IdString;
import com.google.gerrit.extensions.restapi.ResourceNotFoundException;
@@ -443,7 +443,11 @@ public class CommentsTest {
MoreObjects.firstNonNull(ci.side, Side.REVISION));
assertEquals(TimeUtil.roundToSecond(plc.getWrittenOn()),
TimeUtil.roundToSecond(ci.updated));
assertEquals(plc.getRange(), ci.range);
assertEquals(plc.getWrittenOn(), ci.updated);
assertEquals(plc.getRange().getStartLine(), ci.range.startLine);
assertEquals(plc.getRange().getStartCharacter(), ci.range.startCharacter);
assertEquals(plc.getRange().getEndLine(), ci.range.endLine);
assertEquals(plc.getRange().getEndCharacter(), ci.range.endCharacter);
}
private static PatchLineComment newPatchLineComment(PatchSet.Id psId,