use of org.sonatype.aether.graph.DependencyNode in project sonatype-aether by sonatype.
the class PostorderNodeListGeneratorTest 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());
}
}
use of org.sonatype.aether.graph.DependencyNode in project sonatype-aether by sonatype.
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());
}
}
use of org.sonatype.aether.graph.DependencyNode in project sonatype-aether by sonatype.
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");
}
use of org.sonatype.aether.graph.DependencyNode 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));
}
use of org.sonatype.aether.graph.DependencyNode in project sonatype-aether by sonatype.
the class OrDependencyFilterTest method acceptTest.
@Test
public void acceptTest() {
NodeBuilder builder = new NodeBuilder();
builder.artifactId("test");
List<DependencyNode> parents = new LinkedList<DependencyNode>();
// 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<DependencyFilter>();
filters.add(getDenyFilter());
filters.add(getAcceptFilter());
assertTrue(new OrDependencyFilter(filters).accept(builder.build(), parents));
filters = new LinkedList<DependencyFilter>();
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));
}
Aggregations