Author: brett
Date: Thu Jan 29 04:15:02 2009
New Revision: 738752
URL: http://svn.apache.org/viewvc?rev=738752&view=rev
Log:
[MNG-3920] add integration test for uses of plexus-component-api in plugins
Added:
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3920PlexusComponentApiTest.java
(with props)
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3920/
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3920/pom.xml
(with props)
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-plexus-component-api/
(props changed)
- copied from r738336,
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-plexus-utils-11/
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-plexus-component-api/src/main/java/org/apache/maven/its/plugins/VelocityMojo.java
(contents, props changed)
- copied, changed from r738336,
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-plexus-utils-11/src/main/java/org/apache/maven/its/plugins/SerializeMojo.java
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-plexus-component-api/src/main/resources/
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-plexus-component-api/src/main/resources/template.vm
(with props)
Removed:
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-plexus-component-api/src/main/java/org/apache/maven/its/plugins/SerializeMojo.java
Modified:
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/bootstrap/pom.xml
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-plexus-component-api/pom.xml
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/pom.xml
Added:
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3920PlexusComponentApiTest.java
URL:
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3920PlexusComponentApiTest.java?rev=738752&view=auto
==============================================================================
---
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3920PlexusComponentApiTest.java
(added)
+++
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3920PlexusComponentApiTest.java
Thu Jan 29 04:15:02 2009
@@ -0,0 +1,55 @@
+package org.apache.maven.it;
+
+/*
+ * 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.
+ */
+
+import java.io.File;
+
+import org.apache.maven.it.util.FileUtils;
+import org.apache.maven.it.util.ResourceExtractor;
+
+/**
+ * This is a test set for <a
href="http://jira.codehaus.org/browse/MNG-3920">MNG-3920</a>. The first test
verifies that
+ * a plugin using plexus-component-api in a Plexus component does not cause
linkage errors.
+ */
+public class MavenITmng3920PlexusComponentApiTest
+ extends AbstractMavenIntegrationTestCase
+{
+ public MavenITmng3920PlexusComponentApiTest()
+ {
+ super( "(2.0.10,2.1.0-M1),(2.1.0-M1,)" ); // only test in 2.0.11+, and
not in 2.1.0-M1
+ }
+
+ public void testitMNG3920()
+ throws Exception
+ {
+ File dir =
+ ResourceExtractor.simpleExtractResources( getClass(), "/mng-3920"
);
+
+ Verifier verifier;
+
+ verifier = new Verifier( dir.getAbsolutePath() );
+
+ verifier.executeGoal( "validate" );
+
+ verifier.verifyErrorFreeLog();
+
+ verifier.resetStreams();
+ }
+}
Propchange:
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3920PlexusComponentApiTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified:
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/bootstrap/pom.xml
URL:
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/bootstrap/pom.xml?rev=738752&r1=738751&r2=738752&view=diff
==============================================================================
---
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/bootstrap/pom.xml
(original)
+++
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/bootstrap/pom.xml
Thu Jan 29 04:15:02 2009
@@ -185,6 +185,12 @@
</dependency>
<dependency>
<groupId>org.apache.maven.its.plugins</groupId>
+ <artifactId>maven-it-plugin-plexus-component-api</artifactId>
+ <version>${itPluginVersion}</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.its.plugins</groupId>
<artifactId>maven-it-plugin-project-interpolation</artifactId>
<version>${itPluginVersion}</version>
<scope>runtime</scope>
Added:
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3920/pom.xml
URL:
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3920/pom.xml?rev=738752&view=auto
==============================================================================
---
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3920/pom.xml
(added)
+++
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3920/pom.xml
Thu Jan 29 04:15:02 2009
@@ -0,0 +1,24 @@
+<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.mng3920</groupId>
+ <artifactId>child</artifactId>
+ <packaging>jar</packaging>
+ <version>1.0-SNAPSHOT</version>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.its.plugins</groupId>
+ <artifactId>maven-it-plugin-plexus-component-api</artifactId>
+ <version>2.1-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>velocity</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Propchange:
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3920/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-plexus-component-api/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Jan 29 04:15:02 2009
@@ -0,0 +1,4 @@
+.classpath
+.settings
+.project
+target
Propchange:
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-plexus-component-api/
------------------------------------------------------------------------------
svn:mergeinfo =
Modified:
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-plexus-component-api/pom.xml
URL:
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-plexus-component-api/pom.xml?rev=738752&r1=738336&r2=738752&view=diff
==============================================================================
---
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-plexus-component-api/pom.xml
(original)
+++
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-plexus-component-api/pom.xml
Thu Jan 29 04:15:02 2009
@@ -28,16 +28,17 @@
<version>2.1-SNAPSHOT</version>
</parent>
- <artifactId>maven-it-plugin-plexus-utils-11</artifactId>
+ <artifactId>maven-it-plugin-plexus-component-api</artifactId>
<packaging>maven-plugin</packaging>
- <name>Maven Integration Test Plugin :: Plexus Utils 1.1</name>
+ <name>Maven Integration Test Plugin :: Plexus Component API</name>
<dependencies>
+ <!-- introduces component-api, should be excluded -->
<dependency>
<groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-utils</artifactId>
- <version>1.1</version>
+ <artifactId>plexus-velocity</artifactId>
+ <version>1.1.7</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
Copied:
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-plexus-component-api/src/main/java/org/apache/maven/its/plugins/VelocityMojo.java
(from r738336,
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-plexus-utils-11/src/main/java/org/apache/maven/its/plugins/SerializeMojo.java)
URL:
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-plexus-component-api/src/main/java/org/apache/maven/its/plugins/VelocityMojo.java?p2=maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-plexus-component-api/src/main/java/org/apache/maven/its/plugins/VelocityMojo.java&p1=maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-plexus-utils-11/src/main/java/org/apache/maven/its/plugins/SerializeMojo.java&r1=738336&r2=738752&rev=738752&view=diff
==============================================================================
---
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-plexus-utils-11/src/main/java/org/apache/maven/its/plugins/SerializeMojo.java
(original)
+++
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-plexus-component-api/src/main/java/org/apache/maven/its/plugins/VelocityMojo.java
Thu Jan 29 04:15:02 2009
@@ -19,55 +19,38 @@
* under the License.
*/
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStreamWriter;
-import java.io.Writer;
-
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
-import org.codehaus.plexus.util.IOUtil;
-import org.codehaus.plexus.util.xml.Xpp3Dom;
-import org.codehaus.plexus.util.xml.pull.MXSerializer;
-import org.codehaus.plexus.util.xml.pull.XmlSerializer;
+import org.codehaus.plexus.velocity.VelocityComponent;
/**
- * @goal serialize
+ * @goal velocity
* @phase validate
*/
-public class SerializeMojo
+public class VelocityMojo
extends AbstractMojo
{
-
/**
- * @parameter default-value="${project.build.directory}/serialized.xml"
+ * @component
*/
- private File file;
+ protected VelocityComponent velocityComponent;
public void execute()
throws MojoExecutionException, MojoFailureException
{
- Writer writer = null;
- XmlSerializer s = new MXSerializer();
+ // velocityComponent should not be null
+ velocityComponent.getEngine();
+
try
{
- file.getParentFile().mkdirs();
- writer = new OutputStreamWriter( new FileOutputStream( file ),
"UTF-8" );
- s.setOutput( writer );
-
- Xpp3Dom dom = new Xpp3Dom( "root" );
-
- dom.writeToSerializer( "", s );
+ // velocityComponent engine should not be null
+ // this is the real test to check that we got the right
Initializable interface in both Plexus and the component
+ velocityComponent.getEngine().getTemplate( "/template.vm" );
}
- catch ( IOException e )
+ catch ( Exception e )
{
throw new MojoExecutionException( e.getMessage(), e );
}
- finally
- {
- IOUtil.close( writer );
- }
}
}
Propchange:
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-plexus-component-api/src/main/java/org/apache/maven/its/plugins/VelocityMojo.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-plexus-component-api/src/main/java/org/apache/maven/its/plugins/VelocityMojo.java
------------------------------------------------------------------------------
svn:mergeinfo =
Added:
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-plexus-component-api/src/main/resources/template.vm
URL:
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-plexus-component-api/src/main/resources/template.vm?rev=738752&view=auto
==============================================================================
---
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-plexus-component-api/src/main/resources/template.vm
(added)
+++
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-plexus-component-api/src/main/resources/template.vm
Thu Jan 29 04:15:02 2009
@@ -0,0 +1 @@
+Hello, World!
Propchange:
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-plexus-component-api/src/main/resources/template.vm
------------------------------------------------------------------------------
svn:eol-style = native
Modified:
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/pom.xml
URL:
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-support/core-it-plugins/pom.xml?rev=738752&r1=738751&r2=738752&view=diff
==============================================================================
---
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/pom.xml
(original)
+++
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/pom.xml
Thu Jan 29 04:15:02 2009
@@ -57,6 +57,7 @@
<module>maven-it-plugin-all</module>
<module>maven-it-plugin-plexus-utils-11</module>
<module>maven-it-plugin-plexus-utils-new</module>
+ <module>maven-it-plugin-plexus-component-api</module>
</modules>
<scm>