summaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-web/archiva-rest
diff options
context:
space:
mode:
authorOlivier Lamy <olamy@apache.org>2011-11-03 15:19:44 +0000
committerOlivier Lamy <olamy@apache.org>2011-11-03 15:19:44 +0000
commit1baef37e754082258f5d55dd2be4432e0e2eb340 (patch)
treefa99e8e10a229dcb1dc2cc5ef1c5640725387a8e /archiva-modules/archiva-web/archiva-rest
parent44885020d874da2d4eb7b8d96780825d5c0bd521 (diff)
downloadarchiva-1baef37e754082258f5d55dd2be4432e0e2eb340.tar.gz
archiva-1baef37e754082258f5d55dd2be4432e0e2eb340.zip
fix unit tests in archiva-rest-services
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1197182 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/archiva-web/archiva-rest')
-rw-r--r--archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultSearchService.java6
-rw-r--r--archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/SearchServiceTest.java1
2 files changed, 7 insertions, 0 deletions
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<Artifact> artifacts = searchService.searchArtifacts( searchRequest );