maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bentm...@apache.org
Subject svn commit: r795346 - in /maven/core-integration-testing/trunk/core-it-suite/src/test: java/org/apache/maven/it/ resources/mng-3099/ resources/mng-3099/plugin/ resources/mng-3099/repo/ resources/mng-3099/repo/org/ resources/mng-3099/repo/org/apache/ re...
Date Sat, 18 Jul 2009 11:45:17 GMT
Author: bentmann
Date: Sat Jul 18 11:45:16 2009
New Revision: 795346

URL: http://svn.apache.org/viewvc?rev=795346&view=rev
Log:
[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

Added:
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3099/repo/
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3099/repo/org/
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3099/repo/org/apache/
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3099/repo/org/apache/maven/
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3099/repo/org/apache/maven/its/
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3099/repo/org/apache/maven/its/mng3099/
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3099/repo/org/apache/maven/its/mng3099/maven-metadata.xml
  (with props)
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3099/repo/org/apache/maven/its/mng3099/maven-mng3099-plugin/
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3099/repo/org/apache/maven/its/mng3099/maven-mng3099-plugin/0.1/
    maven/core-integration-testing/trunk/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
  (with props)
    maven/core-integration-testing/trunk/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
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3099/repo/org/apache/maven/its/mng3099/maven-mng3099-plugin/maven-metadata.xml
  (with props)
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3099/settings-template.xml
      - copied, changed from r795168, maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3099/settings.xml
Removed:
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3099/plugin/
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3099/readme.txt
    maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3099/settings.xml
Modified:
    maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3099SettingsProfilesWithNoPomTest.java

Modified: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3099SettingsProfilesWithNoPomTest.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3099SettingsProfilesWithNoPomTest.java?rev=795346&r1=795345&r2=795346&view=diff
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3099SettingsProfilesWithNoPomTest.java
(original)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3099SettingsProfilesWithNoPomTest.java
Sat Jul 18 11:45:16 2009
@@ -23,82 +23,44 @@
 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 <a href="http://jira.codehaus.org/browse/MNG-3099">MNG-3099</a>.
  *
  * @author <a href="mailto:brianf@apache.org">Brian Fox</a>
- *
  */
 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.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 verifier = new Verifier( testDir.getAbsolutePath() );
         verifier.setAutoclean( false );
-        verifier.executeGoal( "org.apache.maven.its.mng3099:maven-mng3099-plugin:1:profile-props"
);
-
+        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();
 
-        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" );
     }
+
 }

Added: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3099/repo/org/apache/maven/its/mng3099/maven-metadata.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3099/repo/org/apache/maven/its/mng3099/maven-metadata.xml?rev=795346&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3099/repo/org/apache/maven/its/mng3099/maven-metadata.xml
(added)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3099/repo/org/apache/maven/its/mng3099/maven-metadata.xml
Sat Jul 18 11:45:16 2009
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<metadata>
+  <plugins>
+    <plugin>
+      <name>Maven Integration Test Plugin :: Touch</name>
+      <prefix>mng3099</prefix>
+      <artifactId>maven-mng3099-plugin</artifactId>
+    </plugin>
+  </plugins>
+</metadata>

Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3099/repo/org/apache/maven/its/mng3099/maven-metadata.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3099/repo/org/apache/maven/its/mng3099/maven-metadata.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/core-integration-testing/trunk/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
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/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?rev=795346&view=auto
==============================================================================
Binary file - no diff available.

