Author: bentmann
Date: Sun Aug 24 13:07:31 2008
New Revision: 688554

URL: http://svn.apache.org/viewvc?rev=688554&view=rev
Log:
o Added integration test to check multiple Maven invocations per project

Added:
    maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-multiple/
    maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-multiple/pom.xml 
  (with props)
    maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-multiple/src/
    maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-multiple/src/it/
    
maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-multiple/src/it/project/
    
maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-multiple/src/it/project/invoker.properties
   (with props)
    
maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-multiple/src/it/project/pom.xml
   (with props)
    
maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-multiple/src/it/project/src/
    
maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-multiple/src/it/project/src/main/
    
maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-multiple/src/it/project/src/main/java/
    
maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-multiple/src/it/project/src/main/java/org/
    
maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-multiple/src/it/project/src/main/java/org/TestMojo.java
   (with props)
    
maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-multiple/src/it/settings.xml
   (with props)
    
maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-multiple/verify.bsh  
 (with props)
Modified:
    maven/plugins/trunk/maven-invoker-plugin/src/it/settings.xml

Added: 
maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-multiple/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-multiple/pom.xml?rev=688554&view=auto
==============================================================================
--- maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-multiple/pom.xml 
(added)
+++ maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-multiple/pom.xml 
Sun Aug 24 13:07:31 2008
@@ -0,0 +1,70 @@
+<?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.plugins.invoker</groupId>
+  <artifactId>invocation-multiple</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <packaging>pom</packaging>
+
+  <description>Test to check for proper support of multiple Maven invocations 
per project.</description>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-invoker-plugin</artifactId>
+        <version>@pom.version@</version>
+        <configuration>
+          <debug>true</debug>
+          <projectsDirectory>src/it</projectsDirectory>
+          <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
+          <pomIncludes>
+            <pomInclude>*/pom.xml</pomInclude>
+          </pomIncludes>
+          <settingsFile>src/it/settings.xml</settingsFile>
+          <goals>
+            <goal>validate</goal>
+          </goals>
+          <filterProperties>
+            <invoker.repo.local>${invoker.repo.local}</invoker.repo.local>
+          </filterProperties>
+        </configuration>
+        <executions>
+          <execution>
+            <id>integration-test</id>
+            <goals>
+              <goal>run</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+
+</project>

Propchange: 
maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-multiple/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-multiple/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: 
maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-multiple/src/it/project/invoker.properties
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-multiple/src/it/project/invoker.properties?rev=688554&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-multiple/src/it/project/invoker.properties
 (added)
+++ 
maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-multiple/src/it/project/invoker.properties
 Sun Aug 24 13:07:31 2008
@@ -0,0 +1,25 @@
+#######################################
+# Default build
+#######################################
+invoker.goals = install
+invoker.profiles = plugin,profile0
+invoker.mavenOpts = -Dfile.encoding=UTF-8
+
+#######################################
+# First build
+#######################################
+invoker.profiles.1 = 
+
+#######################################
+# Second build
+#######################################
+invoker.goals.2 = test:test-maven-plugin:0.1-SNAPSHOT:test
+invoker.profiles.2 = plugin,profile1
+# maven opts should fall back to invoker.mavenOpts
+
+#######################################
+# Third build
+#######################################
+invoker.goals.3 = test:test-maven-plugin:0.1-SNAPSHOT:test
+# profiles should fall back to invoker.profiles
+invoker.mavenOpts.3 = -Dfile.encoding=ISO-8859-1

Propchange: 
maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-multiple/src/it/project/invoker.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-multiple/src/it/project/invoker.properties
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: 
maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-multiple/src/it/project/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-multiple/src/it/project/pom.xml?rev=688554&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-multiple/src/it/project/pom.xml
 (added)
+++ 
maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-multiple/src/it/project/pom.xml
 Sun Aug 24 13:07:31 2008
@@ -0,0 +1,105 @@
+<?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>test</groupId>
+  <artifactId>test-maven-plugin</artifactId>
+  <version>0.1-SNAPSHOT</version>
+  <packaging>maven-plugin</packaging>
+  
+  <prerequisites>
+    <maven>2.0</maven>
+  </prerequisites>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+  
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-plugin-api</artifactId>
+      <version>2.0</version>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>2.0.2</version>
+        <configuration>
+          <source>1.4</source>
+          <target>1.4</target>
+        </configuration>
+      </plugin>
+      <plugin>
+        <artifactId>maven-install-plugin</artifactId>
+        <version>2.2</version>
+      </plugin>
+      <plugin>
+        <artifactId>maven-jar-plugin</artifactId>
+        <version>2.2</version>
+      </plugin>
+      <plugin>
+        <artifactId>maven-plugin-plugin</artifactId>
+        <version>2.4.2</version>
+      </plugin>
+      <plugin>
+        <artifactId>maven-resources-plugin</artifactId>
+        <version>2.2</version>
+      </plugin>
+      <plugin>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <version>2.4.3</version>
+      </plugin>
+    </plugins>
+  </build>
+
+  <profiles>
+    <profile>
+      <id>plugin</id>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>${project.artifactId}</artifactId>
+            <version>${project.version}</version>
+            <configuration>
+              
<outputFile>${project.build.directory}/${testProperty}.txt</outputFile>
+            </configuration>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+    <profile>
+      <id>profile0</id>
+      <properties>
+        <testProperty>test0</testProperty>
+      </properties>
+    </profile>
+    <profile>
+      <id>profile1</id>
+      <properties>
+        <testProperty>test1</testProperty>
+      </properties>
+    </profile>
+  </profiles>
+</project>

