Search in sources :

Example 1 with NodeBuilder

use of org.sonatype.aether.test.util.NodeBuilder in project sonatype-aether by sonatype.

the class PatternInclusionsDependencyFilterTest method acceptTestCornerCases.

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

Example 2 with NodeBuilder

use of org.sonatype.aether.test.util.NodeBuilder in project sonatype-aether by sonatype.

the class DependencyFilterUtilsTest method testClasspathFilterCompileRuntime.

@Test
public void testClasspathFilterCompileRuntime() {
    NodeBuilder builder = new NodeBuilder().artifactId("aid");
    DependencyFilter filter = DependencyFilterUtils.classpathFilter("compile", "runtime");
    assertTrue(filter.accept(builder.scope("compile").build(), PARENTS));
    assertTrue(filter.accept(builder.scope("system").build(), PARENTS));
    assertTrue(filter.accept(builder.scope("provided").build(), PARENTS));
    assertTrue(filter.accept(builder.scope("runtime").build(), PARENTS));
    assertFalse(filter.accept(builder.scope("test").build(), PARENTS));
}
Also used : DependencyFilter(org.sonatype.aether.graph.DependencyFilter) NodeBuilder(org.sonatype.aether.test.util.NodeBuilder) Test(org.junit.Test)

Example 3 with NodeBuilder

use of org.sonatype.aether.test.util.NodeBuilder in project sonatype-aether by sonatype.

the class DependencyFilterUtilsTest method testClasspathFilterRuntime.

@Test
public void testClasspathFilterRuntime() {
    NodeBuilder builder = new NodeBuilder().artifactId("aid");
    DependencyFilter filter = DependencyFilterUtils.classpathFilter("runtime");
    assertTrue(filter.accept(builder.scope("compile").build(), PARENTS));
    assertFalse(filter.accept(builder.scope("system").build(), PARENTS));
    assertFalse(filter.accept(builder.scope("provided").build(), PARENTS));
    assertTrue(filter.accept(builder.scope("runtime").build(), PARENTS));
    assertFalse(filter.accept(builder.scope("test").build(), PARENTS));
}
Also used : DependencyFilter(org.sonatype.aether.graph.DependencyFilter) NodeBuilder(org.sonatype.aether.test.util.NodeBuilder) Test(org.junit.Test)

Example 4 with NodeBuilder

use of org.sonatype.aether.test.util.NodeBuilder in project sonatype-aether by sonatype.

the class DependencyFilterUtilsTest method testClasspathFilterCompile.

@Test
public void testClasspathFilterCompile() {
    NodeBuilder builder = new NodeBuilder().artifactId("aid");
    DependencyFilter filter = DependencyFilterUtils.classpathFilter("compile");
    assertTrue(filter.accept(builder.scope("compile").build(), PARENTS));
    assertTrue(filter.accept(builder.scope("system").build(), PARENTS));
    assertTrue(filter.accept(builder.scope("provided").build(), PARENTS));
    assertFalse(filter.accept(builder.scope("runtime").build(), PARENTS));
    assertFalse(filter.accept(builder.scope("test").build(), PARENTS));
}
Also used : DependencyFilter(org.sonatype.aether.graph.DependencyFilter) NodeBuilder(org.sonatype.aether.test.util.NodeBuilder) Test(org.junit.Test)

Example 5 with NodeBuilder

use of org.sonatype.aether.test.util.NodeBuilder in project sonatype-aether by sonatype.

the class ExclusionDependencyFilterTest method acceptTest.

@Test
public void acceptTest() {
    NodeBuilder builder = new NodeBuilder();
    builder.groupId("com.example.test").artifactId("testArtifact");
    List<DependencyNode> parents = new LinkedList<DependencyNode>();
    String[] excludes;
    excludes = new String[] { "com.example.test:testArtifact" };
    assertFalse(new ExclusionsDependencyFilter(Arrays.asList(excludes)).accept(builder.build(), parents));
    excludes = new String[] { "com.example.test:testArtifact", "com.foo:otherArtifact" };
    assertFalse(new ExclusionsDependencyFilter(Arrays.asList(excludes)).accept(builder.build(), parents));
    excludes = new String[] { "testArtifact" };
    assertFalse(new ExclusionsDependencyFilter(Arrays.asList(excludes)).accept(builder.build(), parents));
    excludes = new String[] { "otherArtifact" };
    assertTrue(new ExclusionsDependencyFilter(Arrays.asList(excludes)).accept(builder.build(), parents));
    assertTrue(new ExclusionsDependencyFilter((Collection<String>) null).accept(builder.build(), parents));
}
Also used : DependencyNode(org.sonatype.aether.graph.DependencyNode) NodeBuilder(org.sonatype.aether.test.util.NodeBuilder) LinkedList(java.util.LinkedList) Test(org.junit.Test)

Aggregations

NodeBuilder (org.sonatype.aether.test.util.NodeBuilder)29 Test (org.junit.Test)28 DependencyNode (org.sonatype.aether.graph.DependencyNode)20 DependencyFilter (org.sonatype.aether.graph.DependencyFilter)10 LinkedList (java.util.LinkedList)6 Map (java.util.Map)4 DependencyGraphTransformationContext (org.sonatype.aether.collection.DependencyGraphTransformationContext)4 ConflictMarker (org.sonatype.aether.util.graph.transformer.ConflictMarker)4 Before (org.junit.Before)1