use of org.apache.archiva.rest.api.services.SearchService in project archiva by apache.
the class SearchServiceTest method searchWithSearchUnknwownRepoId.
@Test
public /**
* ensure we don't return response for an unknown repo
*/
void searchWithSearchUnknwownRepoId() throws Exception {
SearchService searchService = getSearchService(authorizationHeader);
SearchRequest searchRequest = new SearchRequest();
searchRequest.setBundleExportPackage("org.apache.karaf.features.command.completers");
searchRequest.setRepositories(Arrays.asList("tototititata"));
List<Artifact> artifacts = searchService.searchArtifacts(searchRequest);
assertNotNull(artifacts);
assertTrue(" not 0 results for Bundle ExportPackage org.apache.karaf.features.command.completers but " + artifacts.size() + ":" + artifacts, artifacts.size() == 0);
}
use of org.apache.archiva.rest.api.services.SearchService in project archiva by apache.
the class SearchServiceTest method quickSearchOnArtifactIdGuest.
/**
* same search but with Guest user
*
* @throws Exception
*/
@Test
public void quickSearchOnArtifactIdGuest() throws Exception {
SearchService searchService = getSearchService(null);
// START SNIPPET: quick-search
List<Artifact> artifacts = searchService.quickSearch("commons-logging");
// return all artifacts with groupId OR artifactId OR version OR packaging OR className
// NOTE : only artifacts with classifier empty are returned
// END SNIPPET: quick-search
assertNotNull(artifacts);
assertTrue(" not 6 results for commons-logging search but " + artifacts.size() + ":" + artifacts, artifacts.size() == 6);
log.info("artifacts for commons-logging size {} search {}", artifacts.size(), artifacts);
}
Aggregations