use of org.sonatype.aether.test.util.NodeBuilder in project sonatype-aether by sonatype.
the class AbstractDependencyGraphTransformerTest method setUp.
@Before
public void setUp() {
builder = new NodeBuilder();
context = newContext();
}
use of org.sonatype.aether.test.util.NodeBuilder in project sonatype-aether by sonatype.
the class ConflictMarkerTest method testRelocation2.
@Test
public void testRelocation2() throws Exception {
NodeBuilder builder = new NodeBuilder();
DependencyNode root = builder.build();
root.getChildren().add(builder.artifactId("a").reloc("reloc").build());
root.getChildren().add(builder.artifactId("a").build());
DependencyGraphTransformationContext context = newContext();
assertSame(root, new ConflictMarker().transformGraph(root, context));
Map<?, ?> ids = (Map<?, ?>) context.get(TransformationContextKeys.CONFLICT_IDS);
assertNotNull(ids);
assertNull(ids.get(root));
assertNotNull(ids.get(root.getChildren().get(0)));
assertNotNull(ids.get(root.getChildren().get(1)));
assertSame(ids.get(root.getChildren().get(0)), ids.get(root.getChildren().get(1)));
}
use of org.sonatype.aether.test.util.NodeBuilder in project sonatype-aether by sonatype.
the class ConflictMarkerTest method testRelocation1.
@Test
public void testRelocation1() throws Exception {
NodeBuilder builder = new NodeBuilder();
DependencyNode root = builder.build();
root.getChildren().add(builder.artifactId("a").build());
root.getChildren().add(builder.artifactId("a").reloc("reloc").build());
DependencyGraphTransformationContext context = newContext();
assertSame(root, new ConflictMarker().transformGraph(root, context));
Map<?, ?> ids = (Map<?, ?>) context.get(TransformationContextKeys.CONFLICT_IDS);
assertNotNull(ids);
assertNull(ids.get(root));
assertNotNull(ids.get(root.getChildren().get(0)));
assertNotNull(ids.get(root.getChildren().get(1)));
assertSame(ids.get(root.getChildren().get(0)), ids.get(root.getChildren().get(1)));
}
use of org.sonatype.aether.test.util.NodeBuilder in project sonatype-aether by sonatype.
the class ConflictMarkerTest method testSimple.
@Test
public void testSimple() throws Exception {
NodeBuilder builder = new NodeBuilder();
DependencyNode root = builder.build();
root.getChildren().add(builder.artifactId("a").build());
root.getChildren().add(builder.artifactId("b").build());
DependencyGraphTransformationContext context = newContext();
assertSame(root, new ConflictMarker().transformGraph(root, context));
Map<?, ?> ids = (Map<?, ?>) context.get(TransformationContextKeys.CONFLICT_IDS);
assertNotNull(ids);
assertNull(ids.get(root));
assertNotNull(ids.get(root.getChildren().get(0)));
assertNotNull(ids.get(root.getChildren().get(1)));
assertNotSame(ids.get(root.getChildren().get(0)), ids.get(root.getChildren().get(1)));
assertFalse(ids.get(root.getChildren().get(0)).equals(ids.get(root.getChildren().get(1))));
}
use of org.sonatype.aether.test.util.NodeBuilder in project sonatype-aether by sonatype.
the class AndDependencyFilterTest method acceptTest.
@Test
public void acceptTest() {
NodeBuilder builder = new NodeBuilder();
builder.artifactId("test");
List<DependencyNode> parents = new LinkedList<DependencyNode>();
// Empty AND
assertTrue(new AndDependencyFilter().accept(builder.build(), parents));
// Basic Boolean Input
assertTrue(new AndDependencyFilter(getAcceptFilter()).accept(builder.build(), parents));
assertFalse(new AndDependencyFilter(getDenyFilter()).accept(builder.build(), parents));
assertFalse(new AndDependencyFilter(getDenyFilter(), getDenyFilter()).accept(builder.build(), parents));
assertFalse(new AndDependencyFilter(getDenyFilter(), getAcceptFilter()).accept(builder.build(), parents));
assertFalse(new AndDependencyFilter(getAcceptFilter(), getDenyFilter()).accept(builder.build(), parents));
assertTrue(new AndDependencyFilter(getAcceptFilter(), getAcceptFilter()).accept(builder.build(), parents));
assertFalse(new AndDependencyFilter(getDenyFilter(), getDenyFilter(), getDenyFilter()).accept(builder.build(), parents));
assertFalse(new AndDependencyFilter(getAcceptFilter(), getDenyFilter(), getDenyFilter()).accept(builder.build(), parents));
assertFalse(new AndDependencyFilter(getAcceptFilter(), getAcceptFilter(), getDenyFilter()).accept(builder.build(), parents));
assertTrue(new AndDependencyFilter(getAcceptFilter(), getAcceptFilter(), getAcceptFilter()).accept(builder.build(), parents));
// User another constructor
Collection<DependencyFilter> filters = new LinkedList<DependencyFilter>();
filters.add(getDenyFilter());
filters.add(getAcceptFilter());
assertFalse(new AndDependencyFilter(filters).accept(builder.build(), parents));
filters = new LinkedList<DependencyFilter>();
filters.add(getDenyFilter());
filters.add(getDenyFilter());
assertFalse(new AndDependencyFilter(filters).accept(builder.build(), parents));
filters = new LinkedList<DependencyFilter>();
filters.add(getAcceptFilter());
filters.add(getAcceptFilter());
assertTrue(new AndDependencyFilter(filters).accept(builder.build(), parents));
// newInstance
assertTrue(AndDependencyFilter.newInstance(getAcceptFilter(), getAcceptFilter()).accept(builder.build(), parents));
assertFalse(AndDependencyFilter.newInstance(getAcceptFilter(), getDenyFilter()).accept(builder.build(), parents));
assertFalse(AndDependencyFilter.newInstance(getDenyFilter(), null).accept(builder.build(), parents));
assertTrue(AndDependencyFilter.newInstance(getAcceptFilter(), null).accept(builder.build(), parents));
assertNull(AndDependencyFilter.newInstance(null, null));
}
Aggregations