Author: jdcasey
Date: Wed Jun 17 20:48:24 2009
New Revision: 785790

URL: http://svn.apache.org/viewvc?rev=785790&view=rev
Log:
[MNG-4207] Adding IT plugin that depends on log4j, and integration test to 
verify non-lightweight http wagon can shade commons-logging and log4j properly

Added:
    
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4207PluginWithLog4JTest.java
   (with props)
    
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4207/
    
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4207/pom.xml
   (with props)
    
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-log4j/
    
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-log4j/pom.xml
   (with props)
    
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-log4j/src/
    
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-log4j/src/main/
    
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-log4j/src/main/java/
    
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-log4j/src/main/java/org/
    
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-log4j/src/main/java/org/apache/
    
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-log4j/src/main/java/org/apache/maven/
    
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-log4j/src/main/java/org/apache/maven/plugin/
    
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-log4j/src/main/java/org/apache/maven/plugin/coreit/
    
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-log4j/src/main/java/org/apache/maven/plugin/coreit/ItMojo.java
   (with props)
Modified:
    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/MavenITmng4207PluginWithLog4JTest.java
URL: 
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4207PluginWithLog4JTest.java?rev=785790&view=auto
==============================================================================
--- 
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4207PluginWithLog4JTest.java
 (added)
+++ 
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4207PluginWithLog4JTest.java
 Wed Jun 17 20:48:24 2009
@@ -0,0 +1,54 @@
+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 org.apache.maven.it.util.ResourceExtractor;
+
+import java.io.File;
+
+/**
+ * This is a test set for <a 
href="http://jira.codehaus.org/browse/MNG-4207";>MNG-4207</a>.
+ * 
+ * @author John Casey
+ */
+public class MavenITmng4207PluginWithLog4JTest
+    extends AbstractMavenIntegrationTestCase
+{
+
+    public MavenITmng4207PluginWithLog4JTest()
+    {
+        super( ALL_MAVEN_VERSIONS );
+    }
+
+    /**
+     * Test that exclusions defined on a dependency apply to its transitive 
dependencies as well.
+     */
+    public void testit()
+        throws Exception
+    {
+        File testDir = ResourceExtractor.simpleExtractResources( getClass(), 
"/mng-4207" );
+
+        Verifier verifier = new Verifier( testDir.getAbsolutePath() );
+        verifier.executeGoal( "initialize" );
+        verifier.verifyErrorFreeLog();
+        verifier.resetStreams();
+    }
+
+}

Propchange: 
maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4207PluginWithLog4JTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4207/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4207/pom.xml?rev=785790&view=auto
==============================================================================
--- 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4207/pom.xml
 (added)
+++ 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4207/pom.xml
 Wed Jun 17 20:48:24 2009
@@ -0,0 +1,64 @@
+<?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>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.its.mngXXXX</groupId>
+  <artifactId>test</artifactId>
+  <version>0.1</version>
+  <packaging>jar</packaging>
+
+  <build>
+    <extensions>
+      <extension>
+        <groupId>org.apache.maven.wagon</groupId>
+        <artifactId>wagon-webdav-jackrabbit</artifactId>
+        <version>1.0-beta-5</version>
+      </extension>
+      <!--extension>
+        <groupId>org.apache.maven.wagon</groupId>
+        <artifactId>wagon-http</artifactId>
+        <version>1.0-beta-5</version>
+      </extension-->
+    </extensions>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.its.plugins</groupId>
+        <artifactId>maven-it-plugin-log4j</artifactId>
+        <configuration>
+          <groupId>test</groupId>
+          <artifactId>test</artifactId>
+          <version>1.0</version>
+        </configuration>
+        <executions>
+          <execution>
+            <id>test</id>
+            <phase>initialize</phase>
+            <goals>
+              <goal>it</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Propchange: 
maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-4207/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-log4j/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-log4j/pom.xml?rev=785790&view=auto
==============================================================================
--- 
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-log4j/pom.xml
 (added)
+++ 
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-log4j/pom.xml
 Wed Jun 17 20:48:24 2009
