use of aQute.bnd.maven.support.Pom.Dependency in project bnd by bndtools.
the class MavenTest method testProjectPom.
/**
* Test parsing a project pom
*
* @throws Exception
*/
public static void testProjectPom() throws Exception {
Maven maven = new Maven(null);
ProjectPom pom = maven.createProjectModel(IO.getFile(cwd, "testresources/ws/maven1/testpom.xml"));
assertEquals("artifact", pom.getArtifactId());
assertEquals("group-parent", pom.getGroupId());
assertEquals("1.0.0", pom.getVersion());
assertEquals("Artifact", pom.getName());
assertEquals("Parent Description\n\nDescription artifact", pom.getDescription());
List<Dependency> dependencies = pom.getDependencies();
// dep1
boolean dep1 = false;
// artifact (after macro)
boolean dep2 = false;
// junit
boolean dep3 = false;
// easymock
boolean dep4 = false;
for (Dependency dep : dependencies) {
String artifactId = dep.getArtifactId();
if ("dep1".equals(artifactId)) {
assertFalse(dep1);
dep1 = true;
assertEquals("xyz", dep.getGroupId());
assertEquals("1.0.1", dep.getVersion());
assertEquals(Pom.Scope.valueOf("compile"), dep.getScope());
} else if ("artifact".equals(artifactId)) {
assertFalse(dep2);
dep2 = true;
assertEquals("group-parent", dep.getGroupId());
assertEquals("1.0.2", dep.getVersion());
assertEquals(Pom.Scope.valueOf("compile"), dep.getScope());
} else if ("junit".equals(artifactId)) {
assertFalse(dep3);
dep3 = true;
assertEquals("junit", dep.getGroupId());
assertEquals("4.0", dep.getVersion());
assertEquals(Pom.Scope.valueOf("test"), dep.getScope());
} else if ("easymock".equals(artifactId)) {
assertFalse(dep4);
dep4 = true;
assertEquals("org.easymock", dep.getGroupId());
assertEquals("2.4", dep.getVersion());
assertEquals(Pom.Scope.valueOf("compile"), dep.getScope());
} else
fail("'" + artifactId + "'");
}
assertTrue(dep1 && dep2 && dep3 && dep4);
assertEquals("aa", pom.getProperty("a"));
assertEquals("b from parent", pom.getProperty("b"));
assertEquals("aab from parentartifact", pom.getProperty("c"));
}
Aggregations