use of org.apache.archiva.repository.BasicManagedRepository in project archiva by apache.
the class DuplicateArtifactsConsumerTest method setUp.
@Before
@Override
public void setUp() throws Exception {
super.setUp();
assertNotNull(consumer);
config = new BasicManagedRepository(TEST_REPO, TEST_REPO, Paths.get("target"));
config.setLocation(Paths.get("target/test-repository").toAbsolutePath().toUri());
metadataRepository = mock(MetadataRepository.class);
RepositorySession session = mock(RepositorySession.class);
when(session.getRepository()).thenReturn(metadataRepository);
RepositorySessionFactory factory = applicationContext.getBean(RepositorySessionFactory.class);
// (RepositorySessionFactory) lookup( RepositorySessionFactory.class );
when(factory.createSession()).thenReturn(session);
when(pathTranslator.getArtifactForPath(TEST_REPO, TEST_FILE)).thenReturn(TEST_METADATA);
}
use of org.apache.archiva.repository.BasicManagedRepository in project archiva by apache.
the class RepositoryProviderMock method createStagingInstance.
@Override
public ManagedRepository createStagingInstance(ManagedRepositoryConfiguration configuration) throws RepositoryException {
String id = configuration.getId() + StagingRepositoryFeature.STAGING_REPO_POSTFIX;
BasicManagedRepository managedRepository = new BasicManagedRepository(id, configuration.getName(), Paths.get("target/repositories"));
updateManagedInstance(managedRepository, configuration);
return managedRepository;
}
use of org.apache.archiva.repository.BasicManagedRepository in project archiva by apache.
the class RepositoryProviderMock method createManagedInstance.
@Override
public ManagedRepository createManagedInstance(ManagedRepositoryConfiguration configuration) throws RepositoryException {
BasicManagedRepository managedRepository = new BasicManagedRepository(configuration.getId(), configuration.getName(), Paths.get("target/repositories"));
updateManagedInstance(managedRepository, configuration);
return managedRepository;
}
use of org.apache.archiva.repository.BasicManagedRepository in project archiva by apache.
the class AbstractRepositoryPurgeTest method getRepoConfiguration.
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;
}
use of org.apache.archiva.repository.BasicManagedRepository in project archiva by apache.
the class DefaultLegacyRepositoryConverter method convertLegacyRepository.
@Override
public void convertLegacyRepository(Path legacyRepositoryDirectory, Path repositoryDirectory, List<String> fileExclusionPatterns) throws RepositoryConversionException {
try {
String defaultRepositoryUrl = PathUtil.toUrl(repositoryDirectory);
BasicManagedRepository legacyRepository = new BasicManagedRepository("legacy", "Legacy Repository", repositoryDirectory.getParent());
legacyRepository.setLocation(legacyRepositoryDirectory.toAbsolutePath().toUri());
legacyRepository.setLayout("legacy");
ArtifactRepository repository = artifactRepositoryFactory.createArtifactRepository("default", defaultRepositoryUrl, defaultLayout, null, null);
legacyConverterConsumer.setExcludes(fileExclusionPatterns);
legacyConverterConsumer.setDestinationRepository(repository);
List<KnownRepositoryContentConsumer> knownConsumers = new ArrayList<>(1);
knownConsumers.add(legacyConverterConsumer);
List<InvalidRepositoryContentConsumer> invalidConsumers = Collections.emptyList();
List<String> ignoredContent = new ArrayList<String>(Arrays.asList(RepositoryScanner.IGNORABLE_CONTENT));
repoScanner.scan(legacyRepository, knownConsumers, invalidConsumers, ignoredContent, RepositoryScanner.FRESH_SCAN);
} catch (RepositoryScannerException e) {
throw new RepositoryConversionException("Error convering legacy repository.", e);
}
}
Aggregations