use of org.commonjava.maven.ext.core.ManipulationSession in project pom-manipulation-ext by release-engineering.
the class PropertiesUtilsTest method testUpdateNestedProperties3.
@Test
public void testUpdateNestedProperties3() throws Exception {
// io.hawt:project:1.4.9
final Model modelParent = TestUtils.resolveModelResource(RESOURCE_BASE, "project-1.4.9.pom");
Project pP = new Project(modelParent);
ManipulationSession session = createUpdateSession();
assertTrue(updateProperties(session, pP, false, "perfectus-build", "610379.redhat-1") == PropertiesUtils.PropertyUpdate.FOUND);
try {
assertTrue(updateProperties(session, pP, false, "perfectus-build", "610.NOTTHEVALUE.redhat-1") == PropertiesUtils.PropertyUpdate.FOUND);
} catch (ManipulationException e) {
e.printStackTrace();
// Pass.
}
try {
assertTrue(updateProperties(session, pP, true, "perfectus-build", "610.NOTTHEVALUE.redhat-1") == PropertiesUtils.PropertyUpdate.FOUND);
} catch (ManipulationException e) {
e.printStackTrace();
// Pass.
}
}
use of org.commonjava.maven.ext.core.ManipulationSession in project pom-manipulation-ext by release-engineering.
the class PropertiesUtilsTest method testUpdateProjectVersionProperty.
@Test
public void testUpdateProjectVersionProperty() throws Exception {
Project pP = getProject();
ManipulationSession session = createUpdateSession();
assertFalse(updateProperties(session, pP, false, "project.version", "5.0.4.Final-redhat-1") == PropertiesUtils.PropertyUpdate.FOUND);
}
use of org.commonjava.maven.ext.core.ManipulationSession in project pom-manipulation-ext by release-engineering.
the class CliTest method checkLocalRepositoryWithExplicitMavenRepo.
@Test
public void checkLocalRepositoryWithExplicitMavenRepo() throws Exception {
File folder = temp.newFolder();
Cli c = new Cli();
executeMethod(c, "run", new Object[] { new String[] { "-Dmaven.repo.local=" + folder.toString() } });
ManipulationSession session = (ManipulationSession) FieldUtils.readField(c, "session", true);
MavenSession ms = (MavenSession) FieldUtils.readField(session, "mavenSession", true);
assertTrue(ms.getRequest().getLocalRepository().getBasedir().equals(ms.getRequest().getLocalRepositoryPath().toString()));
}
use of org.commonjava.maven.ext.core.ManipulationSession in project pom-manipulation-ext by release-engineering.
the class CliTest method checkLocalRepositoryWithDefaults.
@Test
public void checkLocalRepositoryWithDefaults() throws Exception {
Cli c = new Cli();
File settings = writeSettings(temp.newFile());
executeMethod(c, "run", new Object[] { new String[] { "-s", settings.toString() } });
ManipulationSession session = (ManipulationSession) FieldUtils.readField(c, "session", true);
MavenSession ms = (MavenSession) FieldUtils.readField(session, "mavenSession", true);
assertTrue(ms.getRequest().getLocalRepository().getBasedir().equals(ms.getRequest().getLocalRepositoryPath().toString()));
assertTrue("File " + new File(ms.getRequest().getLocalRepository().getBasedir()).getParentFile().toString() + " was not equal to " + System.getProperty("user.home") + File.separatorChar + ".m2", new File(ms.getRequest().getLocalRepository().getBasedir()).getParentFile().toString().equals(System.getProperty("user.home") + File.separatorChar + ".m2"));
}
use of org.commonjava.maven.ext.core.ManipulationSession in project pom-manipulation-ext by release-engineering.
the class CliTest method checkTargetDefaultMatches.
@Test
public void checkTargetDefaultMatches() throws Exception {
Cli c = new Cli();
executeMethod(c, "run", new Object[] { new String[] {} });
ManipulationSession session = (ManipulationSession) FieldUtils.readField(c, "session", true);
File defaultTarget = (File) FieldUtils.readField(c, "target", true);
assertTrue("Session file should match", defaultTarget.equals(session.getPom()));
}
Aggregations