use of org.sonatype.aether.graph.DependencyNode in project sonatype-aether by sonatype.
the class DependencyGraphParserTest method testOnlyRoot.
@Test
public void testOnlyRoot() throws IOException {
String def = "gid:aid:jar:1:scope";
DependencyNode node = parser.parseLiteral(def);
assertNotNull(node);
assertEquals(0, node.getChildren().size());
Dependency dependency = node.getDependency();
assertNotNull(dependency);
assertEquals("scope", dependency.getScope());
Artifact artifact = dependency.getArtifact();
assertNotNull(artifact);
assertEquals("gid", artifact.getGroupId());
assertEquals("aid", artifact.getArtifactId());
assertEquals("jar", artifact.getExtension());
assertEquals("1", artifact.getVersion());
}
use of org.sonatype.aether.graph.DependencyNode in project sonatype-aether by sonatype.
the class DependencyGraphParserTest method testResourceLoading.
@Test
public void testResourceLoading() throws UnsupportedEncodingException, IOException {
String prefix = "org/sonatype/aether/test/util/";
String name = "testResourceLoading.txt";
DependencyNode node = parser.parse(prefix + name);
assertEquals(0, node.getChildren().size());
assertNodeProperties(node, "");
}
use of org.sonatype.aether.graph.DependencyNode in project sonatype-aether by sonatype.
the class DependencyGraphParserTest method testDeepChildren.
@Test
public void testDeepChildren() throws IOException {
String def = "gid1:aid1:ext1:ver1\n" + "+- gid2:aid2:ext2:ver2:scope2\n" + "| \\- gid3:aid3:ext3:ver3\n" + "\\- gid4:aid4:ext4:ver4:scope4";
DependencyNode node = parser.parseLiteral(def);
assertNodeProperties(node, 1);
assertEquals(2, node.getChildren().size());
assertNodeProperties(node.getChildren().get(1), 4);
DependencyNode lvl1Node = node.getChildren().get(0);
assertNodeProperties(lvl1Node, 2);
assertEquals(1, lvl1Node.getChildren().size());
assertNodeProperties(lvl1Node.getChildren().get(0), 3);
}
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));
}
use of org.sonatype.aether.graph.DependencyNode in project sonatype-aether by sonatype.
the class DefaultDependencyCollectorTest method testCyclicDependencies.
@Test
public void testCyclicDependencies() throws Exception {
DependencyNode root = parser.parse("cycle.txt");
CollectRequest request = new CollectRequest(root.getDependency(), Arrays.asList(repository));
CollectResult result = collector.collectDependencies(session, request);
assertEqualSubtree(root, result.getRoot());
}
Aggregations