Search in sources :

Example 1 with MavenManagedRepository

use of org.apache.archiva.repository.maven2.MavenManagedRepository in project archiva by apache.

the class AbstractRepositoryLayerTestCase method createRepository.

protected MavenManagedRepository createRepository(String id, String name, Path location) {
    MavenManagedRepository repo = new MavenManagedRepository(id, name, location.getParent().toAbsolutePath());
    repo.setLocation(location.toAbsolutePath().toUri());
    return repo;
}
Also used : MavenManagedRepository(org.apache.archiva.repository.maven2.MavenManagedRepository)

Example 2 with MavenManagedRepository

use of org.apache.archiva.repository.maven2.MavenManagedRepository in project archiva by apache.

the class RepositoryRequestTest method createManagedRepositoryContent.

protected ManagedRepositoryContent createManagedRepositoryContent(String id, String name, Path location, String layout) throws Exception {
    MavenManagedRepository repo = new MavenManagedRepository(id, name, archivaConfiguration.getRepositoryBaseDir());
    repo.setLocation(location.toAbsolutePath().toUri());
    repo.setLayout(layout);
    RepositoryContentProvider provider = applicationContext.getBean("repositoryContentProvider#maven", RepositoryContentProvider.class);
    ManagedRepositoryContent repoContent = provider.createManagedContent(repo);
    return repoContent;
}
Also used : RepositoryContentProvider(org.apache.archiva.repository.RepositoryContentProvider) MavenManagedRepository(org.apache.archiva.repository.maven2.MavenManagedRepository) ManagedRepositoryContent(org.apache.archiva.repository.ManagedRepositoryContent)

Example 3 with MavenManagedRepository

use of org.apache.archiva.repository.maven2.MavenManagedRepository in project archiva by apache.

the class MetadataToolsTest method createTestRepoContent.

private ManagedRepositoryContent createTestRepoContent() throws Exception {
    Path repoRoot = Paths.get("target/metadata-tests/" + name.getMethodName());
    if (Files.exists(repoRoot)) {
        org.apache.archiva.common.utils.FileUtils.deleteDirectory(repoRoot);
    }
    Files.createDirectories(repoRoot);
    MavenManagedRepository repoConfig = createRepository("test-repo", "Test Repository: " + name.getMethodName(), repoRoot);
    RepositoryContentProvider provider = applicationContext.getBean("repositoryContentProvider#maven", RepositoryContentProvider.class);
    ManagedRepositoryContent repoContent = provider.createManagedContent(repoConfig);
    return repoContent;
}
Also used : Path(java.nio.file.Path) RepositoryContentProvider(org.apache.archiva.repository.RepositoryContentProvider) MavenManagedRepository(org.apache.archiva.repository.maven2.MavenManagedRepository) ManagedRepositoryContent(org.apache.archiva.repository.ManagedRepositoryContent)

Example 4 with MavenManagedRepository

use of org.apache.archiva.repository.maven2.MavenManagedRepository in project archiva by apache.

the class MetadataToolsTest method assertSnapshotVersions.

private void assertSnapshotVersions(String artifactId, String version, String[] expectedVersions) throws Exception {
    Path repoRootDir = Paths.get("src/test/repositories/metadata-repository");
    VersionedReference reference = new VersionedReference();
    reference.setGroupId("org.apache.archiva.metadata.tests");
    reference.setArtifactId(artifactId);
    reference.setVersion(version);
    MavenManagedRepository repo = createRepository("test-repo", "Test Repository: " + name.getMethodName(), repoRootDir);
    RepositoryContentProvider provider = applicationContext.getBean("repositoryContentProvider#maven", RepositoryContentProvider.class);
    ManagedRepositoryContent repoContent = provider.createManagedContent(repo);
    Set<String> testedVersionSet = tools.gatherSnapshotVersions(repoContent, reference);
    // Sort the list (for asserts)
    List<String> testedVersions = new ArrayList<>();
    testedVersions.addAll(testedVersionSet);
    Collections.sort(testedVersions, new VersionComparator());
    // Test the expected array of versions, to the actual tested versions
    assertEquals("Assert Snapshot Versions: length/size", expectedVersions.length, testedVersions.size());
    for (int i = 0; i < expectedVersions.length; i++) {
        String actualVersion = testedVersions.get(i);
        assertEquals("Snapshot Versions[" + i + "]", expectedVersions[i], actualVersion);
    }
}
Also used : Path(java.nio.file.Path) VersionedReference(org.apache.archiva.model.VersionedReference) RepositoryContentProvider(org.apache.archiva.repository.RepositoryContentProvider) MavenManagedRepository(org.apache.archiva.repository.maven2.MavenManagedRepository) ManagedRepositoryContent(org.apache.archiva.repository.ManagedRepositoryContent) ArrayList(java.util.ArrayList) VersionComparator(org.apache.archiva.common.utils.VersionComparator)

Example 5 with MavenManagedRepository

use of org.apache.archiva.repository.maven2.MavenManagedRepository in project archiva by apache.

the class AbstractProxyTestCase method createRepository.

protected ManagedRepositoryContent createRepository(String id, String name, String path, String layout) throws Exception {
    MavenManagedRepository repo = new MavenManagedRepository(id, name, Paths.get(path).getParent());
    repo.setLocation(new URI(path));
    repo.setLayout(layout);
    RepositoryContentProvider provider = applicationContext.getBean("repositoryContentProvider#maven", RepositoryContentProvider.class);
    ManagedRepositoryContent repoContent = provider.createManagedContent(repo);
    return repoContent;
}
Also used : RepositoryContentProvider(org.apache.archiva.repository.RepositoryContentProvider) MavenManagedRepository(org.apache.archiva.repository.maven2.MavenManagedRepository) ManagedRepositoryContent(org.apache.archiva.repository.ManagedRepositoryContent) URI(java.net.URI)

Aggregations

MavenManagedRepository (org.apache.archiva.repository.maven2.MavenManagedRepository)10 ManagedRepositoryContent (org.apache.archiva.repository.ManagedRepositoryContent)5 RepositoryContentProvider (org.apache.archiva.repository.RepositoryContentProvider)5 Path (java.nio.file.Path)4 URI (java.net.URI)3 Before (org.junit.Before)3 ArrayList (java.util.ArrayList)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1 HttpServletResponse (javax.servlet.http.HttpServletResponse)1 ManagedRepositoryAdmin (org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin)1 DefaultManagedRepositoryAdmin (org.apache.archiva.admin.repository.managed.DefaultManagedRepositoryAdmin)1 VersionComparator (org.apache.archiva.common.utils.VersionComparator)1 ArchivaConfiguration (org.apache.archiva.configuration.ArchivaConfiguration)1 FileType (org.apache.archiva.configuration.FileType)1 NetworkProxyConfiguration (org.apache.archiva.configuration.NetworkProxyConfiguration)1 RemoteRepositoryConfiguration (org.apache.archiva.configuration.RemoteRepositoryConfiguration)1 VersionedReference (org.apache.archiva.model.VersionedReference)1 RepositoryProxyConnectors (org.apache.archiva.proxy.model.RepositoryProxyConnectors)1 RepositoryRegistry (org.apache.archiva.repository.RepositoryRegistry)1 ManagedDefaultRepositoryContent (org.apache.archiva.repository.content.maven2.ManagedDefaultRepositoryContent)1