From 643384ce2d97747f135554b6ad4b7e2ca694a569 Mon Sep 17 00:00:00 2001 From: Benjamin Bentmann Date: Sat, 18 Jul 2009 11:45:16 +0000 Subject: [PATCH] [MNG-4246] plugin resolution failures during pom-less execution (like archetype:generate) o Strengthened existing IT for MNG-3099 which is just about the same issue git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@795346 13f79535-47bb-0310-9956-ffa450edef68 --- ...Tmng3099SettingsProfilesWithNoPomTest.java | 78 +++++------------- .../test/resources/mng-3099/plugin/pom.xml | 29 ------- .../apache/maven/its/mng3099/MNG3099Mojo.java | 40 --------- .../src/test/resources/mng-3099/readme.txt | 1 - .../maven/its/mng3099/maven-metadata.xml | 10 +++ .../0.1/maven-mng3099-plugin-0.1.jar | Bin 0 -> 7859 bytes .../0.1/maven-mng3099-plugin-0.1.pom | 69 ++++++++++++++++ .../maven-mng3099-plugin/maven-metadata.xml | 14 ++++ .../resources/mng-3099/settings-template.xml | 50 +++++++++++ .../src/test/resources/mng-3099/settings.xml | 20 ----- 10 files changed, 163 insertions(+), 148 deletions(-) delete mode 100644 its/core-it-suite/src/test/resources/mng-3099/plugin/pom.xml delete mode 100644 its/core-it-suite/src/test/resources/mng-3099/plugin/src/main/java/org/apache/maven/its/mng3099/MNG3099Mojo.java delete mode 100644 its/core-it-suite/src/test/resources/mng-3099/readme.txt create mode 100644 its/core-it-suite/src/test/resources/mng-3099/repo/org/apache/maven/its/mng3099/maven-metadata.xml create mode 100644 its/core-it-suite/src/test/resources/mng-3099/repo/org/apache/maven/its/mng3099/maven-mng3099-plugin/0.1/maven-mng3099-plugin-0.1.jar create mode 100644 its/core-it-suite/src/test/resources/mng-3099/repo/org/apache/maven/its/mng3099/maven-mng3099-plugin/0.1/maven-mng3099-plugin-0.1.pom create mode 100644 its/core-it-suite/src/test/resources/mng-3099/repo/org/apache/maven/its/mng3099/maven-mng3099-plugin/maven-metadata.xml create mode 100644 its/core-it-suite/src/test/resources/mng-3099/settings-template.xml delete mode 100644 its/core-it-suite/src/test/resources/mng-3099/settings.xml diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3099SettingsProfilesWithNoPomTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3099SettingsProfilesWithNoPomTest.java index 2702d1567a..fcbb9fe031 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3099SettingsProfilesWithNoPomTest.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3099SettingsProfilesWithNoPomTest.java @@ -23,82 +23,44 @@ import org.apache.maven.it.Verifier; import org.apache.maven.it.util.ResourceExtractor; import java.io.File; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; /** - * This is a sample integration test. The IT tests typically - * operate by having a sample project in the - * /src/test/resources folder along with a junit test like - * this one. The junit test uses the verifier (which uses - * the invoker) to invoke a new instance of Maven on the - * project in the resources folder. It then checks the - * results. This is a non-trivial example that shows two - * phases. See more information inline in the code. + * This is a test set for MNG-3099. * * @author Brian Fox - * */ public class MavenITmng3099SettingsProfilesWithNoPomTest extends AbstractMavenIntegrationTestCase { + public MavenITmng3099SettingsProfilesWithNoPomTest() { super( "(2.0.8,)" ); // 2.0.9+ } - public void testitMNG3099 () + /** + * Verify that (active) profiles from the settings are effective even if no POM is in use (e.g archetype:create). + * In more detail, this means the plugin can be resolved from the repositories given in the settings and the plugin + * can access properties defined by the profiles. + */ + public void testit() throws Exception { - // The testdir is computed from the location of this - // file. File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3099" ); - File plugin = new File( testDir, "plugin" ); - - Verifier verifier; - - verifier = new Verifier( plugin.getAbsolutePath() ); - - verifier.executeGoal( "install" ); - - /* - * Reset the streams before executing the verifier - * again. - */ + Verifier verifier = new Verifier( testDir.getAbsolutePath() ); + verifier.setAutoclean( false ); + verifier.deleteDirectory( "target" ); + verifier.deleteArtifacts( "org.apache.maven.its.mng3099" ); + verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", verifier.newDefaultFilterProperties() ); + verifier.getCliOptions().add( "-s" ); + verifier.getCliOptions().add( "settings.xml" ); + verifier.executeGoal( "org.apache.maven.its.mng3099:maven-mng3099-plugin:0.1:touch" ); + verifier.verifyErrorFreeLog(); verifier.resetStreams(); - verifier = new Verifier( testDir.getAbsolutePath() ); - - /* - * Use the settings for this test, which contains the profile we're looking for. - */ - List cliOptions = new ArrayList(); - cliOptions.add( "-s" ); - cliOptions.add( "\"" + new File( testDir, "settings.xml" ).getAbsolutePath() + "\"" ); - - verifier.setCliOptions( cliOptions ); - - verifier.setAutoclean( false ); - verifier.executeGoal( "org.apache.maven.its.mng3099:maven-mng3099-plugin:1:profile-props" ); - - - List lines = verifier.loadFile( new File( testDir, "log.txt" ), false ); - boolean found = false; - for ( Iterator it = lines.iterator(); it.hasNext(); ) - { - String line = (String) it.next(); - if ( line.indexOf( "local-profile-prop=local-profile-prop-value" ) > -1 ) - { - found = true; - break; - } - } - - if ( !found ) - { - fail( "Profile-injected property value: local-profile-prop-value was not found in log output." ); - } + verifier.assertFilePresent( "target/PASSED.txt" ); + verifier.assertFileNotPresent( "target/touch.txt" ); } + } diff --git a/its/core-it-suite/src/test/resources/mng-3099/plugin/pom.xml b/its/core-it-suite/src/test/resources/mng-3099/plugin/pom.xml deleted file mode 100644 index 3bd4c66163..0000000000 --- a/its/core-it-suite/src/test/resources/mng-3099/plugin/pom.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - 4.0.0 - - org.apache.maven.its.mng3099 - maven-mng3099-plugin - 1 - maven-plugin - - maven-mng3099-plugin - Tests properties injected as a result of active profiles in the user settings file. - - - - org.apache.maven - maven-plugin-api - 2.0.7 - compile - - - org.apache.maven - maven-project - 2.0.7 - compile - - - - \ No newline at end of file diff --git a/its/core-it-suite/src/test/resources/mng-3099/plugin/src/main/java/org/apache/maven/its/mng3099/MNG3099Mojo.java b/its/core-it-suite/src/test/resources/mng-3099/plugin/src/main/java/org/apache/maven/its/mng3099/MNG3099Mojo.java deleted file mode 100644 index 379ecd9db1..0000000000 --- a/its/core-it-suite/src/test/resources/mng-3099/plugin/src/main/java/org/apache/maven/its/mng3099/MNG3099Mojo.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.apache.maven.its.mng3099; - -/* - * Copyright 2001-2005 The Apache Software Foundation. - * - * Licensed 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.plugin.AbstractMojo; -import org.apache.maven.plugin.MojoExecutionException; - -/** - * Tests MNG-3099. - * - * @goal profile-props - * @requiresProject false - */ -public final class MNG3099Mojo extends AbstractMojo { - - /** - * @parameter expression="${local-profile-prop}" - */ - private String localProfileProp; - - - public void execute() throws MojoExecutionException { - - this.getLog().info("local-profile-prop=" + this.localProfileProp); - } -} diff --git a/its/core-it-suite/src/test/resources/mng-3099/readme.txt b/its/core-it-suite/src/test/resources/mng-3099/readme.txt deleted file mode 100644 index 06abe346a7..0000000000 --- a/its/core-it-suite/src/test/resources/mng-3099/readme.txt +++ /dev/null @@ -1 +0,0 @@ -This IT checks that profiles which are brought in from settings files (and which are activated via activeProfiles) are present even if no POM is in use. \ No newline at end of file diff --git a/its/core-it-suite/src/test/resources/mng-3099/repo/org/apache/maven/its/mng3099/maven-metadata.xml b/its/core-it-suite/src/test/resources/mng-3099/repo/org/apache/maven/its/mng3099/maven-metadata.xml new file mode 100644 index 0000000000..dfdcb9e094 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-3099/repo/org/apache/maven/its/mng3099/maven-metadata.xml @@ -0,0 +1,10 @@ + + + + + Maven Integration Test Plugin :: Touch + mng3099 + maven-mng3099-plugin + + + diff --git a/its/core-it-suite/src/test/resources/mng-3099/repo/org/apache/maven/its/mng3099/maven-mng3099-plugin/0.1/maven-mng3099-plugin-0.1.jar b/its/core-it-suite/src/test/resources/mng-3099/repo/org/apache/maven/its/mng3099/maven-mng3099-plugin/0.1/maven-mng3099-plugin-0.1.jar new file mode 100644 index 0000000000000000000000000000000000000000..e0fdeff35d74c30a901a964ffa5fc81603ba1c20 GIT binary patch literal 7859 zcmeHMc{tSF`yOj!O|~qrgk*^^j6GY6-N-VwNXD3uW$fA4$dZad_H3!tD|?obB@~9S zjSwYcE3%ce(03-)lvKa>y59eO@0n}(%r(z_pXWU1oaa2}9s^wpN?HK1y?0zz{QU6c z4-MfzR2_CmTw7m5!r+S;5b%y*mijif3`zJpfbeGh-VAz3Ut2@n7zToBtUx=o%S&Wr_aH`WGED z8e+s2$kJi7Lik1p;;GZ{T)$Yqm?=26*i1+Ep&N^GzV8u;HOLwS`05tmvs(mDzO|i% zr*Gc7zzhw{mlC zYyVU9x59{l`R4g&mx$ebfo+|Otze-)gEwc!^EU$p{ohHp%+%)Ay3#JAol6b?fOY@? z#2{>0!EQ)$$YNpNv_5)ddgubNzm(|aLGP30Hw zPPckd!TQyO<(?8NwMZ514W7DGQ zT5>{#-~4)-eiLQz-6Xr!3}Z~FMT9?sb?PqO984zOI`?vYqwiqV?Hc%KGBN>iPM(ko!vIz99(vY)BggEW;I}3);g(>;V zTna58iaG16(`yb+$L2RuA4TRi&CxJk+MmyH6b__ZvR>eJoHp@pPkM>gXuo3WJ#J-t zo_aC5CW}WqVWP0y2J3}L-tW|v#Dp!Td&KZ8I?@54Snc#!@3>LQD=W)u+B-Xiy^K^I zr*=F>`#WfG=^Pi+vFfxicMIobU_|n?aEkmD9Tcw@mLZ+!I>EP+t#W6In&Ocn4nXHG ze>o4IJWx^r7Ceg?vDqCN6Ky_T=RPsq{T#%PWi#r%os@ck6?uEZ7hbj|2i?!-wwMTU zlmdx;a_Z_1KWtb%7%@>jtRdzQIgQ&09Qfd8T^yjw!EF#&`J%ZB8|TV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4-_SUI^?2WTU~SlCcb{WzO!f4 zWIbx?8vgbB9bZd?pM?vtpKpkS!Wy)B;RSuZ@PZt@JV7q5_7Jdw!gu%9t!mGqf5`Ni zTl@>J_!h+i2&mXn%V_-@^#2t@{}n_36+{2eiXmd6s;GZ`C76&wVhHbJ|5he(^FX;F zJ-i%|p2j}MFuLM8V%ktcts>YWR7@8$F=@o8FJ`zXiZKLN7=Wd#q@*jQWMFPS42*_g zDR2pXQuK?gErW&NCv_y+CBzr?N-+{TgSui`dRTE;PpJ)zC zOiM|%B8LG}1|r*M*zrk)_T=-F1Pz;voR#9&8a!dVgvJDzC#GnU9!P?1ugMdQiLD@v zsB3Jl4y=o|FHMIC;I9W>2mp5oBf`f7}Kp17KuBI zuu{L&a9crJue&5rEW + + + + + 4.0.0 + + org.apache.maven.its.mng3099 + maven-mng3099-plugin + 0.1 + maven-plugin + + Maven Integration Test Plugin :: Touch + + A test plugin that creates an empty file. + + 2009 + + + + maven-core-it + file:///${basedir}/repo + + + + + true + + + + + org.apache.maven + maven-plugin-api + 2.0 + + + + + + + . + + pom.xml + src/** + + + + src/main/resources + + + + diff --git a/its/core-it-suite/src/test/resources/mng-3099/repo/org/apache/maven/its/mng3099/maven-mng3099-plugin/maven-metadata.xml b/its/core-it-suite/src/test/resources/mng-3099/repo/org/apache/maven/its/mng3099/maven-mng3099-plugin/maven-metadata.xml new file mode 100644 index 0000000000..5caaa82668 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-3099/repo/org/apache/maven/its/mng3099/maven-mng3099-plugin/maven-metadata.xml @@ -0,0 +1,14 @@ + + + org.apache.maven.its.mng3099 + maven-mng3099-plugin + 0.1 + + 0.1 + 0.1 + + 0.1 + + 20090718111552 + + diff --git a/its/core-it-suite/src/test/resources/mng-3099/settings-template.xml b/its/core-it-suite/src/test/resources/mng-3099/settings-template.xml new file mode 100644 index 0000000000..d0340a4805 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-3099/settings-template.xml @@ -0,0 +1,50 @@ + + + + + + + + local-profile + + target/PASSED.txt + + + + maven-core-it + @baseurl@/repo + + ignore + + + false + + + + + + maven-core-it + @baseurl@/repo + + ignore + + + false + + + + + + + + local-profile + + + diff --git a/its/core-it-suite/src/test/resources/mng-3099/settings.xml b/its/core-it-suite/src/test/resources/mng-3099/settings.xml deleted file mode 100644 index b03bb53f85..0000000000 --- a/its/core-it-suite/src/test/resources/mng-3099/settings.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - local-profile - - local-profile-prop-value - - - - - - local-profile - - -