Propchange: 
maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-multiple/src/it/project/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-multiple/src/it/project/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: 
maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-multiple/src/it/project/src/main/java/org/TestMojo.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-multiple/src/it/project/src/main/java/org/TestMojo.java?rev=688554&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-multiple/src/it/project/src/main/java/org/TestMojo.java
 (added)
+++ 
maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-multiple/src/it/project/src/main/java/org/TestMojo.java
 Sun Aug 24 13:07:31 2008
@@ -0,0 +1,49 @@
+package org;
+
+import java.io.*;
+import java.util.*;
+
+import org.apache.maven.plugin.*;
+
+/**
+ * @goal test
+ */
+public class TestMojo extends AbstractMojo {
+
+    /**
+     * @parameter default-value="${project.build.directory}/test.txt"
+     */
+    private File outputFile;
+
+    /**
+     * @see org.apache.maven.plugin.AbstractMojo#execute()
+     */
+    public void execute() throws MojoExecutionException, MojoFailureException {
+        outputFile.getParentFile().mkdirs();
+        Writer writer = null;
+        try
+        {
+            writer = new OutputStreamWriter( new FileOutputStream( outputFile 
), "UTF-8" );
+            writer.write( System.getProperty( "file.encoding" ) );
+        }
+        catch (IOException e)
+        {
+            throw new MojoExecutionException( "Failed", e );
+        }
+        finally
+        {
+            if ( writer != null )
+            {
+                try
+                {
+                    writer.close();
+                }
+                catch (IOException e)
+                {
+                    // ignore
+                }
+            }
+        }
+    }
+
+}

Propchange: 
maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-multiple/src/it/project/src/main/java/org/TestMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-multiple/src/it/project/src/main/java/org/TestMojo.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: 
maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-multiple/src/it/settings.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-multiple/src/it/settings.xml?rev=688554&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-multiple/src/it/settings.xml
 (added)
+++ 
maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-multiple/src/it/settings.xml
 Sun Aug 24 13:07:31 2008
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<settings>
+  <profiles>
+    <profile>
+      <id>it-repo</id>
+      <activation>
+        <activeByDefault>true</activeByDefault>
+      </activation>
+      <!--
+      NOTE: We don't use @localRepository@ here which refers to the isolated 
local repository of the ITs and is quite
+      empty. In contrast, @invoker.repo.local@ has been defined to refer to 
the original local repository which is a
+      far better source for artifacts.
+      -->
+      <repositories>
+        <repository>
+          <id>local.central</id>
+          <url>file://@invoker.repo.local@</url>
+          <releases>
+            <enabled>true</enabled>
+          </releases>
+          <snapshots>
+            <enabled>true</enabled>
+          </snapshots>
+        </repository>
+      </repositories>
+      <pluginRepositories>
+        <pluginRepository>
+          <id>local.central</id>
+          <url>file://@invoker.repo.local@</url>
+          <releases>
+            <enabled>true</enabled>
+          </releases>
+          <snapshots>
+            <enabled>true</enabled>
+          </snapshots>
+        </pluginRepository>
+      </pluginRepositories>
+    </profile>
+  </profiles>
+</settings>

Propchange: 
maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-multiple/src/it/settings.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-multiple/src/it/settings.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: 
maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-multiple/verify.bsh
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-multiple/verify.bsh?rev=688554&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-multiple/verify.bsh 
(added)
+++ 
maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-multiple/verify.bsh 
Sun Aug 24 13:07:31 2008
@@ -0,0 +1,47 @@
+import java.io.*;
+import java.util.*;
+import java.util.regex.*;
+
+import org.codehaus.plexus.util.*;
+
+try
+{
+    File test0File = new File( basedir, "target/it/project/target/test0.txt" );
+    System.out.println( "Checking for existence of first test file: " + 
test0File );
+    if ( !test0File.exists() )
+    {
+        System.out.println( "FAILED!" );
+        return false;
+    }
+
+    String test0 = FileUtils.fileRead( test0File, "UTF-8" ).trim();
+    System.out.println( "Checking contents of first test file: " + test0 );
+    if ( !"ISO-8859-1".equals( test0 ) )
+    {
+        System.out.println( "FAILED!" );
+        return false;
+    }
+
+    File test1File = new File( basedir, "target/it/project/target/test1.txt" );
+    System.out.println( "Checking for existence of second test file: " + 
test1File );
+    if ( !test1File.exists() )
+    {
+        System.out.println( "FAILED!" );
+        return false;
+    }
+
+    String test1 = FileUtils.fileRead( test1File, "UTF-8" ).trim();
+    System.out.println( "Checking contents of second test file: " + test1 );
+    if ( !"UTF-8".equals( test1 ) )
+    {
+        System.out.println( "FAILED!" );
+        return false;
+    }
+}
+catch( Throwable t )
+{
+    t.printStackTrace();
+    return false;
+}
+
+return true;

Propchange: 
maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-multiple/verify.bsh
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-multiple/verify.bsh
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: maven/plugins/trunk/maven-invoker-plugin/src/it/settings.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/settings.xml?rev=688554&r1=688553&r2=688554&view=diff
==============================================================================
--- maven/plugins/trunk/maven-invoker-plugin/src/it/settings.xml (original)
+++ maven/plugins/trunk/maven-invoker-plugin/src/it/settings.xml Sun Aug 24 
13:07:31 2008
@@ -26,6 +26,10 @@
       <activation>
         <activeByDefault>true</activeByDefault>
       </activation>
+      <properties>
+        <!-- This property allows the ITs to access the real local repository 
instead of the isolated one -->
+        <invoker.repo.local>@localRepository@</invoker.repo.local>
+      </properties>
       <repositories>
         <repository>
           <id>local.central</id>


Reply via email to