summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Lamy <olamy@apache.org>2011-09-15 10:44:22 +0000
committerOlivier Lamy <olamy@apache.org>2011-09-15 10:44:22 +0000
commit7c1ab2042a3a6e6277e62b174df8593247074e7c (patch)
tree7541d1a2cab0ba7634078e43621af5692ccef617
parentf0b844b438ad28ffbf18f26824479b9b5ce0a15c (diff)
downloadarchiva-7c1ab2042a3a6e6277e62b174df8593247074e7c.tar.gz
archiva-7c1ab2042a3a6e6277e62b174df8593247074e7c.zip
[MRM-1490] REST services : unit test for search on OSGI SymbolicName which returns two versions
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1171041 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/SearchServiceTest.java30
1 files changed, 30 insertions, 0 deletions
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 063682d00..f04cd335e 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
@@ -151,6 +151,36 @@ public class SearchServiceTest
deleteTestRepo( testRepoId, targetRepo );
}
+ @Test
+ public void searchWithSearchRequestBundleSymbolicNameTwoVersion()
+ 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.core" );
+
+ List<Artifact> artifacts = searchService.searchArtifacts( searchRequest );
+
+ assertNotNull( artifacts );
+ assertTrue(
+ " not 2 results for Bundle Symbolic Name org.apache.karaf.features.core but " + artifacts.size() + ":"
+ + artifacts, artifacts.size() == 2 );
+ log.info( "artifacts for commons-logging size {} search {}", artifacts.size(), artifacts );
+
+ deleteTestRepo( testRepoId, targetRepo );
+ }
+
private File createAndIndexRepo( String testRepoId )
throws Exception
{