use of org.apache.archiva.repository.maven2.MavenManagedRepository in project archiva by apache.
the class AbstractRepositoryLayerTestCase method createRepository.
protected MavenManagedRepository createRepository(String id, String name, Path location) {
MavenManagedRepository repo = new MavenManagedRepository(id, name, location.getParent().toAbsolutePath());
repo.setLocation(location.toAbsolutePath().toUri());
return repo;
}
use of org.apache.archiva.repository.maven2.MavenManagedRepository in project archiva by apache.
the class RepositoryRequestTest method createManagedRepositoryContent.
protected ManagedRepositoryContent createManagedRepositoryContent(String id, String name, Path location, String layout) throws Exception {
MavenManagedRepository repo = new MavenManagedRepository(id, name, archivaConfiguration.getRepositoryBaseDir());
repo.setLocation(location.toAbsolutePath().toUri());
repo.setLayout(layout);
RepositoryContentProvider provider = applicationContext.getBean("repositoryContentProvider#maven", RepositoryContentProvider.class);
ManagedRepositoryContent repoContent = provider.createManagedContent(repo);
return repoContent;
}
use of org.apache.archiva.repository.maven2.MavenManagedRepository in project archiva by apache.
the class MetadataToolsTest method createTestRepoContent.
private ManagedRepositoryContent createTestRepoContent() throws Exception {
Path repoRoot = Paths.get("target/metadata-tests/" + name.getMethodName());
if (Files.exists(repoRoot)) {
org.apache.archiva.common.utils.FileUtils.deleteDirectory(repoRoot);
}
Files.createDirectories(repoRoot);
MavenManagedRepository repoConfig = createRepository("test-repo", "Test Repository: " + name.getMethodName(), repoRoot);
RepositoryContentProvider provider = applicationContext.getBean("repositoryContentProvider#maven", RepositoryContentProvider.class);
ManagedRepositoryContent repoContent = provider.createManagedContent(repoConfig);
return repoContent;
}
use of org.apache.archiva.repository.maven2.MavenManagedRepository in project archiva by apache.
the class MetadataToolsTest method assertSnapshotVersions.
private void assertSnapshotVersions(String artifactId, String version, String[] expectedVersions) throws Exception {
Path repoRootDir = Paths.get("src/test/repositories/metadata-repository");
VersionedReference reference = new VersionedReference();
reference.setGroupId("org.apache.archiva.metadata.tests");
reference.setArtifactId(artifactId);
reference.setVersion(version);
MavenManagedRepository repo = createRepository("test-repo", "Test Repository: " + name.getMethodName(), repoRootDir);
RepositoryContentProvider provider = applicationContext.getBean("repositoryContentProvider#maven", RepositoryContentProvider.class);
ManagedRepositoryContent repoContent = provider.createManagedContent(repo);
Set<String> testedVersionSet = tools.gatherSnapshotVersions(repoContent, reference);
// Sort the list (for asserts)
List<String> testedVersions = new ArrayList<>();
testedVersions.addAll(testedVersionSet);
Collections.sort(testedVersions, new VersionComparator());
// Test the expected array of versions, to the actual tested versions
assertEquals("Assert Snapshot Versions: length/size", expectedVersions.length, testedVersions.size());
for (int i = 0; i < expectedVersions.length; i++) {
String actualVersion = testedVersions.get(i);
assertEquals("Snapshot Versions[" + i + "]", expectedVersions[i], actualVersion);
}
}
use of org.apache.archiva.repository.maven2.MavenManagedRepository in project archiva by apache.
the class AbstractProxyTestCase method createRepository.
protected ManagedRepositoryContent createRepository(String id, String name, String path, String layout) throws Exception {
MavenManagedRepository repo = new MavenManagedRepository(id, name, Paths.get(path).getParent());
repo.setLocation(new URI(path));
repo.setLayout(layout);
RepositoryContentProvider provider = applicationContext.getBean("repositoryContentProvider#maven", RepositoryContentProvider.class);
ManagedRepositoryContent repoContent = provider.createManagedContent(repo);
return repoContent;
}
Aggregations