Search in sources :

Example 41 with DefaultFileLockManager

use of org.apache.archiva.common.filelock.DefaultFileLockManager 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);
}
Also used : MetadataRepository(org.apache.archiva.metadata.repository.MetadataRepository) Repository(org.apache.archiva.repository.Repository) MetadataRepository(org.apache.archiva.metadata.repository.MetadataRepository) BasicManagedRepository(org.apache.archiva.repository.base.managed.BasicManagedRepository) BasicManagedRepository(org.apache.archiva.repository.base.managed.BasicManagedRepository) RepositorySessionFactory(org.apache.archiva.metadata.repository.RepositorySessionFactory) FilesystemStorage(org.apache.archiva.repository.storage.fs.FilesystemStorage) ArrayList(java.util.ArrayList) DefaultFileLockManager(org.apache.archiva.common.filelock.DefaultFileLockManager) RepositorySession(org.apache.archiva.metadata.repository.RepositorySession) RssFeedGenerator(org.apache.archiva.rss.RssFeedGenerator) ArchivaRepositoryRegistry(org.apache.archiva.repository.base.ArchivaRepositoryRegistry) Before(org.junit.Before)

Example 42 with DefaultFileLockManager

use of org.apache.archiva.common.filelock.DefaultFileLockManager 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);
}
Also used : Path(java.nio.file.Path) FilesystemStorage(org.apache.archiva.repository.storage.fs.FilesystemStorage) FilesystemAsset(org.apache.archiva.repository.storage.fs.FilesystemAsset) DefaultFileLockManager(org.apache.archiva.common.filelock.DefaultFileLockManager)

Aggregations

DefaultFileLockManager (org.apache.archiva.common.filelock.DefaultFileLockManager)42 FilesystemStorage (org.apache.archiva.repository.storage.fs.FilesystemStorage)41 Path (java.nio.file.Path)23 FileLockManager (org.apache.archiva.common.filelock.FileLockManager)14 FilesystemAsset (org.apache.archiva.repository.storage.fs.FilesystemAsset)12 IndexCreationFeature (org.apache.archiva.repository.features.IndexCreationFeature)7 StorageAsset (org.apache.archiva.repository.storage.StorageAsset)7 BasicManagedRepository (org.apache.archiva.repository.base.managed.BasicManagedRepository)6 ArtifactContentEntry (org.apache.archiva.rest.api.model.ArtifactContentEntry)6 IOException (java.io.IOException)5 URI (java.net.URI)5 Test (org.junit.Test)5 Test (org.junit.jupiter.api.Test)4 ArrayList (java.util.ArrayList)3 ManagedRepository (org.apache.archiva.repository.ManagedRepository)3 DavException (org.apache.jackrabbit.webdav.DavException)3 Before (org.junit.Before)3 Date (java.util.Date)2 MavenMetadataReader (org.apache.archiva.maven.metadata.MavenMetadataReader)2 ArchivaRepositoryMetadata (org.apache.archiva.model.ArchivaRepositoryMetadata)2