Updated Branches:
  refs/heads/master c304ba2bd -> d2e332754

[MNG-5482] added IT to check that missing Sonatype Aether classes are
detected and give a hint to AetherClassNotFound Wiki article

Project: http://git-wip-us.apache.org/repos/asf/maven-integration-testing/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/maven-integration-testing/commit/d2e33275
Tree: 
http://git-wip-us.apache.org/repos/asf/maven-integration-testing/tree/d2e33275
Diff: 
http://git-wip-us.apache.org/repos/asf/maven-integration-testing/diff/d2e33275

Branch: refs/heads/master
Commit: d2e33275427e595655ef0ee7987b88f882b96bd8
Parents: c304ba2
Author: Hervé Boutemy <hbout...@apache.org>
Authored: Thu May 30 03:07:13 2013 +0200
Committer: Hervé Boutemy <hbout...@apache.org>
Committed: Thu May 30 03:07:13 2013 +0200

----------------------------------------------------------------------
 .../org/apache/maven/it/IntegrationTestSuite.java  |    1 +
 .../maven/it/MavenITmng5482AetherNotFoundTest.java |  113 +++++++++++++++
 .../resources/mng-5482/plugin-dependency/pom.xml   |   26 ++++
 .../test/resources/mng-5482/plugin-site/pom.xml    |   26 ++++
 .../test/resources/mng-5482/report-mpir/pom.xml    |   42 ++++++
 pom.xml                                            |   28 ++++
 6 files changed, 236 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/d2e33275/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
----------------------------------------------------------------------
diff --git 
a/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java 
b/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
index a06066b..bacc532 100644
--- a/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
+++ b/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
@@ -109,6 +109,7 @@ public class IntegrationTestSuite
         //suite.addTestSuite( MavenITmng5208EventSpyParallelTest.class );
         
         
+        suite.addTestSuite( MavenITmng5482AetherNotFoundTest.class );
         suite.addTestSuite( 
MavenITmng5445LegacyStringSearchModelInterpolatorTest.class );
         suite.addTestSuite( MavenITmng5387ArtifactReplacementPlugin.class );
         suite.addTestSuite( MavenITmng5382Jsr330Plugin.class );

http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/d2e33275/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5482AetherNotFoundTest.java
----------------------------------------------------------------------
diff --git 
a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5482AetherNotFoundTest.java
 
