Search in sources :

Example 41 with DependencyNode

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");
}
Also used : DependencyNode(org.sonatype.aether.graph.DependencyNode) List(java.util.List) Test(org.junit.Test)

Example 42 with DependencyNode

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());
    }
}
Also used : DependencyNode(org.sonatype.aether.graph.DependencyNode)

Example 43 with DependencyNode

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");
}
Also used : DependencyNode(org.sonatype.aether.graph.DependencyNode) List(java.util.List) Test(org.junit.Test)

Example 44 with DependencyNode

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");
}
Also used : DependencyNode(org.sonatype.aether.graph.DependencyNode) Test(org.junit.Test)

Example 45 with DependencyNode

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");
}
Also used : DependencyNode(org.sonatype.aether.graph.DependencyNode) Test(org.junit.Test)

Aggregations

DependencyNode (org.sonatype.aether.graph.DependencyNode)114 Test (org.junit.Test)82 NodeBuilder (org.sonatype.aether.test.util.NodeBuilder)20 Dependency (org.sonatype.aether.graph.Dependency)14 IdentityHashMap (java.util.IdentityHashMap)13 CollectRequest (org.sonatype.aether.collection.CollectRequest)12 CollectResult (org.sonatype.aether.collection.CollectResult)11 List (java.util.List)8 Map (java.util.Map)8 LinkedList (java.util.LinkedList)7 Artifact (org.sonatype.aether.artifact.Artifact)6 DependencyFilter (org.sonatype.aether.graph.DependencyFilter)5 ArrayList (java.util.ArrayList)4 DependencyGraphTransformationContext (org.sonatype.aether.collection.DependencyGraphTransformationContext)4 ConflictMarker (org.sonatype.aether.util.graph.transformer.ConflictMarker)4 HashMap (java.util.HashMap)3 ArtifactDescriptorException (org.sonatype.aether.resolution.ArtifactDescriptorException)3 BufferedReader (java.io.BufferedReader)2 HashSet (java.util.HashSet)2 RepositorySystemSession (org.sonatype.aether.RepositorySystemSession)2