use of org.apache.archiva.repository.BasicManagedRepository in project archiva by apache.
the class ArchivaCli method doScan.
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);
}
}
use of org.apache.archiva.repository.BasicManagedRepository in project archiva by apache.
the class ArtifactMissingChecksumsConsumerTest method setUp.
@Before
@Override
public void setUp() throws Exception {
super.setUp();
Path basePath = Paths.get("target/test-classes");
repoConfig = new BasicManagedRepository("test-repo", "Test Repository", basePath);
repoConfig.setLayout("default");
repoConfig.setLocation(basePath.resolve("test-repo/").toUri());
consumer = applicationContext.getBean("knownRepositoryContentConsumer#create-missing-checksums", KnownRepositoryContentConsumer.class);
}
use of org.apache.archiva.repository.BasicManagedRepository in project archiva by apache.
the class SimpleArtifactConsumerTest method setUpMockRepository.
private void setUpMockRepository() throws RepositoryAdminException, IOException, RepositoryException {
Path repoDir = Paths.get("target/test-consumer-repo");
Files.createDirectories(repoDir);
repoDir.toFile().deleteOnExit();
testRepository = new BasicManagedRepository("test-consumer-repository", "Test-Consumer-Repository", Paths.get("target/repositories"));
testRepository.setLocation(repoDir.toAbsolutePath().toUri());
repositoryRegistry.putRepository(testRepository);
// when( repositoryRegistry.getManagedRepository( testRepository.getId() ) ).thenReturn( testRepository );
}
use of org.apache.archiva.repository.BasicManagedRepository in project archiva by apache.
the class RepositoryScannerTest method createRepository.
protected EditableManagedRepository createRepository(String id, String name, Path location) {
BasicManagedRepository repo = new BasicManagedRepository(id, name, location.getParent());
repo.setLocation(location.toAbsolutePath().toUri());
return repo;
}
use of org.apache.archiva.repository.BasicManagedRepository in project archiva by apache.
the class MavenRepositoryProvider method getManagedConfiguration.
@Override
public ManagedRepositoryConfiguration getManagedConfiguration(ManagedRepository managedRepository) throws RepositoryException {
if (!(managedRepository instanceof MavenManagedRepository || managedRepository instanceof BasicManagedRepository)) {
log.error("Wrong remote repository type " + managedRepository.getClass().getName());
throw new RepositoryException("The given repository type cannot be handled by the maven provider: " + managedRepository.getClass().getName());
}
ManagedRepositoryConfiguration cfg = new ManagedRepositoryConfiguration();
cfg.setType(managedRepository.getType().toString());
cfg.setId(managedRepository.getId());
cfg.setName(managedRepository.getName());
cfg.setDescription(managedRepository.getDescription());
cfg.setLocation(convertUriToPath(managedRepository.getLocation()));
cfg.setLayout(managedRepository.getLayout());
cfg.setRefreshCronExpression(managedRepository.getSchedulingDefinition());
cfg.setScanned(managedRepository.isScanned());
cfg.setBlockRedeployments(managedRepository.blocksRedeployments());
StagingRepositoryFeature stagingRepositoryFeature = managedRepository.getFeature(StagingRepositoryFeature.class).get();
cfg.setStageRepoNeeded(stagingRepositoryFeature.isStageRepoNeeded());
IndexCreationFeature indexCreationFeature = managedRepository.getFeature(IndexCreationFeature.class).get();
cfg.setIndexDir(convertUriToPath(indexCreationFeature.getIndexPath()));
cfg.setPackedIndexDir(convertUriToPath(indexCreationFeature.getPackedIndexPath()));
cfg.setSkipPackedIndexCreation(indexCreationFeature.isSkipPackedIndexCreation());
ArtifactCleanupFeature artifactCleanupFeature = managedRepository.getFeature(ArtifactCleanupFeature.class).get();
cfg.setRetentionCount(artifactCleanupFeature.getRetentionCount());
cfg.setRetentionPeriod(artifactCleanupFeature.getRetentionPeriod().getDays());
cfg.setDeleteReleasedSnapshots(artifactCleanupFeature.isDeleteReleasedSnapshots());
if (managedRepository.getActiveReleaseSchemes().contains(ReleaseScheme.RELEASE)) {
cfg.setReleases(true);
} else {
cfg.setReleases(false);
}
if (managedRepository.getActiveReleaseSchemes().contains(ReleaseScheme.SNAPSHOT)) {
cfg.setSnapshots(true);
} else {
cfg.setSnapshots(false);
}
return cfg;
}
Aggregations