use of com.google.gerrit.server.account.GroupCache in project gerrit by GerritCodeReview.
the class ProjectResetterTest method groupEviction.
@Test
public void groupEviction() throws Exception {
AccountGroup.UUID uuid1 = AccountGroup.uuid("abcd1");
AccountGroup.UUID uuid2 = AccountGroup.uuid("abcd2");
AccountGroup.UUID uuid3 = AccountGroup.uuid("abcd3");
Project.NameKey allUsers = Project.nameKey(AllUsersNameProvider.DEFAULT);
Repository allUsersRepo = repoManager.createRepository(allUsers);
GroupCache cache = mock(GroupCache.class);
GroupIndexer indexer = mock(GroupIndexer.class);
GroupIncludeCache includeCache = mock(GroupIncludeCache.class);
createRef(allUsersRepo, RefNames.refsGroups(uuid1));
Ref ref2 = createRef(allUsersRepo, RefNames.refsGroups(uuid2));
try (ProjectResetter resetProject = builder(null, null, null, cache, includeCache, indexer, null).build(new ProjectResetter.Config().reset(project).reset(allUsers))) {
updateRef(allUsersRepo, ref2);
createRef(allUsersRepo, RefNames.refsGroups(uuid3));
}
verify(cache).evict(uuid2);
verify(indexer).index(uuid2);
verify(includeCache).evictParentGroupsOf(uuid2);
verify(cache).evict(uuid3);
verify(indexer).index(uuid3);
verify(includeCache).evictParentGroupsOf(uuid3);
verifyNoMoreInteractions(cache, indexer, includeCache);
}
Aggregations