Add possibility to read groups from NoteDb

By default, groups are still read from ReviewDb. Reading from NoteDb
can be enabled by setting the config parameter 'readGroupsFromNoteDb'
in the section 'user' to 'true'.

To test the implementation of groups in ReviewDb as well as in NoteDb,
we execute all tests in GroupsIT twice: once with 'readGroupsFromNoteDb'
enabled and once without. Ideally, we would do so for all tests but
for the moment, we have to do that manually.

This change adds some TODOs which must be addressed before we can
submit this topic.

Change-Id: I24dfd1b7d0ee0a623b684816185bd59f7f89549d
This commit is contained in:
Alice Kober-Sotzek
2017-10-24 14:40:33 +02:00
parent 53144d4c5c
commit b1108e7974
4 changed files with 54 additions and 7 deletions

View File

@@ -150,18 +150,15 @@ public class GroupCacheImpl implements GroupCache {
static class ByIdLoader extends CacheLoader<AccountGroup.Id, Optional<InternalGroup>> {
private final SchemaFactory<ReviewDb> schema;
private final Groups groups;
private final BooleanSupplier hasGroupIndex;
private final Provider<InternalGroupQuery> groupQueryProvider;
@Inject
ByIdLoader(
SchemaFactory<ReviewDb> schema,
Groups groups,
GroupIndexCollection groupIndexCollection,
Provider<InternalGroupQuery> groupQueryProvider) {
this.schema = schema;
this.groups = groups;
hasGroupIndex = () -> groupIndexCollection.getSearchIndex() != null;
this.groupQueryProvider = groupQueryProvider;
}
@@ -173,7 +170,7 @@ public class GroupCacheImpl implements GroupCache {
}
try (ReviewDb db = schema.open()) {
return groups.getGroup(db, key);
return Groups.getGroupFromReviewDb(db, key);
}
}
}