From f0b844b438ad28ffbf18f26824479b9b5ce0a15c Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Thu, 15 Sep 2011 10:44:07 +0000 Subject: [PATCH] [MRM-1490] REST services : unit test for search on OSGI SymbolicName git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1171040 13f79535-47bb-0310-9956-ffa450edef68 --- .../rest/services/SearchServiceTest.java | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) 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 38ecd35df..063682d00 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 @@ -121,6 +121,36 @@ public class SearchServiceTest deleteTestRepo( testRepoId, targetRepo ); } + @Test + public void searchWithSearchRequestBundleSymbolicNameOneVersion() + throws Exception + { + + String testRepoId = "test-repo"; + // force guest user creation if not exists + if ( getUserService( authorizationHeader ).getGuestUser() == null ) + { + assertNotNull( getUserService( authorizationHeader ).createGuestUser() ); + } + + File targetRepo = createAndIndexRepo( testRepoId ); + + SearchService searchService = getSearchService( authorizationHeader ); + + SearchRequest searchRequest = new SearchRequest(); + searchRequest.setBundleSymbolicName( "org.apache.karaf.features.command" ); + + List artifacts = searchService.searchArtifacts( searchRequest ); + + assertNotNull( artifacts ); + assertTrue( + " not 1 results for Bundle Symbolic Name org.apache.karaf.features.command but " + artifacts.size() + ":" + + artifacts, artifacts.size() == 1 ); + log.info( "artifacts for commons-logging size {} search {}", artifacts.size(), artifacts ); + + deleteTestRepo( testRepoId, targetRepo ); + } + private File createAndIndexRepo( String testRepoId ) throws Exception {