use of org.apache.archiva.maven.model.Artifact in project archiva by apache.
the class SearchServiceTest method searchWithSearchNoRepos.
@Test
public /**
* ensure we revert to all observable repos in case of no repo in the request
*/
void searchWithSearchNoRepos() throws Exception {
SearchService searchService = getSearchService(authorizationHeader);
SearchRequest searchRequest = new SearchRequest();
searchRequest.setBundleExportPackage("org.apache.karaf.features.command.completers");
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() == 1);
log.info("artifact url {}", artifacts.get(0).getUrl());
}
use of org.apache.archiva.maven.model.Artifact in project archiva by apache.
the class SearchServiceTest method searchWithSearchRequestExportPackageOneVersion.
@Test
public void searchWithSearchRequestExportPackageOneVersion() throws Exception {
SearchService searchService = getSearchService(authorizationHeader);
SearchRequest searchRequest = new SearchRequest();
searchRequest.setBundleExportPackage("org.apache.karaf.features.command.completers");
searchRequest.setRepositories(Arrays.asList(TEST_REPO));
List<Artifact> artifacts = searchService.searchArtifacts(searchRequest);
assertNotNull(artifacts);
assertTrue(" not 1 results for Bundle ExportPackage org.apache.karaf.features.command.completers but " + artifacts.size() + ":" + artifacts, artifacts.size() == 1);
log.info("artifact url {}", artifacts.get(0).getUrl());
}
use of org.apache.archiva.maven.model.Artifact in project archiva by apache.
the class SearchServiceTest method searchWithSearchRequestBundleSymbolicNameTwoVersion.
@Test
public void searchWithSearchRequestBundleSymbolicNameTwoVersion() throws Exception {
UiConfiguration uiConfiguration = new UiConfiguration();
uiConfiguration.setApplicationUrl(null);
getArchivaAdministrationService().setUiConfiguration(uiConfiguration);
SearchService searchService = getSearchService(authorizationHeader);
SearchRequest searchRequest = new SearchRequest();
searchRequest.setBundleSymbolicName("org.apache.karaf.features.core");
List<Artifact> artifacts = searchService.searchArtifacts(searchRequest);
assertThat(artifacts).isNotNull().hasSize(2);
for (Artifact artifact : artifacts) {
log.info("url: {}", artifact.getUrl());
String version = artifact.getVersion();
//
Assertions.assertThat(artifact.getUrl()).isEqualTo("http://localhost:" + getServerPort() + "/repository/test-repo/org/apache/karaf/features/org.apache.karaf.features.core/" + version + "/org.apache.karaf.features.core-" + version + ".jar");
}
}
use of org.apache.archiva.maven.model.Artifact in project archiva by apache.
the class SearchServiceTest method quickSearchOnArtifactId.
@Test
public void quickSearchOnArtifactId() throws Exception {
SearchService searchService = getSearchService(authorizationHeader);
// 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);
}
use of org.apache.archiva.maven.model.Artifact in project archiva by apache.
the class SearchServiceTest method getSearchArtifactsWithOnlyClassifier.
@Test
public /**
* test we don't return 2 artifacts pom + zip one
*/
void getSearchArtifactsWithOnlyClassifier() throws Exception {
// force guest user creation if not exists
if (getUserService(authorizationHeader).getGuestUser() == null) {
assertNotNull(getUserService(authorizationHeader).createGuestUser());
}
createAndIndexRepo(TEST_REPO, getProjectDirectory().resolve("src/test/repo-with-classifier-only"));
SearchService searchService = getSearchService(authorizationHeader);
SearchRequest searchRequest = new SearchRequest("org.foo", "studio-all-update-site", null, null, null, Arrays.asList(TEST_REPO));
List<Artifact> artifacts = searchService.searchArtifacts(searchRequest);
log.info("artifacts: {}", artifacts);
assertEquals(1, artifacts.size());
}
Aggregations