use of org.sonatype.aether.graph.DependencyNode in project sonatype-aether by sonatype.
the class JavaEffectiveScopeCalculatorTest method testConflictWinningScopeGetsUsedForInheritance.
@Test
public void testConflictWinningScopeGetsUsedForInheritance() throws Exception {
DependencyNode root = parser.parse("conflict-and-inheritance.txt");
root = transform(root);
expectScope("compile", root, 0, 0);
expectScope("compile", root, 0, 0, 0);
}
use of org.sonatype.aether.graph.DependencyNode in project sonatype-aether by sonatype.
the class JavaEffectiveScopeCalculatorTest method testConflictingDirectNodes.
/**
* obscure case (illegal maven POM). Current behavior: last mentioned wins.
*/
@Test
public void testConflictingDirectNodes() throws RepositoryException, IOException {
for (Scope scope1 : Scope.values()) {
for (Scope scope2 : Scope.values()) {
parser.setSubstitutions(scope1.toString(), scope2.toString());
DependencyNode root = parser.parse("conflicting-direct-nodes.txt");
String expected = scope2.toString();
String msg = String.format("expected '%s' to win\n" + parser.dump(root), expected);
root = transform(root);
msg += "\ntransformed:\n" + parser.dump(root);
expectScope(msg, expected, root, 0);
expectScope(msg, expected, root, 1);
}
}
}
use of org.sonatype.aether.graph.DependencyNode in project sonatype-aether by sonatype.
the class JavaEffectiveScopeCalculatorTest method testCycleA.
@Test
public void testCycleA() throws Exception {
DependencyNode root = parser.parse("cycle-a.txt");
root = transform(root);
expectScope("compile", root, 0);
expectScope("runtime", root, 0, 0);
expectScope("runtime", root, 1);
expectScope("compile", root, 1, 0);
}
use of org.sonatype.aether.graph.DependencyNode in project sonatype-aether by sonatype.
the class JavaEffectiveScopeCalculatorTest method testCycleC.
@Test
public void testCycleC() throws Exception {
DependencyNode root = parser.parse("cycle-c.txt");
root = transform(root);
expectScope("runtime", root, 0);
expectScope("runtime", root, 0, 0);
expectScope("runtime", root, 0, 0, 0);
expectScope("runtime", root, 1);
expectScope("runtime", root, 1, 0);
expectScope("runtime", root, 1, 0, 0);
}
use of org.sonatype.aether.graph.DependencyNode in project sonatype-aether by sonatype.
the class NearestVersionConflictResolverTest method testNearestDirtyVersionUnderneathRemovedNode.
@Test
public void testNearestDirtyVersionUnderneathRemovedNode() throws Exception {
// root
// +- a
// | \- b:1 # will be removed in favor of b:2
// | \- j:1 # nearest version of j in dirty tree
// +- c
// | \- d
// | \- e
// | \- j:2
// \- b:2
DependencyNode j1 = builder.artifactId("j").version("1").build();
DependencyNode j2 = builder.artifactId("j").version("2").build();
DependencyNode b1 = builder.artifactId("b").version("1").build();
b1.getChildren().add(j1);
DependencyNode a = builder.artifactId("a").build();
a.getChildren().add(b1);
DependencyNode e = builder.artifactId("e").build();
e.getChildren().add(j2);
DependencyNode d = builder.artifactId("d").build();
d.getChildren().add(e);
DependencyNode c = builder.artifactId("c").build();
c.getChildren().add(d);
DependencyNode b2 = builder.artifactId("b").version("2").build();
DependencyNode root = builder.artifactId(null).build();
root.getChildren().add(a);
root.getChildren().add(c);
root.getChildren().add(b2);
Map<DependencyNode, Object> conflictIds = new IdentityHashMap<DependencyNode, Object>();
conflictIds.put(j1, "j");
conflictIds.put(j2, "j");
conflictIds.put(a, "a");
conflictIds.put(b1, "b");
conflictIds.put(b2, "b");
conflictIds.put(c, "c");
conflictIds.put(d, "d");
conflictIds.put(e, "e");
context.put(TransformationContextKeys.CONFLICT_IDS, conflictIds);
NearestVersionConflictResolver transformer = new NearestVersionConflictResolver();
root = transformer.transformGraph(root, context);
List<DependencyNode> trail = find(root, "j");
assertEquals(5, trail.size());
}
Aggregations