use of org.sonatype.aether.graph.DependencyNode in project sonatype-aether by sonatype.
the class PathRecordingDependencyVisitorTest method testGetPaths_RecordsMatchesBeneathMatchedParentsIfRequested.
@Test
public void testGetPaths_RecordsMatchesBeneathMatchedParentsIfRequested() throws Exception {
DependencyNode root = parse("nested.txt");
PathRecordingDependencyVisitor visitor = new PathRecordingDependencyVisitor(new ArtifactMatcher(), false);
root.accept(visitor);
List<List<DependencyNode>> paths = visitor.getPaths();
assertEquals(paths.toString(), 3, paths.size());
assertPath(paths.get(0), "x");
assertPath(paths.get(1), "x", "a", "y");
assertPath(paths.get(2), "x", "y");
}
use of org.sonatype.aether.graph.DependencyNode in project sonatype-aether by sonatype.
the class PathRecordingDependencyVisitorTest method assertPath.
private void assertPath(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.sonatype.aether.graph.DependencyNode in project sonatype-aether by sonatype.
the class PathRecordingDependencyVisitorTest method testGetPaths_RecordsMatchesBeneathUnmatchedParents.
@Test
public void testGetPaths_RecordsMatchesBeneathUnmatchedParents() throws Exception {
DependencyNode root = parse("simple.txt");
PathRecordingDependencyVisitor visitor = new PathRecordingDependencyVisitor(new ArtifactMatcher());
root.accept(visitor);
List<List<DependencyNode>> paths = visitor.getPaths();
assertEquals(paths.toString(), 2, paths.size());
assertPath(paths.get(0), "a", "b", "x");
assertPath(paths.get(1), "a", "x");
}
use of org.sonatype.aether.graph.DependencyNode in project sonatype-aether by sonatype.
the class PostorderNodeListGeneratorTest method testOrdering.
@Test
public void testOrdering() throws Exception {
DependencyNode root = parse("simple.txt");
PostorderNodeListGenerator visitor = new PostorderNodeListGenerator();
root.accept(visitor);
assertSequence(visitor.getNodes(), "c", "b", "e", "d", "a");
}
use of org.sonatype.aether.graph.DependencyNode in project sonatype-aether by sonatype.
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");
}
Aggregations