Author: jdcasey Date: Mon Jun 16 08:09:10 2008 New Revision: 668185 URL: http://svn.apache.org/viewvc?rev=668185&view=rev Log: Adding integration tests for MNG-3536, MNG-3535, MNG-3475, MNG-2562.
Added: maven/core-integration-testing/trunk/core-integration-testing-plugins/maven-it-plugin-project-interpolation/src/main/java/org/apache/maven/plugin/coreit/PropertyInterpolationVerifierMojo.java (with props) maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng2562Timestamp.java (with props) maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3475BaseAlignedDir.java (with props) maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3535SelfReferentialProperties.java (with props) maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3536AppendedAbsolutePaths.java (with props) maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-2562-timestamp/ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-2562-timestamp/pom.xml (with props) maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3475-baseAlignedDir/ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3475-baseAlignedDir/plugin/ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3475-baseAlignedDir/plugin/pom.xml (with props) maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3475-baseAlignedDir/plugin/src/ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3475-baseAlignedDir/plugin/src/main/ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3475-baseAlignedDir/plugin/src/main/java/ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3475-baseAlignedDir/plugin/src/main/java/test/ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3475-baseAlignedDir/plugin/src/main/java/test/Mojo3475.java (with props) maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3475-baseAlignedDir/pom.xml (with props) maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3475-baseAlignedDir/project/ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3475-baseAlignedDir/project/pom.xml (with props) maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3535-selfReferentialProperties/ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3535-selfReferentialProperties/pom.xml (with props) maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3536-appendedAbsolutePaths/ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3536-appendedAbsolutePaths/plugin/ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3536-appendedAbsolutePaths/plugin/pom.xml (with props) maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3536-appendedAbsolutePaths/plugin/src/ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3536-appendedAbsolutePaths/plugin/src/main/ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3536-appendedAbsolutePaths/plugin/src/main/java/ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3536-appendedAbsolutePaths/plugin/src/main/java/plugin/ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3536-appendedAbsolutePaths/plugin/src/main/java/plugin/Mojo3563.java (with props) maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3536-appendedAbsolutePaths/pom.xml (with props) maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3536-appendedAbsolutePaths/project/ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3536-appendedAbsolutePaths/project/pom.xml (with props) maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3536-appendedAbsolutePaths/project/src/ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3536-appendedAbsolutePaths/project/src/main/ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3536-appendedAbsolutePaths/project/src/main/java/ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3536-appendedAbsolutePaths/project/src/main/java/plugin/ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3536-appendedAbsolutePaths/project/src/main/java/plugin/Mojo3563.java (with props) Modified: maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/IntegrationTestSuite.java Added: maven/core-integration-testing/trunk/core-integration-testing-plugins/maven-it-plugin-project-interpolation/src/main/java/org/apache/maven/plugin/coreit/PropertyInterpolationVerifierMojo.java URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-testing-plugins/maven-it-plugin-project-interpolation/src/main/java/org/apache/maven/plugin/coreit/PropertyInterpolationVerifierMojo.java?rev=668185&view=auto ============================================================================== --- maven/core-integration-testing/trunk/core-integration-testing-plugins/maven-it-plugin-project-interpolation/src/main/java/org/apache/maven/plugin/coreit/PropertyInterpolationVerifierMojo.java (added) +++ maven/core-integration-testing/trunk/core-integration-testing-plugins/maven-it-plugin-project-interpolation/src/main/java/org/apache/maven/plugin/coreit/PropertyInterpolationVerifierMojo.java Mon Jun 16 08:09:10 2008 @@ -0,0 +1,58 @@ +package org.apache.maven.plugin.coreit; + +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.project.MavenProject; +import org.apache.maven.model.Model; + +import java.io.File; +import java.util.Properties; +import java.util.Iterator; +import java.util.Map; +import java.util.Enumeration; + +/** + * @goal verify-property + * @phase validate + */ +public class PropertyInterpolationVerifierMojo extends AbstractMojo { + + /** + * @parameter expression="${project}" + */ + private MavenProject project; + + /** + * @parameter expression="${buildSourceDirectory}" + */ + private File buildSourceDirectory; + + /** + * @parameter expression="${properties}" + */ + private Properties properties; + + + public void execute() throws MojoExecutionException, MojoFailureException { + Model model = project.getModel(); + if (properties == null) { + return; + } + + Enumeration e = properties.propertyNames(); + while (e.hasMoreElements()) { + String name = (String) e.nextElement(); + String value = properties.getProperty(name); + if(!value.equals(model.getProperties().getProperty(name))) { + throw new MojoExecutionException("Properties do not match: Name = " + name + ", Value = " + value); + } + + if(value.indexOf("${") > -1) { + throw new MojoExecutionException("Unresolved value: Name = " + name + ", Value = " + value); + } + + getLog().info("Property match: Name = " + name + ", Value = " + value); + } + } +} Propchange: maven/core-integration-testing/trunk/core-integration-testing-plugins/maven-it-plugin-project-interpolation/src/main/java/org/apache/maven/plugin/coreit/PropertyInterpolationVerifierMojo.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/core-integration-testing/trunk/core-integration-testing-plugins/maven-it-plugin-project-interpolation/src/main/java/org/apache/maven/plugin/coreit/PropertyInterpolationVerifierMojo.java ------------------------------------------------------------------------------ svn:keywords = "Author Date Id Revision" Modified: maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/IntegrationTestSuite.java URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/IntegrationTestSuite.java?rev=668185&r1=668184&r2=668185&view=diff ============================================================================== --- maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/IntegrationTestSuite.java (original) +++ maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/IntegrationTestSuite.java Mon Jun 16 08:09:10 2008 @@ -65,6 +65,12 @@ * a fail fast technique as well. */ + // TODO: Move these into their proper positions! + suite.addTestSuite( MavenITmng3536AppendedAbsolutePaths.class ); + suite.addTestSuite( MavenITmng3535SelfReferentialProperties.class ); + suite.addTestSuite( MavenITmng2562Timestamp.class ); + suite.addTestSuite( MavenITmng3475BaseAlignedDir.class ); + suite.addTestSuite( MavenITmng3581PluginUsesWagonDependency.class ); suite.addTestSuite( MavenITmng3545ProfileDeactivation.class ); suite.addTestSuite( MavenITmng3498ForkToOtherMojoTest.class ); Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng2562Timestamp.java URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng2562Timestamp.java?rev=668185&view=auto ============================================================================== --- maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng2562Timestamp.java (added) +++ maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng2562Timestamp.java Mon Jun 16 08:09:10 2008 @@ -0,0 +1,24 @@ +package org.apache.maven.integrationtests; + +import org.apache.maven.it.util.ResourceExtractor; +import org.apache.maven.it.Verifier; + +import java.io.File; + +public class MavenITmng2562Timestamp extends AbstractMavenIntegrationTestCase { + + public MavenITmng2562Timestamp() + { + super( "(2.0.9,)"); + } + + public void testitMNG2562() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), + "/mng-2562-timestamp"); + Verifier verifier = new Verifier(testDir.getAbsolutePath()); + verifier.executeGoal("verify"); + + verifier.verifyErrorFreeLog(); + verifier.resetStreams(); + } +} Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng2562Timestamp.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng2562Timestamp.java ------------------------------------------------------------------------------ svn:keywords = "Author Date Id Revision" Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3475BaseAlignedDir.java URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3475BaseAlignedDir.java?rev=668185&view=auto ============================================================================== --- maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3475BaseAlignedDir.java (added) +++ maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3475BaseAlignedDir.java Mon Jun 16 08:09:10 2008 @@ -0,0 +1,39 @@ +package org.apache.maven.integrationtests; + +import org.apache.maven.it.Verifier; +import org.apache.maven.it.util.ResourceExtractor; + +import java.io.File; + +public class MavenITmng3475BaseAlignedDir + extends AbstractMavenIntegrationTestCase +{ + + public MavenITmng3475BaseAlignedDir() + { + super( "(2.0.9,)"); + } + + public void testitMNG3475() + throws Exception + { + File testDir = ResourceExtractor.simpleExtractResources( getClass(), + "/mng-3475-baseAlignedDir" ); + + File pluginDir = new File( testDir, "plugin" ); + Verifier verifier = new Verifier( pluginDir.getAbsolutePath() ); + + verifier.executeGoal( "install" ); + + verifier.verifyErrorFreeLog(); + verifier.resetStreams(); + + File projectDir = new File( testDir, "project" ); + verifier = new Verifier( projectDir.getAbsolutePath() ); + + verifier.executeGoal( "validate" ); + verifier.verifyErrorFreeLog(); + verifier.resetStreams(); + } + +} Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3475BaseAlignedDir.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3475BaseAlignedDir.java ------------------------------------------------------------------------------ svn:keywords = "Author Date Id Revision" Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3535SelfReferentialProperties.java URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3535SelfReferentialProperties.java?rev=668185&view=auto ============================================================================== --- maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3535SelfReferentialProperties.java (added) +++ maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3535SelfReferentialProperties.java Mon Jun 16 08:09:10 2008 @@ -0,0 +1,24 @@ +package org.apache.maven.integrationtests; + +import org.apache.maven.it.util.ResourceExtractor; +import org.apache.maven.it.Verifier; + +import java.io.File; + +public class MavenITmng3535SelfReferentialProperties extends AbstractMavenIntegrationTestCase { + + public MavenITmng3535SelfReferentialProperties() + { + super( "(2.0.9,)"); + } + + public void testitMNG3535() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), + "/mng-3535-selfReferentialProperties"); + Verifier verifier = new Verifier(testDir.getAbsolutePath()); + verifier.executeGoal("verify"); + + verifier.verifyErrorFreeLog(); + verifier.resetStreams(); + } +} Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3535SelfReferentialProperties.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3535SelfReferentialProperties.java ------------------------------------------------------------------------------ svn:keywords = "Author Date Id Revision" Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3536AppendedAbsolutePaths.java URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3536AppendedAbsolutePaths.java?rev=668185&view=auto ============================================================================== --- maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3536AppendedAbsolutePaths.java (added) +++ maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3536AppendedAbsolutePaths.java Mon Jun 16 08:09:10 2008 @@ -0,0 +1,33 @@ +package org.apache.maven.integrationtests; + +import org.apache.maven.it.util.ResourceExtractor; +import org.apache.maven.it.Verifier; + +import java.io.File; + +public class MavenITmng3536AppendedAbsolutePaths extends AbstractMavenIntegrationTestCase { + + public MavenITmng3536AppendedAbsolutePaths() + { + super( "(2.0.9,)"); + } + + public void testitMNG3536() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources( getClass(), + "/mng-3536-appendedAbsolutePaths" ); + File pluginDir = new File( testDir, "plugin" ); + Verifier verifier = new Verifier( pluginDir.getAbsolutePath() ); + + verifier.executeGoal( "install" ); + + verifier.verifyErrorFreeLog(); + verifier.resetStreams(); + + File projectDir = new File( testDir, "project" ); + verifier = new Verifier( projectDir.getAbsolutePath() ); + + verifier.executeGoal( "verify" ); + verifier.verifyErrorFreeLog(); + verifier.resetStreams(); + } +} Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3536AppendedAbsolutePaths.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3536AppendedAbsolutePaths.java ------------------------------------------------------------------------------ svn:keywords = "Author Date Id Revision" Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-2562-timestamp/pom.xml URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-2562-timestamp/pom.xml?rev=668185&view=auto ============================================================================== --- maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-2562-timestamp/pom.xml (added) +++ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-2562-timestamp/pom.xml Mon Jun 16 08:09:10 2008 @@ -0,0 +1,57 @@ +<!-- +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. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>test</groupId> + <artifactId>mng-2562-timestamp</artifactId> + <packaging>pom</packaging> + <version>1.0</version> + <name>Apache Maven: mng-2562-timestamp</name> + <build> + <sourceDirectory>${project.basedir}/src/main/java</sourceDirectory> + <plugins> + <plugin> + <groupId>org.apache.maven.its.plugins</groupId> + <version>2.1-SNAPSHOT</version> + <artifactId>maven-it-plugin-project-interpolation</artifactId> + <executions> + <execution> + <phase>validate</phase> + <goals> + <goal>verify-property</goal> + </goals> + </execution> + </executions> + <configuration> + <properties> + <property> + <name>timestamp</name> + <value>${build.timestamp}</value> + </property> + </properties> + </configuration> + </plugin> + </plugins> + </build> + <properties> + <timestamp>${build.timestamp}</timestamp> + </properties> +</project> \ No newline at end of file Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-2562-timestamp/pom.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-2562-timestamp/pom.xml ------------------------------------------------------------------------------ svn:keywords = "Author Date Id Revision" Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3475-baseAlignedDir/plugin/pom.xml URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3475-baseAlignedDir/plugin/pom.xml?rev=668185&view=auto ============================================================================== --- maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3475-baseAlignedDir/plugin/pom.xml (added) +++ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3475-baseAlignedDir/plugin/pom.xml Mon Jun 16 08:09:10 2008 @@ -0,0 +1,40 @@ +<!-- +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. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>plugin</groupId> + <artifactId>mng3475-baseAlignedDir-plugin</artifactId> + <packaging>maven-plugin</packaging> + <version>1.0</version> + <name>Apache Maven: mng3536-baseAlignedDir-plugin</name> + <dependencies> + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-plugin-api</artifactId> + <version>2.0.9</version> + </dependency> + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-project</artifactId> + <version>2.0.9</version> + </dependency> + </dependencies> +</project> \ No newline at end of file Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3475-baseAlignedDir/plugin/pom.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3475-baseAlignedDir/plugin/pom.xml ------------------------------------------------------------------------------ svn:keywords = "Author Date Id Revision" Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3475-baseAlignedDir/plugin/src/main/java/test/Mojo3475.java URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3475-baseAlignedDir/plugin/src/main/java/test/Mojo3475.java?rev=668185&view=auto ============================================================================== --- maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3475-baseAlignedDir/plugin/src/main/java/test/Mojo3475.java (added) +++ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3475-baseAlignedDir/plugin/src/main/java/test/Mojo3475.java Mon Jun 16 08:09:10 2008 @@ -0,0 +1,55 @@ +package test; + +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.project.MavenProject; +import org.apache.maven.model.Build; +import org.codehaus.plexus.util.StringUtils; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +/** + * @goal validate + * @phase validate + */ +public class Mojo3475 + extends AbstractMojo +{ + /** + * @parameter expression="${project}" + */ + private MavenProject project; + + public void execute() + throws MojoExecutionException, MojoFailureException + { + Build build = project.getModel().getBuild(); + List failed = new ArrayList(); + + testDirectoryAbsolutePath( build.getDirectory(), failed ); + testDirectoryAbsolutePath( build.getOutputDirectory(), failed ); + testDirectoryAbsolutePath( build.getTestOutputDirectory(), failed ); + testDirectoryAbsolutePath( build.getSourceDirectory(), failed ); + testDirectoryAbsolutePath( build.getTestSourceDirectory(), failed ); + testDirectoryAbsolutePath( build.getScriptSourceDirectory(), failed ); + testDirectoryAbsolutePath( project.getReporting().getOutputDirectory(), failed ); + + if ( !failed.isEmpty() ) + { + throw new MojoExecutionException( "One or more directories were not absolute:\n\n" + StringUtils.join( failed.iterator(), "\n" ) ); + } + } + + private void testDirectoryAbsolutePath( String directory, List failed ) + throws MojoExecutionException + { + if ( !directory.equals( new File( directory ).getAbsolutePath() ) ) + { + failed.add( directory ); + } + System.out.println( directory ); + } +} Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3475-baseAlignedDir/plugin/src/main/java/test/Mojo3475.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3475-baseAlignedDir/plugin/src/main/java/test/Mojo3475.java ------------------------------------------------------------------------------ svn:keywords = "Author Date Id Revision" Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3475-baseAlignedDir/pom.xml URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3475-baseAlignedDir/pom.xml?rev=668185&view=auto ============================================================================== --- maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3475-baseAlignedDir/pom.xml (added) +++ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3475-baseAlignedDir/pom.xml Mon Jun 16 08:09:10 2008 @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- +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. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>test</groupId> + <artifactId>mng3475</artifactId> + <version>1.0</version> + <packaging>pom</packaging> + <name>Apache Maven: mng3475</name> + <modules> + <module>plugin</module> + <module>project</module> + </modules> +</project> Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3475-baseAlignedDir/pom.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3475-baseAlignedDir/pom.xml ------------------------------------------------------------------------------ svn:keywords = "Author Date Id Revision" Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3475-baseAlignedDir/project/pom.xml URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3475-baseAlignedDir/project/pom.xml?rev=668185&view=auto ============================================================================== --- maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3475-baseAlignedDir/project/pom.xml (added) +++ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3475-baseAlignedDir/project/pom.xml Mon Jun 16 08:09:10 2008 @@ -0,0 +1,46 @@ +<!-- +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. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>test</groupId> + <artifactId>mng3475-baseAlignedDir</artifactId> + <packaging>pom</packaging> + <version>1.0</version> + <name>Apache Maven: mng3475-baseAlignedDir</name> + + <build> + <plugins> + <plugin> + <groupId>plugin</groupId> + <artifactId>mng3475-baseAlignedDir-plugin</artifactId> + <version>1.0</version> + <executions> + <execution> + <id>validate-basedir-alignment</id> + <goals> + <goal>validate</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> \ No newline at end of file Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3475-baseAlignedDir/project/pom.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3475-baseAlignedDir/project/pom.xml ------------------------------------------------------------------------------ svn:keywords = "Author Date Id Revision" Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3535-selfReferentialProperties/pom.xml URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3535-selfReferentialProperties/pom.xml?rev=668185&view=auto ============================================================================== --- maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3535-selfReferentialProperties/pom.xml (added) +++ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3535-selfReferentialProperties/pom.xml Mon Jun 16 08:09:10 2008 @@ -0,0 +1,57 @@ +<!-- +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. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>test</groupId> + <artifactId>mng3536-AppendedAbsolutePaths</artifactId> + <packaging>pom</packaging> + <version>1.0</version> + <name>Apache Maven: mng3536-AppendedAbsolutePaths</name> + <build> + <sourceDirectory>${project.basedir}/src/main/java</sourceDirectory> + <plugins> + <plugin> + <groupId>org.apache.maven.its.plugins</groupId> + <version>2.1-SNAPSHOT</version> + <artifactId>maven-it-plugin-project-interpolation</artifactId> + <executions> + <execution> + <phase>install</phase> + <goals> + <goal>verify-property</goal> + </goals> + </execution> + </executions> + <configuration> + <properties> + <property> + <name>java.specification.version</name> + <value>${java.specification.version}</value> + </property> + </properties> + </configuration> + </plugin> + </plugins> + </build> + <properties> + <java.specification.version>${java.specification.version}</java.specification.version> + </properties> +</project> \ No newline at end of file Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3535-selfReferentialProperties/pom.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3535-selfReferentialProperties/pom.xml ------------------------------------------------------------------------------ svn:keywords = "Author Date Id Revision" Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3536-appendedAbsolutePaths/plugin/pom.xml URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3536-appendedAbsolutePaths/plugin/pom.xml?rev=668185&view=auto ============================================================================== --- maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3536-appendedAbsolutePaths/plugin/pom.xml (added) +++ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3536-appendedAbsolutePaths/plugin/pom.xml Mon Jun 16 08:09:10 2008 @@ -0,0 +1,40 @@ +<!-- +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. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>plugin</groupId> + <artifactId>mng3536-AppendedAbsolutePaths-plugin</artifactId> + <packaging>maven-plugin</packaging> + <version>1.0</version> + <name>Apache Maven: mng3536-AppendedAbsolutePaths-plugin</name> + <dependencies> + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-plugin-api</artifactId> + <version>2.0.9</version> + </dependency> + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-project</artifactId> + <version>2.0.9</version> + </dependency> + </dependencies> +</project> \ No newline at end of file Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3536-appendedAbsolutePaths/plugin/pom.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3536-appendedAbsolutePaths/plugin/pom.xml ------------------------------------------------------------------------------ svn:keywords = "Author Date Id Revision" Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3536-appendedAbsolutePaths/plugin/src/main/java/plugin/Mojo3563.java URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3536-appendedAbsolutePaths/plugin/src/main/java/plugin/Mojo3563.java?rev=668185&view=auto ============================================================================== --- maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3536-appendedAbsolutePaths/plugin/src/main/java/plugin/Mojo3563.java (added) +++ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3536-appendedAbsolutePaths/plugin/src/main/java/plugin/Mojo3563.java Mon Jun 16 08:09:10 2008 @@ -0,0 +1,37 @@ +package plugin; + +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.project.MavenProject; +import org.apache.maven.model.Model; + +import java.io.File; + +/** + * + * @goal validate + * @phase validate + */ +public class Mojo3563 extends AbstractMojo { + + /** + * @parameter expression="${project}" + */ + private MavenProject project; + + public void execute() throws MojoExecutionException, MojoFailureException { + Model model = project.getModel(); + String property = model.getProperties().getProperty("test"); + if (property == null) { + throw new MojoExecutionException("Could not find property."); + } + + File testFile = new File(property.substring(property.indexOf(":") + 1)); + if (!testFile.exists()) { + throw new MojoExecutionException("Test file does not exist: File = " + testFile.getAbsolutePath() + "Property = " + property); + } + getLog().info("Property = " + property); + + } +} Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3536-appendedAbsolutePaths/plugin/src/main/java/plugin/Mojo3563.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3536-appendedAbsolutePaths/plugin/src/main/java/plugin/Mojo3563.java ------------------------------------------------------------------------------ svn:keywords = "Author Date Id Revision" Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3536-appendedAbsolutePaths/pom.xml URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3536-appendedAbsolutePaths/pom.xml?rev=668185&view=auto ============================================================================== --- maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3536-appendedAbsolutePaths/pom.xml (added) +++ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3536-appendedAbsolutePaths/pom.xml Mon Jun 16 08:09:10 2008 @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- +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. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>test</groupId> + <artifactId>mng3536</artifactId> + <version>1.0</version> + <packaging>pom</packaging> + <name>Apache Maven: mng3536</name> + <modules> + <module>plugin</module> + <module>project</module> + </modules> +</project> Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3536-appendedAbsolutePaths/pom.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3536-appendedAbsolutePaths/pom.xml ------------------------------------------------------------------------------ svn:keywords = "Author Date Id Revision" Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3536-appendedAbsolutePaths/project/pom.xml URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3536-appendedAbsolutePaths/project/pom.xml?rev=668185&view=auto ============================================================================== --- maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3536-appendedAbsolutePaths/project/pom.xml (added) +++ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3536-appendedAbsolutePaths/project/pom.xml Mon Jun 16 08:09:10 2008 @@ -0,0 +1,49 @@ +<!-- +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. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>test</groupId> + <artifactId>mng3536-AppendedAbsolutePaths</artifactId> + <packaging>pom</packaging> + <version>1.0</version> + <name>Apache Maven: mng3536-AppendedAbsolutePaths</name> + <build> + <sourceDirectory>${project.basedir}/src/main/java</sourceDirectory> + <plugins> + <plugin> + <groupId>plugin</groupId> + <artifactId>mng3536-AppendedAbsolutePaths-plugin</artifactId> + <version>1.0</version> + <executions> + <execution> + <phase>validate</phase> + <goals> + <goal>validate</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + <properties> + <test>file:${project.build.sourceDirectory}/plugin/Mojo3563.java</test> + </properties> +</project> \ No newline at end of file Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3536-appendedAbsolutePaths/project/pom.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3536-appendedAbsolutePaths/project/pom.xml ------------------------------------------------------------------------------ svn:keywords = "Author Date Id Revision" Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3536-appendedAbsolutePaths/project/src/main/java/plugin/Mojo3563.java URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3536-appendedAbsolutePaths/project/src/main/java/plugin/Mojo3563.java?rev=668185&view=auto ============================================================================== --- maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3536-appendedAbsolutePaths/project/src/main/java/plugin/Mojo3563.java (added) +++ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3536-appendedAbsolutePaths/project/src/main/java/plugin/Mojo3563.java Mon Jun 16 08:09:10 2008 @@ -0,0 +1,38 @@ +package plugin; + +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.project.MavenProject; +import org.apache.maven.model.Model; + +import java.io.File; + +/** + * Maven Mojo for executing nunit tests + * + * @goal validate + * @phase validate + */ +public class Mojo3563 extends AbstractMojo { + + /** + * @parameter expression="${project}" + */ + private MavenProject project; + + public void execute() throws MojoExecutionException, MojoFailureException { + Model model = project.getModel(); + String property = model.getProperties().getProperty("test"); + if (property == null) { + throw new MojoExecutionException("Could not find property."); + } + + File testFile = new File(property.substring(property.indexOf(":") + 1)); + if (!testFile.exists()) { + throw new MojoExecutionException("Test file does not exist: File = " + testFile.getAbsolutePath() + ", Property = " + property); + } + getLog().info("Property = " + property); + + } +} Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3536-appendedAbsolutePaths/project/src/main/java/plugin/Mojo3563.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3536-appendedAbsolutePaths/project/src/main/java/plugin/Mojo3563.java ------------------------------------------------------------------------------ svn:keywords = "Author Date Id Revision"