From 1baef37e754082258f5d55dd2be4432e0e2eb340 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Thu, 3 Nov 2011 15:19:44 +0000 Subject: [PATCH] fix unit tests in archiva-rest-services git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1197182 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/archiva/rest/services/DefaultSearchService.java | 6 ++++++ .../org/apache/archiva/rest/services/SearchServiceTest.java | 1 + 2 files changed, 7 insertions(+) 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 ); -- 2.39.5