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 filesystemStorage = (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();
filesystemStorage = new FilesystemStorage(indexDirectory, new DefaultFileLockManager());
} else {
indexDirectory = repoDir.resolve(indexDirectory);
}
} else {
indexDirectory = repoDir.resolve(".index");
indexPath = ".index";
}
if (!Files.exists(indexDirectory)) {
Files.createDirectories(indexDirectory);
}
return new FilesystemAsset(filesystemStorage, indexPath, indexDirectory);
}
use of org.apache.archiva.common.filelock.DefaultFileLockManager in project archiva by apache.
the class MavenContentHelperTest method getArtifactVersion.
@Test
void getArtifactVersion() throws IOException, URISyntaxException {
MavenContentHelper mavenContentHelper = new MavenContentHelper();
MavenMetadataReader reader = new MavenMetadataReader();
mavenContentHelper.setMetadataReader(reader);
Path testRepoPath = Paths.get(Thread.currentThread().getContextClassLoader().getResource("repositories/metadata-repository").toURI());
FilesystemStorage storage = new FilesystemStorage(testRepoPath, new DefaultFileLockManager());
assertArtifactVersion(mavenContentHelper, "1.0-alpha-11-SNAPSHOT", storage.getAsset("org/apache/archiva/metadata/tests/snap_shots_1/1.0-alpha-11-SNAPSHOT"), "1.0-alpha-11-SNAPSHOT", "1.0-alpha-11-SNAPSHOT");
assertArtifactVersion(mavenContentHelper, "1.0-alpha-11-20070316.175232-11", storage.getAsset("org/apache/archiva/metadata/tests/snap_shots_a/1.0-alpha-11-SNAPSHOT"), "", "1.0-alpha-11-SNAPSHOT");
assertArtifactVersion(mavenContentHelper, "2.2-20070316.153953-10", storage.getAsset("org/apache/archiva/metadata/tests/snap_shots_b/2.2-SNAPSHOT"), "", "2.2-SNAPSHOT");
}
use of org.apache.archiva.common.filelock.DefaultFileLockManager in project archiva by apache.
the class MavenContentHelperTest method setUp.
@BeforeAll
static void setUp() throws IOException {
tempDir = Files.createTempDirectory("archivamaventest");
storage = new FilesystemStorage(tempDir, new DefaultFileLockManager());
}
use of org.apache.archiva.common.filelock.DefaultFileLockManager in project archiva by apache.
the class FileSystemStorageUtilTest method createRootAsset.
@Override
protected StorageAsset createRootAsset() {
try {
Path tmpDir = Files.createTempDirectory("testfs");
tmpDirs.add(tmpDir);
FilesystemStorage storage = new FilesystemStorage(tmpDir, new DefaultFileLockManager());
return storage.getRoot();
} catch (IOException e) {
fail("Could not create storage");
return null;
}
}
use of org.apache.archiva.common.filelock.DefaultFileLockManager in project archiva by apache.
the class FilesystemStorageTest method init.
@Before
public void init() throws IOException {
baseDir = Files.createTempDirectory("FsStorageTest");
DefaultFileLockManager fl = new DefaultFileLockManager();
fsStorage = new FilesystemStorage(baseDir, fl);
Files.createDirectories(baseDir.resolve("dir1"));
Files.createDirectories(baseDir.resolve("dir2"));
file1 = Files.createFile(baseDir.resolve("dir1/testfile1.dat"));
dir1 = Files.createDirectories(baseDir.resolve("dir1/testdir"));
file1Asset = new FilesystemAsset(fsStorage, "/dir1/testfile1.dat", file1);
dir1Asset = new FilesystemAsset(fsStorage, "/dir1/testdir", dir1);
}
Aggregations