Search in sources :

Example 51 with DependencyNode

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

the class PatternExclusionsDependencyFilterTest method acceptTestLessToken.

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

Example 52 with DependencyNode

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

the class PatternExclusionsDependencyFilterTest method acceptTestMatches.

@Test
public void acceptTestMatches() {
    NodeBuilder builder = new NodeBuilder();
    builder.groupId("com.example.test").artifactId("testArtifact").ext("jar").version("1.0.3");
    DependencyNode node = builder.build();
    // full match
    assertTrue("com.example.test:testArtifact:jar:1.0.3", dontAccept(node, "com.example.test:testArtifact:jar:1.0.3"));
    // single wildcard
    assertTrue("*:testArtifact:jar:1.0.3", dontAccept(node, "*:testArtifact:jar:1.0.3"));
    assertTrue("com.example.test:*:jar:1.0.3", dontAccept(node, "com.example.test:*:jar:1.0.3"));
    assertTrue("com.example.test:testArtifact:*:1.0.3", dontAccept(node, "com.example.test:testArtifact:*:1.0.3"));
    assertTrue("com.example.test:testArtifact:*:1.0.3", dontAccept(node, "com.example.test:testArtifact:*:1.0.3"));
    // implicit wildcard
    assertTrue(":testArtifact:jar:1.0.3", dontAccept(node, ":testArtifact:jar:1.0.3"));
    assertTrue("com.example.test::jar:1.0.3", dontAccept(node, "com.example.test::jar:1.0.3"));
    assertTrue("com.example.test:testArtifact::1.0.3", dontAccept(node, "com.example.test:testArtifact::1.0.3"));
    assertTrue("com.example.test:testArtifact:jar:", dontAccept(node, "com.example.test:testArtifact:jar:"));
    // multi wildcards
    assertTrue("*:*:jar:1.0.3", dontAccept(node, "*:*:jar:1.0.3"));
    assertTrue("com.example.test:*:*:1.0.3", dontAccept(node, "com.example.test:*:*:1.0.3"));
    assertTrue("com.example.test:testArtifact:*:*", dontAccept(node, "com.example.test:testArtifact:*:*"));
    assertTrue("*:testArtifact:jar:*", dontAccept(node, "*:testArtifact:jar:*"));
    assertTrue("*:*:jar:*", dontAccept(node, "*:*:jar:*"));
    assertTrue(":*:jar:", dontAccept(node, ":*:jar:"));
    // partial wildcards
    assertTrue("*.example.test:testArtifact:jar:1.0.3", dontAccept(node, "*.example.test:testArtifact:jar:1.0.3"));
    assertTrue("com.example.test:testArtifact:*ar:1.0.*", dontAccept(node, "com.example.test:testArtifact:*ar:1.0.*"));
    assertTrue("com.example.test:testArtifact:jar:1.0.*", dontAccept(node, "com.example.test:testArtifact:jar:1.0.*"));
    assertTrue("*.example.*:testArtifact:jar:1.0.3", dontAccept(node, "*.example.*:testArtifact:jar:1.0.3"));
    // wildcard as empty string
    assertTrue("com.example.test*:testArtifact:jar:1.0.3", dontAccept(node, "com.example.test*:testArtifact:jar:1.0.3"));
}
Also used : DependencyNode(org.eclipse.aether.graph.DependencyNode) NodeBuilder(org.eclipse.aether.internal.test.util.NodeBuilder) Test(org.junit.Test)

Example 53 with DependencyNode

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

the class PatternExclusionsDependencyFilterTest method acceptTestCornerCases.

@Test
public void acceptTestCornerCases() {
    NodeBuilder builder = new NodeBuilder();
    builder.artifactId("testArtifact");
    DependencyNode node = builder.build();
    List<DependencyNode> parents = new LinkedList<>();
    // Empty String, Empty List
    assertTrue(dontAccept(node, ""));
    assertTrue(new PatternExclusionsDependencyFilter(new LinkedList<String>()).accept(node, parents));
    assertTrue(new PatternExclusionsDependencyFilter((String[]) null).accept(node, parents));
    assertTrue(new PatternExclusionsDependencyFilter((VersionScheme) null, "[1,10]").accept(node, parents));
}
Also used : DependencyNode(org.eclipse.aether.graph.DependencyNode) NodeBuilder(org.eclipse.aether.internal.test.util.NodeBuilder) LinkedList(java.util.LinkedList) PatternExclusionsDependencyFilter(org.eclipse.aether.util.filter.PatternExclusionsDependencyFilter) Test(org.junit.Test)

Example 54 with DependencyNode

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

the class PatternInclusionsDependencyFilterTest method acceptTestLessToken.

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

Example 55 with DependencyNode

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

the class PatternInclusionsDependencyFilterTest method acceptTestRange.

@Test
public void acceptTestRange() {
    NodeBuilder builder = new NodeBuilder();
    builder.groupId("com.example.test").artifactId("testArtifact").ext("jar").version("1.0.3");
    DependencyNode node = builder.build();
    String prefix = "com.example.test:testArtifact:jar:";
    assertTrue(prefix + "[1.0.3,1.0.4)", acceptVersionRange(node, prefix + "[1.0.3,1.0.4)"));
    assertTrue(prefix + "[1.0.3,)", acceptVersionRange(node, prefix + "[1.0.3,)"));
    assertTrue(prefix + "[1.0.3,]", acceptVersionRange(node, prefix + "[1.0.3,]"));
    assertTrue(prefix + "(,1.0.3]", acceptVersionRange(node, prefix + "(,1.0.3]"));
    assertTrue(prefix + "[1.0,]", acceptVersionRange(node, prefix + "[1.0,]"));
    assertTrue(prefix + "[1,4]", acceptVersionRange(node, prefix + "[1,4]"));
    assertTrue(prefix + "(1,4)", acceptVersionRange(node, prefix + "(1,4)"));
    assertTrue(prefix + "(1.0.2,1.0.3]", acceptVersionRange(node, prefix + "(1.0.2,1.0.3]", prefix + "(1.1,)"));
    assertFalse(prefix + "(1.0.3,2.0]", acceptVersionRange(node, prefix + "(1.0.3,2.0]"));
    assertFalse(prefix + "(1,1.0.2]", acceptVersionRange(node, prefix + "(1,1.0.2]"));
    assertFalse(prefix + "(1.0.2,1.0.3)", acceptVersionRange(node, prefix + "(1.0.2,1.0.3)", prefix + "(1.0.3,)"));
}
Also used : DependencyNode(org.eclipse.aether.graph.DependencyNode) NodeBuilder(org.eclipse.aether.internal.test.util.NodeBuilder) 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