Search in sources :

Example 56 with DependencyNode

use of org.eclipse.aether.graph.DependencyNode in project maven-resolver by apache.

the class PatternInclusionsDependencyFilterTest method acceptTestMoreToken.

@Test
public void acceptTestMoreToken() {
    NodeBuilder builder = new NodeBuilder();
    builder.groupId("com.example.test").artifactId("testArtifact").ext("jar").version("1.0.3");
    DependencyNode node = builder.build();
    assertFalse("com.example.test:testArtifact:jar:1.0.3:foo", accept(node, "com.example.test:testArtifact:jar:1.0.3:foo"));
}
Also used : DependencyNode(org.eclipse.aether.graph.DependencyNode) NodeBuilder(org.eclipse.aether.internal.test.util.NodeBuilder) Test(org.junit.Test)

Example 57 with DependencyNode

use of org.eclipse.aether.graph.DependencyNode in project maven-resolver by apache.

the class ScopeDependencyFilterTest method acceptTest.

@Test
public void acceptTest() {
    NodeBuilder builder = new NodeBuilder();
    builder.scope("compile").artifactId("test");
    List<DependencyNode> parents = new LinkedList<>();
    // null or empty
    assertTrue(new ScopeDependencyFilter(null, null).accept(builder.build(), parents));
    assertTrue(new ScopeDependencyFilter(new LinkedList<String>(), new LinkedList<String>()).accept(builder.build(), parents));
    assertTrue(new ScopeDependencyFilter((String[]) null).accept(builder.build(), parents));
    // only excludes
    assertTrue(new ScopeDependencyFilter("test").accept(builder.build(), parents));
    assertFalse(new ScopeDependencyFilter("compile").accept(builder.build(), parents));
    assertFalse(new ScopeDependencyFilter("compile", "test").accept(builder.build(), parents));
    // Both
    String[] excludes1 = { "provided" };
    String[] includes1 = { "compile", "test" };
    assertTrue(new ScopeDependencyFilter(Arrays.asList(includes1), Arrays.asList(excludes1)).accept(builder.build(), parents));
    assertTrue(new ScopeDependencyFilter(Arrays.asList(includes1), null).accept(builder.build(), parents));
    // exclude wins
    String[] excludes2 = { "compile" };
    String[] includes2 = { "compile" };
    assertFalse(new ScopeDependencyFilter(Arrays.asList(includes2), Arrays.asList(excludes2)).accept(builder.build(), parents));
}
Also used : DependencyNode(org.eclipse.aether.graph.DependencyNode) ScopeDependencyFilter(org.eclipse.aether.util.filter.ScopeDependencyFilter) NodeBuilder(org.eclipse.aether.internal.test.util.NodeBuilder) LinkedList(java.util.LinkedList) Test(org.junit.Test)

Example 58 with DependencyNode

use of org.eclipse.aether.graph.DependencyNode in project maven-resolver by apache.

the class ConflictIdSorterTest method testSimple.

@Test
public void testSimple() throws Exception {
    DependencyNode node = parseResource("simple.txt");
    assertSame(node, transform(node));
    expectOrder("gid2:aid::jar", "gid:aid::jar", "gid:aid2::jar");
    expectCycle(false);
}
Also used : DependencyNode(org.eclipse.aether.graph.DependencyNode) Test(org.junit.Test)

Example 59 with DependencyNode

use of org.eclipse.aether.graph.DependencyNode in project maven-resolver by apache.

the class ConflictIdSorterTest method testCycles.

@Test
public void testCycles() throws Exception {
    DependencyNode node = parseResource("cycles.txt");
    assertSame(node, transform(node));
    expectOrder("*", "*", "*", "gid:aid::jar");
    expectCycle(true);
}
Also used : DependencyNode(org.eclipse.aether.graph.DependencyNode) Test(org.junit.Test)

Example 60 with DependencyNode

use of org.eclipse.aether.graph.DependencyNode in project maven-resolver by apache.

the class ConflictIdSorterTest method testNoConflicts.

@Test
public void testNoConflicts() throws Exception {
    DependencyNode node = parseResource("no-conflicts.txt");
    assertSame(node, transform(node));
    expectOrder("gid:aid::jar", "gid3:aid::jar", "gid2:aid::jar", "gid4:aid::jar");
    expectCycle(false);
}
Also used : DependencyNode(org.eclipse.aether.graph.DependencyNode) Test(org.junit.Test)

Aggregations

DependencyNode (org.eclipse.aether.graph.DependencyNode)258 Test (org.junit.Test)107 Artifact (org.eclipse.aether.artifact.Artifact)63 Dependency (org.eclipse.aether.graph.Dependency)59 DefaultArtifact (org.eclipse.aether.artifact.DefaultArtifact)56 DefaultDependencyNode (org.eclipse.aether.graph.DefaultDependencyNode)53 CollectRequest (org.eclipse.aether.collection.CollectRequest)52 ArrayList (java.util.ArrayList)39 IOException (java.io.IOException)29 List (java.util.List)27 CollectResult (org.eclipse.aether.collection.CollectResult)24 DependencyCollectionException (org.eclipse.aether.collection.DependencyCollectionException)22 DependencyRequest (org.eclipse.aether.resolution.DependencyRequest)22 PreorderNodeListGenerator (org.eclipse.aether.util.graph.visitor.PreorderNodeListGenerator)20 RemoteRepository (org.eclipse.aether.repository.RemoteRepository)19 Path (java.nio.file.Path)18 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)18 File (java.io.File)17 DependencyFilter (org.eclipse.aether.graph.DependencyFilter)17 Map (java.util.Map)16