@Test public void testAssignedRepositories_singleRepositoryAssigned() throws Exception { when(repositoryManager.browse()).thenReturn(ImmutableList.of(repository)); configureRepositoryMock("singleRule"); Map<EntityId, List<Repository>> assignedRepositoryMap = underTest.calculateAssignedRepositories(); assertEquals(1, assignedRepositoryMap.size()); List<Repository> assignedRepositories = assignedRepositoryMap.get(new DetachedEntityId("singleRule")); assertEquals(ImmutableList.of(repository), assignedRepositories); }
@Override public Map<EntityId, List<Repository>> calculateAssignedRepositories() { return StreamSupport.stream(repositoryManager.browse().spliterator(), false) .filter(repository -> routingRuleCache.getRoutingRuleId(repository) != null) .collect(groupingBy(routingRuleCache::getRoutingRuleId, toList())); }
RoutingRuleHelperImpl implements RoutingRuleHelper { @Override public Map<EntityId, List<Repository>> calculateAssignedRepositories() { return StreamSupport.stream(repositoryManager.browse().spliterator(), false) .filter(repository -> routingRuleCache.getRoutingRuleId(repository) != null) .collect(groupingBy(routingRuleCache::getRoutingRuleId, toList())); } }
RoutingRuleHelperImpl implements RoutingRuleHelper { @Override public Map<EntityId, List<Repository>> calculateAssignedRepositories() { return StreamSupport.stream(repositoryManager.browse().spliterator(), false) .filter(repository -> routingRuleCache.getRoutingRuleId(repository) != null) .collect(groupingBy(routingRuleCache::getRoutingRuleId, toList())); } @Inject  RoutingRuleHelperImpl(
      final RoutingRuleCache routingRuleCache,
      final RepositoryManager repositoryManager,
      final RepositoryPermissionChecker repositoryPermissionChecker); }
RoutingRuleHelperImpl implements RoutingRuleHelper { @Override public Map<EntityId, List<Repository>> calculateAssignedRepositories() { return StreamSupport.stream(repositoryManager.browse().spliterator(), false) .filter(repository -> routingRuleCache.getRoutingRuleId(repository) != null) .collect(groupingBy(routingRuleCache::getRoutingRuleId, toList())); } @Inject  RoutingRuleHelperImpl(
      final RoutingRuleCache routingRuleCache,
      final RepositoryManager repositoryManager,
      final RepositoryPermissionChecker repositoryPermissionChecker); @Override boolean isAllowed(final Repository repository, final String path); boolean isAllowed(final RoutingRule routingRule, final String path); @Override boolean isAllowed(final RoutingMode mode, final List<String> matchers, final String path); @Override Map<EntityId, List<Repository>> calculateAssignedRepositories(); @Override void ensureUserHasPermissionToRead(); }
RoutingRuleHelperImpl implements RoutingRuleHelper { @Override public Map<EntityId, List<Repository>> calculateAssignedRepositories() { return StreamSupport.stream(repositoryManager.browse().spliterator(), false) .filter(repository -> routingRuleCache.getRoutingRuleId(repository) != null) .collect(groupingBy(routingRuleCache::getRoutingRuleId, toList())); } @Inject  RoutingRuleHelperImpl(
      final RoutingRuleCache routingRuleCache,
      final RepositoryManager repositoryManager,
      final RepositoryPermissionChecker repositoryPermissionChecker); @Override boolean isAllowed(final Repository repository, final String path); boolean isAllowed(final RoutingRule routingRule, final String path); @Override boolean isAllowed(final RoutingMode mode, final List<String> matchers, final String path); @Override Map<EntityId, List<Repository>> calculateAssignedRepositories(); @Override void ensureUserHasPermissionToRead();  }