Add PatchLineCommentsUtil to assist with notedb migration

Like ApprovalsUtil and ChangeMessagesUtil, we added an abstraction
layer to assist in the migration to notedb. So far, we have only
migrated published comments over to the notedb (drafts still are only
stored in the reviewdb). This utility class helps to read published
comments from either the notedb or the ReviewDb depending on the state
of the NotesMigration instance.

Additionally, in this change, I modified all callers of
PatchLineCommentAccess that query for only published comments to
instead use the corresponding methods in the PatchLineCommentsUtil.

Finally, the test class, CommentsTest, had to be modified to add the
ability to test reading published comments from the notedb, so I
created a separate Config in that class to test the notedb path.

Change-Id: I3a5637dda5d97df335c40d5cda22165ecf1d8232
This commit is contained in:
Yacob Yonas
2014-07-02 16:31:27 -07:00
parent 712022f675
commit d710c0cfd8
10 changed files with 341 additions and 36 deletions

View File

@@ -36,12 +36,14 @@ public class NotesMigration {
cfg.setBoolean("notedb", null, "write", true);
cfg.setBoolean("notedb", "patchSetApprovals", "read", true);
cfg.setBoolean("notedb", "changeMessages", "read", true);
cfg.setBoolean("notedb", "publishedComments", "read", true);
return new NotesMigration(cfg);
}
private final boolean write;
private final boolean readPatchSetApprovals;
private final boolean readChangeMessages;
private final boolean readPublishedComments;
@Inject
NotesMigration(@GerritServerConfig Config cfg) {
@@ -50,6 +52,8 @@ public class NotesMigration {
cfg.getBoolean("notedb", "patchSetApprovals", "read", false);
readChangeMessages =
cfg.getBoolean("notedb", "changeMessages", "read", false);
readPublishedComments =
cfg.getBoolean("notedb", "publishedComments", "read", false);
}
public boolean write() {
@@ -63,4 +67,8 @@ public class NotesMigration {
public boolean readChangeMessages() {
return readChangeMessages;
}
public boolean readPublishedComments() {
return readPublishedComments;
}
}