use of org.eclipse.aether.graph.DependencyNode in project maven-resolver by apache.
the class PostorderNodeListGeneratorTest method testDuplicateSuppression.
@Test
public void testDuplicateSuppression() throws Exception {
DependencyNode root = parse("cycles.txt");
PostorderNodeListGenerator visitor = new PostorderNodeListGenerator();
root.accept(visitor);
assertSequence(visitor.getNodes(), "c", "b", "e", "d", "a");
}
use of org.eclipse.aether.graph.DependencyNode in project maven-resolver by apache.
the class PreorderNodeListGeneratorTest method testDuplicateSuppression.
@Test
public void testDuplicateSuppression() throws Exception {
DependencyNode root = parse("cycles.txt");
PreorderNodeListGenerator visitor = new PreorderNodeListGenerator();
root.accept(visitor);
assertSequence(visitor.getNodes(), "a", "b", "c", "d", "e");
}
use of org.eclipse.aether.graph.DependencyNode in project maven-resolver by apache.
the class PreorderNodeListGeneratorTest method assertSequence.
private void assertSequence(List<DependencyNode> actual, String... expected) {
assertEquals(actual.toString(), expected.length, actual.size());
for (int i = 0; i < expected.length; i++) {
DependencyNode node = actual.get(i);
assertEquals(actual.toString(), expected[i], node.getDependency().getArtifact().getArtifactId());
}
}
use of org.eclipse.aether.graph.DependencyNode in project maven-resolver by apache.
the class DefaultDependencyCollectorTest method testManagedVersionScope.
@Test
public void testManagedVersionScope() throws DependencyCollectionException {
Dependency dependency = newDep("managed:aid:ext:ver");
CollectRequest request = new CollectRequest(dependency, Arrays.asList(repository));
session.setDependencyManager(new ClassicDependencyManager());
CollectResult result = collector.collectDependencies(session, request);
assertEquals(0, result.getExceptions().size());
DependencyNode root = result.getRoot();
assertEquals(dependency, dep(root));
assertEquals(dependency.getArtifact(), dep(root).getArtifact());
assertEquals(1, root.getChildren().size());
Dependency expect = newDep("gid:aid:ext:ver", "compile");
assertEquals(expect, dep(root, 0));
assertEquals(1, path(root, 0).getChildren().size());
expect = newDep("gid:aid2:ext:managedVersion", "managedScope");
assertEquals(expect, dep(root, 0, 0));
}
use of org.eclipse.aether.graph.DependencyNode in project maven-resolver by apache.
the class DefaultDependencyCollectorTest method testDuplicates.
@Test
public void testDuplicates() throws DependencyCollectionException {
Dependency dependency = newDep("duplicate:transitive:ext:dependency");
CollectRequest request = new CollectRequest(dependency, Arrays.asList(repository));
CollectResult result = collector.collectDependencies(session, request);
assertEquals(0, result.getExceptions().size());
DependencyNode root = result.getRoot();
Dependency newDependency = root.getDependency();
assertEquals(dependency, newDependency);
assertEquals(dependency.getArtifact(), newDependency.getArtifact());
assertEquals(2, root.getChildren().size());
Dependency dep = newDep("gid:aid:ext:ver", "compile");
assertEquals(dep, dep(root, 0));
dep = newDep("gid:aid2:ext:ver", "compile");
assertEquals(dep, dep(root, 1));
assertEquals(dep, dep(root, 0, 0));
assertEquals(dep(root, 1), dep(root, 0, 0));
}
Aggregations