Search in sources :

Example 11 with BrowseService

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

the class BrowseServiceTest method readArtifactContentEntries.

@Test
public void readArtifactContentEntries() throws Exception {
    BrowseService browseService = getBrowseService(authorizationHeader, true);
    List<ArtifactContentEntry> artifactContentEntries = browseService.getArtifactContentEntries("commons-logging", "commons-logging", "1.1", null, null, null, TEST_REPO_ID);
    log.info("artifactContentEntries: {}", artifactContentEntries);
    // 
    assertThat(artifactContentEntries).isNotNull().isNotEmpty().hasSize(// 
    2).contains(// 
    new ArtifactContentEntry("org", false, 0, TEST_REPO_ID), new ArtifactContentEntry("META-INF", false, 0, 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 12 with BrowseService

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

the class BrowseServiceTest method searchArtifacts.

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

Example 13 with BrowseService

use of org.apache.archiva.rest.api.services.BrowseService 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);
    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.maven2.model.Artifact) Test(org.junit.Test)

Example 14 with BrowseService

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

the class BrowseServiceTest method metadatagetthenaddthendelete.

@Test
public void metadatagetthenaddthendelete() throws Exception {
    try {
        scanRepo(TEST_REPO_ID);
        waitForScanToComplete(TEST_REPO_ID);
        BrowseService browseService = getBrowseService(authorizationHeader, false);
        Map<String, String> metadatas = toMap(browseService.getMetadatas("commons-cli", "commons-cli", "1.0", TEST_REPO_ID));
        assertThat(metadatas).isNotNull().isEmpty();
        browseService.addMetadata("commons-cli", "commons-cli", "1.0", "wine", "bordeaux", TEST_REPO_ID);
        metadatas = toMap(browseService.getMetadatas("commons-cli", "commons-cli", "1.0", TEST_REPO_ID));
        assertThat(metadatas).isNotNull().isNotEmpty().contains(MapEntry.entry("wine", "bordeaux"));
        browseService.deleteMetadata("commons-cli", "commons-cli", "1.0", "wine", TEST_REPO_ID);
        metadatas = toMap(browseService.getMetadatas("commons-cli", "commons-cli", "1.0", TEST_REPO_ID));
        assertThat(metadatas).isNotNull().isEmpty();
    } catch (ArchivaRestServiceException e) {
        log.error(e.getMessage(), e);
        throw e;
    }
}
Also used : ArchivaRestServiceException(org.apache.archiva.rest.api.services.ArchivaRestServiceException) BrowseService(org.apache.archiva.rest.api.services.BrowseService) Test(org.junit.Test)

Example 15 with BrowseService

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

the class BrowseServiceTest method browsegroupIdWithReleaseStartNumber.

@Test
public void browsegroupIdWithReleaseStartNumber() throws Exception {
    BrowseService browseService = getBrowseService(authorizationHeader, false);
    BrowseResult browseResult = browseService.browseGroupId("commons-logging.commons-logging", TEST_REPO_ID);
    log.info("browseResult: {}", browseResult);
}
Also used : BrowseService(org.apache.archiva.rest.api.services.BrowseService) BrowseResult(org.apache.archiva.rest.api.model.BrowseResult) 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