use of org.apache.archiva.common.filelock.DefaultFileLockManager in project archiva by apache.
the class RepositoryScannerTest method createRepository.
protected EditableManagedRepository createRepository(String id, String name, Path location) throws IOException {
FileLockManager lockManager = new DefaultFileLockManager();
FilesystemStorage storage = new FilesystemStorage(location.toAbsolutePath(), lockManager);
BasicManagedRepository repo = new BasicManagedRepository(id, name, storage);
repo.setLocation(location.toAbsolutePath().toUri());
repo.setContent(new ManagedRepositoryContentMock(repo));
return repo;
}
use of org.apache.archiva.common.filelock.DefaultFileLockManager in project archiva by apache.
the class RemoteRepositoryHandlerTest method createRepository.
protected EditableRemoteRepository createRepository(String id, String name, Path location) throws IOException {
FileLockManager lockManager = new DefaultFileLockManager();
FilesystemStorage storage = new FilesystemStorage(location.toAbsolutePath(), lockManager);
BasicRemoteRepository repo = new BasicRemoteRepository(id, name, storage);
repo.setLocation(location.toAbsolutePath().toUri());
return repo;
}
use of org.apache.archiva.common.filelock.DefaultFileLockManager in project archiva by apache.
the class ContentItemTest method setup.
@BeforeEach
public void setup() throws IOException {
this.repository = new ManagedRepositoryContentMock();
this.storage = new FilesystemStorage(Paths.get("target"), new DefaultFileLockManager());
this.asset = storage.getRoot();
}
use of org.apache.archiva.common.filelock.DefaultFileLockManager in project archiva by apache.
the class MavenManagedRepository method newLocalInstance.
public static MavenManagedRepository newLocalInstance(String id, String name, Path basePath) throws IOException {
FileLockManager lockManager = new DefaultFileLockManager();
FilesystemStorage storage = new FilesystemStorage(basePath.resolve(id), lockManager);
return new MavenManagedRepository(id, name, storage);
}
use of org.apache.archiva.common.filelock.DefaultFileLockManager in project archiva by apache.
the class ArchivaIndexManagerMock method getIndexPath.
private StorageAsset getIndexPath(Repository repo) throws IOException {
IndexCreationFeature icf = repo.getFeature(IndexCreationFeature.class);
Path repoDir = repo.getRoot().getFilePath();
URI indexDir = icf.getIndexPath();
String indexPath = indexDir.getPath();
Path indexDirectory = null;
FilesystemStorage fsStorage = (FilesystemStorage) repo.getRoot().getStorage();
if (!StringUtils.isEmpty(indexDir.toString())) {
indexDirectory = PathUtil.getPathFromUri(indexDir);
// not absolute so create it in repository directory
if (indexDirectory.isAbsolute()) {
indexPath = indexDirectory.getFileName().toString();
fsStorage = new FilesystemStorage(indexDirectory.getParent(), new DefaultFileLockManager());
} else {
indexDirectory = repoDir.resolve(indexDirectory);
}
} else {
indexDirectory = repoDir.resolve(".index");
indexPath = ".index";
}
if (!Files.exists(indexDirectory)) {
Files.createDirectories(indexDirectory);
}
return new FilesystemAsset(fsStorage, indexPath, indexDirectory);
}
Aggregations