use of org.commonjava.maven.ext.io.PomIO in project pom-manipulation-ext by release-engineering.
the class ProjectInheritanceTest method testVerifyInheritanceReversedMultiple.
@Test
public void testVerifyInheritanceReversedMultiple() throws Exception {
// Locate the PME project pom file. Use that to verify inheritance tracking.
final File projectroot = new File(TestUtils.resolveFileResource(RESOURCE_BASE, "").getParentFile().getParentFile().getParentFile().getParentFile(), "integration-test/src/it/project-inheritance/pom.xml");
PomIO pomIO = new PomIO();
List<Project> projects = pomIO.parseProject(projectroot);
for (int i = 0; i <= 3; i++) {
if (i == 0) {
// First project should be root
assertTrue(projects.get(i).getProjectParent() == null);
assertTrue(projects.get(i).getPom().equals(projectroot));
assertTrue(projects.get(i).getReverseInheritedList().size() == 1);
} else if (i == 1) {
List<Project> inherited = projects.get(i).getReverseInheritedList();
assertTrue(inherited.size() == 2);
assertTrue(inherited.get(0).getProjectParent().getPom().equals(projectroot));
} else if (i == 2) {
List<Project> inherited = projects.get(i).getReverseInheritedList();
assertTrue(inherited.size() == 3);
assertTrue(inherited.get(2).getPom().equals(projectroot));
}
}
}
use of org.commonjava.maven.ext.io.PomIO in project pom-manipulation-ext by release-engineering.
the class ProjectInheritanceTest method testVerifyProjectVersion.
@Test
public void testVerifyProjectVersion() throws Exception {
final ManipulationSession session = new ManipulationSession();
final File projectroot = new File(TestUtils.resolveFileResource(RESOURCE_BASE, "").getParentFile().getParentFile().getParentFile().getParentFile(), "integration-test/src/it/project-inheritance/pom.xml");
PomIO pomIO = new PomIO();
List<Project> projects = pomIO.parseProject(projectroot);
for (Project p : projects) {
if (p.getPom().equals(projectroot)) {
HashMap<ArtifactRef, Dependency> deps = p.getResolvedManagedDependencies(session);
for (ArtifactRef a : deps.keySet()) {
assertFalse(a.getVersionString().contains("project.version"));
}
deps = p.getResolvedDependencies(session);
assertTrue(deps.size() == 1);
for (ArtifactRef a : deps.keySet()) {
assertFalse(a.getVersionString().contains("project.version"));
}
assertFalse(deps.containsKey("org.mockito:mockito-all:jar:*"));
deps = p.getAllResolvedDependencies(session);
assertTrue(deps.size() == 3);
for (ArtifactRef a : deps.keySet()) {
assertFalse(a.getVersionString().contains("project.version"));
if (a.getGroupId().equals("org.mockito")) {
assertTrue(a.getVersionString().contains("*"));
}
}
assertTrue(deps.containsKey(SimpleArtifactRef.parse("org.mockito:mockito-all:jar:*")));
}
}
}
use of org.commonjava.maven.ext.io.PomIO in project pom-manipulation-ext by release-engineering.
the class ProjectInheritanceTest method testVerifyRelativeExecutionRoot.
@Test
public void testVerifyRelativeExecutionRoot() throws Exception {
final File projectRoot = new File(System.getProperty("user.dir") + "/pom.xml");
Path root = Paths.get(projectRoot.getParent());
Path absolute = Paths.get(projectRoot.toString());
Path relative = root.relativize(absolute);
PomIO pomIO = new PomIO();
List<Project> projects = pomIO.parseProject(relative.toFile());
assertTrue(projects.size() == 1);
assertTrue(projects.get(0).isExecutionRoot());
}
Aggregations