use of org.apache.archiva.repository.base.managed.BasicManagedRepository in project archiva by apache.
the class ArchivaIndexingTaskExecutorTest method setUp.
@Before
@Override
public void setUp() throws Exception {
super.setUp();
Path baseDir = Paths.get(System.getProperty("basedir"), "target/test-classes").toAbsolutePath();
BasicManagedRepository repositoryConfig = BasicManagedRepository.newFilesystemInstance("test-repo", "Test Repository", baseDir.resolve("test-repo"));
Path repoLocation = baseDir.resolve("test-repo");
repositoryConfig.setLocation(repoLocation.toUri());
repositoryConfig.setLayout("default");
repositoryConfig.setScanned(true);
repositoryConfig.addActiveReleaseScheme(ReleaseScheme.RELEASE);
repositoryConfig.removeActiveReleaseScheme(ReleaseScheme.SNAPSHOT);
repositoryRegistry.putRepository(repositoryConfig);
repo = repositoryRegistry.getManagedRepository(repositoryConfig.getId());
}
use of org.apache.archiva.repository.base.managed.BasicManagedRepository in project archiva by apache.
the class RepositoryProviderMock method createManagedInstance.
@Override
public ManagedRepository createManagedInstance(ManagedRepositoryConfiguration configuration) throws RepositoryException {
BasicManagedRepository managedRepository = null;
try {
managedRepository = BasicManagedRepository.newFilesystemInstance(configuration.getId(), configuration.getName(), Paths.get("target/repositories").resolve(configuration.getId()));
} catch (IOException e) {
throw new RepositoryException(e);
}
updateManagedInstance(managedRepository, configuration);
return managedRepository;
}
use of org.apache.archiva.repository.base.managed.BasicManagedRepository in project archiva by apache.
the class MavenRepositoryMapperTest method reverseMap.
@Test
void reverseMap() throws IOException, URISyntaxException, UnsupportedURIException {
MavenRepositoryMapper mapper = new MavenRepositoryMapper();
Path tmpDir = Files.createTempDirectory("mapper-test");
FilesystemStorage fsStorage = new FilesystemStorage(tmpDir, new DefaultFileLockManager());
EditableManagedRepository repository = new BasicManagedRepository(Locale.getDefault(), RepositoryType.MAVEN, "repo02", "Repo 02", fsStorage);
repository.setDescription(Locale.getDefault(), "This is repo 02");
repository.setBlocksRedeployment(false);
repository.setLocation(new URI("test-path"));
repository.setScanned(true);
repository.setLayout("maven2");
repository.setSchedulingDefinition("* 3,5,10 * * *");
IndexCreationFeature icf = repository.getFeature(IndexCreationFeature.class);
icf.setIndexPath(new URI(".indexer"));
icf.setPackedIndexPath(new URI(".index"));
icf.setSkipPackedIndexCreation(false);
ArtifactCleanupFeature acf = repository.getFeature(ArtifactCleanupFeature.class);
acf.setDeleteReleasedSnapshots(false);
acf.setRetentionPeriod(Period.ofDays(5));
acf.setRetentionCount(17);
StagingRepositoryFeature srf = repository.getFeature(StagingRepositoryFeature.class);
srf.setStageRepoNeeded(false);
MavenManagedRepository result = mapper.reverseMap(repository);
assertEquals("repo02", result.getId());
assertEquals("Repo 02", result.getName());
assertEquals("This is repo 02", result.getDescription());
assertFalse(result.isBlocksRedeployments());
assertEquals("test-path", result.getLocation());
assertTrue(result.isScanned());
assertEquals("maven2", result.getLayout());
assertEquals("* 3,5,10 * * *", result.getSchedulingDefinition());
assertEquals(".indexer", result.getIndexPath());
assertEquals(".index", result.getPackedIndexPath());
assertFalse(result.isSkipPackedIndexCreation());
assertFalse(result.isDeleteSnapshotsOfRelease());
assertEquals(Period.ofDays(5), result.getRetentionPeriod());
assertEquals(17, result.getRetentionCount());
assertFalse(result.hasStagingRepository());
}
use of org.apache.archiva.repository.base.managed.BasicManagedRepository in project archiva by apache.
the class MavenRepositoryMapperTest method reverseUpdate.
@Test
void reverseUpdate() throws IOException, URISyntaxException, UnsupportedURIException {
MavenRepositoryMapper mapper = new MavenRepositoryMapper();
MavenManagedRepository result = new MavenManagedRepository();
Path tmpDir = Files.createTempDirectory("mapper-test");
FilesystemStorage fsStorage = new FilesystemStorage(tmpDir, new DefaultFileLockManager());
EditableManagedRepository repository = new BasicManagedRepository(Locale.getDefault(), RepositoryType.MAVEN, "repo02", "Repo 02", fsStorage);
repository.setDescription(Locale.getDefault(), "This is repo 02");
repository.setBlocksRedeployment(false);
repository.setLocation(new URI("test-path"));
repository.setScanned(true);
repository.setLayout("maven2");
repository.setSchedulingDefinition("* 3,5,10 * * *");
IndexCreationFeature icf = repository.getFeature(IndexCreationFeature.class);
icf.setIndexPath(new URI(".indexer"));
icf.setPackedIndexPath(new URI(".index"));
icf.setSkipPackedIndexCreation(false);
ArtifactCleanupFeature acf = repository.getFeature(ArtifactCleanupFeature.class);
acf.setDeleteReleasedSnapshots(false);
acf.setRetentionPeriod(Period.ofDays(5));
acf.setRetentionCount(17);
StagingRepositoryFeature srf = repository.getFeature(StagingRepositoryFeature.class);
srf.setStageRepoNeeded(false);
mapper.reverseUpdate(repository, result);
assertEquals("repo02", result.getId());
assertEquals("Repo 02", result.getName());
assertEquals("This is repo 02", result.getDescription());
assertFalse(result.isBlocksRedeployments());
assertEquals("test-path", result.getLocation());
assertTrue(result.isScanned());
assertEquals("maven2", result.getLayout());
assertEquals("* 3,5,10 * * *", result.getSchedulingDefinition());
assertEquals(".indexer", result.getIndexPath());
assertEquals(".index", result.getPackedIndexPath());
assertFalse(result.isSkipPackedIndexCreation());
assertFalse(result.isDeleteSnapshotsOfRelease());
assertEquals(Period.ofDays(5), result.getRetentionPeriod());
assertEquals(17, result.getRetentionCount());
assertFalse(result.hasStagingRepository());
}
use of org.apache.archiva.repository.base.managed.BasicManagedRepository in project archiva by apache.
the class RepositoryProviderMock method createManagedInstance.
@Override
public ManagedRepository createManagedInstance(ManagedRepositoryConfiguration configuration) throws RepositoryException {
BasicManagedRepository managedRepository;
try {
managedRepository = BasicManagedRepository.newFilesystemInstance(configuration.getId(), configuration.getName(), Paths.get("target/repositories"));
} catch (IOException e) {
throw new RepositoryException(e);
}
updateManagedInstance(managedRepository, configuration);
return managedRepository;
}
Aggregations