Search in sources :

Example 11 with ReadMetadataRequest

use of org.apache.archiva.metadata.repository.storage.ReadMetadataRequest in project archiva by apache.

the class Maven2RepositoryMetadataResolverManagedSnapshotTest method testModelWithJdkProfileActivation.

@Test(expected = RepositoryStorageRuntimeException.class)
@Override
public void testModelWithJdkProfileActivation() throws Exception {
    // skygo IMHO must fail because TEST_REPO_ID ( is snap ,no release) and we seek for a snapshot
    ReadMetadataRequest readMetadataRequest = new ReadMetadataRequest().repositoryId(TEST_REPO_ID).namespace("org.apache.maven").projectId("maven-archiver").projectVersion("2.4.1");
    ProjectVersionMetadata metadata = storage.readProjectVersionMetadata(readMetadataRequest);
}
Also used : ReadMetadataRequest(org.apache.archiva.metadata.repository.storage.ReadMetadataRequest) ProjectVersionMetadata(org.apache.archiva.metadata.model.ProjectVersionMetadata) Test(org.junit.Test)

Example 12 with ReadMetadataRequest

use of org.apache.archiva.metadata.repository.storage.ReadMetadataRequest in project archiva by apache.

the class Maven2RepositoryMetadataResolverTest method testGetProjectVersionMetadataForInvalidPom.

@Test
public void testGetProjectVersionMetadataForInvalidPom() throws Exception {
    try {
        storage.readProjectVersionMetadata(new ReadMetadataRequest(TEST_REPO_ID, "com.example.test", "invalid-pom", "1.0"));
        fail("Should have received an exception due to invalid POM");
    } catch (RepositoryStorageMetadataInvalidException e) {
        assertEquals("invalid-pom", e.getId());
    }
}
Also used : ReadMetadataRequest(org.apache.archiva.metadata.repository.storage.ReadMetadataRequest) RepositoryStorageMetadataInvalidException(org.apache.archiva.metadata.repository.storage.RepositoryStorageMetadataInvalidException) Test(org.junit.Test)

Example 13 with ReadMetadataRequest

use of org.apache.archiva.metadata.repository.storage.ReadMetadataRequest in project archiva by apache.

the class Maven2RepositoryMetadataResolverTest method testGetProjectVersionMetadataForTimestampedSnapshot.

@Test
public void testGetProjectVersionMetadataForTimestampedSnapshot() throws Exception {
    ProjectVersionMetadata metadata = storage.readProjectVersionMetadata(new ReadMetadataRequest(TEST_REPO_ID, "org.apache", "apache", "5-SNAPSHOT"));
    MavenProjectFacet facet = MavenProjectFacet.class.cast(metadata.getFacet(MavenProjectFacet.FACET_ID));
    assertEquals("pom", facet.getPackaging());
    assertEquals("http://www.apache.org/", metadata.getUrl());
    assertNull(facet.getParent());
    assertEquals("org.apache", facet.getGroupId());
    assertEquals("apache", facet.getArtifactId());
    assertNull(metadata.getCiManagement());
    assertNotNull(metadata.getDescription());
    // TODO: this would be better
    // assertEquals(
    // "The Apache Software Foundation provides support for the Apache community of open-source software projects. " +
    // "The Apache projects are characterized by a collaborative, consensus based development process, an open " +
    // "and pragmatic software license, and a desire to create high quality software that leads the way in its " +
    // "field. We consider ourselves not simply a group of projects sharing a server, but rather a community of " +
    // "developers and users.", metadata.getDescription() );
    assertEquals("5-SNAPSHOT", metadata.getId());
    assertNull(metadata.getIssueManagement());
    checkApacheLicense(metadata);
    assertEquals("The Apache Software Foundation", metadata.getName());
    String path = "maven/pom/trunk/asf";
    assertEquals(ASF_SCM_CONN_BASE + path, metadata.getScm().getConnection());
    assertEquals(ASF_SCM_DEV_CONN_BASE + path, metadata.getScm().getDeveloperConnection());
    assertEquals(ASF_SCM_VIEWVC_BASE + path, metadata.getScm().getUrl());
    checkOrganizationApache(metadata);
    assertEquals(1, metadata.getMailingLists().size());
    assertMailingList(metadata.getMailingLists().get(0), "Apache Announce List", "http://mail-archives.apache.org/mod_mbox/www-announce/", "announce@apache.org", "announce-subscribe@apache.org", "announce-unsubscribe@apache.org", Collections.<String>emptyList(), true);
    assertEquals(Collections.<Dependency>emptyList(), metadata.getDependencies());
}
Also used : ReadMetadataRequest(org.apache.archiva.metadata.repository.storage.ReadMetadataRequest) ProjectVersionMetadata(org.apache.archiva.metadata.model.ProjectVersionMetadata) Test(org.junit.Test)