b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5482AetherNotFoundTest.java
new file mode 100644
index 0000000..e1f15fe
--- /dev/null
+++ 
b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5482AetherNotFoundTest.java
@@ -0,0 +1,113 @@
+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;
+import java.io.IOException;
+import java.util.List;
+import java.util.regex.Pattern;
+
+/**
+ * This is a test set for <a 
href="http://jira.codehaus.org/browse/MNG-5482";>MNG-5482</a>.
+ * 
+ * It checks that plugins and reports causing errors because of Aether change 
from Sonatype to Eclipse
+ * get a dedicated message to explain solution to end-users
+ * 
+ * @author hboutemy
+ */
+public class MavenITmng5482AetherNotFoundTest
+    extends AbstractMavenIntegrationTestCase
+{
+
+    public MavenITmng5482AetherNotFoundTest()
+    {
+        super( "[3.1-A,)" );
+    }
+
+    public void testPluginDependency()
+        throws IOException, VerificationException
+    {
+        check( "plugin-dependency" );
+    }
+
+    public void testPluginSite()
+        throws IOException, VerificationException
+    {
+        check( "plugin-site" );
+    }
+
+    /*public void testReportMpir()
+        throws IOException, VerificationException
+    {
+        check( "report-mpir" );
+    }*/
+
+    public void check( String dir )
+        throws IOException, VerificationException
+    {
+        File testDir = ResourceExtractor.simpleExtractResources( getClass(), 
"/mng-5482/" + dir );
+
+        Verifier verifier = newVerifier( testDir.getAbsolutePath() );
+        verifier.setAutoclean( false );
+
+        try
+        {
+            verifier.executeGoal( "validate" );
+
+            fail( "should throw an error during execution." );
+        }
+        catch ( VerificationException e )
+        {
+            // expected...it'd be nice if we could get the specifics of the 
exception right here...
+        }
+        finally
+        {
+            verifier.resetStreams();
+        }
+
+        List<String> lines = verifier.loadFile( new File( testDir, "log.txt" 
), false );
+
+        int msg = indexOf( lines, "Caused by: 
java.lang.ClassNotFoundException: org.sonatype.aether.+" );
+        assertTrue( "ClassNotFoundException message was not found in output.", 
msg >= 0 );
+
+        int url = indexOf( lines, 
".*http://cwiki.apache.org/confluence/display/MAVEN/AetherClassNotFound.*"; );
+        assertTrue( "Url to ClassNotFoundAether was not found in output.", url 
>= 0 );
+    }
+
+    private int indexOf( List<String> logLines, String regex )
+    {
+        Pattern pattern = Pattern.compile( regex );
+
+        for ( int i = 0; i < logLines.size(); i++ )
+        {
+            String logLine = logLines.get( i );
+
+            if ( pattern.matcher( logLine ).matches() )
+            {
+                return i;
+            }
+        }
+
+        return -1;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/d2e33275/core-it-suite/src/test/resources/mng-5482/plugin-dependency/pom.xml
----------------------------------------------------------------------
diff --git 
a/core-it-suite/src/test/resources/mng-5482/plugin-dependency/pom.xml 
b/core-it-suite/src/test/resources/mng-5482/plugin-dependency/pom.xml
new file mode 100644
index 0000000..405f507
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-5482/plugin-dependency/pom.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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.mng5482</groupId>
+  <artifactId>mng-5482-plugin-site</artifactId>
+  <version>1</version>
+  <packaging>pom</packaging>
+  
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-dependency-plugin</artifactId>
+        <version>2.7</version>
+        <executions>
+          <execution>
+            <id>trigger-error</id>
+            <phase>validate</phase>
+            <goals>
+              <goal>tree</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>

http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/d2e33275/core-it-suite/src/test/resources/mng-5482/plugin-site/pom.xml
----------------------------------------------------------------------
diff --git a/core-it-suite/src/test/resources/mng-5482/plugin-site/pom.xml 
b/core-it-suite/src/test/resources/mng-5482/plugin-site/pom.xml
new file mode 100644
index 0000000..84485d1
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-5482/plugin-site/pom.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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.mng5482</groupId>
+  <artifactId>mng-5482-plugin-site</artifactId>
+  <version>1</version>
+  <packaging>pom</packaging>
+  
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-site-plugin</artifactId>
+        <version>3.2</version>
+        <executions>
+          <execution>
+            <id>trigger-error</id>
+            <phase>validate</phase>
+            <goals>
+              <goal>site</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>

http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/d2e33275/core-it-suite/src/test/resources/mng-5482/report-mpir/pom.xml
----------------------------------------------------------------------
diff --git a/core-it-suite/src/test/resources/mng-5482/report-mpir/pom.xml 
b/core-it-suite/src/test/resources/mng-5482/report-mpir/pom.xml
new file mode 100644
index 0000000..f4a3a0c
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-5482/report-mpir/pom.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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.mng5482</groupId>
+  <artifactId>mng-5482-plugin-site</artifactId>
+  <version>1</version>
+  <packaging>pom</packaging>
+  
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-site-plugin</artifactId>
+        <version>3.3</version>
+        <executions>
+          <execution>
+            <id>trigger-error</id>
+            <phase>validate</phase>
+            <goals>
+              <goal>site</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+
+  <reporting>
+    <plugins>
+      <plugin>
+        <artifactId>maven-project-info-reports-plugin</artifactId>
+        <version>2.6</version>
+        <reportSets>
+          <reportSet>
+            <reports>
+              <report>dependencies</report>
+            </reports>
+          </reportSet>
+        </reportSets>
+      </plugin>
+    </plugins>
+  </reporting>
+</project>

http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/d2e33275/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 72c5138..9df8f21 100644
--- a/pom.xml
+++ b/pom.xml
@@ -103,4 +103,32 @@ under the License.
       </releases>
     </repository>
   </repositories>
+
+  <profiles>
+    <profile>
+      <id>reporting</id>
+      <reporting>
+        <plugins>
+          <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-project-info-reports-plugin</artifactId>
+            <version>2.7</version>
+          </plugin>
+          <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-jxr-plugin</artifactId>
+            <reportSets>
+              <reportSet>
+                <id>default</id>
+                <reports>
+                  <report>jxr</report>
+                  <report>test-jxr</report>
+                </reports>
+              </reportSet>
+            </reportSets>
+          </plugin>
+        </plugins>
+      </reporting>
+    </profile>
+  </profiles>
 </project>

Reply via email to