use of org.commonjava.maven.ext.common.model.Project in project pom-manipulation-ext by release-engineering.
the class PomIOTest method testGAVReturnPOMs.
@Test
public void testGAVReturnPOMs() throws Exception {
URL resource = PomIOTest.class.getResource(filename);
assertNotNull(resource);
File pom = new File(resource.getFile());
assertTrue(pom.exists());
File targetFile = folder.newFile("target.xml");
FileUtils.copyFile(pom, targetFile);
Model model = new Model();
model.setGroupId("org.commonjava.maven.ext.versioning.test");
model.setArtifactId("dospom");
model.setVersion("1.0");
model.setPackaging("pom");
model.setModelVersion("4.0.0");
Project p = new Project(targetFile, model);
p.setExecutionRoot();
HashSet<Project> changed = new HashSet<>();
changed.add(p);
GAV gav = pomIO.rewritePOMs(changed);
assertTrue(gav.version.equals("1.0"));
assertTrue(gav.groupId.equals("org.commonjava.maven.ext.versioning.test"));
assertTrue(gav.artifactId.equals("dospom"));
}
use of org.commonjava.maven.ext.common.model.Project in project pom-manipulation-ext by release-engineering.
the class PomIOTest method testRewritePOMs.
@Test
public void testRewritePOMs() throws Exception {
URL resource = PomIOTest.class.getResource(filename);
assertNotNull(resource);
File pom = new File(resource.getFile());
assertTrue(pom.exists());
File targetFile = folder.newFile("target.xml");
FileUtils.copyFile(pom, targetFile);
Model model = new Model();
model.setGroupId("org.commonjava.maven.ext.versioning.test");
model.setArtifactId("dospom");
model.setVersion("1.0");
model.setPackaging("pom");
model.setModelVersion("4.0.0");
Project p = new Project(targetFile, model);
HashSet<Project> changed = new HashSet<>();
changed.add(p);
pomIO.rewritePOMs(changed);
assertTrue(FileUtils.contentEqualsIgnoreEOL(pom, targetFile, "UTF-8"));
assertTrue(FileUtils.contentEquals(targetFile, pom));
}
use of org.commonjava.maven.ext.common.model.Project in project pom-manipulation-ext by release-engineering.
the class ProjectInheritanceTest method testVerifyExecutionRoot.
@Test
public void testVerifyExecutionRoot() 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/common/pom.xml");
PomIO pomIO = new PomIO();
List<Project> projects = pomIO.parseProject(projectroot);
for (Project p : projects) {
if (p.getKey().toString().equals("io.apiman:apiman-common:1.2.7-SNAPSHOT")) {
assertTrue(p.isExecutionRoot());
assertTrue(p.isInheritanceRoot());
} else {
assertFalse(p.isExecutionRoot());
assertFalse(p.isInheritanceRoot());
}
}
}
use of org.commonjava.maven.ext.common.model.Project in project pom-manipulation-ext by release-engineering.
the class ProjectInheritanceTest method testVerifyInheritance.
@Test
public void testVerifyInheritance() 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(), "pom.xml");
PomIO pomIO = new PomIO();
List<Project> projects = pomIO.parseProject(projectroot);
for (Project p : projects) {
if (!p.getPom().equals(projectroot)) {
assertTrue(p.getProjectParent().getPom().equals(projectroot));
}
}
}
use of org.commonjava.maven.ext.common.model.Project in project pom-manipulation-ext by release-engineering.
the class PropertyInterpolatorTest method testInteropolateDependencies.
@Test
public void testInteropolateDependencies() throws Exception {
final Model model = TestUtils.resolveModelResource(RESOURCE_BASE, "infinispan-bom-8.2.0.Final.pom");
Project project = new Project(model);
PropertyInterpolator pi = new PropertyInterpolator(project.getModel().getProperties(), project);
String nonInterp = "", interp = "";
// Explicitly calling the non-resolved model dependencies...
for (Dependency d : project.getModel().getDependencyManagement().getDependencies()) {
nonInterp += (d.getGroupId().equals("${project.groupId}") ? project.getGroupId() : d.getGroupId()) + ":" + (d.getArtifactId().equals("${project.artifactId}") ? project.getArtifactId() : d.getArtifactId()) + System.lineSeparator();
interp += pi.interp(d.getGroupId().equals("${project.groupId}") ? project.getGroupId() : d.getGroupId()) + ":" + pi.interp(d.getArtifactId().equals("${project.artifactId}") ? project.getArtifactId() : d.getArtifactId()) + System.lineSeparator();
}
assertTrue(nonInterp.contains("${"));
assertFalse(interp.contains("${"));
}
Aggregations