Example 14 with ReadMetadataRequest

use of org.apache.archiva.metadata.repository.storage.ReadMetadataRequest in project archiva by apache.

the class Maven2RepositoryMetadataResolverTest method testGetProjectVersionMetadataForTimestampedSnapshotIncompleteMetadata.

@Test
public void testGetProjectVersionMetadataForTimestampedSnapshotIncompleteMetadata() throws Exception {
    try {
        storage.readProjectVersionMetadata(new ReadMetadataRequest(TEST_REPO_ID, "com.example.test", "incomplete-metadata", "1.0-SNAPSHOT"));
        fail("Should not be found");
    } catch (RepositoryStorageMetadataNotFoundException e) {
        assertEquals("missing-pom", e.getId());
    }
}
Also used : RepositoryStorageMetadataNotFoundException(org.apache.archiva.metadata.repository.storage.RepositoryStorageMetadataNotFoundException) ReadMetadataRequest(org.apache.archiva.metadata.repository.storage.ReadMetadataRequest) Test(org.junit.Test)

Example 15 with ReadMetadataRequest

use of org.apache.archiva.metadata.repository.storage.ReadMetadataRequest in project archiva by apache.

the class Maven2RepositoryMetadataResolverTest method testGetProjectVersionMetadataForMissingPom.

@Test
public void testGetProjectVersionMetadataForMissingPom() throws Exception {
    try {
        storage.readProjectVersionMetadata(new ReadMetadataRequest(TEST_REPO_ID, "com.example.test", "missing-pom", "1.0"));
        fail("Should not be found");
    } catch (RepositoryStorageMetadataNotFoundException e) {
        assertEquals("missing-pom", e.getId());
    }
}
Also used : RepositoryStorageMetadataNotFoundException(org.apache.archiva.metadata.repository.storage.RepositoryStorageMetadataNotFoundException) ReadMetadataRequest(org.apache.archiva.metadata.repository.storage.ReadMetadataRequest) Test(org.junit.Test)

Aggregations

ReadMetadataRequest (org.apache.archiva.metadata.repository.storage.ReadMetadataRequest)36 Test (org.junit.Test)31 ProjectVersionMetadata (org.apache.archiva.metadata.model.ProjectVersionMetadata)20 ArrayList (java.util.ArrayList)16 RepositoryStorageMetadataNotFoundException (org.apache.archiva.metadata.repository.storage.RepositoryStorageMetadataNotFoundException)8 ArtifactMetadata (org.apache.archiva.metadata.model.ArtifactMetadata)7 Dependency (org.apache.archiva.metadata.model.Dependency)7 RepositoryStorageMetadataInvalidException (org.apache.archiva.metadata.repository.storage.RepositoryStorageMetadataInvalidException)6 RepositoryStorageRuntimeException (org.apache.archiva.metadata.repository.storage.RepositoryStorageRuntimeException)6 MavenArtifactFacet (org.apache.archiva.metadata.model.maven2.MavenArtifactFacet)3 Path (java.nio.file.Path)2 ProjectMetadata (org.apache.archiva.metadata.model.ProjectMetadata)2 RepositoryListener (org.apache.archiva.repository.events.RepositoryListener)2 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 Reader (java.io.Reader)1 URL (java.net.URL)1 Charset (java.nio.charset.Charset)1 Files (java.nio.file.Files)1 NoSuchFileException (java.nio.file.NoSuchFileException)1