Search in sources :

Example 31 with ReadMetadataRequest

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

the class Maven2RepositoryMetadataResolverManagedReleaseTest method testGetProjectVersionMetadataForTimestampedSnapshotMissingMetadata.

@Test(expected = RepositoryStorageRuntimeException.class)
@Override
public void testGetProjectVersionMetadataForTimestampedSnapshotMissingMetadata() throws Exception {
    ReadMetadataRequest readMetadataRequest = new ReadMetadataRequest().repositoryId(TEST_REPO_ID).namespace("com.example.test").projectId("missing-metadata").projectVersion("1.0-SNAPSHOT");
    storage.readProjectVersionMetadata(readMetadataRequest);
}
Also used : ReadMetadataRequest(org.apache.archiva.metadata.repository.storage.ReadMetadataRequest) Test(org.junit.Test)

Example 32 with ReadMetadataRequest

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

the class Maven2RepositoryMetadataResolverManagedSnapshotTest method testGetProjectVersionMetadataForMissingPom.

@Test(expected = RepositoryStorageRuntimeException.class)
@Override
public void testGetProjectVersionMetadataForMissingPom() throws Exception {
    ReadMetadataRequest readMetadataRequest = new ReadMetadataRequest().repositoryId(TEST_REPO_ID).namespace("com.example.test").projectId("missing-pom").projectVersion("1.0");
    storage.readProjectVersionMetadata(readMetadataRequest);
}
Also used : ReadMetadataRequest(org.apache.archiva.metadata.repository.storage.ReadMetadataRequest) Test(org.junit.Test)

Example 33 with ReadMetadataRequest

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

the class Maven2RepositoryMetadataResolverManagedSnapshotTest method testGetProjectVersionMetadataForMislocatedPom.

@Test(expected = RepositoryStorageRuntimeException.class)
@Override
public void testGetProjectVersionMetadataForMislocatedPom() throws Exception {
    ReadMetadataRequest readMetadataRequest = new ReadMetadataRequest().repositoryId(TEST_REPO_ID).namespace("com.example.test").projectId("mislocated-pom").projectVersion("1.0");
    storage.readProjectVersionMetadata(readMetadataRequest);
}
Also used : ReadMetadataRequest(org.apache.archiva.metadata.repository.storage.ReadMetadataRequest) Test(org.junit.Test)

Example 34 with ReadMetadataRequest

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

the class Maven2RepositoryMetadataResolverTest method testGetProjectVersionMetadataForMislocatedPom.

@Test
public void testGetProjectVersionMetadataForMislocatedPom() throws Exception {
    try {
        storage.readProjectVersionMetadata(new ReadMetadataRequest(TEST_REPO_ID, "com.example.test", "mislocated-pom", "1.0"));
        fail("Should have received an exception due to mislocated POM");
    } catch (RepositoryStorageMetadataInvalidException e) {
        assertEquals("mislocated-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 35 with ReadMetadataRequest

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

the class Maven2RepositoryMetadataResolverTest method testGetProjectVersionMetadata.

@Test
public void testGetProjectVersionMetadata() throws Exception {
    ProjectVersionMetadata metadata = storage.readProjectVersionMetadata(new ReadMetadataRequest(TEST_REPO_ID, "org.apache.archiva", "archiva-common", "1.2.1"));
    MavenProjectFacet facet = (MavenProjectFacet) metadata.getFacet(MavenProjectFacet.FACET_ID);
    assertEquals("jar", facet.getPackaging());
    assertEquals("http://archiva.apache.org/ref/1.2.1/archiva-base/archiva-common", metadata.getUrl());
    assertEquals("org.apache.archiva", facet.getParent().getGroupId());
    assertEquals("archiva-base", facet.getParent().getArtifactId());
    assertEquals("1.2.1", facet.getParent().getVersion());
    assertEquals("archiva-common", facet.getArtifactId());
    assertEquals("org.apache.archiva", facet.getGroupId());
    assertEquals("continuum", metadata.getCiManagement().getSystem());
    assertEquals("http://vmbuild.apache.org/continuum", metadata.getCiManagement().getUrl());
    assertNotNull(metadata.getDescription());
    // TODO: this would be better
    // assertEquals(
    // "Archiva is an application for managing one or more remote repositories, including administration, artifact handling, browsing and searching.",
    // metadata.getDescription() );
    assertEquals("1.2.1", metadata.getId());
    assertEquals("jira", metadata.getIssueManagement().getSystem());
    assertEquals("http://jira.codehaus.org/browse/MRM", metadata.getIssueManagement().getUrl());
    checkApacheLicense(metadata);
    assertEquals("Archiva Base :: Common", metadata.getName());
    String path = "archiva/tags/archiva-1.2.1/archiva-modules/archiva-base/archiva-common";
    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(4, metadata.getMailingLists().size());
    assertMailingList("users", metadata.getMailingLists().get(0), "Archiva User List", true, "http://www.nabble.com/archiva-users-f16426.html");
    assertMailingList("dev", metadata.getMailingLists().get(1), "Archiva Developer List", true, "http://www.nabble.com/archiva-dev-f16427.html");
    assertMailingList("commits", metadata.getMailingLists().get(2), "Archiva Commits List", false, null);
    assertMailingList("issues", metadata.getMailingLists().get(3), "Archiva Issues List", false, "http://www.nabble.com/Archiva---Issues-f29617.html");
    List<Dependency> dependencies = metadata.getDependencies();
    assertEquals(10, dependencies.size());
    assertDependency(dependencies.get(0), "commons-lang", "commons-lang", "2.2");
    assertDependency(dependencies.get(1), "commons-io", "commons-io", "1.4");
    assertDependency(dependencies.get(2), "org.slf4j", "slf4j-api", "1.5.0");
    assertDependency(dependencies.get(3), "org.codehaus.plexus", "plexus-component-api", "1.0-alpha-22");
    assertDependency(dependencies.get(4), "org.codehaus.plexus", "plexus-spring", "1.2", "test");
    assertDependency(dependencies.get(5), "xalan", "xalan", "2.7.0");
    assertDependency(dependencies.get(6), "dom4j", "dom4j", "1.6.1", "test");
    assertDependency(dependencies.get(7), "junit", "junit", "3.8.1", "test");
    assertDependency(dependencies.get(8), "easymock", "easymock", "1.2_Java1.3", "test");
    assertDependency(dependencies.get(9), "easymock", "easymockclassextension", "1.2", "test");
    assertEquals(8, metadata.getProperties().size());
    assertEquals("http://www.apache.org/images/asf_logo_wide.gif", metadata.getProperties().get("organization.logo"));
}
Also used : ReadMetadataRequest(org.apache.archiva.metadata.repository.storage.ReadMetadataRequest) ProjectVersionMetadata(org.apache.archiva.metadata.model.ProjectVersionMetadata) Dependency(org.apache.archiva.metadata.model.Dependency) 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