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 0000000000..e0fdeff35d Binary files /dev/null and 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 differ 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.pom 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.pom new file mode 100644 index 0000000000..f24f0e2572 --- /dev/null +++ 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.pom @@ -0,0 +1,69 @@ + + + + + + 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 - - -