maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdca...@apache.org
Subject svn commit: r634449 - in /maven/core-integration-testing/trunk: core-integration-tests/src/test/java/org/apache/maven/integrationtests/ core-integration-tests/src/test/resources/mng-3394-pomPluginVersionDominance/ core-integration-tests/src/test/resour...
Date Thu, 06 Mar 2008 23:06:09 GMT
Author: jdcasey
Date: Thu Mar  6 15:06:05 2008
New Revision: 634449

URL: http://svn.apache.org/viewvc?rev=634449&view=rev
Log:
[MNG-3394] Adding two integration tests, and making a small adjustment to the console output
when maven.version system property is not present.

Added:
    maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3394POMPluginVersionDominanceTest.java
  (with props)
    maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3394-pomPluginVersionDominance/
    maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3394-pomPluginVersionDominance/lifecycleMojoVersionInPluginMgmt/
    maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3394-pomPluginVersionDominance/lifecycleMojoVersionInPluginMgmt/pom.xml
  (with props)
    maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3394-pomPluginVersionDominance/lifecycleMojoVersionInPluginMgmt/readme.txt
  (with props)
    maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3394-pomPluginVersionDominance/preferBuildPluginOverPluginMgmt/
    maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3394-pomPluginVersionDominance/preferBuildPluginOverPluginMgmt/pom.xml
  (with props)
    maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3394-pomPluginVersionDominance/preferBuildPluginOverPluginMgmt/readme.txt
  (with props)
