diff --git a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/IndexMerger.java b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/IndexMerger.java index 4dbe2a819..09165b7eb 100644 --- a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/IndexMerger.java +++ b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/IndexMerger.java @@ -20,7 +20,6 @@ package org.apache.archiva.indexer.merger; import org.apache.maven.index.context.IndexingContext; -import java.io.File; import java.util.Collection; /** @@ -34,7 +33,7 @@ public interface IndexMerger * system property which contains the value in s for ttl of temporary index groups */ static final String TMP_GROUP_INDEX_SYS_KEY = "archiva.tmp.group.index.ttl"; - + /** * @param repositoriesIds repositories Ids to merge content * @param packIndex will generate a downloadable index diff --git a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/RepositorySearchException.java b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/RepositorySearchException.java index 364cce2c2..e3da55107 100644 --- a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/RepositorySearchException.java +++ b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/RepositorySearchException.java @@ -31,7 +31,7 @@ public class RepositorySearchException { super( msg ); } - + public RepositorySearchException( Throwable e ) { super( e ); diff --git a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/SearchResultLimits.java b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/SearchResultLimits.java index 52d64cb62..80cd83530 100644 --- a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/SearchResultLimits.java +++ b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/SearchResultLimits.java @@ -21,13 +21,13 @@ package org.apache.archiva.indexer.search; /** * SearchResultLimits - used to provide the search some limits on how the results are returned. - * This can provide paging for the + * This can provide paging for the * * @version $Id: SearchResultLimits.java 718864 2008-11-19 06:33:35Z brett $ */ public class SearchResultLimits { - /** + /** * Constant to use for {@link #setSelectedPage(int)} to indicate a desire to get ALL PAGES. * USE WITH CAUTION!! */ @@ -49,7 +49,7 @@ public class SearchResultLimits /** * Set page size for maximum # of hits to return per page. - * + * * @param pageSize size of page by # of hits. (maximum value is 200) */ public void setPageSize( int pageSize ) diff --git a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/SearchResults.java b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/SearchResults.java index 32979271d..49de894c7 100644 --- a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/SearchResults.java +++ b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/SearchResults.java @@ -35,7 +35,7 @@ public class SearchResults private Map hits = new HashMap(); private int totalHits; - + private int totalHitsMapSize; private int returnedHitsCount; @@ -123,8 +123,8 @@ public class SearchResults } /** - * @since 1.4-M1 * @return + * @since 1.4-M1 */ public int getTotalHitsMapSize() { @@ -132,10 +132,10 @@ public class SearchResults } /** - * @since 1.4-M1 * @param totalHitsMapSize + * @since 1.4-M1 */ - public void setTotalHitsMapSize(int totalHitsMapSize) + public void setTotalHitsMapSize( int totalHitsMapSize ) { this.totalHitsMapSize = totalHitsMapSize; } diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/NexusRepositorySearchPaginateTest.java b/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/NexusRepositorySearchPaginateTest.java index b9fd071b2..ed33539eb 100644 --- a/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/NexusRepositorySearchPaginateTest.java +++ b/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/NexusRepositorySearchPaginateTest.java @@ -39,11 +39,11 @@ public class NexusRepositorySearchPaginateTest { NexusRepositorySearch search = new NexusRepositorySearch(); - SearchResults searchResults = build(10, new SearchResultLimits(0)); + SearchResults searchResults = build( 10, new SearchResultLimits( 0 ) ); - searchResults = search.paginate(searchResults); + searchResults = search.paginate( searchResults ); - assertEquals(10, searchResults.getReturnedHitsCount()); + assertEquals( 10, searchResults.getReturnedHitsCount() ); } @@ -53,17 +53,17 @@ public class NexusRepositorySearchPaginateTest { NexusRepositorySearch search = new NexusRepositorySearch(); - SearchResults origSearchResults = build(63, new SearchResultLimits(0)); + SearchResults origSearchResults = build( 63, new SearchResultLimits( 0 ) ); - SearchResults searchResults = search.paginate(origSearchResults); + SearchResults searchResults = search.paginate( origSearchResults ); - assertEquals(30, searchResults.getReturnedHitsCount()); + assertEquals( 30, searchResults.getReturnedHitsCount() ); - origSearchResults = build(63, new SearchResultLimits(1)); + origSearchResults = build( 63, new SearchResultLimits( 1 ) ); - searchResults = search.paginate(origSearchResults); + searchResults = search.paginate( origSearchResults ); - assertEquals(30, searchResults.getReturnedHitsCount()); + assertEquals( 30, searchResults.getReturnedHitsCount() ); } @@ -73,32 +73,32 @@ public class NexusRepositorySearchPaginateTest { NexusRepositorySearch search = new NexusRepositorySearch(); - SearchResults searchResults = build(32, new SearchResultLimits(1)); + SearchResults searchResults = build( 32, new SearchResultLimits( 1 ) ); - searchResults = search.paginate(searchResults); + searchResults = search.paginate( searchResults ); - assertEquals(2, searchResults.getReturnedHitsCount()); + assertEquals( 2, searchResults.getReturnedHitsCount() ); } - SearchResults build(int number, SearchResultLimits limits) + SearchResults build( int number, SearchResultLimits limits ) { SearchResults searchResults = new SearchResults(); - searchResults.setLimits(limits); + searchResults.setLimits( limits ); for ( int i = 0; i < number; i++ ) { SearchResultHit hit = new SearchResultHit(); - hit.setGroupId("commons-foo"); - hit.setArtifactId("commons-bar-" + i); - hit.setPackaging("jar"); - hit.setVersions(Arrays.asList("1.0")); + hit.setGroupId( "commons-foo" ); + hit.setArtifactId( "commons-bar-" + i ); + hit.setPackaging( "jar" ); + hit.setVersions( Arrays.asList( "1.0" ) ); String id = - SearchUtil.getHitId(hit.getGroupId(), hit.getArtifactId(), hit.getClassifier(), hit.getPackaging()); - searchResults.addHit(id, hit); + SearchUtil.getHitId( hit.getGroupId(), hit.getArtifactId(), hit.getClassifier(), hit.getPackaging() ); + searchResults.addHit( id, hit ); } - searchResults.setTotalHits(number); + searchResults.setTotalHits( number ); return searchResults; } diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/NexusRepositorySearchTest.java b/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/NexusRepositorySearchTest.java index 6a024dcb1..cf66e7915 100644 --- a/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/NexusRepositorySearchTest.java +++ b/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/NexusRepositorySearchTest.java @@ -118,7 +118,7 @@ public class NexusRepositorySearchTest archivaConfigControl.reset(); // search groupId - archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config , 1 , 2); + archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1, 2 ); archivaConfigControl.replay(); @@ -141,7 +141,7 @@ public class NexusRepositorySearchTest List selectedRepos = Arrays.asList( TEST_REPO_1 ); // search artifactId - archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config , 1 , 2 ); + archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1, 2 ); archivaConfigControl.replay(); @@ -161,7 +161,7 @@ public class NexusRepositorySearchTest archivaConfigControl.reset(); // search groupId - archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config , 1 , 2 ); + archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1, 2 ); archivaConfigControl.replay(); @@ -185,7 +185,7 @@ public class NexusRepositorySearchTest selectedRepos.add( TEST_REPO_1 ); // search artifactId - archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config , 1 , 2 ); + archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1, 2 ); archivaConfigControl.replay(); @@ -215,7 +215,7 @@ public class NexusRepositorySearchTest selectedRepos.add( TEST_REPO_1 ); // search artifactId - archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config , 1 , 2 ); + archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1, 2 ); archivaConfigControl.replay(); @@ -251,7 +251,7 @@ public class NexusRepositorySearchTest List selectedRepos = new ArrayList(); selectedRepos.add( TEST_REPO_1 ); - archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config , 1 , 2 ); + archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1, 2 ); archivaConfigControl.replay(); SearchResults results = search.search( "user", selectedRepos, "archiva search", null, null ); @@ -275,7 +275,7 @@ public class NexusRepositorySearchTest SearchResultLimits limits = new SearchResultLimits( 0 ); limits.setPageSize( 1 ); - archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config , 1 , 2 ); + archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1, 2 ); archivaConfigControl.replay(); @@ -295,7 +295,7 @@ public class NexusRepositorySearchTest limits = new SearchResultLimits( 1 ); limits.setPageSize( 1 ); - archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config , 1 , 2 ); + archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1, 2 ); archivaConfigControl.replay(); @@ -330,7 +330,7 @@ public class NexusRepositorySearchTest config.addManagedRepository( createRepositoryConfig( TEST_REPO_2 ) ); - archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config , 1 , 5 ); + archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1, 5 ); archivaConfigControl.replay(); @@ -365,7 +365,7 @@ public class NexusRepositorySearchTest List selectedRepos = new ArrayList(); selectedRepos.add( TEST_REPO_1 ); - archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config , 1 , 2 ); + archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1, 2 ); archivaConfigControl.replay(); @@ -384,7 +384,7 @@ public class NexusRepositorySearchTest List selectedRepos = new ArrayList(); selectedRepos.add( TEST_REPO_1 ); - archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config , 1 , 2 ); + archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1, 2 ); archivaConfigControl.replay(); @@ -402,7 +402,7 @@ public class NexusRepositorySearchTest List selectedRepos = new ArrayList(); selectedRepos.add( "non-existing-repo" ); - archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config , 1 , 2 ); + archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1, 2 ); archivaConfigControl.replay(); @@ -425,7 +425,7 @@ public class NexusRepositorySearchTest List previousSearchTerms = new ArrayList(); previousSearchTerms.add( "archiva-test" ); - archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config , 1 , 2 ); + archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1, 2 ); archivaConfigControl.replay(); @@ -463,7 +463,7 @@ public class NexusRepositorySearchTest searchFields.setVersion( "1.0" ); searchFields.setRepositories( selectedRepos ); - archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config , 1 , 2 ); + archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1, 2 ); archivaConfigControl.replay(); @@ -498,7 +498,7 @@ public class NexusRepositorySearchTest SearchResultLimits limits = new SearchResultLimits( 0 ); limits.setPageSize( 1 ); - archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config , 1 , 2 ); + archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1, 2 ); archivaConfigControl.replay(); @@ -516,7 +516,7 @@ public class NexusRepositorySearchTest limits = new SearchResultLimits( 1 ); limits.setPageSize( 1 ); - archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config , 1 , 2 ); + archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1, 2 ); archivaConfigControl.replay(); @@ -548,7 +548,7 @@ public class NexusRepositorySearchTest searchFields.setArtifactId( "artifactid-numeric" ); searchFields.setRepositories( selectedRepos ); - archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config , 1 , 2 ); + archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1, 2 ); archivaConfigControl.replay(); @@ -591,7 +591,7 @@ public class NexusRepositorySearchTest try { - archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config , 1 , 2 ); + archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1, 2 ); archivaConfigControl.replay(); @@ -625,7 +625,7 @@ public class NexusRepositorySearchTest try { - archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config , 1 , 2 ); + archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1, 2 ); archivaConfigControl.replay(); @@ -658,7 +658,7 @@ public class NexusRepositorySearchTest searchFields.setClassName( "org.apache.archiva.test.App" ); searchFields.setRepositories( selectedRepos ); - archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config , 1 , 2 ); + archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1, 2 ); archivaConfigControl.replay(); @@ -689,7 +689,7 @@ public class NexusRepositorySearchTest searchFields.setPackaging( "jar" ); searchFields.setRepositories( selectedRepos ); - archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config , 1 , 2 ); + archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1, 2 ); archivaConfigControl.replay(); @@ -740,7 +740,7 @@ public class NexusRepositorySearchTest searchFields.setClassName( "com.classname.search.App" ); searchFields.setRepositories( selectedRepos ); - archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config , 1 , 2 ); + archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1, 2 ); archivaConfigControl.replay(); @@ -768,7 +768,7 @@ public class NexusRepositorySearchTest searchFields.setGroupId( "org.apache.archiva" ); searchFields.setRepositories( selectedRepos ); - archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config , 1 , 2 ); + archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1, 2 ); archivaConfigControl.replay(); @@ -792,7 +792,7 @@ public class NexusRepositorySearchTest searchFields.setClassName( "SomeClass" ); searchFields.setRepositories( selectedRepos ); - archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config , 1 , 2 ); + archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1, 2 ); archivaConfigControl.replay(); @@ -806,13 +806,14 @@ public class NexusRepositorySearchTest } @Test - public void getAllGroupIds() throws Exception + public void getAllGroupIds() + throws Exception { createIndexContainingMoreArtifacts( true ); List selectedRepos = Arrays.asList( TEST_REPO_1 ); - archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config , 0 , 2 ); + archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 0, 2 ); archivaConfigControl.replay(); @@ -823,8 +824,8 @@ public class NexusRepositorySearchTest log.info( "groupIds: " + groupIds ); assertEquals( 3, groupIds.size() ); - assertTrue( groupIds.contains( "com" )); - assertTrue( groupIds.contains( "org.apache.felix") ); + assertTrue( groupIds.contains( "com" ) ); + assertTrue( groupIds.contains( "org.apache.felix" ) ); assertTrue( groupIds.contains( "org.apache.archiva" ) ); } @@ -840,7 +841,7 @@ public class NexusRepositorySearchTest searchFields.setClassName( "SomeClass" ); searchFields.setRepositories( selectedRepos ); - archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config , 1 , 2 ); + archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config, 1, 2 ); archivaConfigControl.replay();