use of org.apache.archiva.repository.storage.fs.FilesystemStorage in project archiva by apache.
the class MavenContentHelperTest method getLatestArtifactSnapshotVersion.
@Test
void getLatestArtifactSnapshotVersion() throws URISyntaxException, IOException {
MavenContentHelper mavenContentHelper = new MavenContentHelper();
MavenMetadataReader reader = new MavenMetadataReader();
mavenContentHelper.setMetadataReader(reader);
Path testRepoPath = Paths.get(Thread.currentThread().getContextClassLoader().getResource("repositories/default-repository").toURI());
FilesystemStorage storage = new FilesystemStorage(testRepoPath, new DefaultFileLockManager());
// Directory without metadata file
assertEquals("2.1-20090808.085535-2", mavenContentHelper.getLatestArtifactSnapshotVersion(storage.getAsset("org/apache/archiva/sample-parent/2.1-SNAPSHOT"), "2.1-SNAPSHOT"));
// Directory with metadata file
assertEquals("1.3-20070802.113139-29", mavenContentHelper.getLatestArtifactSnapshotVersion(storage.getAsset("org/apache/axis2/axis2/1.3-SNAPSHOT"), "1.3-SNAPSHOT"));
}
use of org.apache.archiva.repository.storage.fs.FilesystemStorage in project archiva by apache.
the class NewVersionsOfArtifactRssFeedProcessorTest method setUp.
@Before
@Override
public void setUp() throws Exception {
super.setUp();
newVersionsProcessor = new NewVersionsOfArtifactRssFeedProcessor();
newVersionsProcessor.setGenerator(new RssFeedGenerator());
metadataRepository = mock(MetadataRepository.class);
sessionFactory = mock(RepositorySessionFactory.class);
session = mock(RepositorySession.class);
when(sessionFactory.createSession()).thenReturn(session);
when(session.getRepository()).thenReturn(metadataRepository);
repositoryRegistry = mock(ArchivaRepositoryRegistry.class);
List<Repository> reg = new ArrayList<>();
reg.add(new BasicManagedRepository(TEST_REPO, TEST_REPO, new FilesystemStorage(Paths.get("target/test-storage"), new DefaultFileLockManager())));
when(repositoryRegistry.getRepositories()).thenReturn(reg);
newVersionsProcessor.setRepositorySessionFactory(sessionFactory);
newVersionsProcessor.setRepositoryRegistry(repositoryRegistry);
}
use of org.apache.archiva.repository.storage.fs.FilesystemStorage in project archiva by apache.
the class ArtifactBuilderTest method getFile.
StorageAsset getFile(String path) throws IOException {
Path filePath = Paths.get(path);
FilesystemStorage filesystemStorage = new FilesystemStorage(filePath.getParent(), new DefaultFileLockManager());
return new FilesystemAsset(filesystemStorage, filePath.getFileName().toString(), filePath);
}
Aggregations