From ed2a3826408004aa1503445a51c6a59c184fe9a4 Mon Sep 17 00:00:00 2001 From: Benjamin Bentmann Date: Fri, 12 Jun 2009 20:35:43 +0000 Subject: [PATCH] o Decoupled IT from production plugins git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@784264 13f79535-47bb-0310-9956-ffa450edef68 --- ...Tmng3394POMPluginVersionDominanceTest.java | 66 ++++--------------- .../lifecycleMojoVersionInPluginMgmt/pom.xml | 15 +++-- .../readme.txt | 5 -- .../preferBuildPluginOverPluginMgmt/pom.xml | 12 +++- .../readme.txt | 1 - 5 files changed, 32 insertions(+), 67 deletions(-) delete mode 100644 its/core-it-suite/src/test/resources/mng-3394/lifecycleMojoVersionInPluginMgmt/readme.txt delete mode 100644 its/core-it-suite/src/test/resources/mng-3394/preferBuildPluginOverPluginMgmt/readme.txt diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3394POMPluginVersionDominanceTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3394POMPluginVersionDominanceTest.java index 80d359bfc2..c298dd3494 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3394POMPluginVersionDominanceTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3394POMPluginVersionDominanceTest.java @@ -51,75 +51,31 @@ public class MavenITmng3394POMPluginVersionDominanceTest //testShouldUsePluginVersionFromPluginMgmtForLifecycleMojoWhenNotInBuildPlugins 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 verifier = new Verifier( testDir.getAbsolutePath() ); + verifier.setAutoclean( false ); + verifier.deleteDirectory( "target" ); + verifier.executeGoal( "process-resources" ); 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 ); + verifier.assertFilePresent( "target/resources-resources.txt" ); } - public void testitMNG3394b () + public void testitMNG3394b() throws Exception { //testShouldPreferPluginVersionFromBuildPluginsOverThatInPluginMgmt File testDir = ResourceExtractor.simpleExtractResources( getClass(), BASEDIR_PREFIX + "preferBuildPluginOverPluginMgmt" ); - Verifier verifier; - - verifier = new Verifier( testDir.getAbsolutePath() ); + Verifier verifier = new Verifier( testDir.getAbsolutePath() ); verifier.setAutoclean( false ); + verifier.deleteDirectory( "target" ); 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(); + + verifier.assertFilePresent( "target/clean-clean.txt" ); } + } diff --git a/its/core-it-suite/src/test/resources/mng-3394/lifecycleMojoVersionInPluginMgmt/pom.xml b/its/core-it-suite/src/test/resources/mng-3394/lifecycleMojoVersionInPluginMgmt/pom.xml index 0cc0dd3636..f94b1c4ec6 100644 --- a/its/core-it-suite/src/test/resources/mng-3394/lifecycleMojoVersionInPluginMgmt/pom.xml +++ b/its/core-it-suite/src/test/resources/mng-3394/lifecycleMojoVersionInPluginMgmt/pom.xml @@ -1,18 +1,25 @@ 4.0.0 + org.apache.maven.its.mng3394 lifecycleMojoVersionInPluginMgmt - pom 1 - lifecycleMojoVersionInPluginMgmt + jar + + Maven Integration Test :: MNG-3394 + + This test should verify that the Resources Plugin version used is 0.1-stub, not the latest one. It should + get this version from the POM's pluginManagement section, even though the plugin's mojo call is coming from + the default lifecycle bindings, and the plugin is not specified in the POM's build/plugins section. + - maven-site-plugin - 2.0-beta-5 + maven-resources-plugin + 0.1-stub-SNAPSHOT diff --git a/its/core-it-suite/src/test/resources/mng-3394/lifecycleMojoVersionInPluginMgmt/readme.txt b/its/core-it-suite/src/test/resources/mng-3394/lifecycleMojoVersionInPluginMgmt/readme.txt deleted file mode 100644 index 5c37bb1fd2..0000000000 --- a/its/core-it-suite/src/test/resources/mng-3394/lifecycleMojoVersionInPluginMgmt/readme.txt +++ /dev/null @@ -1,5 +0,0 @@ -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 diff --git a/its/core-it-suite/src/test/resources/mng-3394/preferBuildPluginOverPluginMgmt/pom.xml b/its/core-it-suite/src/test/resources/mng-3394/preferBuildPluginOverPluginMgmt/pom.xml index 16a756fcf9..3b89c0c42c 100644 --- a/its/core-it-suite/src/test/resources/mng-3394/preferBuildPluginOverPluginMgmt/pom.xml +++ b/its/core-it-suite/src/test/resources/mng-3394/preferBuildPluginOverPluginMgmt/pom.xml @@ -1,10 +1,18 @@ 4.0.0 + org.apache.maven.its.mng3394 preferBuildPluginOverPluginMgmt - jar 1 + jar + + Maven Integration Test :: MNG-3394 + + 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. + @@ -18,7 +26,7 @@ maven-clean-plugin - 2.1.1 + 0.1-stub-SNAPSHOT diff --git a/its/core-it-suite/src/test/resources/mng-3394/preferBuildPluginOverPluginMgmt/readme.txt b/its/core-it-suite/src/test/resources/mng-3394/preferBuildPluginOverPluginMgmt/readme.txt deleted file mode 100644 index 339a1bffc7..0000000000 --- a/its/core-it-suite/src/test/resources/mng-3394/preferBuildPluginOverPluginMgmt/readme.txt +++ /dev/null @@ -1 +0,0 @@ -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