use of org.apache.archiva.common.filelock.DefaultFileLockManager in project archiva by apache.
the class BasicManagedRepositoryValidatorTest 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());
return repo;
}
use of org.apache.archiva.common.filelock.DefaultFileLockManager in project archiva by apache.
the class BasicRemoteRepositoryValidatorTest 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());
repo.setContent(new RemoteRepositoryContentMock());
return repo;
}
use of org.apache.archiva.common.filelock.DefaultFileLockManager in project archiva by apache.
the class MavenIndexContext method getPath.
@Override
public StorageAsset getPath() {
if (dir == null) {
StorageAsset repositoryDirAsset = repository.getRoot();
Path repositoryDir = repositoryDirAsset.getFilePath().toAbsolutePath();
Path indexDir = delegate.getIndexDirectoryFile().toPath();
if (indexDir.startsWith(repositoryDir)) {
dir = repository.getAsset(repositoryDir.relativize(indexDir).toString());
} else {
try {
FilesystemStorage storage = new FilesystemStorage(indexDir, new DefaultFileLockManager());
dir = storage.getRoot();
} catch (IOException e) {
log.error("Error occured while creating storage for index dir");
}
}
}
return dir;
}
use of org.apache.archiva.common.filelock.DefaultFileLockManager in project archiva by apache.
the class FilesystemAssetTest method init.
@Before
public void init() throws IOException {
assetPathDir = Files.createTempDirectory("assetDir");
assetPathFile = Files.createTempFile(assetPathDir, "assetFile", "dat");
filesystemStorage = new FilesystemStorage(assetPathDir, new DefaultFileLockManager());
}
use of org.apache.archiva.common.filelock.DefaultFileLockManager 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"));
}
Aggregations