use of org.sonatype.aether.impl.ArtifactDescriptorReader in project sonatype-aether by sonatype.
the class DefaultDependencyCollectorTest method testArtifactDescriptorResolutionNotRestrictedToRepoHostingSelectedVersion.
@Test
public void testArtifactDescriptorResolutionNotRestrictedToRepoHostingSelectedVersion() throws Exception {
RemoteRepository repo2 = new RemoteRepository("test", "default", "file:///");
final List<RemoteRepository> repos = new ArrayList<RemoteRepository>();
collector.setArtifactDescriptorReader(new ArtifactDescriptorReader() {
public ArtifactDescriptorResult readArtifactDescriptor(RepositorySystemSession session, ArtifactDescriptorRequest request) throws ArtifactDescriptorException {
repos.addAll(request.getRepositories());
return new ArtifactDescriptorResult(request);
}
});
DependencyNode root = parser.parseLiteral("verrange:parent:jar:[1,):compile");
List<Dependency> dependencies = Arrays.asList(root.getDependency());
CollectRequest request = new CollectRequest(dependencies, null, Arrays.asList(repository, repo2));
CollectResult result = collector.collectDependencies(session, request);
assertEquals(0, result.getExceptions().size());
assertEquals(2, repos.size());
assertEquals("id", repos.get(0).getId());
assertEquals("test", repos.get(1).getId());
}
Aggregations