use of com.google.gerrit.testutil.DisabledReviewDb in project gerrit by GerritCodeReview.
the class AbstractQueryChangesTest method prepopulatedFields.
@Test
public void prepopulatedFields() throws Exception {
assume().that(notesMigration.readChanges()).isFalse();
TestRepository<Repo> repo = createProject("repo");
Change change = insert(repo, newChange(repo));
db = new DisabledReviewDb();
requestContext.setContext(newRequestContext(userId));
// Use QueryProcessor directly instead of API so we get ChangeDatas back.
List<ChangeData> cds = queryProcessor.query(queryBuilder.parse(change.getId().toString())).entities();
assertThat(cds).hasSize(1);
ChangeData cd = cds.get(0);
cd.change();
cd.patchSets();
cd.currentApprovals();
cd.changedLines();
cd.reviewedBy();
cd.reviewers();
cd.unresolvedCommentCount();
// TODO(dborowitz): Swap out GitRepositoryManager somehow? Will probably be
// necessary for NoteDb anyway.
cd.isMergeable();
exception.expect(DisabledReviewDb.Disabled.class);
cd.messages();
}
use of com.google.gerrit.testutil.DisabledReviewDb in project gerrit by GerritCodeReview.
the class AcceptanceTestRequestScope method disableDb.
public Context disableDb() {
Context old = current.get();
SchemaFactory<ReviewDb> sf = new SchemaFactory<ReviewDb>() {
@Override
public ReviewDb open() {
return new DisabledReviewDb();
}
};
Context ctx = new Context(sf, old.session, old.user, old.created);
current.set(ctx);
local.setContext(ctx);
return old;
}
use of com.google.gerrit.testutil.DisabledReviewDb in project gerrit by GerritCodeReview.
the class AbstractQueryChangesTest method prepopulateOnlyRequestedFields.
@Test
public void prepopulateOnlyRequestedFields() throws Exception {
assume().that(notesMigration.readChanges()).isFalse();
TestRepository<Repo> repo = createProject("repo");
Change change = insert(repo, newChange(repo));
db = new DisabledReviewDb();
requestContext.setContext(newRequestContext(userId));
// Use QueryProcessor directly instead of API so we get ChangeDatas back.
List<ChangeData> cds = queryProcessor.setRequestedFields(ImmutableSet.of(ChangeField.PATCH_SET.getName(), ChangeField.CHANGE.getName())).query(queryBuilder.parse(change.getId().toString())).entities();
assertThat(cds).hasSize(1);
ChangeData cd = cds.get(0);
cd.change();
cd.patchSets();
exception.expect(DisabledReviewDb.Disabled.class);
cd.currentApprovals();
}
Aggregations