private void doScan( String path, String[] consumers ) throws ConsumerException, MalformedURLException { BasicManagedRepository repo = new BasicManagedRepository( Paths.get(path).getFileName().toString(), "Archiva CLI Provided Repo", Paths.get(path).getParent()); repo.setLocation( Paths.get(path).toUri() ); List<KnownRepositoryContentConsumer> knownConsumerList = new ArrayList<>(); knownConsumerList.addAll( getConsumerList( consumers ) ); List<InvalidRepositoryContentConsumer> invalidConsumerList = Collections.emptyList(); List<String> ignoredContent = new ArrayList<>(); ignoredContent.addAll( Arrays.asList( RepositoryScanner.IGNORABLE_CONTENT ) ); RepositoryScanner scanner = applicationContext.getBean( RepositoryScanner.class ); try { RepositoryScanStatistics stats = scanner.scan( repo, knownConsumerList, invalidConsumerList, ignoredContent, RepositoryScanner.FRESH_SCAN ); LOGGER.info( stats.toDump( repo ) ); } catch ( RepositoryScannerException e ) { LOGGER.error( e.getMessage(), e ); } }
legacyRepository.setLocation( legacyRepositoryDirectory.toAbsolutePath().toUri() ); legacyRepository.setLayout( "legacy" );
public org.apache.archiva.repository.ManagedRepository getRepoConfiguration( String repoId, String repoName ) throws URISyntaxException { Path basePath = Paths.get("target/test-" + getName()).toAbsolutePath(); config = new BasicManagedRepository( repoId, repoName, basePath); config.addActiveReleaseScheme( ReleaseScheme.RELEASE ); config.addActiveReleaseScheme( ReleaseScheme.SNAPSHOT ); ArtifactCleanupFeature atf = config.getFeature( ArtifactCleanupFeature.class ).get(); atf.setRetentionPeriod( Period.ofDays( TEST_DAYS_OLDER) ); String path = AbstractRepositoryPurgeTest.fixPath( basePath.resolve( repoId ).toAbsolutePath().toString() ); config.setLocation( new URI( path ) ); atf.setDeleteReleasedSnapshots( true ); atf.setRetentionCount( TEST_RETENTION_COUNT ); return config; }