Search in sources :

Example 16 with BrowseService

use of org.apache.archiva.rest.api.services.BrowseService in project archiva by apache.

the class BrowseServiceTest method getArtifactsByMetadata.

@Test
public void getArtifactsByMetadata() throws Exception {
    // START SNIPPET: get-artifacts-by-metadata
    BrowseService browseService = getBrowseService(authorizationHeader, true);
    List<Artifact> artifactDownloadInfos = browseService.getArtifactsByMetadata("type", "pom", TEST_REPO_ID);
    assertThat(artifactDownloadInfos).isNotNull().isNotEmpty().hasSize(11);
// END SNIPPET: get-artifacts-by-metadata
}
Also used : BrowseService(org.apache.archiva.rest.api.services.BrowseService) Artifact(org.apache.archiva.maven2.model.Artifact) Test(org.junit.Test)

Example 17 with BrowseService

use of org.apache.archiva.rest.api.services.BrowseService in project archiva by apache.

the class BrowseServiceTest method readArtifactContentTextPom.

@Test
public void readArtifactContentTextPom() throws Exception {
    BrowseService browseService = getBrowseService(authorizationHeader, true);
    WebClient.client(browseService).accept(MediaType.TEXT_PLAIN);
    String text = browseService.getArtifactContentText("commons-logging", "commons-logging", "1.1", null, "pom", null, TEST_REPO_ID).getContent();
    log.info("text: {}", text);
    assertThat(text).contains("<url>http://jakarta.apache.org/commons/${pom.artifactId.substring(8)}/</url>").contains("<subscribe>commons-dev-subscribe@jakarta.apache.org</subscribe>");
}
Also used : BrowseService(org.apache.archiva.rest.api.services.BrowseService) Test(org.junit.Test)

Example 18 with BrowseService

use of org.apache.archiva.rest.api.services.BrowseService in project archiva by apache.

the class BrowseServiceTest method getArtifactsByProjectVersionMetadataWithNoRepository.

@Test
public void getArtifactsByProjectVersionMetadataWithNoRepository() throws Exception {
    BrowseService browseService = getBrowseService(authorizationHeader, true);
    browseService.addMetadata("commons-cli", "commons-cli", "1.0", "wine", "bordeaux", TEST_REPO_ID);
    List<Artifact> artifactDownloadInfos = browseService.getArtifactsByProjectVersionMetadata("wine", "bordeaux", null);
    assertThat(artifactDownloadInfos).isNotNull().isNotEmpty().hasSize(3);
}
Also used : BrowseService(org.apache.archiva.rest.api.services.BrowseService) Artifact(org.apache.archiva.maven2.model.Artifact) Test(org.junit.Test)

Example 19 with BrowseService

use of org.apache.archiva.rest.api.services.BrowseService in project archiva by apache.

the class BrowseServiceTest method readArtifactContentEntriesFilesAndDirectories.

@Test
public void readArtifactContentEntriesFilesAndDirectories() throws Exception {
    BrowseService browseService = getBrowseService(authorizationHeader, true);
    List<ArtifactContentEntry> artifactContentEntries = browseService.getArtifactContentEntries("commons-logging", "commons-logging", "1.1", null, null, "org/apache/commons/logging/", TEST_REPO_ID);
    log.info("artifactContentEntries: {}", artifactContentEntries);
    assertThat(artifactContentEntries).isNotNull().isNotEmpty().hasSize(10).contains(new ArtifactContentEntry("org/apache/commons/logging/impl", false, 4, TEST_REPO_ID), new ArtifactContentEntry("org/apache/commons/logging/LogSource.class", true, 4, TEST_REPO_ID));
}
Also used : ArtifactContentEntry(org.apache.archiva.rest.api.model.ArtifactContentEntry) BrowseService(org.apache.archiva.rest.api.services.BrowseService) Test(org.junit.Test)

Example 20 with BrowseService

use of org.apache.archiva.rest.api.services.BrowseService in project archiva by apache.

the class BrowseServiceTest method getArtifactDownloadInfos.

@Test
public void getArtifactDownloadInfos() throws Exception {
    BrowseService browseService = getBrowseService(authorizationHeader, true);
    List<Artifact> artifactDownloadInfos = browseService.getArtifactDownloadInfos("commons-logging", "commons-logging", "1.1", TEST_REPO_ID);
    log.info("artifactDownloadInfos {}", artifactDownloadInfos);
    assertThat(artifactDownloadInfos).isNotNull().isNotEmpty().hasSize(3);
}
Also used : BrowseService(org.apache.archiva.rest.api.services.BrowseService) Artifact(org.apache.archiva.maven2.model.Artifact) Test(org.junit.Test)

Aggregations

BrowseService (org.apache.archiva.rest.api.services.BrowseService)29 Test (org.junit.Test)28 Artifact (org.apache.archiva.maven2.model.Artifact)11 Path (java.nio.file.Path)5 ManagedRepositoriesService (org.apache.archiva.rest.api.services.ManagedRepositoriesService)5 RepositoriesService (org.apache.archiva.rest.api.services.RepositoriesService)5 BrowseResult (org.apache.archiva.rest.api.model.BrowseResult)4 VersionsList (org.apache.archiva.rest.api.model.VersionsList)4 ArtifactContentEntry (org.apache.archiva.rest.api.model.ArtifactContentEntry)3 BrowseResultEntry (org.apache.archiva.rest.api.model.BrowseResultEntry)3 ArrayList (java.util.ArrayList)2 ManagedRepository (org.apache.archiva.admin.model.beans.ManagedRepository)2 JacksonJaxbJsonProvider (com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider)1 HashMap (java.util.HashMap)1 BadRequestException (javax.ws.rs.BadRequestException)1 ForbiddenException (javax.ws.rs.ForbiddenException)1 ProjectVersionMetadata (org.apache.archiva.metadata.model.ProjectVersionMetadata)1 Role (org.apache.archiva.redback.rest.api.model.Role)1 MetadataAddRequest (org.apache.archiva.rest.api.model.MetadataAddRequest)1 ArchivaRestServiceException (org.apache.archiva.rest.api.services.ArchivaRestServiceException)1