Propchange: maven/core-integration-testing/trunk/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
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: maven/core-integration-testing/trunk/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
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/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?rev=795346&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/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
(added)
+++ maven/core-integration-testing/trunk/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
Sat Jul 18 11:45:16 2009
@@ -0,0 +1,69 @@
+<?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>org.apache.maven.its.mng3099</groupId>
+  <artifactId>maven-mng3099-plugin</artifactId>
+  <version>0.1</version>
+  <packaging>maven-plugin</packaging>
+
+  <name>Maven Integration Test Plugin :: Touch</name>
+  <description>
+    A test plugin that creates an empty file.
+  </description>
+  <inceptionYear>2009</inceptionYear>
+
+  <distributionManagement>
+    <repository>
+      <id>maven-core-it</id>
+      <url>file:///${basedir}/repo</url>
+    </repository>
+  </distributionManagement>
+
+  <properties>
+    <maven.test.skip>true</maven.test.skip>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-plugin-api</artifactId>
+      <version>2.0</version>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <resources>
+      <resource>
+        <directory>.</directory>
+        <includes>
+          <include>pom.xml</include>
+          <include>src/**</include>
+        </includes>
+      </resource>
+      <resource>
+        <directory>src/main/resources</directory>
+      </resource>
+    </resources>
+  </build>
+</project>

Added: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3099/repo/org/apache/maven/its/mng3099/maven-mng3099-plugin/maven-metadata.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3099/repo/org/apache/maven/its/mng3099/maven-mng3099-plugin/maven-metadata.xml?rev=795346&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3099/repo/org/apache/maven/its/mng3099/maven-mng3099-plugin/maven-metadata.xml
(added)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3099/repo/org/apache/maven/its/mng3099/maven-mng3099-plugin/maven-metadata.xml
Sat Jul 18 11:45:16 2009
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<metadata>
+  <groupId>org.apache.maven.its.mng3099</groupId>
+  <artifactId>maven-mng3099-plugin</artifactId>
+  <version>0.1</version>
+  <versioning>
+    <latest>0.1</latest>
+    <release>0.1</release>
+    <versions>
+      <version>0.1</version>
+    </versions>
+    <lastUpdated>20090718111552</lastUpdated>
+  </versioning>
+</metadata>

Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3099/repo/org/apache/maven/its/mng3099/maven-mng3099-plugin/maven-metadata.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3099/repo/org/apache/maven/its/mng3099/maven-mng3099-plugin/maven-metadata.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Copied: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3099/settings-template.xml
(from r795168, maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3099/settings.xml)
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3099/settings-template.xml?p2=maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3099/settings-template.xml&p1=maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3099/settings.xml&r1=795168&r2=795346&rev=795346&view=diff
==============================================================================
--- maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3099/settings.xml
(original)
+++ maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3099/settings-template.xml
Sat Jul 18 11:45:16 2009
@@ -1,20 +1,50 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <settings 
-	xmlns="http://maven.apache.org/SETTINGS/1.0.0" 
-	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
-	xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
-	
-	<profiles>
-		<profile>
-			<id>local-profile</id>
-			<properties>
-				<local-profile-prop>local-profile-prop-value</local-profile-prop>
-			</properties>
-		</profile>
-	</profiles>
-	
-	<activeProfiles>
-		<activeProfile>local-profile</activeProfile>
-	</activeProfiles>
-	
+  xmlns="http://maven.apache.org/SETTINGS/1.0.0" 
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+  xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
+  
+  <!--
+  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.
+  -->
+
+  <profiles>
+    <profile>
+      <id>local-profile</id>
+      <properties>
+        <touch.outputFile>target/PASSED.txt</touch.outputFile>
+      </properties>
+      <repositories>
+        <repository>
+          <id>maven-core-it</id>
+          <url>@baseurl@/repo</url>
+          <releases>
+            <checksumPolicy>ignore</checksumPolicy>
+          </releases>
+          <snapshots>
+            <enabled>false</enabled>
+          </snapshots>
+        </repository>
+      </repositories>
+      <pluginRepositories>
+        <pluginRepository>
+          <id>maven-core-it</id>
+          <url>@baseurl@/repo</url>
+          <releases>
+            <checksumPolicy>ignore</checksumPolicy>
+          </releases>
+          <snapshots>
+            <enabled>false</enabled>
+          </snapshots>
+        </pluginRepository>
+      </pluginRepositories>
+    </profile>
+  </profiles>
+  
+  <activeProfiles>
+    <activeProfile>local-profile</activeProfile>
+  </activeProfiles>
+  
 </settings>



Mime
View raw message