]> source.dussan.org Git - archiva.git/commitdiff
fix unit tests in archiva-rest-services
authorOlivier Lamy <olamy@apache.org>
Thu, 3 Nov 2011 15:19:44 +0000 (15:19 +0000)
committerOlivier Lamy <olamy@apache.org>
Thu, 3 Nov 2011 15:19:44 +0000 (15:19 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1197182 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultSearchService.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/SearchServiceTest.java

index d71f26a4d37686cf34bcf382387c068534e44547..ffb2799012b4d7429f5202efb721a520dddfbc68 100644 (file)
@@ -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 );
index 91a1cc029f7c5d20dd41304bdefe511140b607c6..55774dc512b637c5fee91f82c15d3d7834f5af31 100644 (file)
@@ -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<Artifact> artifacts = searchService.searchArtifacts( searchRequest );