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 345929fa9a..0852621fd8 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 @@ -151,6 +151,9 @@ MavenITmng3645POMSyntaxErrorTest suite.addTestSuite( MavenITmng1491ReactorArtifactIdCollision.class ); suite.addTestSuite( MavenITmng1412DependenciesOrderTest.class ); suite.addTestSuite( MavenITmng0469Test.class ); + suite.addTestSuite( MavenIT0141Test.class ); + suite.addTestSuite( MavenIT0140Test.class ); + suite.addTestSuite( MavenIT0139Test.class ); suite.addTestSuite( MavenIT0138PluginLifecycleTest.class ); suite.addTestSuite( MavenIT0137EarLifecycleTest.class ); suite.addTestSuite( MavenIT0136RarLifecycleTest.class ); diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0139Test.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0139Test.java new file mode 100644 index 0000000000..81c8de3170 --- /dev/null +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0139Test.java @@ -0,0 +1,85 @@ +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; + +/** + * + * @author Benjamin Bentmann + * @version $Id$ + */ +public class MavenIT0139Test + extends AbstractMavenIntegrationTestCase +{ + + /** + * Test that expressions of the form ${project.*} resolve correctly to POM values. + */ + public void testit0139() + throws Exception + { + File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/it0139" ); + File child = new File( testDir, "child" ); + + Verifier verifier = new Verifier( child.getAbsolutePath() ); + verifier.executeGoal( "initialize" ); + verifier.verifyErrorFreeLog(); + verifier.resetStreams(); + + Properties props = verifier.loadProperties( "target/interpolated.properties" ); + String prefix = "project.properties."; + + assertEquals( child.getCanonicalFile(), new File( props.getProperty( prefix + "projectDir" ) ).getCanonicalFile() ); + + assertEquals( "org.apache.maven.its.it0139.child", props.getProperty( prefix + "projectGroupId" ) ); + assertEquals( "child", props.getProperty( prefix + "projectArtifactId" ) ); + assertEquals( "2.0-alpha-1", props.getProperty( prefix + "projectVersion" ) ); + assertEquals( "jar", props.getProperty( prefix + "projectPackaging" ) ); + + assertEquals( "child-name", props.getProperty( prefix + "projectName" ) ); + assertEquals( "child-desc", props.getProperty( prefix + "projectDesc" ) ); + assertEquals( "http://child.org/", props.getProperty( prefix + "projectUrl" ) ); + assertEquals( "2008", props.getProperty( prefix + "projectYear" ) ); + assertEquals( "child-org-name", props.getProperty( prefix + "projectOrgName" ) ); + + assertEquals( "2.0.0", props.getProperty( prefix + "projectPrereqMvn" ) ); + assertEquals( "http://scm.org/", props.getProperty( prefix + "projectScmUrl" ) ); + assertEquals( "http://issue.org/", props.getProperty( prefix + "projectIssueUrl" ) ); + assertEquals( "http://ci.org/", props.getProperty( prefix + "projectCiUrl" ) ); + assertEquals( "child-dist-repo", props.getProperty( prefix + "projectDistRepoName" ) ); + + assertEquals( "org.apache.maven.its.it0139", props.getProperty( prefix + "parentGroupId" ) ); + assertEquals( "parent", props.getProperty( prefix + "parentArtifactId" ) ); + assertEquals( "1.0", props.getProperty( prefix + "parentVersion" ) ); + + /* + * NOTE: We intentionally do not check whether the build paths have been basedir aligned, that's another + * story... + */ + assertTrue( props.getProperty( prefix + "projectBuildOut" ).endsWith( "bin" ) ); + assertTrue( props.getProperty( prefix + "projectSiteOut" ).endsWith( "doc" ) ); + } + +} diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0140Test.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0140Test.java new file mode 100644 index 0000000000..4b7ddc82ab --- /dev/null +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0140Test.java @@ -0,0 +1,85 @@ +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; + +/** + * + * @author Benjamin Bentmann + * @version $Id$ + */ +public class MavenIT0140Test + extends AbstractMavenIntegrationTestCase +{ + + /** + * Test that expressions of the form ${pom.*} resolve correctly to POM values. + */ + public void testit0140() + throws Exception + { + File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/it0140" ); + File child = new File( testDir, "child" ); + + Verifier verifier = new Verifier( child.getAbsolutePath() ); + verifier.executeGoal( "initialize" ); + verifier.verifyErrorFreeLog(); + verifier.resetStreams(); + + Properties props = verifier.loadProperties( "target/interpolated.properties" ); + String prefix = "project.properties."; + + assertEquals( child.getCanonicalFile(), new File( props.getProperty( prefix + "projectDir" ) ).getCanonicalFile() ); + + assertEquals( "org.apache.maven.its.it0140.child", props.getProperty( prefix + "projectGroupId" ) ); + assertEquals( "child", props.getProperty( prefix + "projectArtifactId" ) ); + assertEquals( "2.0-alpha-1", props.getProperty( prefix + "projectVersion" ) ); + assertEquals( "jar", props.getProperty( prefix + "projectPackaging" ) ); + + assertEquals( "child-name", props.getProperty( prefix + "projectName" ) ); + assertEquals( "child-desc", props.getProperty( prefix + "projectDesc" ) ); + assertEquals( "http://child.org/", props.getProperty( prefix + "projectUrl" ) ); + assertEquals( "2008", props.getProperty( prefix + "projectYear" ) ); + assertEquals( "child-org-name", props.getProperty( prefix + "projectOrgName" ) ); + + assertEquals( "2.0.0", props.getProperty( prefix + "projectPrereqMvn" ) ); + assertEquals( "http://scm.org/", props.getProperty( prefix + "projectScmUrl" ) ); + assertEquals( "http://issue.org/", props.getProperty( prefix + "projectIssueUrl" ) ); + assertEquals( "http://ci.org/", props.getProperty( prefix + "projectCiUrl" ) ); + assertEquals( "child-dist-repo", props.getProperty( prefix + "projectDistRepoName" ) ); + + assertEquals( "org.apache.maven.its.it0140", props.getProperty( prefix + "parentGroupId" ) ); + assertEquals( "parent", props.getProperty( prefix + "parentArtifactId" ) ); + assertEquals( "1.0", props.getProperty( prefix + "parentVersion" ) ); + + /* + * NOTE: We intentionally do not check whether the build paths have been basedir aligned, that's another + * story... + */ + assertTrue( props.getProperty( prefix + "projectBuildOut" ).endsWith( "bin" ) ); + assertTrue( props.getProperty( prefix + "projectSiteOut" ).endsWith( "doc" ) ); + } + +} diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0141Test.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0141Test.java new file mode 100644 index 0000000000..7523bc03a2 --- /dev/null +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenIT0141Test.java @@ -0,0 +1,85 @@ +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; + +/** + * + * @author Benjamin Bentmann + * @version $Id$ + */ +public class MavenIT0141Test + extends AbstractMavenIntegrationTestCase +{ + + /** + * Test that expressions of the form ${*} resolve correctly to POM values (ugly but real). + */ + public void testit0141() + throws Exception + { + File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/it0141" ); + File child = new File( testDir, "child" ); + + Verifier verifier = new Verifier( child.getAbsolutePath() ); + verifier.executeGoal( "initialize" ); + verifier.verifyErrorFreeLog(); + verifier.resetStreams(); + + Properties props = verifier.loadProperties( "target/interpolated.properties" ); + String prefix = "project.properties."; + + assertEquals( child.getCanonicalFile(), new File( props.getProperty( prefix + "projectDir" ) ).getCanonicalFile() ); + + assertEquals( "org.apache.maven.its.it0141.child", props.getProperty( prefix + "projectGroupId" ) ); + assertEquals( "child", props.getProperty( prefix + "projectArtifactId" ) ); + assertEquals( "2.0-alpha-1", props.getProperty( prefix + "projectVersion" ) ); + assertEquals( "jar", props.getProperty( prefix + "projectPackaging" ) ); + + assertEquals( "child-name", props.getProperty( prefix + "projectName" ) ); + assertEquals( "child-desc", props.getProperty( prefix + "projectDesc" ) ); + assertEquals( "http://child.org/", props.getProperty( prefix + "projectUrl" ) ); + assertEquals( "2008", props.getProperty( prefix + "projectYear" ) ); + assertEquals( "child-org-name", props.getProperty( prefix + "projectOrgName" ) ); + + assertEquals( "2.0.0", props.getProperty( prefix + "projectPrereqMvn" ) ); + assertEquals( "http://scm.org/", props.getProperty( prefix + "projectScmUrl" ) ); + assertEquals( "http://issue.org/", props.getProperty( prefix + "projectIssueUrl" ) ); + assertEquals( "http://ci.org/", props.getProperty( prefix + "projectCiUrl" ) ); + assertEquals( "child-dist-repo", props.getProperty( prefix + "projectDistRepoName" ) ); + + assertEquals( "org.apache.maven.its.it0141", props.getProperty( prefix + "parentGroupId" ) ); + assertEquals( "parent", props.getProperty( prefix + "parentArtifactId" ) ); + assertEquals( "1.0", props.getProperty( prefix + "parentVersion" ) ); + + /* + * NOTE: We intentionally do not check whether the build paths have been basedir aligned, that's another + * story... + */ + assertTrue( props.getProperty( prefix + "projectBuildOut" ).endsWith( "bin" ) ); + assertTrue( props.getProperty( prefix + "projectSiteOut" ).endsWith( "doc" ) ); + } + +} diff --git a/its/core-it-suite/src/test/resources/it0139/child/pom.xml b/its/core-it-suite/src/test/resources/it0139/child/pom.xml new file mode 100644 index 0000000000..f566a34ed7 --- /dev/null +++ b/its/core-it-suite/src/test/resources/it0139/child/pom.xml @@ -0,0 +1,118 @@ + + + + + + 4.0.0 + + + org.apache.maven.its.it0139 + parent + 1.0 + + + org.apache.maven.its.it0139.child + child + 2.0-alpha-1 + jar + + child-name + child-desc + http://child.org/ + 2008 + + child-org-name + + + + 2.0.0 + + + + http://scm.org/ + + + http://issue.org/ + + + http://ci.org/ + + + + maven-core-it + child-dist-repo + http://dist.org/ + + + + + + ${basedir} + ${project.groupId} + ${project.artifactId} + ${project.version} + ${project.packaging} + ${project.name} + ${project.description} + ${project.url} + ${project.inceptionYear} + ${project.organization.name} + ${project.prerequisites.maven} + ${project.scm.url} + ${project.issueManagement.url} + ${project.ciManagement.url} + ${project.distributionManagement.repository.name} + ${project.build.outputDirectory} + ${project.reporting.outputDirectory} + ${project.parent.groupId} + ${project.parent.artifactId} + ${project.parent.version} + + + + target/bin + + + org.apache.maven.its.plugins + maven-it-plugin-expression + 2.1-SNAPSHOT + + + initialize + + eval + + + target/interpolated.properties + + project/properties + + + + + + + + + + target/doc + + + diff --git a/its/core-it-suite/src/test/resources/it0139/pom.xml b/its/core-it-suite/src/test/resources/it0139/pom.xml new file mode 100644 index 0000000000..41e8674003 --- /dev/null +++ b/its/core-it-suite/src/test/resources/it0139/pom.xml @@ -0,0 +1,36 @@ + + + + + + 4.0.0 + + org.apache.maven.its.it0139 + parent + 1.0 + pom + + Maven Integration Test :: it0139 + Test POM interpolation with expressions of the form $ { project.* } + + + parent/child + + diff --git a/its/core-it-suite/src/test/resources/it0140/child/pom.xml b/its/core-it-suite/src/test/resources/it0140/child/pom.xml new file mode 100644 index 0000000000..30230a3831 --- /dev/null +++ b/its/core-it-suite/src/test/resources/it0140/child/pom.xml @@ -0,0 +1,118 @@ + + + + + + 4.0.0 + + + org.apache.maven.its.it0140 + parent + 1.0 + + + org.apache.maven.its.it0140.child + child + 2.0-alpha-1 + jar + + child-name + child-desc + http://child.org/ + 2008 + + child-org-name + + + + 2.0.0 + + + + http://scm.org/ + + + http://issue.org/ + + + http://ci.org/ + + + + maven-core-it + child-dist-repo + http://dist.org/ + + + + + + ${basedir} + ${pom.groupId} + ${pom.artifactId} + ${pom.version} + ${pom.packaging} + ${pom.name} + ${pom.description} + ${pom.url} + ${pom.inceptionYear} + ${pom.organization.name} + ${pom.prerequisites.maven} + ${pom.scm.url} + ${pom.issueManagement.url} + ${pom.ciManagement.url} + ${pom.distributionManagement.repository.name} + ${pom.build.outputDirectory} + ${pom.reporting.outputDirectory} + ${pom.parent.groupId} + ${pom.parent.artifactId} + ${pom.parent.version} + + + + target/bin + + + org.apache.maven.its.plugins + maven-it-plugin-expression + 2.1-SNAPSHOT + + + initialize + + eval + + + target/interpolated.properties + + project/properties + + + + + + + + + + target/doc + + + diff --git a/its/core-it-suite/src/test/resources/it0140/pom.xml b/its/core-it-suite/src/test/resources/it0140/pom.xml new file mode 100644 index 0000000000..65252594c3 --- /dev/null +++ b/its/core-it-suite/src/test/resources/it0140/pom.xml @@ -0,0 +1,36 @@ + + + + + + 4.0.0 + + org.apache.maven.its.it0140 + parent + 1.0 + pom + + Maven Integration Test :: it0140 + Test POM interpolation with expressions of the form $ { pom.* } + + + parent/child + + diff --git a/its/core-it-suite/src/test/resources/it0141/child/pom.xml b/its/core-it-suite/src/test/resources/it0141/child/pom.xml new file mode 100644 index 0000000000..4083e76c6b --- /dev/null +++ b/its/core-it-suite/src/test/resources/it0141/child/pom.xml @@ -0,0 +1,118 @@ + + + + + + 4.0.0 + + + org.apache.maven.its.it0141 + parent + 1.0 + + + org.apache.maven.its.it0141.child + child + 2.0-alpha-1 + jar + + child-name + child-desc + http://child.org/ + 2008 + + child-org-name + + + + 2.0.0 + + + + http://scm.org/ + + + http://issue.org/ + + + http://ci.org/ + + + + maven-core-it + child-dist-repo + http://dist.org/ + + + + + + ${basedir} + ${groupId} + ${artifactId} + ${version} + ${packaging} + ${name} + ${description} + ${url} + ${inceptionYear} + ${organization.name} + ${prerequisites.maven} + ${scm.url} + ${issueManagement.url} + ${ciManagement.url} + ${distributionManagement.repository.name} + ${build.outputDirectory} + ${reporting.outputDirectory} + ${parent.groupId} + ${parent.artifactId} + ${parent.version} + + + + target/bin + + + org.apache.maven.its.plugins + maven-it-plugin-expression + 2.1-SNAPSHOT + + + initialize + + eval + + + target/interpolated.properties + + project/properties + + + + + + + + + + target/doc + + + diff --git a/its/core-it-suite/src/test/resources/it0141/pom.xml b/its/core-it-suite/src/test/resources/it0141/pom.xml new file mode 100644 index 0000000000..75074e4801 --- /dev/null +++ b/its/core-it-suite/src/test/resources/it0141/pom.xml @@ -0,0 +1,36 @@ + + + + + + 4.0.0 + + org.apache.maven.its.it0141 + parent + 1.0 + pom + + Maven Integration Test :: it0141 + Test POM interpolation with expressions of the form $ { * } (ugly but real) + + + parent/child + +