Search in sources :

Example 1 with MavenManagedRepository

use of org.apache.archiva.maven.repository.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.maven.repository.MavenManagedRepository) ManagedRepositoryContent(org.apache.archiva.repository.ManagedRepositoryContent)

Example 2 with MavenManagedRepository

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

the class MavenRepositoryRequestInfoTest method createRepository.

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

Example 3 with MavenManagedRepository

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

the class MavenRepositoryRequestInfoTest method createManagedRepositoryContent.

protected ManagedRepositoryContent createManagedRepositoryContent(String id, String name, Path location, String layout) throws Exception {
    MavenManagedRepository repo = MavenManagedRepository.newLocalInstance(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.maven.repository.MavenManagedRepository) ManagedRepositoryContent(org.apache.archiva.repository.ManagedRepositoryContent)

Example 4 with MavenManagedRepository

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

the class MavenRepositoryRequestInfoTest method setUp.

@Before
public void setUp() throws Exception {
    Path repoDir = getRepositoryPath("default-repository");
    MavenManagedRepository repository = createRepository("testRepo", "Unit Test Repo", repoDir);
    FileType fileType = archivaConfiguration.getConfiguration().getRepositoryScanning().getFileTypes().get(0);
    fileType.addPattern("**/*.xml");
    assertEquals(FileTypes.ARTIFACTS, fileType.getId());
    fileTypes.afterConfigurationChange(null, "fileType", null);
    ManagedDefaultRepositoryContent repoContent = new ManagedDefaultRepositoryContent(repository, fileTypes, fileLockManager);
    // repoContent = (ManagedRepositoryContent) lookup( ManagedRepositoryContent.class, "default" );
    repository.setContent(repoContent);
    repoContent.setMavenContentHelper(mavenContentHelper);
    repoContent.setArtifactMappingProviders(artifactMappingProviders);
    repoContent.setPathTranslator(pathTranslator);
    repoRequest = new MavenRepositoryRequestInfo(repository);
}
Also used : Path(java.nio.file.Path) FileType(org.apache.archiva.configuration.model.FileType) MavenManagedRepository(org.apache.archiva.maven.repository.MavenManagedRepository) Before(org.junit.Before)

Example 5 with MavenManagedRepository

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

the class ManagedDefaultRepositoryContentTest method createManagedRepoWithContent.

private ManagedRepository createManagedRepoWithContent(String sourceRepoName) throws IOException, URISyntaxException {
    Path repoDir = copyRepository(sourceRepoName);
    MavenManagedRepository repo = createRepository(sourceRepoName, sourceRepoName, repoDir);
    ManagedDefaultRepositoryContent deleteRepoContent = new ManagedDefaultRepositoryContent(repo, fileTypes, fileLockManager);
    deleteRepoContent.setMavenContentHelper(contentHelper);
    return repo;
}
Also used : Path(java.nio.file.Path) MavenManagedRepository(org.apache.archiva.maven.repository.MavenManagedRepository)

Aggregations

MavenManagedRepository (org.apache.archiva.maven.repository.MavenManagedRepository)8 Path (java.nio.file.Path)6 FileType (org.apache.archiva.configuration.model.FileType)3 ManagedRepositoryContent (org.apache.archiva.repository.ManagedRepositoryContent)3 RepositoryContentProvider (org.apache.archiva.repository.RepositoryContentProvider)3 Before (org.junit.Before)2 ArrayList (java.util.ArrayList)1 VersionComparator (org.apache.archiva.common.utils.VersionComparator)1 ItemSelector (org.apache.archiva.repository.content.ItemSelector)1 ArchivaItemSelector (org.apache.archiva.repository.content.base.ArchivaItemSelector)1