use of com.google.gerrit.server.util.OneOffRequestContext in project gerrit by GerritCodeReview.
the class GerritServer method checkNoteDbState.
private void checkNoteDbState() throws Exception {
NoteDbMode mode = NoteDbMode.get();
if (mode != NoteDbMode.CHECK && mode != NoteDbMode.PRIMARY) {
return;
}
NoteDbChecker checker = testInjector.getInstance(NoteDbChecker.class);
OneOffRequestContext oneOffRequestContext = testInjector.getInstance(OneOffRequestContext.class);
try (ManualRequestContext ctx = oneOffRequestContext.open()) {
if (mode == NoteDbMode.CHECK) {
checker.rebuildAndCheckAllChanges();
} else if (mode == NoteDbMode.PRIMARY) {
checker.assertNoReviewDbChanges(desc.testDescription());
}
}
}
Aggregations