Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
public class MavenITmng7038RootdirTest extends AbstractMavenIntegrationTestCase {

public MavenITmng7038RootdirTest() {
super("[4.0.0-alpha-6,)");
super("[3.10.0,)");
}

@Test
Expand Down Expand Up @@ -58,42 +58,8 @@ public void testRootdir() throws IOException, VerificationException {
Boolean.TRUE.toString(),
props.getProperty("project.properties.activated"));

verifier.verifyFilePresent("module-a/target/pom.properties");
props = verifier.loadProperties("module-a/target/pom.properties");
assertEquals(
"project.properties.rootdir",
new File(testDir, "module-a").getAbsolutePath(),
props.getProperty("project.properties.rootdir"));
assertEquals(
"project.rootDirectory",
new File(testDir, "module-a").getAbsolutePath(),
props.getProperty("project.rootDirectory"));
assertEquals("session.topDirectory", testDir.getAbsolutePath(), props.getProperty("session.topDirectory"));
assertEquals("session.rootDirectory", testDir.getAbsolutePath(), props.getProperty("session.rootDirectory"));
assertEquals(
"project.properties.activated",
Boolean.FALSE.toString(),
props.getProperty("project.properties.activated"));

verifier.verifyFilePresent("module-a/module-a-1/target/pom.properties");
props = verifier.loadProperties("module-a/module-a-1/target/pom.properties");
assertEquals(
"project.properties.rootdir",
new File(testDir, "module-a").getAbsolutePath(),
props.getProperty("project.properties.rootdir"));
assertEquals(
"project.rootDirectory",
new File(testDir, "module-a").getAbsolutePath(),
props.getProperty("project.rootDirectory"));
assertEquals("session.topDirectory", testDir.getAbsolutePath(), props.getProperty("session.topDirectory"));
assertEquals("session.rootDirectory", testDir.getAbsolutePath(), props.getProperty("session.rootDirectory"));
assertEquals(
"project.properties.activated",
Boolean.FALSE.toString(),
props.getProperty("project.properties.activated"));

verifier.verifyFilePresent("module-b/target/pom.properties");
props = verifier.loadProperties("module-b/target/pom.properties");
verifier.verifyFilePresent("module/target/pom.properties");
props = verifier.loadProperties("module/target/pom.properties");
assertEquals(
"project.properties.rootdir",
testDir.getAbsolutePath(),
Expand All @@ -106,8 +72,8 @@ public void testRootdir() throws IOException, VerificationException {
Boolean.TRUE.toString(),
props.getProperty("project.properties.activated"));

verifier.verifyFilePresent("module-b/module-b-1/target/pom.properties");
props = verifier.loadProperties("module-b/module-b-1/target/pom.properties");
verifier.verifyFilePresent("module/module-1/target/pom.properties");
props = verifier.loadProperties("module/module-1/target/pom.properties");
assertEquals(
"project.properties.rootdir",
testDir.getAbsolutePath(),
Expand All @@ -122,67 +88,9 @@ public void testRootdir() throws IOException, VerificationException {
}

@Test
public void testRootdirWithTopdirAndRoot() throws IOException, VerificationException {
File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-7038-rootdir");
Verifier verifier = newVerifier(new File(testDir, "module-a").getAbsolutePath());

verifier.addCliArgument("validate");
verifier.execute();
verifier.verifyErrorFreeLog();

Properties props;

verifier.verifyFilePresent("target/pom.properties");
props = verifier.loadProperties("target/pom.properties");
assertEquals(
"project.properties.rootdir",
new File(testDir, "module-a").getAbsolutePath(),
props.getProperty("project.properties.rootdir"));
assertEquals(
"project.rootDirectory",
new File(testDir, "module-a").getAbsolutePath(),
props.getProperty("project.rootDirectory"));
assertEquals(
"session.topDirectory",
new File(testDir, "module-a").getAbsolutePath(),
props.getProperty("session.topDirectory"));
assertEquals(
"session.rootDirectory",
new File(testDir, "module-a").getAbsolutePath(),
props.getProperty("session.rootDirectory"));
assertEquals(
"project.properties.activated",
Boolean.FALSE.toString(),
props.getProperty("project.properties.activated"));

verifier.verifyFilePresent("module-a-1/target/pom.properties");
props = verifier.loadProperties("module-a-1/target/pom.properties");
assertEquals(
"project.properties.rootdir",
new File(testDir, "module-a").getAbsolutePath(),
props.getProperty("project.properties.rootdir"));
assertEquals(
"project.rootDirectory",
new File(testDir, "module-a").getAbsolutePath(),
props.getProperty("project.rootDirectory"));
assertEquals(
"session.topDirectory",
new File(testDir, "module-a").getAbsolutePath(),
props.getProperty("session.topDirectory"));
assertEquals(
"session.rootDirectory",
new File(testDir, "module-a").getAbsolutePath(),
props.getProperty("session.rootDirectory"));
assertEquals(
"project.properties.activated",
Boolean.FALSE.toString(),
props.getProperty("project.properties.activated"));
}

@Test
public void testRootdirWithTopdirAndNoRoot() throws IOException, VerificationException {
public void testRootdirWithTopdir() throws IOException, VerificationException {
File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-7038-rootdir");
Verifier verifier = newVerifier(new File(testDir, "module-b").getAbsolutePath());
Verifier verifier = newVerifier(new File(testDir, "module").getAbsolutePath());

verifier.addCliArgument("validate");
verifier.execute();
Expand All @@ -199,24 +107,24 @@ public void testRootdirWithTopdirAndNoRoot() throws IOException, VerificationExc
assertEquals("project.rootDirectory", testDir.getAbsolutePath(), props.getProperty("project.rootDirectory"));
assertEquals(
"session.topDirectory",
new File(testDir, "module-b").getAbsolutePath(),
new File(testDir, "module").getAbsolutePath(),
props.getProperty("session.topDirectory"));
assertEquals("session.rootDirectory", testDir.getAbsolutePath(), props.getProperty("session.rootDirectory"));
assertEquals(
"project.properties.activated",
Boolean.TRUE.toString(),
props.getProperty("project.properties.activated"));

verifier.verifyFilePresent("module-b-1/target/pom.properties");
props = verifier.loadProperties("module-b-1/target/pom.properties");
verifier.verifyFilePresent("module-1/target/pom.properties");
props = verifier.loadProperties("module-1/target/pom.properties");
assertEquals(
"project.properties.rootdir",
testDir.getAbsolutePath(),
props.getProperty("project.properties.rootdir"));
assertEquals("project.rootDirectory", testDir.getAbsolutePath(), props.getProperty("project.rootDirectory"));
assertEquals(
"session.topDirectory",
new File(testDir, "module-b").getAbsolutePath(),
new File(testDir, "module").getAbsolutePath(),
props.getProperty("session.topDirectory"));
assertEquals("session.rootDirectory", testDir.getAbsolutePath(), props.getProperty("session.rootDirectory"));
assertEquals(
Expand Down
36 changes: 0 additions & 36 deletions core-it-suite/src/test/resources/mng-7038-rootdir/module-a/pom.xml

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ under the License.

<parent>
<groupId>org.apache.maven.its.mng7038</groupId>
<artifactId>module-a</artifactId>
<artifactId>module</artifactId>
<version>1.0</version>
</parent>

<artifactId>module-a-1</artifactId>
<artifactId>module-1</artifactId>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ under the License.
<version>1.0</version>
</parent>

<artifactId>module-b</artifactId>
<artifactId>module</artifactId>

<packaging>pom</packaging>

<modules>
<module>module-b-1</module>
<module>module-1</module>
</modules>

</project>
6 changes: 3 additions & 3 deletions core-it-suite/src/test/resources/mng-7038-rootdir/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ under the License.
<description>Test project.rootDirectory, session.topDirectory and session.rootDirectory properties.</description>

<modules>
<module>module-a</module>
<module>module-b</module>
<module>module</module>
</modules>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<rootdir>${project.rootDirectory}</rootdir>
<bsedir>${project.basedir}</bsedir>
<activated>false</activated>
</properties>

Expand Down Expand Up @@ -74,7 +74,7 @@ under the License.
<id>rootdir-profile-activation</id>
<activation>
<file>
<exists>${rootDirectory}/.mvn/.gitkeep</exists>
<exists>${project.rootDirectory}/.mvn/.gitkeep</exists>
</file>
</activation>
<properties>
Expand Down