use of org.apache.archiva.repository.ManagedRepositoryContent in project archiva by apache.
the class RepositoryRequestTest method testNativePathBadRequestTooShort.
@Test
public void testNativePathBadRequestTooShort() throws Exception {
ManagedRepositoryContent repository = createManagedRepo("default");
// Test bad request path (too short)
try {
repoRequest.toNativePath("org.apache.derby/license.txt", repository);
fail("Should have thrown an exception about a too short path.");
} catch (LayoutException e) {
// expected path.
}
}
use of org.apache.archiva.repository.ManagedRepositoryContent 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.ManagedRepositoryContent in project archiva by apache.
the class RepositoryRequestTest method testNativePathBadRequestBlank.
@Test
public void testNativePathBadRequestBlank() throws Exception {
ManagedRepositoryContent repository = createManagedRepo("default");
// Test bad request path (too short)
try {
repoRequest.toNativePath("", repository);
fail("Should have thrown an exception about an blank request.");
} catch (LayoutException e) {
// expected path.
}
}
use of org.apache.archiva.repository.ManagedRepositoryContent in project archiva by apache.
the class RepositoryRequestTest method testNativePathBadRequestUnknownType.
@Test
public void testNativePathBadRequestUnknownType() throws Exception {
ManagedRepositoryContent repository = createManagedRepo("default");
// Test bad request path (too short)
try {
repoRequest.toNativePath("org/apache/derby/derby/10.2.2.0/license.txt", repository);
fail("Should have thrown an exception about an invalid type.");
} catch (LayoutException e) {
// expected path.
}
}
use of org.apache.archiva.repository.ManagedRepositoryContent 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;
}
Aggregations