use of org.eclipse.aether.graph.DependencyNode in project maven-resolver by apache.
the class SimpleOptionalitySelectorTest method testDeriveOptionality.
@Test
public void testDeriveOptionality() throws Exception {
DependencyNode root = parseResource("derive.txt");
assertSame(root, transform(root));
assertEquals(2, root.getChildren().size());
assertTrue(root.getChildren().get(0).getDependency().isOptional());
assertTrue(root.getChildren().get(0).getChildren().get(0).getDependency().isOptional());
assertFalse(root.getChildren().get(1).getDependency().isOptional());
assertFalse(root.getChildren().get(1).getChildren().get(0).getDependency().isOptional());
}
use of org.eclipse.aether.graph.DependencyNode in project maven-resolver by apache.
the class SimpleOptionalitySelectorTest method testResolveOptionalityConflict_NonOptionalWins.
@Test
public void testResolveOptionalityConflict_NonOptionalWins() throws Exception {
DependencyNode root = parseResource("conflict.txt");
assertSame(root, transform(root));
assertEquals(2, root.getChildren().size());
assertTrue(root.getChildren().get(0).getDependency().isOptional());
assertFalse(root.getChildren().get(0).getChildren().get(0).getDependency().isOptional());
}
use of org.eclipse.aether.graph.DependencyNode in project maven-resolver by apache.
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<>();
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(null).accept(builder.build(), parents));
}
use of org.eclipse.aether.graph.DependencyNode in project maven-resolver by apache.
the class OrDependencyFilterTest method acceptTest.
@Test
public void acceptTest() {
NodeBuilder builder = new NodeBuilder();
builder.artifactId("test");
List<DependencyNode> parents = new LinkedList<>();
// Empty OR
assertFalse(new OrDependencyFilter().accept(builder.build(), parents));
// Basic Boolean Input
assertTrue(new OrDependencyFilter(getAcceptFilter()).accept(builder.build(), parents));
assertFalse(new OrDependencyFilter(getDenyFilter()).accept(builder.build(), parents));
assertFalse(new OrDependencyFilter(getDenyFilter(), getDenyFilter()).accept(builder.build(), parents));
assertTrue(new OrDependencyFilter(getDenyFilter(), getAcceptFilter()).accept(builder.build(), parents));
assertTrue(new OrDependencyFilter(getAcceptFilter(), getDenyFilter()).accept(builder.build(), parents));
assertTrue(new OrDependencyFilter(getAcceptFilter(), getAcceptFilter()).accept(builder.build(), parents));
assertFalse(new OrDependencyFilter(getDenyFilter(), getDenyFilter(), getDenyFilter()).accept(builder.build(), parents));
assertTrue(new OrDependencyFilter(getAcceptFilter(), getDenyFilter(), getDenyFilter()).accept(builder.build(), parents));
assertTrue(new OrDependencyFilter(getAcceptFilter(), getAcceptFilter(), getDenyFilter()).accept(builder.build(), parents));
assertTrue(new OrDependencyFilter(getAcceptFilter(), getAcceptFilter(), getAcceptFilter()).accept(builder.build(), parents));
// User another constructor
Collection<DependencyFilter> filters = new LinkedList<>();
filters.add(getDenyFilter());
filters.add(getAcceptFilter());
assertTrue(new OrDependencyFilter(filters).accept(builder.build(), parents));
filters = new LinkedList<>();
filters.add(getDenyFilter());
filters.add(getDenyFilter());
assertFalse(new OrDependencyFilter(filters).accept(builder.build(), parents));
// newInstance
assertTrue(AndDependencyFilter.newInstance(getAcceptFilter(), getAcceptFilter()).accept(builder.build(), parents));
assertFalse(AndDependencyFilter.newInstance(getAcceptFilter(), getDenyFilter()).accept(builder.build(), parents));
assertTrue(AndDependencyFilter.newInstance(getAcceptFilter(), null).accept(builder.build(), parents));
assertFalse(AndDependencyFilter.newInstance(getDenyFilter(), null).accept(builder.build(), parents));
assertNull(AndDependencyFilter.newInstance(null, null));
}
use of org.eclipse.aether.graph.DependencyNode in project maven-resolver by apache.
the class PatternExclusionsDependencyFilterTest method acceptTestMissmatch.
@Test
public void acceptTestMissmatch() {
NodeBuilder builder = new NodeBuilder();
builder.groupId("com.example.test").artifactId("testArtifact").ext("jar").version("1.0.3");
DependencyNode node = builder.build();
assertFalse("OTHER.GROUP.ID:testArtifact:jar:1.0.3", dontAccept(node, "OTHER.GROUP.ID:testArtifact:jar:1.0.3"));
assertFalse("com.example.test:OTHER_ARTIFACT:jar:1.0.3", dontAccept(node, "com.example.test:OTHER_ARTIFACT:jar:1.0.3"));
assertFalse("com.example.test:OTHER_ARTIFACT:jar:1.0.3", dontAccept(node, "com.example.test:OTHER_ARTIFACT:jar:1.0.3"));
assertFalse("com.example.test:testArtifact:WAR:1.0.3", dontAccept(node, "com.example.test:testArtifact:WAR:1.0.3"));
assertFalse("com.example.test:testArtifact:jar:SNAPSHOT", dontAccept(node, "com.example.test:testArtifact:jar:SNAPSHOT"));
assertFalse("*:*:war:*", dontAccept(node, "*:*:war:*"));
assertFalse("OTHER.GROUP.ID", dontAccept(node, "OTHER.GROUP.ID"));
}
Aggregations