Search in sources :

Example 1 with FileTypes

use of org.apache.archiva.configuration.provider.FileTypes 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.model.FileType) BaseFile(org.apache.archiva.common.utils.BaseFile) FileTypes(org.apache.archiva.configuration.provider.FileTypes) ConsumerWantsFilePredicate(org.apache.archiva.consumers.functors.ConsumerWantsFilePredicate) ArchivaConfiguration(org.apache.archiva.configuration.provider.ArchivaConfiguration)

Example 2 with FileTypes

use of org.apache.archiva.configuration.provider.FileTypes in project archiva by apache.

the class NexusIndexerConsumerTest method setUp.

@Override
@Before
public void setUp() throws Exception {
    super.setUp();
    scheduler = new ArchivaTaskSchedulerStub();
    ArchivaConfiguration configuration = applicationContext.getBean(ArchivaConfiguration.class);
    FileTypes filetypes = applicationContext.getBean(FileTypes.class);
    nexusIndexerConsumer = new NexusIndexerConsumer(scheduler, configuration, filetypes);
    // initialize to set the file types to be processed
    nexusIndexerConsumer.initialize();
    repositoryConfig = BasicManagedRepository.newFilesystemInstance("test-repo", "Test Repository", Paths.get("target/test-classes").resolve("test-repo"));
    repositoryConfig.setLocation(new URI("target/test-classes/test-repo"));
    repositoryConfig.setLayout("default");
    repositoryConfig.setScanned(true);
    repositoryConfig.addActiveReleaseScheme(ReleaseScheme.RELEASE);
    repositoryConfig.removeActiveReleaseScheme(ReleaseScheme.SNAPSHOT);
    repositoryRegistry.putRepository(repositoryConfig);
}
Also used : FileTypes(org.apache.archiva.configuration.provider.FileTypes) URI(java.net.URI) ArchivaConfiguration(org.apache.archiva.configuration.provider.ArchivaConfiguration) Before(org.junit.Before)

Aggregations

ArchivaConfiguration (org.apache.archiva.configuration.provider.ArchivaConfiguration)2 FileTypes (org.apache.archiva.configuration.provider.FileTypes)2 URI (java.net.URI)1 Path (java.nio.file.Path)1 BaseFile (org.apache.archiva.common.utils.BaseFile)1 FileType (org.apache.archiva.configuration.model.FileType)1 KnownRepositoryContentConsumer (org.apache.archiva.consumers.KnownRepositoryContentConsumer)1 ConsumerWantsFilePredicate (org.apache.archiva.consumers.functors.ConsumerWantsFilePredicate)1 Before (org.junit.Before)1