@Test public void getAllGroupIds() throws Exception { createIndexContainingMoreArtifacts( true ); List<String> selectedRepos = Arrays.asList( TEST_REPO_1 ); EasyMock.expect( archivaConfig.getConfiguration() ).andReturn( config ).times( 0, 2 ); archivaConfigControl.replay(); Collection<String> groupIds = search.getAllGroupIds( "user", selectedRepos ); archivaConfigControl.verify(); log.info( "groupIds: {}", groupIds ); assertEquals( 3, groupIds.size() ); assertTrue( groupIds.contains( "com" ) ); assertTrue( groupIds.contains( "org.apache.felix" ) ); assertTrue( groupIds.contains( "org.apache.archiva" ) ); }
@Override public Collection<String> getAllGroupIds( String principal, List<String> selectedRepos ) throws RepositorySearchException { List<IndexingContext> indexContexts = getIndexingContexts( selectedRepos ); if ( indexContexts == null || indexContexts.isEmpty() ) { return Collections.emptyList(); } try { Set<String> allGroupIds = new HashSet<>(); for ( IndexingContext indexingContext : indexContexts ) { allGroupIds.addAll( indexingContext.getAllGroups() ); } return allGroupIds; } catch ( IOException e ) { throw new RepositorySearchException( e.getMessage(), e ); } }
MavenRepositorySearch implements RepositorySearch { @Override public Collection<String> getAllGroupIds( String principal, List<String> selectedRepos ) throws RepositorySearchException { List<IndexingContext> indexContexts = getIndexingContexts( selectedRepos ); if ( indexContexts == null || indexContexts.isEmpty() ) { return Collections.emptyList(); } try { Set<String> allGroupIds = new HashSet<>(); for ( IndexingContext indexingContext : indexContexts ) { allGroupIds.addAll( indexingContext.getAllGroups() ); } return allGroupIds; } catch ( IOException e ) { throw new RepositorySearchException( e.getMessage(), e ); } } }
MavenRepositorySearch implements RepositorySearch { @Override public Collection<String> getAllGroupIds( String principal, List<String> selectedRepos ) throws RepositorySearchException { List<IndexingContext> indexContexts = getIndexingContexts( selectedRepos ); if ( indexContexts == null || indexContexts.isEmpty() ) { return Collections.emptyList(); } try { Set<String> allGroupIds = new HashSet<>(); for ( IndexingContext indexingContext : indexContexts ) { allGroupIds.addAll( indexingContext.getAllGroups() ); } return allGroupIds; } catch ( IOException e ) { throw new RepositorySearchException( e.getMessage(), e ); } } protected  MavenRepositorySearch(); @Inject  MavenRepositorySearch( Indexer nexusIndexer, RepositoryRegistry repositoryRegistry,
                                  ProxyRegistry proxyRegistry, QueryCreator queryCreator ); }
MavenRepositorySearch implements RepositorySearch { @Override public Collection<String> getAllGroupIds( String principal, List<String> selectedRepos ) throws RepositorySearchException { List<IndexingContext> indexContexts = getIndexingContexts( selectedRepos ); if ( indexContexts == null || indexContexts.isEmpty() ) { return Collections.emptyList(); } try { Set<String> allGroupIds = new HashSet<>(); for ( IndexingContext indexingContext : indexContexts ) { allGroupIds.addAll( indexingContext.getAllGroups() ); } return allGroupIds; } catch ( IOException e ) { throw new RepositorySearchException( e.getMessage(), e ); } } protected  MavenRepositorySearch(); @Inject  MavenRepositorySearch( Indexer nexusIndexer, RepositoryRegistry repositoryRegistry,
                                  ProxyRegistry proxyRegistry, QueryCreator queryCreator ); @Override SearchResults search(String principal, List<String> selectedRepos, String term, SearchResultLimits limits,
                                List<String> previousSearchTerms ); @SuppressWarnings( "deprecation" ) @Override SearchResults search( String principal, SearchFields searchFields, SearchResultLimits limits ); @Override Set<String> getRemoteIndexingContextIds( String managedRepoId ); @Override Collection<String> getAllGroupIds( String principal, List<String> selectedRepos ); }
MavenRepositorySearch implements RepositorySearch { @Override public Collection<String> getAllGroupIds( String principal, List<String> selectedRepos ) throws RepositorySearchException { List<IndexingContext> indexContexts = getIndexingContexts( selectedRepos ); if ( indexContexts == null || indexContexts.isEmpty() ) { return Collections.emptyList(); } try { Set<String> allGroupIds = new HashSet<>(); for ( IndexingContext indexingContext : indexContexts ) { allGroupIds.addAll( indexingContext.getAllGroups() ); } return allGroupIds; } catch ( IOException e ) { throw new RepositorySearchException( e.getMessage(), e ); } } protected  MavenRepositorySearch(); @Inject  MavenRepositorySearch( Indexer nexusIndexer, RepositoryRegistry repositoryRegistry,
                                  ProxyRegistry proxyRegistry, QueryCreator queryCreator ); @Override SearchResults search(String principal, List<String> selectedRepos, String term, SearchResultLimits limits,
                                List<String> previousSearchTerms ); @SuppressWarnings( "deprecation" ) @Override SearchResults search( String principal, SearchFields searchFields, SearchResultLimits limits ); @Override Set<String> getRemoteIndexingContextIds( String managedRepoId ); @Override Collection<String> getAllGroupIds( String principal, List<String> selectedRepos );  }