You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by jd...@apache.org on 2008/01/15 05:15:08 UTC

svn commit: r612010 - in /maven/components/trunk/maven-embedder/src/test: error-reporting-projects/testReportInvalidPluginExecutionEnvironment/ error-reporting-projects/testReportInvalidRepositoryWhileGettingRepositoriesFromProfiles/ error-reporting-pr...

Author: jdcasey
Date: Mon Jan 14 20:15:07 2008
New Revision: 612010

URL: http://svn.apache.org/viewvc?rev=612010&view=rev
Log:
more unit tests.

Added:
    maven/components/trunk/maven-embedder/src/test/error-reporting-projects/testReportInvalidRepositoryWhileGettingRepositoriesFromProfiles/
    maven/components/trunk/maven-embedder/src/test/error-reporting-projects/testReportInvalidRepositoryWhileGettingRepositoriesFromProfiles/pom.xml   (with props)
    maven/components/trunk/maven-embedder/src/test/error-reporting-projects/testReportInvalidRepositoryWhileGettingRepositoriesFromProfiles/profiles.xml   (with props)
Removed:
    maven/components/trunk/maven-embedder/src/test/error-reporting-projects/testReportInvalidPluginExecutionEnvironment/
    maven/components/trunk/maven-embedder/src/test/error-reporting-projects/testReportLifecycleLoaderErrorWhileValidatingTask/
Modified:
    maven/components/trunk/maven-embedder/src/test/java/org/apache/maven/error/ErrorReporterPointcutTest.java

Added: maven/components/trunk/maven-embedder/src/test/error-reporting-projects/testReportInvalidRepositoryWhileGettingRepositoriesFromProfiles/pom.xml
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-embedder/src/test/error-reporting-projects/testReportInvalidRepositoryWhileGettingRepositoriesFromProfiles/pom.xml?rev=612010&view=auto
==============================================================================
--- maven/components/trunk/maven-embedder/src/test/error-reporting-projects/testReportInvalidRepositoryWhileGettingRepositoriesFromProfiles/pom.xml (added)
+++ maven/components/trunk/maven-embedder/src/test/error-reporting-projects/testReportInvalidRepositoryWhileGettingRepositoriesFromProfiles/pom.xml Mon Jan 14 20:15:07 2008
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?><project>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.maven.errortest</groupId>
+  <artifactId>testReportInvalidRepositoryWhileGettingRepositoriesFromProfiles</artifactId>
+  <version>1</version>
+  
+</project>
\ No newline at end of file

Propchange: maven/components/trunk/maven-embedder/src/test/error-reporting-projects/testReportInvalidRepositoryWhileGettingRepositoriesFromProfiles/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/components/trunk/maven-embedder/src/test/error-reporting-projects/testReportInvalidRepositoryWhileGettingRepositoriesFromProfiles/pom.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/components/trunk/maven-embedder/src/test/error-reporting-projects/testReportInvalidRepositoryWhileGettingRepositoriesFromProfiles/profiles.xml
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-embedder/src/test/error-reporting-projects/testReportInvalidRepositoryWhileGettingRepositoriesFromProfiles/profiles.xml?rev=612010&view=auto
==============================================================================
--- maven/components/trunk/maven-embedder/src/test/error-reporting-projects/testReportInvalidRepositoryWhileGettingRepositoriesFromProfiles/profiles.xml (added)
+++ maven/components/trunk/maven-embedder/src/test/error-reporting-projects/testReportInvalidRepositoryWhileGettingRepositoriesFromProfiles/profiles.xml Mon Jan 14 20:15:07 2008
@@ -0,0 +1,18 @@
+<?xml version="1.0"?>
+<profilesXml>
+  <profiles>
+    <profile>
+      <id>test</id>
+      <repositories>
+        <repository>
+          <id>test-repo</id>
+          <url>http://www.google.com/</url>
+          <layout>nothing-special</layout>
+        </repository>
+      </repositories>
+    </profile>
+  </profiles>
+  <activeProfiles>
+    <activeProfile>test</activeProfile>
+  </activeProfiles>
+</profilesXml>
\ No newline at end of file

Propchange: maven/components/trunk/maven-embedder/src/test/error-reporting-projects/testReportInvalidRepositoryWhileGettingRepositoriesFromProfiles/profiles.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/components/trunk/maven-embedder/src/test/error-reporting-projects/testReportInvalidRepositoryWhileGettingRepositoriesFromProfiles/profiles.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Modified: maven/components/trunk/maven-embedder/src/test/java/org/apache/maven/error/ErrorReporterPointcutTest.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-embedder/src/test/java/org/apache/maven/error/ErrorReporterPointcutTest.java?rev=612010&r1=612009&r2=612010&view=diff
==============================================================================
--- maven/components/trunk/maven-embedder/src/test/java/org/apache/maven/error/ErrorReporterPointcutTest.java (original)
+++ maven/components/trunk/maven-embedder/src/test/java/org/apache/maven/error/ErrorReporterPointcutTest.java Mon Jan 14 20:15:07 2008
@@ -26,7 +26,6 @@
 import java.io.PrintWriter;
 import java.io.StringReader;
 import java.io.StringWriter;
