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));
}
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);
}
Aggregations