Search in sources :

Example 21 with BrowseService

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

the class BrowseServiceTest method browsegroupId.

@Test
public void browsegroupId() throws Exception {
    BrowseService browseService = getBrowseService(authorizationHeader, false);
    BrowseResult browseResult = browseService.browseGroupId("org.apache", TEST_REPO_ID);
    assertThat(browseResult).isNotNull();
    // 
    assertThat(browseResult.getBrowseResultEntries()).isNotNull().isNotEmpty().hasSize(// 
    2).contains(// 
    new BrowseResultEntry("org.apache.felix", false), new BrowseResultEntry("org.apache.karaf.features", false));
}
Also used : BrowseResultEntry(org.apache.archiva.rest.api.model.BrowseResultEntry) BrowseService(org.apache.archiva.rest.api.services.BrowseService) BrowseResult(org.apache.archiva.rest.api.model.BrowseResult) Test(org.junit.Test)

Example 22 with BrowseService

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

the class BrowseServiceTest method metadatainbatchmode.

@Test
public void metadatainbatchmode() throws Exception {
    scanRepo(TEST_REPO_ID);
    waitForScanToComplete(TEST_REPO_ID);
    BrowseService browseService = getBrowseService(authorizationHeader, false);
    Map<String, String> inputMetadata = new HashMap<>(3);
    inputMetadata.put("buildNumber", "1");
    inputMetadata.put("author", "alecharp");
    inputMetadata.put("jenkins_version", "1.486");
    MetadataAddRequest metadataAddRequest = new MetadataAddRequest();
    metadataAddRequest.setGroupId("commons-cli");
    metadataAddRequest.setArtifactId("commons-cli");
    metadataAddRequest.setVersion("1.0");
    metadataAddRequest.setMetadatas(inputMetadata);
    browseService.importMetadata(metadataAddRequest, TEST_REPO_ID);
    Map<String, String> metadatas = toMap(browseService.getMetadatas("commons-cli", "commons-cli", "1.0", TEST_REPO_ID));
    assertThat(metadatas).isNotNull().isNotEmpty().contains(MapEntry.entry("buildNumber", "1")).contains(MapEntry.entry("author", "alecharp")).contains(MapEntry.entry("jenkins_version", "1.486"));
}
Also used : MetadataAddRequest(org.apache.archiva.rest.api.model.MetadataAddRequest) HashMap(java.util.HashMap) BrowseService(org.apache.archiva.rest.api.services.BrowseService) Test(org.junit.Test)

Example 23 with BrowseService

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

the class BrowseServiceTest method readArtifactContentEntriesRootPath.

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

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

Example 25 with BrowseService

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

the class BrowseServiceTest method artifactsNumber.

@Test
public void artifactsNumber() throws Exception {
    BrowseService browseService = getBrowseService(authorizationHeader, true);
    // WebClient.client( browseService ).accept( MediaType.TEXT_PLAIN );
    int number = browseService.getArtifacts(TEST_REPO_ID).size();
    log.info("getArtifactsNumber: {}", number);
    assertTrue(number > 1);
}
Also used : BrowseService(org.apache.archiva.rest.api.services.BrowseService) 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