-import java.net.URISyntaxException;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.Iterator;
@@ -146,7 +145,7 @@
     }
 
     private File prepareProjectDir()
-        throws URISyntaxException, IOException
+        throws IOException
     {
         String method = getTestMethodName();
 
@@ -217,7 +216,7 @@
     }
 
     public void testReportErrorResolvingExtensionDirectDependencies()
-        throws URISyntaxException, IOException
+        throws IOException
     {
         File projectDir = prepareProjectDir();
         File localRepo = new File( projectDir, "local-repo" );
@@ -248,7 +247,7 @@
     }
 
     public void testReportAggregatedMojoFailureException()
-        throws URISyntaxException, IOException
+        throws IOException
     {
         if ( !checkOnline() )
         {
@@ -292,7 +291,7 @@
     }
 
     public void testReportErrorConfiguringExtensionPluginRealm()
-        throws URISyntaxException, IOException
+        throws IOException
     {
         File projectDir = prepareProjectDir();
 
@@ -319,7 +318,7 @@
     }
 
     public void testReportErrorFormulatingBuildPlan()
-        throws URISyntaxException, IOException
+        throws IOException
     {
         if ( !checkOnline() )
         {
@@ -351,7 +350,7 @@
     }
 
     public void testReportErrorInterpolatingModel_UsingProjectInstance()
-        throws URISyntaxException, IOException
+        throws IOException
     {
         if ( !checkOnline() )
         {
@@ -388,7 +387,7 @@
     }
 
     public void testReportErrorManagingRealmForExtension()
-        throws URISyntaxException, IOException
+        throws IOException
     {
         File projectDir = prepareProjectDir();
 
@@ -415,7 +414,7 @@
     }
 
     public void testReportErrorResolvingExtensionDependencies()
-        throws URISyntaxException, IOException
+        throws IOException
     {
         File projectDir = prepareProjectDir();
         File localRepo = new File( projectDir, "local-repo" );
@@ -471,7 +470,7 @@
     }
 
     public void testReportInvalidMavenVersion()
-        throws URISyntaxException, IOException
+        throws IOException
     {
         File projectDir = prepareProjectDir();
 
@@ -494,7 +493,7 @@
     }
 
     public void testReportInvalidPluginExecutionEnvironment()
-        throws URISyntaxException, IOException
+        throws IOException
     {
         File projectDir = prepareProjectDir();
 
@@ -517,7 +516,7 @@
     }
 
     public void testReportLifecycleLoaderErrorWhileValidatingTask()
-        throws URISyntaxException, IOException
+        throws IOException
     {
         File projectDir = prepareProjectDir();
         File localRepo = new File( projectDir, "local-repo" );
@@ -618,7 +617,7 @@
     }
 
     public void testReportProjectCycle()
-        throws URISyntaxException, IOException
+        throws IOException
     {
         File projectDir = prepareProjectDir();
 
@@ -641,7 +640,7 @@
     }
 
     public void testReportProjectDependenciesNotFound()
-        throws URISyntaxException, IOException
+        throws IOException
     {
         File projectDir = prepareProjectDir();
 
@@ -665,7 +664,7 @@
 
     // FIXME: Get the wagon to fail (in a way other than 'not found')
     public void testReportProjectDependenciesUnresolvable()
-        throws URISyntaxException, IOException
+        throws IOException
     {
 //        File projectDir = prepareProjectDir();
 //
@@ -688,7 +687,7 @@
     }
 
     public void testReportProjectMojoFailureException()
-        throws URISyntaxException, IOException
+        throws IOException
     {
         File projectDir = prepareProjectDir();
 
@@ -737,7 +736,7 @@
 
     // FIXME: How can I test this when it's masked by reportActivatorErrorWhileGettingRepositoriesFromProfiles?
     public void testReportActivatorError()
-        throws URISyntaxException, IOException
+        throws IOException
     {
         File projectDir = prepareProjectDir();
 
@@ -766,7 +765,7 @@
     }
 
     public void testReportBadDependencyVersion()
-        throws URISyntaxException, IOException
+        throws IOException
     {
         File projectDir = prepareProjectDir();
 
@@ -789,7 +788,7 @@
     }
 
     public void testReportBadManagedDependencyVersion()
-        throws URISyntaxException, IOException
+        throws IOException
     {
         File projectDir = prepareProjectDir();
 
@@ -812,7 +811,7 @@
     }
 
     public void testReportBadNonDependencyProjectArtifactVersion()
-        throws URISyntaxException, IOException
+        throws IOException
     {
         File projectDir = prepareProjectDir();
 
@@ -835,7 +834,7 @@
     }
 
     public void testReportErrorCreatingArtifactRepository()
-        throws URISyntaxException, IOException
+        throws IOException
     {
         File projectDir = prepareProjectDir();
 
@@ -858,7 +857,7 @@
     }
 
     public void testReportErrorCreatingDeploymentArtifactRepository()
-        throws URISyntaxException, IOException
+        throws IOException
     {
         File projectDir = prepareProjectDir();
 
@@ -881,7 +880,7 @@
     }
 
     public void testReportErrorInterpolatingModel_UsingModelInstance()
-        throws URISyntaxException, IOException
+        throws IOException
     {
         File projectDir = prepareProjectDir();
 
@@ -904,7 +903,7 @@
     }
 
     public void testReportErrorLoadingExternalProfilesFromFile_XmlPullParserException()
-        throws URISyntaxException, IOException
+        throws IOException
     {
         File projectDir = prepareProjectDir();
 
@@ -927,7 +926,7 @@
     }
 
     public void testReportErrorLoadingExternalProfilesFromFile_IOException()
-        throws URISyntaxException, IOException
+        throws IOException
     {
         File projectDir = prepareProjectDir();
 
@@ -950,7 +949,7 @@
     }
 
     public void testReportErrorParsingParentProjectModel_XmlPullParserException()
-        throws URISyntaxException, IOException
+        throws IOException
     {
         File projectDir = prepareProjectDir();
         File childDir = new File( projectDir, "child" );
@@ -974,7 +973,7 @@
     }
 
     public void testReportErrorParsingParentProjectModel_IOException()
-        throws URISyntaxException, IOException
+        throws IOException
     {
         File projectDir = prepareProjectDir();
         File childDir = new File( projectDir, "child" );
@@ -998,7 +997,7 @@
     }
 
     public void testReportErrorParsingProjectModel_XmlPullParserException()
-        throws URISyntaxException, IOException
+        throws IOException
     {
         File projectDir = prepareProjectDir();
 
@@ -1021,7 +1020,7 @@
     }
 
     public void testReportErrorParsingProjectModel_IOException()
-        throws URISyntaxException, IOException
+        throws IOException
     {
         File projectDir = prepareProjectDir();
 
@@ -1046,15 +1045,49 @@
     }
 
     public void testReportInvalidRepositoryWhileGettingRepositoriesFromProfiles()
+        throws IOException
     {
-        // TODO Auto-generated method stub
+        File projectDir = prepareProjectDir();
+
+        reporter.reportInvalidRepositoryWhileGettingRepositoriesFromProfiles( null, null, null, null );
+        reporterCtl.setMatcher( MockControl.ALWAYS_MATCHER );
+        reporterCtl.setVoidCallable();
 
+        reporterCtl.replay();
+
+        MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( projectDir )
+                                                                          .setShowErrors( true )
+                                                                          .setErrorReporter( reporter )
+                                                                          .setGoals( Arrays.asList( new String[] {
+                                                                              "initialize"
+                                                                          } ) );
+
+        maven.execute( request );
+
+        reporterCtl.verify();
     }
 
     public void testReportParentPomArtifactNotFound()
+        throws IOException
     {
-        // TODO Auto-generated method stub
+        File projectDir = prepareProjectDir();
+
+        reporter.reportInvalidRepositoryWhileGettingRepositoriesFromProfiles( null, null, null, null );
+        reporterCtl.setMatcher( MockControl.ALWAYS_MATCHER );
+        reporterCtl.setVoidCallable();
 
+        reporterCtl.replay();
+
+        MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( projectDir )
+                                                                          .setShowErrors( true )
+                                                                          .setErrorReporter( reporter )
+                                                                          .setGoals( Arrays.asList( new String[] {
+                                                                              "initialize"
+                                                                          } ) );
+
+        maven.execute( request );
+
+        reporterCtl.verify();
     }
 
     public void testReportParentPomArtifactUnresolvable()
@@ -1064,7 +1097,7 @@
     }
 
     public void testReportProjectCollision()
-        throws URISyntaxException, IOException
+        throws IOException
     {
         File projectDir = prepareProjectDir();
 
@@ -1087,7 +1120,7 @@
     }
 
     public void testReportProjectValidationFailure()
-        throws URISyntaxException, IOException
+        throws IOException
     {
         File projectDir = prepareProjectDir();