diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java b/its/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java index 4ec89918dd..16f4e0aa08 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java @@ -86,6 +86,7 @@ public class IntegrationTestSuite // suite.addTestSuite( MavenIT0109ReleaseUpdateTest.class ); // suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137 + suite.addTestSuite( MavenITmng4318ProjectExecutionRootTest.class ); suite.addTestSuite( MavenITmng4317PluginVersionResolutionFromMultiReposTest.class ); suite.addTestSuite( MavenITmng4314DirectInvocationOfAggregatorTest.class ); suite.addTestSuite( MavenITmng4312TypeAwarePluginParameterExpressionInjectionTest.class ); diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4318ProjectExecutionRootTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4318ProjectExecutionRootTest.java new file mode 100644 index 0000000000..234f50e614 --- /dev/null +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4318ProjectExecutionRootTest.java @@ -0,0 +1,75 @@ +package org.apache.maven.it; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.it.Verifier; +import org.apache.maven.it.util.ResourceExtractor; + +import java.io.File; +import java.util.Properties; + +/** + * This is a test set for MNG-4318. + * + * @author Benjamin Bentmann + */ +public class MavenITmng4318ProjectExecutionRootTest + extends AbstractMavenIntegrationTestCase +{ + + public MavenITmng4318ProjectExecutionRootTest() + { + super( ALL_MAVEN_VERSIONS ); + } + + /** + * Verify that MavenProject.isExecutionRoot() is properly set within a reactor. + */ + public void testit() + throws Exception + { + File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4318" ); + + Verifier verifier = new Verifier( testDir.getAbsolutePath() ); + verifier.setAutoclean( false ); + verifier.deleteDirectory( "target" ); + verifier.deleteDirectory( "sub-1/target" ); + verifier.deleteDirectory( "sub-2/target" ); + verifier.deleteDirectory( "sub-2/sub-3/target" ); + verifier.executeGoal( "validate" ); + verifier.verifyErrorFreeLog(); + verifier.resetStreams(); + + Properties props; + + props = verifier.loadProperties( "target/project.properties" ); + assertEquals( "true", props.getProperty( "project.executionRoot" ) ); + + props = verifier.loadProperties( "sub-1/target/project.properties" ); + assertEquals( "false", props.getProperty( "project.executionRoot" ) ); + + props = verifier.loadProperties( "sub-2/target/project.properties" ); + assertEquals( "false", props.getProperty( "project.executionRoot" ) ); + + props = verifier.loadProperties( "sub-2/sub-3/target/project.properties" ); + assertEquals( "false", props.getProperty( "project.executionRoot" ) ); + } + +} diff --git a/its/core-it-suite/src/test/resources/mng-4318/pom.xml b/its/core-it-suite/src/test/resources/mng-4318/pom.xml new file mode 100644 index 0000000000..e3c09d496e --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-4318/pom.xml @@ -0,0 +1,64 @@ + + + + + + 4.0.0 + + org.apache.maven.its.mng4318 + root + 0.1 + pom + + Maven Integration Test :: MNG-4318 + + Verify that MavenProject.isExecutionRoot() is properly set within a reactor. + + + + sub-1 + sub-2 + + + + + + org.apache.maven.its.plugins + maven-it-plugin-expression + 2.1-SNAPSHOT + + target/project.properties + + project/executionRoot + + + + + test + validate + + eval + + + + + + + diff --git a/its/core-it-suite/src/test/resources/mng-4318/sub-1/pom.xml b/its/core-it-suite/src/test/resources/mng-4318/sub-1/pom.xml new file mode 100644 index 0000000000..846ad937dc --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-4318/sub-1/pom.xml @@ -0,0 +1,40 @@ + + + + + + 4.0.0 + + + org.apache.maven.its.mng4318 + root + 0.1 + + + org.apache.maven.its.mng4318 + sub-1 + 0.1 + jar + + Maven Integration Test :: MNG-4318 :: Sub-1 + + Verify that MavenProject.isExecutionRoot() is properly set within a reactor. + + diff --git a/its/core-it-suite/src/test/resources/mng-4318/sub-2/pom.xml b/its/core-it-suite/src/test/resources/mng-4318/sub-2/pom.xml new file mode 100644 index 0000000000..d0a6136cf4 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-4318/sub-2/pom.xml @@ -0,0 +1,44 @@ + + + + + + 4.0.0 + + + org.apache.maven.its.mng4318 + root + 0.1 + + + org.apache.maven.its.mng4318 + sub-2 + 0.1 + pom + + Maven Integration Test :: MNG-4318 :: Sub-2 + + Verify that MavenProject.isExecutionRoot() is properly set within a reactor. + + + + sub-3 + + diff --git a/its/core-it-suite/src/test/resources/mng-4318/sub-2/sub-3/pom.xml b/its/core-it-suite/src/test/resources/mng-4318/sub-2/sub-3/pom.xml new file mode 100644 index 0000000000..6dab4983af --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-4318/sub-2/sub-3/pom.xml @@ -0,0 +1,40 @@ + + + + + + 4.0.0 + + + org.apache.maven.its.mng4318 + sub-2 + 0.1 + + + org.apache.maven.its.mng4318 + sub-3 + 0.1 + jar + + Maven Integration Test :: MNG-4318 :: Sub-3 + + Verify that MavenProject.isExecutionRoot() is properly set within a reactor. + +