Search in sources :

Example 36 with Artifact

use of se.light.assembly64.model.Artifact in project archiva by apache.

the class RepositoriesServiceTest method deleteWithRepoNull.

@Test(expected = BadRequestException.class)
public void deleteWithRepoNull() throws Exception {
    try {
        RepositoriesService repositoriesService = getRepositoriesService(authorizationHeader);
        Artifact artifact = new Artifact();
        artifact.setGroupId("commons-logging");
        artifact.setArtifactId("commons-logging");
        artifact.setVersion("1.0.1");
        artifact.setPackaging("jar");
        repositoriesService.deleteArtifact(artifact);
    } catch (BadRequestException e) {
        assertEquals("not http " + Response.Status.BAD_REQUEST.getStatusCode() + " status", Response.Status.BAD_REQUEST.getStatusCode(), e.getResponse().getStatus());
        throw e;
    }
}
Also used : RepositoriesService(org.apache.archiva.rest.api.services.RepositoriesService) ManagedRepositoriesService(org.apache.archiva.rest.api.services.ManagedRepositoriesService) BadRequestException(javax.ws.rs.BadRequestException) Artifact(org.apache.archiva.maven2.model.Artifact) Test(org.junit.Test)

Example 37 with Artifact

use of se.light.assembly64.model.Artifact in project archiva by apache.

the class SearchServiceTest method search_with_md5.

/**
 * md5 commons-logging 1.1 6b62417e77b000a87de66ee3935edbf5
 */
@Test
public void search_with_md5() throws Exception {
    SearchService searchService = getSearchService(authorizationHeader);
    List<Artifact> artifacts = searchService.getArtifactByChecksum(new ChecksumSearch(null, "6b62417e77b000a87de66ee3935edbf5"));
    Assertions.assertThat(artifacts).isNotNull().isNotEmpty().hasSize(1);
}
Also used : ChecksumSearch(org.apache.archiva.rest.api.model.ChecksumSearch) SearchService(org.apache.archiva.rest.api.services.SearchService) Artifact(org.apache.archiva.maven2.model.Artifact) Test(org.junit.Test)

Example 38 with Artifact

use of se.light.assembly64.model.Artifact in project archiva by apache.

the class SearchServiceTest method searchArtifactVersions.

@Test
public void searchArtifactVersions() throws Exception {
    // START SNIPPET: searchservice-artifact-versions
    SearchService searchService = getSearchService(authorizationHeader);
    List<Artifact> artifacts = searchService.getArtifactVersions("commons-logging", "commons-logging", "jar");
    // END SNIPPET: searchservice-artifact-versions
    assertNotNull(artifacts);
    assertTrue(" not 13 results for commons-logging search but " + artifacts.size() + ":" + artifacts, artifacts.size() == 13);
    log.info("artifacts for commons-logging size {} search {}", artifacts.size(), artifacts);
    for (Artifact artifact : artifacts) {
        log.info("url: {}", artifact.getUrl());
        String version = artifact.getVersion();
        assertTrue(artifact.getUrl().contains(version));
    }
}
Also used : SearchService(org.apache.archiva.rest.api.services.SearchService) Artifact(org.apache.archiva.maven2.model.Artifact) Test(org.junit.Test)

Example 39 with Artifact

use of se.light.assembly64.model.Artifact in project archiva by apache.

the class SearchServiceTest method searchWithSearchRequestBundleSymbolicNameOneVersion.

@Test
public void searchWithSearchRequestBundleSymbolicNameOneVersion() throws Exception {
    SearchService searchService = getSearchService(authorizationHeader);
    // START SNIPPET: searchservice-with-osgi
    SearchRequest searchRequest = new SearchRequest();
    searchRequest.setBundleSymbolicName("org.apache.karaf.features.command");
    // END SNIPPET: searchservice-with-osgi
    List<Artifact> artifacts = searchService.searchArtifacts(searchRequest);
    assertNotNull(artifacts);
    assertTrue(" not 1 results for Bundle Symbolic Name org.apache.karaf.features.command but " + artifacts.size() + ":" + artifacts, artifacts.size() == 1);
}
Also used : SearchRequest(org.apache.archiva.rest.api.model.SearchRequest) SearchService(org.apache.archiva.rest.api.services.SearchService) Artifact(org.apache.archiva.maven2.model.Artifact) Test(org.junit.Test)

Example 40 with Artifact

use of se.light.assembly64.model.Artifact in project archiva by apache.

the class SearchServiceTest method searchWithSearchRequestGroupIdAndArtifactIdAndClassifier.

@Test
public void searchWithSearchRequestGroupIdAndArtifactIdAndClassifier() throws Exception {
    SearchService searchService = getSearchService(authorizationHeader);
    // START SNIPPET: searchservice-with-classifier
    SearchRequest searchRequest = new SearchRequest();
    searchRequest.setGroupId("commons-logging");
    searchRequest.setArtifactId("commons-logging");
    searchRequest.setClassifier("sources");
    List<Artifact> artifacts = searchService.searchArtifacts(searchRequest);
    // END SNIPPET: searchservice-with-classifier
    assertNotNull(artifacts);
    assertTrue(" not 2 results for commons-logging search but " + artifacts.size() + ":" + artifacts, artifacts.size() == 2);
    log.info("artifacts for commons-logging size {} search {}", artifacts.size(), artifacts);
}
Also used : SearchRequest(org.apache.archiva.rest.api.model.SearchRequest) SearchService(org.apache.archiva.rest.api.services.SearchService) Artifact(org.apache.archiva.maven2.model.Artifact) Test(org.junit.Test)

Aggregations

Artifact (org.apache.archiva.maven2.model.Artifact)37 Test (org.junit.Test)29 SearchService (org.apache.archiva.rest.api.services.SearchService)14 ArrayList (java.util.ArrayList)13 BrowseService (org.apache.archiva.rest.api.services.BrowseService)11 File (java.io.File)10 SearchRequest (org.apache.archiva.rest.api.model.SearchRequest)9 Artifact (se.light.assembly64.model.Artifact)9 ManagedRepositoriesService (org.apache.archiva.rest.api.services.ManagedRepositoriesService)8 RepositoriesService (org.apache.archiva.rest.api.services.RepositoriesService)8 Path (java.nio.file.Path)7 List (java.util.List)6 ArchivaRestServiceException (org.apache.archiva.rest.api.services.ArchivaRestServiceException)6 CancelableTask (se.light.assembly64.model.CancelableTask)6 IOException (java.io.IOException)5 Optional (java.util.Optional)5 Logger (org.slf4j.Logger)5 LoggerFactory (org.slf4j.LoggerFactory)5 ArtifactDelta (se.light.assembly64.model.ArtifactDelta)5 ArtifactType (se.light.assembly64.model.ArtifactType)5