Search in sources :

Example 26 with DefaultFileLockManager

use of org.apache.archiva.common.filelock.DefaultFileLockManager in project archiva by apache.

the class ArtifactContentEntriesTests method readArtifactContentEntriesRootPathNull.

@Test
public void readArtifactContentEntriesRootPathNull() throws Exception {
    FilesystemStorage filesystemStorage = new FilesystemStorage(Paths.get(getBasedir()), new DefaultFileLockManager());
    Path file = Paths.get(getBasedir(), "src/test/repo-with-osgi/commons-logging/commons-logging/1.1/commons-logging-1.1.jar");
    List<ArtifactContentEntry> artifactContentEntries = browseService.readFileEntries(new FilesystemAsset(filesystemStorage, file.toString(), file), null, "foo");
    log.info("artifactContentEntries: {}", artifactContentEntries);
    assertThat(artifactContentEntries).isNotNull().isNotEmpty().hasSize(2).contains(new ArtifactContentEntry("org", false, 0, "foo"), new ArtifactContentEntry("META-INF", false, 0, "foo"));
}
Also used : Path(java.nio.file.Path) FilesystemStorage(org.apache.archiva.repository.storage.fs.FilesystemStorage) ArtifactContentEntry(org.apache.archiva.rest.api.model.ArtifactContentEntry) FilesystemAsset(org.apache.archiva.repository.storage.fs.FilesystemAsset) DefaultFileLockManager(org.apache.archiva.common.filelock.DefaultFileLockManager) Test(org.junit.Test)

Example 27 with DefaultFileLockManager

use of org.apache.archiva.common.filelock.DefaultFileLockManager in project archiva by apache.

the class ArtifactContentEntriesTests method readArtifactContentEntriesSecondDepthOnlyOneDirectory.

@Test
public void readArtifactContentEntriesSecondDepthOnlyOneDirectory() throws Exception {
    FilesystemStorage filesystemStorage = new FilesystemStorage(Paths.get(getBasedir()), new DefaultFileLockManager());
    Path file = Paths.get(getBasedir(), "src/test/repo-with-osgi/commons-logging/commons-logging/1.1/commons-logging-1.1.jar");
    List<ArtifactContentEntry> artifactContentEntries = browseService.readFileEntries(new FilesystemAsset(filesystemStorage, file.toString(), file), "org", "foo");
    log.info("artifactContentEntries: {}", artifactContentEntries);
    assertThat(artifactContentEntries).isNotNull().isNotEmpty().hasSize(1).contains(new ArtifactContentEntry("org/apache", false, 1, "foo"));
}
Also used : Path(java.nio.file.Path) FilesystemStorage(org.apache.archiva.repository.storage.fs.FilesystemStorage) ArtifactContentEntry(org.apache.archiva.rest.api.model.ArtifactContentEntry) FilesystemAsset(org.apache.archiva.repository.storage.fs.FilesystemAsset) DefaultFileLockManager(org.apache.archiva.common.filelock.DefaultFileLockManager) Test(org.junit.Test)

Example 28 with DefaultFileLockManager

use of org.apache.archiva.common.filelock.DefaultFileLockManager in project archiva by apache.

the class ArtifactContentEntriesTests method readArtifactContentEntriesDirectoryAndFiles.

@Test
public void readArtifactContentEntriesDirectoryAndFiles() throws Exception {
    FilesystemStorage filesystemStorage = new FilesystemStorage(Paths.get(getBasedir()), new DefaultFileLockManager());
    Path file = Paths.get(getBasedir(), "src/test/repo-with-osgi/commons-logging/commons-logging/1.1/commons-logging-1.1.jar");
    List<ArtifactContentEntry> artifactContentEntries = browseService.readFileEntries(new FilesystemAsset(filesystemStorage, file.toString(), file), "org/apache/commons/logging/", "foo");
    log.info("artifactContentEntries: {}", artifactContentEntries);
    assertThat(artifactContentEntries).isNotNull().isNotEmpty().hasSize(10).contains(new ArtifactContentEntry("org/apache/commons/logging/impl", false, 4, "foo"), new ArtifactContentEntry("org/apache/commons/logging/LogSource.class", true, 4, "foo"));
}
Also used : Path(java.nio.file.Path) FilesystemStorage(org.apache.archiva.repository.storage.fs.FilesystemStorage) ArtifactContentEntry(org.apache.archiva.rest.api.model.ArtifactContentEntry) FilesystemAsset(org.apache.archiva.repository.storage.fs.FilesystemAsset) DefaultFileLockManager(org.apache.archiva.common.filelock.DefaultFileLockManager) Test(org.junit.Test)

Example 29 with DefaultFileLockManager

use of org.apache.archiva.common.filelock.DefaultFileLockManager in project archiva by apache.

the class ArtifactContentEntriesTests method readArtifactContentEntriesOnlyFiles.

@Test
public void readArtifactContentEntriesOnlyFiles() throws Exception {
    FilesystemStorage filesystemStorage = new FilesystemStorage(Paths.get(getBasedir()), new DefaultFileLockManager());
    Path file = Paths.get(getBasedir(), "src/test/repo-with-osgi/commons-logging/commons-logging/1.1/commons-logging-1.1.jar");
    List<ArtifactContentEntry> artifactContentEntries = browseService.readFileEntries(new FilesystemAsset(filesystemStorage, file.toString(), file), "org/apache/commons/logging/impl/", "foo");
    log.info("artifactContentEntries: {}", artifactContentEntries);
    assertThat(artifactContentEntries).isNotNull().isNotEmpty().hasSize(16).contains(new ArtifactContentEntry("org/apache/commons/logging/impl/AvalonLogger.class", true, 5, "foo"));
}
Also used : Path(java.nio.file.Path) FilesystemStorage(org.apache.archiva.repository.storage.fs.FilesystemStorage) ArtifactContentEntry(org.apache.archiva.rest.api.model.ArtifactContentEntry) FilesystemAsset(org.apache.archiva.repository.storage.fs.FilesystemAsset) DefaultFileLockManager(org.apache.archiva.common.filelock.DefaultFileLockManager) Test(org.junit.Test)

Example 30 with DefaultFileLockManager

use of org.apache.archiva.common.filelock.DefaultFileLockManager in project archiva by apache.

the class ArtifactContentEntriesTests method readArtifactContentEntriesRootPathEmpty.

@Test
public void readArtifactContentEntriesRootPathEmpty() throws Exception {
    FilesystemStorage filesystemStorage = new FilesystemStorage(Paths.get(getBasedir()), new DefaultFileLockManager());
    Path file = Paths.get(getBasedir(), "src/test/repo-with-osgi/commons-logging/commons-logging/1.1/commons-logging-1.1.jar");
    List<ArtifactContentEntry> artifactContentEntries = browseService.readFileEntries(new FilesystemAsset(filesystemStorage, file.toString(), file), "", "foo");
    log.info("artifactContentEntries: {}", artifactContentEntries);
    assertThat(artifactContentEntries).isNotNull().isNotEmpty().hasSize(2).contains(new ArtifactContentEntry("org", false, 0, "foo"), new ArtifactContentEntry("META-INF", false, 0, "foo"));
}
Also used : Path(java.nio.file.Path) FilesystemStorage(org.apache.archiva.repository.storage.fs.FilesystemStorage) ArtifactContentEntry(org.apache.archiva.rest.api.model.ArtifactContentEntry) FilesystemAsset(org.apache.archiva.repository.storage.fs.FilesystemAsset) DefaultFileLockManager(org.apache.archiva.common.filelock.DefaultFileLockManager) Test(org.junit.Test)

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