use of org.apache.archiva.maven.model.TreeEntry in project archiva by apache.
the class DependencyTreeBuilderTestMaven3 method testBuilderDependencies.
@Test
public void testBuilderDependencies() throws Exception {
List<TreeEntry> treeEntries = builder.buildDependencyTree(Collections.singletonList(TEST_REPO_ID), TEST_GROUP_ID, TEST_ARTIFACT_ID, TEST_VERSION);
Artifact artifact = new Artifact(TEST_GROUP_ID, TEST_ARTIFACT_ID, TEST_VERSION, "", "");
artifact.setFileExtension("jar");
assertThat(treeEntries).isNotNull().isNotEmpty().contains(new TreeEntry(artifact));
artifact = new Artifact("commons-lang", "commons-lang", "2.2", "compile", "");
artifact.setFileExtension("jar");
assertThat(treeEntries.get(0).getChilds()).isNotNull().isNotEmpty().contains(new TreeEntry(artifact));
}
use of org.apache.archiva.maven.model.TreeEntry in project archiva by apache.
the class TreeDependencyNodeVisitor method visitEnter.
@Override
public boolean visitEnter(DependencyNode dependencyNode) {
TreeEntry entry = new TreeEntry(getModelMapper().map(dependencyNode.getDependency().getArtifact(), Artifact.class));
entry.getArtifact().setFileExtension(dependencyNode.getDependency().getArtifact().getExtension());
entry.getArtifact().setScope(dependencyNode.getDependency().getScope());
entry.setParent(currentEntry);
currentEntry = entry;
if (firstDependencyNode == null) {
firstDependencyNode = dependencyNode;
treeEntries.add(currentEntry);
} else {
currentEntry.getParent().getChilds().add(currentEntry);
}
return true;
}