Search in sources :

Example 1 with FileType

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

the class RepositoryPurgeConsumerTest method cleanupFileTypes.

private void cleanupFileTypes() {
    ArchivaConfiguration archivaConfiguration = applicationContext.getBean("archivaConfiguration#default", ArchivaConfiguration.class);
    FileType fileType = archivaConfiguration.getConfiguration().getRepositoryScanning().getFileTypes().get(0);
    fileType.removePattern("**/*.xml");
}
Also used : FileType(org.apache.archiva.configuration.FileType) ArchivaConfiguration(org.apache.archiva.configuration.ArchivaConfiguration)

Example 2 with FileType

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

the class FiletypeToMapClosure method execute.

@Override
public void execute(Object input) {
    if (input instanceof FileType) {
        FileType filetype = (FileType) input;
        map.put(filetype.getId(), filetype);
    }
}
Also used : FileType(org.apache.archiva.configuration.FileType)

Example 3 with FileType

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

the class AbstractArtifactConsumerTest method setUp.

@Before
public void setUp() throws Exception {
    FileType fileType = (FileType) archivaConfiguration.getConfiguration().getRepositoryScanning().getFileTypes().get(0);
    assertEquals(FileTypes.ARTIFACTS, fileType.getId());
    fileType.addPattern("**/*.xml");
    repoLocation = Paths.get("target/test-" + getName() + "/test-repo");
}
Also used : FileType(org.apache.archiva.configuration.FileType) Before(org.junit.Before)

Example 4 with FileType

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

the class RepositoryPurgeConsumerTest method assertNotConsumed.

@SuppressWarnings("deprecation")
private void assertNotConsumed(String path) throws Exception {
    ArchivaConfiguration archivaConfiguration = applicationContext.getBean("archivaConfiguration#default", ArchivaConfiguration.class);
    FileType fileType = archivaConfiguration.getConfiguration().getRepositoryScanning().getFileTypes().get(0);
    assertEquals(FileTypes.ARTIFACTS, fileType.getId());
    fileType.addPattern("**/*.xml");
    // FileTypes fileTypes = applicationContext.getBean( FileTypes.class );
    for (FileTypes fileTypes : applicationContext.getBeansOfType(FileTypes.class).values()) {
        fileTypes.afterConfigurationChange(null, "repositoryScanning.fileTypes", null);
    }
    KnownRepositoryContentConsumer repoPurgeConsumer = applicationContext.getBean("knownRepositoryContentConsumer#repository-purge", KnownRepositoryContentConsumer.class);
    Path repoLocation = Paths.get("target/test-" + getName() + "/test-repo");
    Path localFile = repoLocation.resolve(path);
    ConsumerWantsFilePredicate predicate = new ConsumerWantsFilePredicate();
    BaseFile baseFile = new BaseFile(repoLocation.toFile(), localFile.toFile());
    predicate.setBasefile(baseFile);
    assertFalse(predicate.evaluate(repoPurgeConsumer));
}
Also used : Path(java.nio.file.Path) KnownRepositoryContentConsumer(org.apache.archiva.consumers.KnownRepositoryContentConsumer) FileType(org.apache.archiva.configuration.FileType) BaseFile(org.apache.archiva.common.utils.BaseFile) FileTypes(org.apache.archiva.configuration.FileTypes) ConsumerWantsFilePredicate(org.apache.archiva.consumers.functors.ConsumerWantsFilePredicate) ArchivaConfiguration(org.apache.archiva.configuration.ArchivaConfiguration)

Example 5 with FileType

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

the class ManagedDefaultRepositoryContentTest method setUp.

@Before
public void setUp() throws Exception {
    Path repoDir = Paths.get("src/test/repositories/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(artifactMappingProviders, fileTypes);
    // repoContent = (ManagedRepositoryContent) lookup( ManagedRepositoryContent.class, "default" );
    repoContent.setRepository(repository);
}
Also used : Path(java.nio.file.Path) FileType(org.apache.archiva.configuration.FileType) MavenManagedRepository(org.apache.archiva.repository.maven2.MavenManagedRepository) ManagedDefaultRepositoryContent(org.apache.archiva.repository.content.maven2.ManagedDefaultRepositoryContent) Before(org.junit.Before)

Aggregations

FileType (org.apache.archiva.configuration.FileType)5 Path (java.nio.file.Path)2 ArchivaConfiguration (org.apache.archiva.configuration.ArchivaConfiguration)2 Before (org.junit.Before)2 BaseFile (org.apache.archiva.common.utils.BaseFile)1 FileTypes (org.apache.archiva.configuration.FileTypes)1 KnownRepositoryContentConsumer (org.apache.archiva.consumers.KnownRepositoryContentConsumer)1 ConsumerWantsFilePredicate (org.apache.archiva.consumers.functors.ConsumerWantsFilePredicate)1 ManagedDefaultRepositoryContent (org.apache.archiva.repository.content.maven2.ManagedDefaultRepositoryContent)1 MavenManagedRepository (org.apache.archiva.repository.maven2.MavenManagedRepository)1