From: Olivier Lamy Date: Thu, 3 Nov 2011 15:19:44 +0000 (+0000) Subject: fix unit tests in archiva-rest-services X-Git-Tag: archiva-1.4-M2~167 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=1baef37e754082258f5d55dd2be4432e0e2eb340;p=archiva.git fix unit tests in archiva-rest-services git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1197182 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultSearchService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultSearchService.java index d71f26a4d..ffb279901 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultSearchService.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultSearchService.java @@ -128,6 +128,12 @@ public class DefaultSearchService SearchFields searchField = new BeanReplicator().replicateBean( searchRequest, SearchFields.class ); SearchResultLimits limits = new SearchResultLimits( 0 ); + // if no repos set we use ones available for the user + if ( searchField.getRepositories() == null || searchField.getRepositories().isEmpty() ) + { + searchField.setRepositories( getObservableRepos() ); + } + try { SearchResults searchResults = repositorySearch.search( getPrincipal(), searchField, limits ); diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/SearchServiceTest.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/SearchServiceTest.java index 91a1cc029..55774dc51 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/SearchServiceTest.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/SearchServiceTest.java @@ -211,6 +211,7 @@ public class SearchServiceTest SearchRequest searchRequest = new SearchRequest(); searchRequest.setBundleExportPackage( "org.apache.karaf.features.command.completers" ); + searchRequest.setRepositories( Arrays.asList( testRepoId ) ); List artifacts = searchService.searchArtifacts( searchRequest );