Search in sources :

Example 21 with Artifact

use of org.apache.archiva.maven.model.Artifact 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.maven.model.Artifact) Test(org.junit.Test)

Example 22 with Artifact

use of org.apache.archiva.maven.model.Artifact in project archiva by apache.

the class BrowseServiceTest method getArtifactsByProperty.

@Test
public void getArtifactsByProperty() throws Exception {
    // START SNIPPET: get-artifacts-by-property
    BrowseService browseService = getBrowseService(authorizationHeader, true);
    tryAssert(() -> {
        List<Artifact> artifactDownloadInfos = browseService.getArtifactsByProperty("org.name", "The Apache Software Foundation", TEST_REPO_ID);
        assertThat(artifactDownloadInfos).isNotNull().isNotEmpty().hasSize(7);
    // END SNIPPET: get-artifacts-by-property
    });
}
Also used : BrowseService(org.apache.archiva.rest.api.services.BrowseService) Artifact(org.apache.archiva.maven.model.Artifact) Test(org.junit.Test)

Example 23 with Artifact

use of org.apache.archiva.maven.model.Artifact in project archiva by apache.

the class BrowseServiceTest method getArtifactsByProjectVersionMetadata.

@Test
public void getArtifactsByProjectVersionMetadata() throws Exception {
    // START SNIPPET: get-artifacts-by-project-version-metadata
    BrowseService browseService = getBrowseService(authorizationHeader, true);
    browseService.addMetadata("commons-cli", "commons-cli", "1.0", "wine", "bordeaux", TEST_REPO_ID);
    tryAssert(() -> {
        List<Artifact> artifactDownloadInfos = browseService.getArtifactsByProjectVersionMetadata("wine", "bordeaux", TEST_REPO_ID);
        assertThat(artifactDownloadInfos).isNotNull().isNotEmpty().hasSize(3);
    // END SNIPPET: get-artifacts-by-project-version-metadata
    });
}
Also used : BrowseService(org.apache.archiva.rest.api.services.BrowseService) Artifact(org.apache.archiva.maven.model.Artifact) Test(org.junit.Test)

Example 24 with Artifact

use of org.apache.archiva.maven.model.Artifact 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.maven.model.Artifact) Test(org.junit.Test)

Example 25 with Artifact

use of org.apache.archiva.maven.model.Artifact in project archiva by apache.

the class BrowseServiceTest method getArtifactsByProjectVersionMetadataWithNoRepository.

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

Aggregations

Artifact (org.apache.archiva.maven.model.Artifact)37 Test (org.junit.Test)29 SearchService (org.apache.archiva.rest.api.services.SearchService)14 BrowseService (org.apache.archiva.rest.api.services.BrowseService)11 SearchRequest (org.apache.archiva.rest.api.model.SearchRequest)9 ManagedRepositoriesService (org.apache.archiva.rest.api.services.ManagedRepositoriesService)8 RepositoriesService (org.apache.archiva.rest.api.services.RepositoriesService)8 ArchivaRestServiceException (org.apache.archiva.rest.api.services.ArchivaRestServiceException)7 Path (java.nio.file.Path)6 ArrayList (java.util.ArrayList)4 ArtifactMetadata (org.apache.archiva.metadata.model.ArtifactMetadata)4 MetadataRepositoryException (org.apache.archiva.metadata.repository.MetadataRepositoryException)3 VersionsList (org.apache.archiva.rest.api.model.VersionsList)3 BadRequestException (javax.ws.rs.BadRequestException)2 ForbiddenException (javax.ws.rs.ForbiddenException)2 ManagedRepository (org.apache.archiva.admin.model.beans.ManagedRepository)2 ProxyConnector (org.apache.archiva.admin.model.beans.ProxyConnector)2 RemoteRepository (org.apache.archiva.admin.model.beans.RemoteRepository)2 RepositoryGroup (org.apache.archiva.admin.model.beans.RepositoryGroup)2 MetadataRepository (org.apache.archiva.metadata.repository.MetadataRepository)2