Search in sources :

Example 11 with FileType

use of org.apache.archiva.configuration.model.FileType 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 12 with FileType

use of org.apache.archiva.configuration.model.FileType in project archiva by apache.

the class ManagedDefaultRepositoryContentTest 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);
    repoContent = new ManagedDefaultRepositoryContent(repository, fileTypes, fileLockManager);
    repoContent.setMavenContentHelper(contentHelper);
    repoContent.setMetadataReader(metadataReader);
    repoContent.setPathTranslator(pathTranslator);
    repoContent.setArtifactMappingProviders(artifactMappingProviders);
// repoContent = (ManagedRepositoryContent) lookup( ManagedRepositoryContent.class, "default" );
}
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 13 with FileType

use of org.apache.archiva.configuration.model.FileType in project archiva by apache.

the class ManagedDefaultRepositoryContentTest method setupRepoCopy.

private Path setupRepoCopy(String source, String target) throws IOException {
    Path defaultRepo = getRepositoryPath(source);
    Path newRepo = defaultRepo.getParent().resolve(target);
    FileUtils.copyDirectory(defaultRepo.toFile(), newRepo.toFile());
    MavenManagedRepository repository = createRepository("testRepo", "Unit Test Repo", newRepo);
    FileType fileType = archivaConfiguration.getConfiguration().getRepositoryScanning().getFileTypes().get(0);
    fileType.addPattern("**/*.xml");
    assertEquals(FileTypes.ARTIFACTS, fileType.getId());
    fileTypes.afterConfigurationChange(null, "fileType", null);
    repoContent = new ManagedDefaultRepositoryContent(repository, fileTypes, fileLockManager);
    return newRepo;
}
Also used : Path(java.nio.file.Path) FileType(org.apache.archiva.configuration.model.FileType) MavenManagedRepository(org.apache.archiva.maven.repository.MavenManagedRepository)

Aggregations

FileType (org.apache.archiva.configuration.model.FileType)13 Path (java.nio.file.Path)4 RepositoryScanningConfiguration (org.apache.archiva.configuration.model.RepositoryScanningConfiguration)3 MavenManagedRepository (org.apache.archiva.maven.repository.MavenManagedRepository)3 Before (org.junit.Before)3 Iterator (java.util.Iterator)2 List (java.util.List)2 ArchivaConfiguration (org.apache.archiva.configuration.provider.ArchivaConfiguration)2 PostConstruct (javax.annotation.PostConstruct)1 BaseFile (org.apache.archiva.common.utils.BaseFile)1 ArchivaRuntimeConfiguration (org.apache.archiva.configuration.model.ArchivaRuntimeConfiguration)1 Configuration (org.apache.archiva.configuration.model.Configuration)1 FiletypeSelectionPredicate (org.apache.archiva.configuration.model.functors.FiletypeSelectionPredicate)1 FileTypes (org.apache.archiva.configuration.provider.FileTypes)1 KnownRepositoryContentConsumer (org.apache.archiva.consumers.KnownRepositoryContentConsumer)1 ConsumerWantsFilePredicate (org.apache.archiva.consumers.functors.ConsumerWantsFilePredicate)1 Predicate (org.apache.commons.collections4.Predicate)1