You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by br...@apache.org on 2008/03/11 18:25:16 UTC

svn commit: r636019 - in /maven/core-integration-testing/trunk/core-integration-tests/src/test: java/org/apache/maven/integrationtests/ resources/mng3284-usingCachedPlugins/ resources/mng3284-usingCachedPlugins/PomA/ resources/mng3284-usingCachedPlugin...

Author: brianf
Date: Tue Mar 11 10:24:58 2008
New Revision: 636019

URL: http://svn.apache.org/viewvc?rev=636019&view=rev
Log:
MNG-3284: it for plugin caching

Added:
    maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3284UsingCachedPluginsTest.java
    maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng3284-usingCachedPlugins/
    maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng3284-usingCachedPlugins/PomA/
    maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng3284-usingCachedPlugins/PomA/pom.xml
    maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng3284-usingCachedPlugins/PomB/
    maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng3284-usingCachedPlugins/PomB/pom.xml
    maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng3284-usingCachedPlugins/mojo/
    maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng3284-usingCachedPlugins/mojo/pom.xml
    maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng3284-usingCachedPlugins/mojo/src/
    maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng3284-usingCachedPlugins/mojo/src/main/
    maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng3284-usingCachedPlugins/mojo/src/main/groovy/
    maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng3284-usingCachedPlugins/mojo/src/main/groovy/test/
    maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng3284-usingCachedPlugins/mojo/src/main/groovy/test/bug/
    maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng3284-usingCachedPlugins/mojo/src/main/groovy/test/bug/DepMojo.groovy
    maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng3284-usingCachedPlugins/mojo2/
    maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng3284-usingCachedPlugins/mojo2/pom.xml
    maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng3284-usingCachedPlugins/mojo2/src/
    maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng3284-usingCachedPlugins/mojo2/src/main/
    maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng3284-usingCachedPlugins/mojo2/src/main/groovy/
    maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng3284-usingCachedPlugins/mojo2/src/main/groovy/test/
    maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng3284-usingCachedPlugins/mojo2/src/main/groovy/test/bug/
    maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng3284-usingCachedPlugins/mojo2/src/main/groovy/test/bug/DepMojo.groovy
    maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng3284-usingCachedPlugins/pom.xml

Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3284UsingCachedPluginsTest.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3284UsingCachedPluginsTest.java?rev=636019&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3284UsingCachedPluginsTest.java (added)
+++ maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3284UsingCachedPluginsTest.java Tue Mar 11 10:24:58 2008
@@ -0,0 +1,72 @@
+package org.apache.maven.integrationtests;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import junit.framework.Assert;
+
+import org.apache.maven.integrationtests.AbstractMavenIntegrationTestCase;
+import org.apache.maven.it.Verifier;
+import org.apache.maven.it.util.ResourceExtractor;
+
+/**
+ * Integration test to check MNG-3284 - that explicitly defined plugins are used, not the one that is cached.
+ */
+public class MavenITmng3284UsingCachedPluginsTest
+    extends AbstractMavenIntegrationTestCase
+{
+    public void testitMNG3284Test()
+        throws Exception
+    {
+
+        // The testdir is computed from the location of this
+        // file.
+        File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng3284-usingCachedPlugins" );
+
+        Verifier verifier;
+
+        /*
+         * Build Mojo v1
+         */
+        verifier = new Verifier( new File( testDir.getAbsolutePath(), "mojo" ).getAbsolutePath() );
+        verifier.executeGoal( "install" );
+        verifier.verifyErrorFreeLog();
+        verifier.resetStreams();
+
+        /*
+         * Build Mojo v2
+         */
+        verifier = new Verifier( new File( testDir.getAbsolutePath(), "mojo2" ).getAbsolutePath() );
+        verifier.executeGoal( "install" );
+        verifier.verifyErrorFreeLog();
+        verifier.resetStreams();
+
+        /*
+         * Run the simple build
+         */
+        verifier = new Verifier( testDir.getAbsolutePath() );
+        verifier.executeGoal( "install" );
+        verifier.verifyErrorFreeLog();
+
+        List lines = verifier.loadFile( testDir.getAbsolutePath(), "log.txt", false );
+        int foundVersionOne = 0;
+        int foundVersionTwo = 0;
+        for ( Iterator i = lines.iterator(); i.hasNext(); )
+        {
+
+            String line = (String) i.next();
+            if ( line.indexOf( "USING VERSION 1" ) != -1 )
+                foundVersionOne++;
+            if ( line.indexOf( "USING VERSION 2" ) != -1 )
+                foundVersionTwo++;
+        }
+
+        verifier.resetStreams();
+
+        Assert.assertEquals( "Should be using plugin version 1 only once", 1,foundVersionOne );
+        Assert.assertEquals( "Should be using plugin version 2 only once", 1,foundVersionTwo );
+
+    }
+}

Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng3284-usingCachedPlugins/PomA/pom.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng3284-usingCachedPlugins/PomA/pom.xml?rev=636019&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng3284-usingCachedPlugins/PomA/pom.xml (added)
+++ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng3284-usingCachedPlugins/PomA/pom.xml Tue Mar 11 10:24:58 2008
@@ -0,0 +1,35 @@
+<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.bug</groupId>
+  <artifactId>PomA</artifactId>
+  <packaging>jar</packaging>
+
+
+  <parent>
+    <groupId>test</groupId>
+    <artifactId>bug</artifactId>
+    <version>1.0-SNAPSHOT</version>
+   </parent>
+  
+  <build>
+		<plugins>
+			<plugin>
+				<groupId>test.bug</groupId>
+				<artifactId>mojo</artifactId>
+				<version>1.0</version>
+				<executions>
+					<execution>
+						<goals>
+							<goal>bug</goal>
+						</goals>
+					</execution>
+				</executions>
+			</plugin>
+		</plugins>
+ </build>
+
+  
+
+</project>
+
+

Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng3284-usingCachedPlugins/PomB/pom.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng3284-usingCachedPlugins/PomB/pom.xml?rev=636019&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng3284-usingCachedPlugins/PomB/pom.xml (added)
+++ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng3284-usingCachedPlugins/PomB/pom.xml Tue Mar 11 10:24:58 2008
@@ -0,0 +1,29 @@
+<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>
+      <parent>
+    <groupId>test</groupId>
+    <artifactId>bug</artifactId>
+    <version>1.0-SNAPSHOT</version>
+   </parent>
+	<groupId>test.bug</groupId>
+	<artifactId>PomB</artifactId>
+	<packaging>jar</packaging>
+	<version>1.0-SNAPSHOT</version>
+	<build>
+		<plugins>
+			<plugin>
+				<groupId>test.bug</groupId>
+				<artifactId>mojo</artifactId>
+				<version>2.0</version>
+				<executions>
+					<execution>
+						<goals>
+							<goal>bug</goal>
+						</goals>
+					</execution>
+				</executions>
+			</plugin>
+		</plugins>
+	</build>
+</project>
\ No newline at end of file

Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng3284-usingCachedPlugins/mojo/pom.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng3284-usingCachedPlugins/mojo/pom.xml?rev=636019&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng3284-usingCachedPlugins/mojo/pom.xml (added)
+++ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng3284-usingCachedPlugins/mojo/pom.xml Tue Mar 11 10:24:58 2008
@@ -0,0 +1,88 @@
+<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.bug</groupId>
+  <artifactId>mojo</artifactId>
+  <packaging>maven-plugin</packaging>
+  <version>1.0</version>
+  
+  
+  <build>
+		<plugins>
+			<plugin>
+				<groupId>org.codehaus.mojo.groovy</groupId>
+				<artifactId>groovy-maven-plugin</artifactId>
+				<version>1.0-beta-2</version>
+				<executions>
+					<execution>
+						<goals>
+							<goal>compile</goal>
+						</goals>
+					</execution>
+				</executions>
+			</plugin>
+		
+		<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-plugin-plugin</artifactId>
+				<dependencies>
+					<dependency>
+						<groupId>org.codehaus.mojo.groovy</groupId>
+						<artifactId>groovy-mojo-tools</artifactId>
+						<version>1.0-beta-2</version>
+					</dependency>
+				</dependencies>
+				<configuration>
+					<extractors>
+						<extractor>groovy</extractor>
+						<extractor>java</extractor>
+					</extractors>
+					<goalPrefix>bug</goalPrefix>
+				</configuration>
+			</plugin>
+		
+		</plugins>
+		
+		
+	</build>
+  
+  <dependencies>
+  	<dependency>
+			<groupId>org.codehaus.mojo.groovy</groupId>
+			<artifactId>groovy-mojo-support</artifactId>
+			<version>1.0-beta-2</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.maven</groupId>
+			<artifactId>maven-plugin-api</artifactId>
+			<version>2.0</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.maven</groupId>
+			<artifactId>maven-project</artifactId>
+			<version>2.0</version>
+		</dependency>
+			<dependency>
+			<groupId>org.apache.maven</groupId>
+			<artifactId>maven-artifact</artifactId>
+			<version>2.0</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.maven</groupId>
+			<artifactId>maven-settings</artifactId>
+			<version>2.0</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.maven</groupId>
+			<artifactId>maven-plugin-descriptor</artifactId>
+			<version>2.0</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.maven</groupId>
+			<artifactId>maven-core</artifactId>
+			<version>2.0</version>
+		</dependency>
+  </dependencies>
+
+</project>
+
+

Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng3284-usingCachedPlugins/mojo/src/main/groovy/test/bug/DepMojo.groovy
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng3284-usingCachedPlugins/mojo/src/main/groovy/test/bug/DepMojo.groovy?rev=636019&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng3284-usingCachedPlugins/mojo/src/main/groovy/test/bug/DepMojo.groovy (added)
+++ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng3284-usingCachedPlugins/mojo/src/main/groovy/test/bug/DepMojo.groovy Tue Mar 11 10:24:58 2008
@@ -0,0 +1,26 @@
+package test.bug
+
+import org.codehaus.mojo.groovy.GroovyMojoSupport
+
+
+/**
+ * Show bug?
+ *
+ * @goal bug
+ * @phase package
+ */
+class DepMojo
+    extends GroovyMojoSupport
+{
+    
+    
+    void execute() {
+     println "USING VERSION 1"; 
+    }
+    
+    
+  
+}
+
+
+

Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng3284-usingCachedPlugins/mojo2/pom.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng3284-usingCachedPlugins/mojo2/pom.xml?rev=636019&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng3284-usingCachedPlugins/mojo2/pom.xml (added)
+++ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng3284-usingCachedPlugins/mojo2/pom.xml Tue Mar 11 10:24:58 2008
@@ -0,0 +1,88 @@
+<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.bug</groupId>
+  <artifactId>mojo</artifactId>
+  <packaging>maven-plugin</packaging>
+  <version>2.0</version>
+  
+  
+  <build>
+		<plugins>
+			<plugin>
+				<groupId>org.codehaus.mojo.groovy</groupId>
+				<artifactId>groovy-maven-plugin</artifactId>
+				<version>1.0-beta-2</version>
+				<executions>
+					<execution>
+						<goals>
+							<goal>compile</goal>
+						</goals>
+					</execution>
+				</executions>
+			</plugin>
+		
+		<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-plugin-plugin</artifactId>
+				<dependencies>
+					<dependency>
+						<groupId>org.codehaus.mojo.groovy</groupId>
+						<artifactId>groovy-mojo-tools</artifactId>
+						<version>1.0-beta-2</version>
+					</dependency>
+				</dependencies>
+				<configuration>
+					<extractors>
+						<extractor>groovy</extractor>
+						<extractor>java</extractor>
+					</extractors>
+					<goalPrefix>bug</goalPrefix>
+				</configuration>
+			</plugin>
+		
+		</plugins>
+		
+		
+	</build>
+  
+  <dependencies>
+  	<dependency>
+			<groupId>org.codehaus.mojo.groovy</groupId>
+			<artifactId>groovy-mojo-support</artifactId>
+			<version>1.0-beta-2</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.maven</groupId>
+			<artifactId>maven-plugin-api</artifactId>
+			<version>2.0</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.maven</groupId>
+			<artifactId>maven-project</artifactId>
+			<version>2.0</version>
+		</dependency>
+			<dependency>
+			<groupId>org.apache.maven</groupId>
+			<artifactId>maven-artifact</artifactId>
+			<version>2.0</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.maven</groupId>
+			<artifactId>maven-settings</artifactId>
+			<version>2.0</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.maven</groupId>
+			<artifactId>maven-plugin-descriptor</artifactId>
+			<version>2.0</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.maven</groupId>
+			<artifactId>maven-core</artifactId>
+			<version>2.0</version>
+		</dependency>
+  </dependencies>
+
+</project>
+
+

Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng3284-usingCachedPlugins/mojo2/src/main/groovy/test/bug/DepMojo.groovy
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng3284-usingCachedPlugins/mojo2/src/main/groovy/test/bug/DepMojo.groovy?rev=636019&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng3284-usingCachedPlugins/mojo2/src/main/groovy/test/bug/DepMojo.groovy (added)
+++ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng3284-usingCachedPlugins/mojo2/src/main/groovy/test/bug/DepMojo.groovy Tue Mar 11 10:24:58 2008
@@ -0,0 +1,21 @@
+package test.bug
+
+import org.codehaus.mojo.groovy.GroovyMojoSupport
+
+/**
+ * Show bug?
+ *
+ * @goal bug
+ * @phase package
+ */
+class DepMojo
+    extends GroovyMojoSupport
+{
+    void execute() {
+     println "USING VERSION 2"; 
+    }
+  
+}
+
+
+

Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng3284-usingCachedPlugins/pom.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng3284-usingCachedPlugins/pom.xml?rev=636019&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng3284-usingCachedPlugins/pom.xml (added)
+++ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng3284-usingCachedPlugins/pom.xml Tue Mar 11 10:24:58 2008
@@ -0,0 +1,12 @@
+<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>bug</artifactId>
+	<version>1.0-SNAPSHOT</version>
+	<packaging>pom</packaging>
+	<modules>
+		<module>PomA</module>
+		<module>PomB</module>
+	</modules>
+</project>
\ No newline at end of file