Search in sources :

Example 31 with DependencyNode

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

Example 32 with DependencyNode

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

Example 33 with DependencyNode

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

Example 34 with DependencyNode

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));
}
Also used : ClassicDependencyManager(org.eclipse.aether.util.graph.manager.ClassicDependencyManager) CollectResult(org.eclipse.aether.collection.CollectResult) DependencyNode(org.eclipse.aether.graph.DependencyNode) DefaultDependencyNode(org.eclipse.aether.graph.DefaultDependencyNode) Dependency(org.eclipse.aether.graph.Dependency) CollectRequest(org.eclipse.aether.collection.CollectRequest) Test(org.junit.Test)

Example 35 with DependencyNode

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));
}
Also used : CollectResult(org.eclipse.aether.collection.CollectResult) DependencyNode(org.eclipse.aether.graph.DependencyNode) DefaultDependencyNode(org.eclipse.aether.graph.DefaultDependencyNode) Dependency(org.eclipse.aether.graph.Dependency) CollectRequest(org.eclipse.aether.collection.CollectRequest) Test(org.junit.Test)

Aggregations

DependencyNode (org.eclipse.aether.graph.DependencyNode)231 Test (org.junit.Test)107 DefaultDependencyNode (org.eclipse.aether.graph.DefaultDependencyNode)51 Dependency (org.eclipse.aether.graph.Dependency)51 Artifact (org.eclipse.aether.artifact.Artifact)50 CollectRequest (org.eclipse.aether.collection.CollectRequest)47 DefaultArtifact (org.eclipse.aether.artifact.DefaultArtifact)42 ArrayList (java.util.ArrayList)30 List (java.util.List)25 CollectResult (org.eclipse.aether.collection.CollectResult)23 IOException (java.io.IOException)21 DependencyCollectionException (org.eclipse.aether.collection.DependencyCollectionException)21 DependencyRequest (org.eclipse.aether.resolution.DependencyRequest)21 RemoteRepository (org.eclipse.aether.repository.RemoteRepository)18 PreorderNodeListGenerator (org.eclipse.aether.util.graph.visitor.PreorderNodeListGenerator)17 File (java.io.File)16 NodeBuilder (org.eclipse.aether.internal.test.util.NodeBuilder)16 DefaultRepositorySystemSession (org.eclipse.aether.DefaultRepositorySystemSession)14 RepositorySystemSession (org.eclipse.aether.RepositorySystemSession)14 DependencyFilter (org.eclipse.aether.graph.DependencyFilter)14