@@ -0,0 +1,85 @@
+<?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>
+
+  <parent>
+    <artifactId>maven-it-plugin-core-stubs</artifactId>
+    <groupId>org.apache.maven.its.plugins</groupId>
+    <version>2.1-SNAPSHOT</version>
+  </parent>
+
+  <groupId>org.apache.maven.its.plugins</groupId>
+  <artifactId>maven-it-plugin-log4j</artifactId>
+  <packaging>maven-plugin</packaging>
+
+  <name>Maven Integration Test Plugin :: Log4J Client</name>
+  <description>
+    A test plugin that uses log4j.
+  </description>
+  <inceptionYear>2008</inceptionYear>
+
+  <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>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-artifact</artifactId>
+      <version>2.0</version>
+    </dependency>
+    <dependency>
+      <groupId>log4j</groupId>
+      <artifactId>log4j</artifactId>
+      <version>1.2.14</version>
+    </dependency>
+  </dependencies>
+  
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-assembly-plugin</artifactId>
+        <version>2.2-beta-4</version>
+        <executions>
+          <execution>
+            <id>jar-with-deps</id>
+            <phase>package</phase>
+            <goals>
+              <goal>single</goal>
+            </goals>
+            <configuration>
+              <descriptorRefs>
+                <descriptorRef>jar-with-dependencies</descriptorRef>
+              </descriptorRefs>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Propchange: 
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-log4j/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-log4j/src/main/java/org/apache/maven/plugin/coreit/ItMojo.java
URL: 
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-log4j/src/main/java/org/apache/maven/plugin/coreit/ItMojo.java?rev=785790&view=auto
==============================================================================
--- 
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-log4j/src/main/java/org/apache/maven/plugin/coreit/ItMojo.java
 (added)
+++ 
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-log4j/src/main/java/org/apache/maven/plugin/coreit/ItMojo.java
 Wed Jun 17 20:48:24 2009
@@ -0,0 +1,109 @@
+package org.apache.maven.plugin.coreit;
+
+/*
+ * 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.util.*;
+
+import org.apache.maven.artifact.*;
+import org.apache.maven.artifact.factory.*;
+import org.apache.maven.artifact.resolver.*;
+import org.apache.maven.artifact.repository.*;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+
+/**
+ * Resolves an artifact and has an (unused) dependency on log4j.
+ * 
+ * @goal it
+ * 
+ * @author Benjamin Bentmann
+ * @version $Id: CleanMojo.java 698220 2008-09-23 16:18:19Z bentmann $
+ */
+public class ItMojo
+    extends AbstractMojo
+{
+
+    /**
+     * @component
+     */
+    private ArtifactFactory artifactFactory;
+
+    /**
+     * @component
+     */
+    private ArtifactResolver artifactResolver;
+
+    /**
+     * @parameter default-value="${localRepository}"
+     * @required
+     * @readonly
+     */
+    private ArtifactRepository localRepository;
+
+    /**
+     * @parameter default-value="${project.remoteArtifactRepositories}"
+     * @required
+     * @readonly
+     */
+    private List remoteRepositories;
+
+    /**
+     * @parameter default-value="test"
+     */
+    private String groupId;
+
+    /**
+     * @parameter default-value="test"
+     */
+    private String artifactId;
+
+    /**
+     * @parameter default-value="1.0"
+     */
+    private String version;
+
+    /**
+     * Runs this mojo.
+     * 
+     * @throws MojoExecutionException If the output file could not be created.
+     * @throws MojoFailureException If the output file has not been set.
+     */
+    public void execute()
+        throws MojoExecutionException
+    {
+        getLog().info( "[MAVEN-CORE-IT-LOG4J]" );
+
+        Artifact artifact = artifactFactory.createProjectArtifact( groupId, 
artifactId, version );
+
+        try
+        {
+            artifactResolver.resolve( artifact, remoteRepositories, 
localRepository );
+        }
+        catch ( ArtifactNotFoundException e )
+        {
+            getLog().info( "SUCCESS" );
+        }
+        catch ( ArtifactResolutionException e )
+        {
+            throw new MojoExecutionException( "Should have responded with 
ArtifactNotFoundException.", e );
+        }
+    }
+
+}

Propchange: 
maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-log4j/src/main/java/org/apache/maven/plugin/coreit/ItMojo.java
------------------------------------------------------------------------------
    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=785790&r1=785789&r2=785790&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 
Wed Jun 17 20:48:24 2009
@@ -59,6 +59,7 @@
     <module>maven-it-plugin-plexus-utils-11</module>
     <module>maven-it-plugin-plexus-utils-new</module>
     <module>maven-it-plugin-plexus-component-api</module>
+    <module>maven-it-plugin-log4j</module>
   </modules>
 
   <scm>


Reply via email to