Modified:
    maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/IntegrationTestSuite.java
    maven/core-integration-testing/trunk/maven-integration-test-helper/src/main/java/org/apache/maven/integrationtests/AbstractMavenIntegrationTestCase.java

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=634449&r1=634448&r2=634449&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
Thu Mar  6 15:06:05 2008
@@ -181,6 +181,7 @@
         suite.addTestSuite( MavenITmng3428PluginDescriptorArtifactsIncompleteTest.class );
         suite.addTestSuite( MavenITmng2234ActiveProfilesFromSettingsTest.class );
         suite.addTestSuite( MavenITmng3341MetadataUpdatedFromDeploymentRepositoryTest.class
);
+        suite.addTestSuite( MavenITmng3394POMPluginVersionDominanceTest.class );
 
         // ----------------------------------------------------------------------------------------------------
         // Tests that need to be fixed.

Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3394POMPluginVersionDominanceTest.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3394POMPluginVersionDominanceTest.java?rev=634449&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3394POMPluginVersionDominanceTest.java
(added)
+++ maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3394POMPluginVersionDominanceTest.java
Thu Mar  6 15:06:05 2008
@@ -0,0 +1,106 @@
+package org.apache.maven.integrationtests;
+
+import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
+import org.apache.maven.it.Verifier;
+import org.apache.maven.it.util.ResourceExtractor;
+
+import java.io.File;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * Check that plugin versions in the POM obey the correct order
+ * of precedence. Specifically, that mojos in the default lifecycle
+ * bindings can find plugin versions in the pluginManagement section
+ * when the build/plugins section is missing that plugin, and that
+ * plugin versions in build/plugins override those in build/pluginManagement.
+ */
+public class MavenITmng3394POMPluginVersionDominanceTest
+    extends AbstractMavenIntegrationTestCase
+{
+
+	private static final String BASEDIR_PREFIX = "/mng-3394-pomPluginVersionDominance/";
+
+    public MavenITmng3394POMPluginVersionDominanceTest()
+        throws InvalidVersionSpecificationException
+    {
+        super( "(2.0.8,)" ); // only test in 2.0.9+
+    }
+
+    public void testShouldUsePluginVersionFromPluginMgmtForLifecycleMojoWhenNotInBuildPlugins
()
+        throws Exception
+    {
+        File testDir = ResourceExtractor.simpleExtractResources( getClass(), BASEDIR_PREFIX
+ "lifecycleMojoVersionInPluginMgmt" );
+
+        Verifier verifier;
+
+        verifier = new Verifier( testDir.getAbsolutePath() );
+
+        verifier.setCliOptions( Collections.singletonList( "-X" ) );
+
+        verifier.executeGoal( "install" );
+
+        /*
+         * This is the simplest way to check a build
+         * succeeded. It is also the simplest way to create
+         * an IT test: make the build pass when the test
+         * should pass, and make the build fail when the
+         * test should fail. There are other methods
+         * supported by the verifier. They can be seen here:
+         * http://maven.apache.org/shared/maven-verifier/apidocs/index.html
+         */
+        verifier.verifyErrorFreeLog();
+
+        List logFile = verifier.loadFile( new File( testDir, "log.txt" ), false );
+
+        boolean foundSiteBeta5 = false;
+        for ( Iterator it = logFile.iterator(); it.hasNext(); )
+        {
+            String line = (String) it.next();
+            if ( line.indexOf( "maven-site-plugin:2.0-beta-5" ) > -1 )
+            {
+                foundSiteBeta5 = true;
+                break;
+            }
+        }
+
+        /*
+         * Reset the streams before executing the verifier
+         * again.
+         */
+        verifier.resetStreams();
+
+        assertTrue( "No reference to maven-site-plugin, version 2.0-beta-5 found in build
log.", foundSiteBeta5 );
+    }
+
+    public void testShouldPreferPluginVersionFromBuildPluginsOverThatInPluginMgmt ()
+        throws Exception
+    {
+        File testDir = ResourceExtractor.simpleExtractResources( getClass(), BASEDIR_PREFIX
+ "preferBuildPluginOverPluginMgmt" );
+
+        Verifier verifier;
+
+        verifier = new Verifier( testDir.getAbsolutePath() );
+
+        verifier.setAutoclean( false );
+        verifier.executeGoal( "clean" );
+
+        /*
+         * This is the simplest way to check a build
+         * succeeded. It is also the simplest way to create
+         * an IT test: make the build pass when the test
+         * should pass, and make the build fail when the
+         * test should fail. There are other methods
+         * supported by the verifier. They can be seen here:
+         * http://maven.apache.org/shared/maven-verifier/apidocs/index.html
+         */
+        verifier.verifyErrorFreeLog();
+
+        /*
+         * Reset the streams before executing the verifier
+         * again.
+         */
+        verifier.resetStreams();
+    }
+}

Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3394POMPluginVersionDominanceTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3394POMPluginVersionDominanceTest.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3394-pomPluginVersionDominance/lifecycleMojoVersionInPluginMgmt/pom.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3394-pomPluginVersionDominance/lifecycleMojoVersionInPluginMgmt/pom.xml?rev=634449&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3394-pomPluginVersionDominance/lifecycleMojoVersionInPluginMgmt/pom.xml
(added)
+++ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3394-pomPluginVersionDominance/lifecycleMojoVersionInPluginMgmt/pom.xml
Thu Mar  6 15:06:05 2008
@@ -0,0 +1,21 @@
+<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>org.apache.maven.integrationtests</groupId>
+  <artifactId>lifecycleMojoVersionInPluginMgmt</artifactId>
+  <packaging>pom</packaging>
+  <version>1</version>
+  <name>lifecycleMojoVersionInPluginMgmt</name>
+  
+  <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <artifactId>maven-site-plugin</artifactId>
+          <version>2.0-beta-5</version>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+  </build>
+
+</project>

Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3394-pomPluginVersionDominance/lifecycleMojoVersionInPluginMgmt/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3394-pomPluginVersionDominance/lifecycleMojoVersionInPluginMgmt/pom.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3394-pomPluginVersionDominance/lifecycleMojoVersionInPluginMgmt/readme.txt
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3394-pomPluginVersionDominance/lifecycleMojoVersionInPluginMgmt/readme.txt?rev=634449&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3394-pomPluginVersionDominance/lifecycleMojoVersionInPluginMgmt/readme.txt
(added)
+++ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3394-pomPluginVersionDominance/lifecycleMojoVersionInPluginMgmt/readme.txt
Thu Mar  6 15:06:05 2008
@@ -0,0 +1,5 @@
+This test should verify that the site plugin version used is 2.0-beta-5, not the latest one
(which is currently 2.0-beta-6). It should get this version from the POM's pluginManagement
section, even though the site-plugin's mojo call is coming from the default lifecycle bindings,
and the site plugin is not specified in the POM's build/plugins section.
+
+To test, run `mvn -X install | tee build.log` or similar, to capture output to a separate
file. Then, search the debug output for the string:
+
+org.apache.maven.plugins:maven-site-plugin:2.0-beta-5

Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3394-pomPluginVersionDominance/lifecycleMojoVersionInPluginMgmt/readme.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3394-pomPluginVersionDominance/lifecycleMojoVersionInPluginMgmt/readme.txt
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3394-pomPluginVersionDominance/preferBuildPluginOverPluginMgmt/pom.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3394-pomPluginVersionDominance/preferBuildPluginOverPluginMgmt/pom.xml?rev=634449&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3394-pomPluginVersionDominance/preferBuildPluginOverPluginMgmt/pom.xml
(added)
+++ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3394-pomPluginVersionDominance/preferBuildPluginOverPluginMgmt/pom.xml
Thu Mar  6 15:06:05 2008
@@ -0,0 +1,25 @@
+<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>org.apache.maven.integrationtests</groupId>
+  <artifactId>preferBuildPluginOverPluginMgmt</artifactId>
+  <packaging>jar</packaging>
+  <version>1</version>
+
+  <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <artifactId>maven-clean-plugin</artifactId>
+          <version>invalid</version>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+    <plugins>
+      <plugin>
+        <artifactId>maven-clean-plugin</artifactId>
+        <version>2.1.1</version>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3394-pomPluginVersionDominance/preferBuildPluginOverPluginMgmt/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3394-pomPluginVersionDominance/preferBuildPluginOverPluginMgmt/pom.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3394-pomPluginVersionDominance/preferBuildPluginOverPluginMgmt/readme.txt
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3394-pomPluginVersionDominance/preferBuildPluginOverPluginMgmt/readme.txt?rev=634449&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3394-pomPluginVersionDominance/preferBuildPluginOverPluginMgmt/readme.txt
(added)
+++ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3394-pomPluginVersionDominance/preferBuildPluginOverPluginMgmt/readme.txt
Thu Mar  6 15:06:05 2008
@@ -0,0 +1 @@
+Test that the plugin version given in project/build/plugins overrides that in project/build/pluginManagement/plugins.
If this is correct, the clean plugin should find a valid version, and execute. Otherwise,
the version 'invalid' is used by Maven, and the clean plugin with that version cannot be resolved...so
the build fails. Use `mvn clean` to test.
\ No newline at end of file

Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3394-pomPluginVersionDominance/preferBuildPluginOverPluginMgmt/readme.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3394-pomPluginVersionDominance/preferBuildPluginOverPluginMgmt/readme.txt
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Modified: maven/core-integration-testing/trunk/maven-integration-test-helper/src/main/java/org/apache/maven/integrationtests/AbstractMavenIntegrationTestCase.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/maven-integration-test-helper/src/main/java/org/apache/maven/integrationtests/AbstractMavenIntegrationTestCase.java?rev=634449&r1=634448&r2=634449&view=diff
==============================================================================
--- maven/core-integration-testing/trunk/maven-integration-test-helper/src/main/java/org/apache/maven/integrationtests/AbstractMavenIntegrationTestCase.java
(original)
+++ maven/core-integration-testing/trunk/maven-integration-test-helper/src/main/java/org/apache/maven/integrationtests/AbstractMavenIntegrationTestCase.java
Thu Mar  6 15:06:05 2008
@@ -36,20 +36,20 @@
     protected AbstractMavenIntegrationTestCase( String versionRangeStr )
         throws InvalidVersionSpecificationException
     {
-        this.versionRange = VersionRange.createFromVersionSpec( versionRangeStr );
+        versionRange = VersionRange.createFromVersionSpec( versionRangeStr );
 
         String v = System.getProperty( "maven.version" );
         if ( v != null )
         {
-            this.version = new DefaultArtifactVersion( v );
-            if ( !versionRange.containsVersion( this.version ) )
+            version = new DefaultArtifactVersion( v );
+            if ( !versionRange.containsVersion( version ) )
             {
                 skip = true;
             }
         }
         else
         {
-            out.print( "WARNING: " + getITName() + ": version range '" + versionRange
+            out.println( "WARNING: " + getITName() + ": version range '" + versionRange
                 + "' supplied but no maven version - not skipping test." );
         }
     }



Mime
View raw message