use of org.sonatype.aether.graph.DependencyNode in project sonatype-aether by sonatype.
the class PatternInclusionsDependencyFilterTest method acceptTestRange.
@Test
public void acceptTestRange() {
NodeBuilder builder = new NodeBuilder();
builder.groupId("com.example.test").artifactId("testArtifact").ext("jar").version("1.0.3");
DependencyNode node = builder.build();
String prefix = "com.example.test:testArtifact:jar:";
assertTrue(prefix + "[1.0.3,1.0.4)", acceptVersionRange(node, prefix + "[1.0.3,1.0.4)"));
assertTrue(prefix + "[1.0.3,)", acceptVersionRange(node, prefix + "[1.0.3,)"));
assertTrue(prefix + "[1.0.3,]", acceptVersionRange(node, prefix + "[1.0.3,]"));
assertTrue(prefix + "(,1.0.3]", acceptVersionRange(node, prefix + "(,1.0.3]"));
assertTrue(prefix + "[1.0,]", acceptVersionRange(node, prefix + "[1.0,]"));
assertTrue(prefix + "[1,4]", acceptVersionRange(node, prefix + "[1,4]"));
assertTrue(prefix + "(1,4)", acceptVersionRange(node, prefix + "(1,4)"));
assertTrue(prefix + "(1.0.2,1.0.3]", acceptVersionRange(node, prefix + "(1.0.2,1.0.3]", prefix + "(1.1,)"));
assertFalse(prefix + "(1.0.3,2.0]", acceptVersionRange(node, prefix + "(1.0.3,2.0]"));
assertFalse(prefix + "(1,1.0.2]", acceptVersionRange(node, prefix + "(1,1.0.2]"));
assertFalse(prefix + "(1.0.2,1.0.3)", acceptVersionRange(node, prefix + "(1.0.2,1.0.3)", prefix + "(1.0.3,)"));
}
use of org.sonatype.aether.graph.DependencyNode in project sonatype-aether by sonatype.
the class AbstractDependencyGraphTransformerTest method find.
private boolean find(LinkedList<DependencyNode> trail, DependencyNode node, String id) {
trail.addFirst(node);
if (isMatch(node, id)) {
return true;
}
for (DependencyNode child : node.getChildren()) {
if (find(trail, child, id)) {
return true;
}
}
trail.removeFirst();
return false;
}
use of org.sonatype.aether.graph.DependencyNode in project sonatype-aether by sonatype.
the class ConflictMarkerTest method testRelocation3.
@Test
public void testRelocation3() throws Exception {
NodeBuilder builder = new NodeBuilder();
DependencyNode root = builder.build();
root.getChildren().add(builder.artifactId("a").build());
root.getChildren().add(builder.artifactId("b").build());
root.getChildren().add(builder.artifactId("c").reloc("a").reloc("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)));
assertNotNull(ids.get(root.getChildren().get(2)));
assertSame(ids.get(root.getChildren().get(0)), ids.get(root.getChildren().get(1)));
assertSame(ids.get(root.getChildren().get(1)), ids.get(root.getChildren().get(2)));
}
use of org.sonatype.aether.graph.DependencyNode in project sonatype-aether by sonatype.
the class JavaDependencyContextRefinerTest method testDoNotRefineOtherContext.
@Test
public void testDoNotRefineOtherContext() throws IOException, RepositoryException {
DependencyNode node = parser.parseLiteral("gid:aid:ext:cls:ver");
node.setRequestContext("otherContext");
DependencyNode refinedNode = refiner.transformGraph(node, context);
assertEquals(node, refinedNode);
}
use of org.sonatype.aether.graph.DependencyNode in project sonatype-aether by sonatype.
the class DefaultDependencyCollectorTest method testDependencyManagement.
@Test
public void testDependencyManagement() throws IOException, DependencyCollectionException {
collector.setArtifactDescriptorReader(new IniArtifactDescriptorReader("artifact-descriptions/managed/"));
DependencyNode root = parser.parse("expectedSubtreeComparisonResult.txt");
TestDependencyManager depMgmt = new TestDependencyManager();
depMgmt.addManagedDependency(dep(root, 0), "managed", null, null);
depMgmt.addManagedDependency(dep(root, 0, 1), "managed", "managed", null);
depMgmt.addManagedDependency(dep(root, 1), null, null, "managed");
session.setDependencyManager(depMgmt);
// collect result will differ from expectedSubtreeComparisonResult.txt
// set localPath -> no dependency traversal
CollectRequest request = new CollectRequest(dep(root), Arrays.asList(repository));
CollectResult result = collector.collectDependencies(session, request);
DependencyNode node = result.getRoot();
assertEquals("managed", dep(node, 0, 1).getArtifact().getVersion());
assertEquals("managed", dep(node, 0, 1).getScope());
assertEquals("managed", dep(node, 1).getArtifact().getProperty(ArtifactProperties.LOCAL_PATH, null));
assertEquals("managed", dep(node, 0, 0).getArtifact().getProperty(ArtifactProperties.LOCAL_PATH, null));
}
Aggregations