adjust the embedder tests:

- remove a number of downloads from central that were slowing the build significantly
- ensure the tests will run with a repo manager and no central access
- ensure the tests will run offline if the local repository is populated

The technique for populating the repository is very hacky. We really need the tests to be doing this themselves. Perhaps moving these IT-like tests into the IT section and alongside the core ITs is the way to go - but this is a start.


git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@669222 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2008-06-18 16:56:56 +00:00
parent 08f3ac7ab4
commit 3acaa63cf8
34 changed files with 227 additions and 485 deletions

View File

@ -106,6 +106,40 @@ under the License.
</execution>
</executions>
</plugin>
<!-- These aren't used by the build, but need to be in the local repository for
some tests to work offline. Look to improve them.
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>2.3</version>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.2</version>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.2</version>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-scm-plugin</artifactId>
<version>1.0</version>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.3</version>
<extensions>true</extensions>
</plugin>
</plugins>
</build>

View File

@ -17,7 +17,7 @@
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.3.1</version>
<version>2.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>

View File

@ -17,7 +17,7 @@
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.3.1</version>
<version>2.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>

View File

@ -23,7 +23,7 @@
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.3.1</version>
<version>2.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>

View File

@ -25,7 +25,7 @@
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.3.1</version>
<version>2.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>

View File

@ -22,7 +22,7 @@
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.3.1</version>
<version>2.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>

View File

@ -25,7 +25,7 @@
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.3.1</version>
<version>2.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>

View File

@ -17,7 +17,7 @@
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.3.1</version>
<version>2.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>

View File

@ -22,7 +22,7 @@
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.3.1</version>
<version>2.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>

View File

@ -23,7 +23,7 @@
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.3.1</version>
<version>2.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>

View File

@ -28,7 +28,7 @@
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.3.1</version>
<version>2.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>

View File

@ -18,4 +18,10 @@
</dependency>
</dependencies>
<repositories>
<repository>
<id>repo</id>
<url>file://localhost/${basedir}/local-repo</url>
</repository>
</repositories>
</project>

View File

@ -23,7 +23,7 @@
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.3.1</version>
<version>2.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>

View File

@ -17,7 +17,7 @@
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.3.1</version>
<version>2.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
@ -46,4 +46,4 @@
</plugins>
</pluginManagement>
</build>
</project>
</project>

View File

@ -18,7 +18,7 @@
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.3.1</version>
<version>2.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>

View File

@ -25,7 +25,7 @@
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.3.1</version>
<version>2.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>

View File

@ -10,7 +10,7 @@
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.3.1</version>
<version>2.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>

View File

@ -13,4 +13,10 @@
</dependency>
</dependencies>
<repositories>
<repository>
<id>repo</id>
<url>file://localhost/${basedir}/local-repo</url>
</repository>
</repositories>
</project>

View File

@ -17,7 +17,7 @@
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.3.1</version>
<version>2.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>

View File

@ -17,7 +17,7 @@
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.3.1</version>
<version>2.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>

View File

@ -17,7 +17,7 @@
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.3.1</version>
<version>2.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>

View File

@ -17,7 +17,7 @@
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.3.1</version>
<version>2.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>

View File

@ -22,7 +22,7 @@
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.3.1</version>
<version>2.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>

View File

@ -10,7 +10,7 @@
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.3.1</version>
<version>2.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>

View File

@ -19,6 +19,8 @@ package org.apache.maven.embedder;
* under the License.
*/
import java.io.File;
import org.codehaus.plexus.PlexusTestCase;
public abstract class AbstractEmbedderTestCase

View File

@ -1,5 +1,24 @@
package org.apache.maven.embedder;
/*
* 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.artifact.handler.ArtifactHandler;
import org.apache.maven.execution.DefaultMavenExecutionRequest;
import org.apache.maven.execution.MavenExecutionRequest;

View File

@ -33,7 +33,7 @@ public class EmbedderUsingEclipsePluginTest
public void testRunningEclipsePlugin()
throws Exception
{
File basedir = runWithProject( "eclipse:eclipse" );
File basedir = runWithProject( "org.apache.maven.plugins:maven-eclipse-plugin:2.3:eclipse" );
assertFileExists( new File( basedir, ".classpath" ) );

View File

@ -46,7 +46,7 @@ public class EmbedderUsingScmPluginTest
p.setProperty( "connectionUrl", "scm:svn:http://svn.apache.org/repos/asf/maven/components/trunk/maven-embedder" );
File basedir = runWithProject( "scm:diff", p );
File basedir = runWithProject( "org.apache.maven.plugins:maven-scm-plugin:1.0:diff", p );
}
}
}

View File

@ -1,10 +1,34 @@
package org.apache.maven.error;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpConnectionManager;
import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.httpclient.methods.GetMethod;
/*
* 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 java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import junit.framework.TestCase;
import org.apache.maven.artifact.resolver.MultipleArtifactsNotFoundException;
import org.apache.maven.embedder.Configuration;
import org.apache.maven.embedder.DefaultConfiguration;
@ -14,30 +38,15 @@ import org.apache.maven.errors.CoreErrorReporter;
import org.apache.maven.execution.DefaultMavenExecutionRequest;
import org.apache.maven.execution.MavenExecutionRequest;
import org.apache.maven.execution.MavenExecutionResult;
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
import org.apache.maven.plugin.PluginManagerException;
import org.apache.maven.settings.Settings;
import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
import org.easymock.MockControl;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringReader;
import java.io.StringWriter;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import junit.framework.TestCase;
public class ErrorReporterPointcutTest
extends TestCase
{
private static final int ONE_SECOND = 1000;
private MockControl reporterCtl;
private CoreErrorReporter reporter;
@ -46,10 +55,6 @@ public class ErrorReporterPointcutTest
private String basedir;
private static boolean isOffline;
private static boolean offlineIsSet = false;
public void setUp()
throws Exception
{
@ -84,74 +89,6 @@ public class ErrorReporterPointcutTest
maven.stop();
}
private boolean checkOnline()
{
if ( !offlineIsSet )
{
HttpClient client = new HttpClient();
GetMethod get = new GetMethod(
"http://repo1.maven.org/maven2/org/apache/maven/maven-core/2.0/maven-core-2.0.pom" );
HttpConnectionManager mgr = client.getHttpConnectionManager();
mgr.getParams().setConnectionTimeout( 3 * ONE_SECOND );
try
{
int result = client.executeMethod( get );
if ( result == HttpStatus.SC_OK )
{
String body = get.getResponseBodyAsString();
new MavenXpp3Reader().read( new StringReader( body ) );
isOffline = false;
}
else
{
System.out.println( "Got HTTP status of: " + result );
System.out.println( "System is offline" );
isOffline = true;
}
}
catch ( HttpException e )
{
System.out.println( "Got error: " + e.getMessage() );
System.out.println( "System is offline" );
isOffline = true;
}
catch ( IOException e )
{
System.out.println( "Got error: " + e.getMessage() );
System.out.println( "System is offline" );
isOffline = true;
}
catch ( XmlPullParserException e )
{
System.out.println( "Got error: " + e.getMessage() );
System.out.println( "System is offline" );
isOffline = true;
}
finally
{
offlineIsSet = true;
}
}
if ( isOffline )
{
String method = getTestMethodName();
System.out.println( "Test: " + method
+ " requires an access to the Maven central repository. SKIPPING." );
return false;
}
return true;
}
private String getTestMethodName()
{
String method = new Throwable().getStackTrace()[2].getMethodName();
return method;
}
private File prepareProjectDir( String basename )
throws IOException
{
@ -186,13 +123,8 @@ public class ErrorReporterPointcutTest
private void buildTestAccessory( File basedir )
{
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( basedir )
.setShowErrors( true )
.setErrorReporter( new DummyCoreErrorReporter() )
.setGoals( Arrays.asList( new String[] {
"clean",
"install"
} ) );
MavenExecutionRequest request =
createRequest( basedir, new DummyCoreErrorReporter() ).setGoals( Arrays.asList( "clean", "install" ) );
MavenExecutionResult result = maven.execute( request );
@ -202,6 +134,16 @@ public class ErrorReporterPointcutTest
}
}
private MavenExecutionRequest createRequest( File basedir, CoreErrorReporter reporter )
{
return createRequest( reporter ).setBaseDirectory( basedir );
}
private MavenExecutionRequest createRequest( CoreErrorReporter reporter )
{
return new DefaultMavenExecutionRequest().setShowErrors( true ).setErrorReporter( reporter );
}
private void reportExceptions( MavenExecutionResult result,
File basedir )
{
@ -221,9 +163,8 @@ public class ErrorReporterPointcutTest
writer.write( basedir.getPath() );
writer.write( "\nEncountered the following errors:" );
for ( Iterator it = result.getExceptions().iterator(); it.hasNext(); )
for ( Throwable error : (Collection<Throwable>) result.getExceptions() )
{
Throwable error = (Throwable) it.next();
writer.write( "\n\n" );
error.printStackTrace( pWriter );
}
@ -256,13 +197,9 @@ public class ErrorReporterPointcutTest
reporterCtl.replay();
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( project )
.setLocalRepositoryPath( localRepo )
.setShowErrors( true )
.setErrorReporter( reporter )
.setGoals( Arrays.asList( new String[] {
"initialize"
} ) );
MavenExecutionRequest request =
createRequest( project, reporter ).setLocalRepositoryPath( localRepo ).setGoals(
Arrays.asList( "initialize" ) );
maven.execute( request );
@ -272,11 +209,6 @@ public class ErrorReporterPointcutTest
public void testReportAggregatedMojoFailureException()
throws IOException
{
if ( !checkOnline() )
{
return;
}
File projectDir = prepareProjectDir( "aggregate-mojo-failure");
buildTestAccessory( new File( projectDir, "plugin" ) );
@ -289,12 +221,9 @@ public class ErrorReporterPointcutTest
reporterCtl.replay();
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( basedir )
.setShowErrors( true )
.setErrorReporter( reporter )
.setGoals( Arrays.asList( new String[] {
"org.apache.maven.errortest:aggregate-mojo-failure-maven-plugin:1:test"
} ) );
MavenExecutionRequest request =
createRequest( basedir, reporter ).setGoals(
Arrays.asList( "org.apache.maven.errortest:aggregate-mojo-failure-maven-plugin:1:test" ) );
maven.execute( request );
@ -304,11 +233,6 @@ public class ErrorReporterPointcutTest
public void testReportAttemptToOverrideUneditableMojoParameter()
throws IOException
{
if ( !checkOnline() )
{
return;
}
File projectDir = prepareProjectDir( "config-rdonly-mojo-param");
buildTestAccessory( new File( projectDir, "plugin" ) );
@ -328,12 +252,7 @@ public class ErrorReporterPointcutTest
reporterCtl.replay();
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( basedir )
.setShowErrors( true )
.setErrorReporter( reporter )
.setGoals( Arrays.asList( new String[] {
"initialize"
} ) );
MavenExecutionRequest request = createRequest( basedir, reporter ).setGoals( Arrays.asList( "initialize" ) );
maven.execute( request );
@ -343,11 +262,6 @@ public class ErrorReporterPointcutTest
public void testReportErrorApplyingMojoConfiguration()
throws IOException
{
if ( !checkOnline() )
{
return;
}
File projectDir = prepareProjectDir( "mojo-config-error");
File plugin = new File( projectDir, "plugin" );
File project = new File( projectDir, "project" );
@ -360,12 +274,9 @@ public class ErrorReporterPointcutTest
reporterCtl.replay();
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( project )
.setShowErrors( true )
.setErrorReporter( reporter )
.setGoals( Arrays.asList( new String[] {
"org.apache.maven.errortest:mojo-config-error-maven-plugin:1:test"
} ) );
MavenExecutionRequest request =
createRequest( project, reporter ).setGoals(
Arrays.asList( "org.apache.maven.errortest:mojo-config-error-maven-plugin:1:test" ) );
maven.execute( request );
@ -391,12 +302,7 @@ public class ErrorReporterPointcutTest
reporterCtl.replay();
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( project )
.setShowErrors( true )
.setErrorReporter( reporter )
.setGoals( Arrays.asList( new String[] {
"initialize"
} ) );
MavenExecutionRequest request = createRequest( project, reporter ).setGoals( Arrays.asList( "initialize" ) );
maven.execute( request );
@ -406,11 +312,6 @@ public class ErrorReporterPointcutTest
public void testReportErrorFormulatingBuildPlan()
throws IOException
{
if ( !checkOnline() )
{
return;
}
File projectDir = prepareProjectDir( "bad-build-plan" );
buildTestAccessory( new File( projectDir, "plugin" ) );
@ -423,12 +324,9 @@ public class ErrorReporterPointcutTest
reporterCtl.replay();
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( basedir )
.setShowErrors( true )
.setErrorReporter( reporter )
.setGoals( Arrays.asList( new String[] {
"org.apache.maven.errortest:bad-build-plan-maven-plugin:1:test"
} ) );
MavenExecutionRequest request =
createRequest( basedir, reporter ).setGoals(
Arrays.asList( "org.apache.maven.errortest:bad-build-plan-maven-plugin:1:test" ) );
maven.execute( request );
@ -438,13 +336,7 @@ public class ErrorReporterPointcutTest
public void testReportErrorInterpolatingModel_UsingProjectInstance()
throws IOException
{
if ( !checkOnline() )
{
return;
}
File projectDir = prepareProjectDir( "interp-from-project");
File localRepo = new File( projectDir, "local-repo" );
File project = new File( projectDir, "project" );
reporter.reportErrorInterpolatingModel( null, null, null );
@ -453,13 +345,7 @@ public class ErrorReporterPointcutTest
reporterCtl.replay();
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( project )
.setLocalRepositoryPath( localRepo )
.setShowErrors( true )
.setErrorReporter( reporter )
.setGoals( Arrays.asList( new String[] {
"compile"
} ) );
MavenExecutionRequest request = createRequest( project, reporter ).setGoals( Arrays.asList( "compile" ) );
maven.execute( request );
@ -483,13 +369,9 @@ public class ErrorReporterPointcutTest
reporterCtl.replay();
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( project )
.setSettings( settings )
.setShowErrors( true )
.setErrorReporter( reporter )
.setGoals( Arrays.asList( new String[] {
"org.apache.maven.errortest:err-loading-plugin-maven-plugin:1:test"
} ) );
MavenExecutionRequest request =
createRequest( project, reporter ).setSettings( settings ).setGoals(
Arrays.asList( "org.apache.maven.errortest:err-loading-plugin-maven-plugin:1:test" ) );
maven.execute( request );
@ -499,11 +381,6 @@ public class ErrorReporterPointcutTest
public void testReportErrorManagingRealmForExtension()
throws IOException
{
if ( !checkOnline() )
{
return;
}
File projectDir = prepareProjectDir( "ext-realm-error" );
buildTestAccessory( new File( projectDir, "ext" ) );
@ -516,12 +393,7 @@ public class ErrorReporterPointcutTest
reporterCtl.replay();
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( project )
.setShowErrors( true )
.setErrorReporter( reporter )
.setGoals( Arrays.asList( new String[] {
"initialize"
} ) );
MavenExecutionRequest request = createRequest( project, reporter ).setGoals( Arrays.asList( "initialize" ) );
maven.execute( request );
@ -541,13 +413,9 @@ public class ErrorReporterPointcutTest
reporterCtl.replay();
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( project )
.setLocalRepositoryPath( localRepo )
.setShowErrors( true )
.setErrorReporter( reporter )
.setGoals( Arrays.asList( new String[] {
"initialize"
} ) );
MavenExecutionRequest request =
createRequest( project, reporter ).setLocalRepositoryPath( localRepo ).setGoals(
Arrays.asList( "initialize" ) );
maven.execute( request );
@ -567,13 +435,9 @@ public class ErrorReporterPointcutTest
reporterCtl.replay();
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( project )
.setShowErrors( true )
.setLocalRepositoryPath( localRepo )
.setErrorReporter( reporter )
.setGoals( Arrays.asList( new String[] {
"initialize"
} ) );
MavenExecutionRequest request =
createRequest( project, reporter ).setLocalRepositoryPath( localRepo ).setGoals(
Arrays.asList( "initialize" ) );
maven.execute( request );
@ -597,13 +461,8 @@ public class ErrorReporterPointcutTest
reporterCtl.replay();
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( project )
.setShowErrors( true )
.setSettings( settings )
.setErrorReporter( reporter )
.setGoals( Arrays.asList( new String[] {
"initialize"
} ) );
MavenExecutionRequest request =
createRequest( project, reporter ).setSettings( settings ).setGoals( Arrays.asList( "initialize" ) );
maven.execute( request );
@ -629,13 +488,9 @@ public class ErrorReporterPointcutTest
reporterCtl.replay();
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( project )
.setShowErrors( true )
.setLocalRepositoryPath( localRepo )
.setErrorReporter( reporter )
.setGoals( Arrays.asList( new String[] {
"initialize"
} ) );
MavenExecutionRequest request =
createRequest( project, reporter ).setLocalRepositoryPath( localRepo ).setGoals(
Arrays.asList( "initialize" ) );
maven.execute( request );
@ -660,13 +515,9 @@ public class ErrorReporterPointcutTest
reporterCtl.replay();
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( project )
.setShowErrors( true )
.setLocalRepositoryPath( localRepo )
.setErrorReporter( reporter )
.setGoals( Arrays.asList( new String[] {
"initialize"
} ) );
MavenExecutionRequest request =
createRequest( project, reporter ).setLocalRepositoryPath( localRepo ).setGoals(
Arrays.asList( "initialize" ) );
maven.execute( request );
@ -684,12 +535,7 @@ public class ErrorReporterPointcutTest
reporterCtl.replay();
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( projectDir )
.setShowErrors( true )
.setErrorReporter( reporter )
.setGoals( Arrays.asList( new String[] {
"initialize"
} ) );
MavenExecutionRequest request = createRequest( projectDir, reporter ).setGoals( Arrays.asList( "initialize" ) );
maven.execute( request );
@ -707,12 +553,9 @@ public class ErrorReporterPointcutTest
reporterCtl.replay();
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( projectDir )
.setShowErrors( true )
.setErrorReporter( reporter )
.setGoals( Arrays.asList( new String[] {
"compiler:compile"
} ) );
MavenExecutionRequest request =
createRequest( projectDir, reporter ).setGoals(
Arrays.asList( "org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile" ) );
maven.execute( request );
@ -735,13 +578,8 @@ public class ErrorReporterPointcutTest
reporterCtl.replay();
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( projectDir )
.setShowErrors( true )
.setSettings( settings )
.setErrorReporter( reporter )
.setGoals( Arrays.asList( new String[] {
"invalid:test"
} ) );
MavenExecutionRequest request =
createRequest( projectDir, reporter ).setSettings( settings ).setGoals( Arrays.asList( "invalid:test" ) );
maven.execute( request );
@ -756,11 +594,8 @@ public class ErrorReporterPointcutTest
reporterCtl.replay();
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setShowErrors( true )
.setErrorReporter( reporter )
.setGoals( Arrays.asList( new String[] {
"name:of:invalid:direct:mojo:for:test"
} ) );
MavenExecutionRequest request =
createRequest( reporter ).setGoals( Arrays.asList( "name:of:invalid:direct:mojo:for:test" ) );
maven.execute( request );
@ -770,11 +605,6 @@ public class ErrorReporterPointcutTest
public void testReportMissingRequiredMojoParameter()
throws IOException
{
if ( !checkOnline() )
{
return;
}
File projectDir = prepareProjectDir( "missing-req-mojo-param" );
buildTestAccessory( new File( projectDir, "plugin" ) );
@ -787,12 +617,9 @@ public class ErrorReporterPointcutTest
reporterCtl.replay();
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( basedir )
.setShowErrors( true )
.setErrorReporter( reporter )
.setGoals( Arrays.asList( new String[] {
"org.apache.maven.errortest:missing-req-mojo-param-maven-plugin:1:test"
} ) );
MavenExecutionRequest request =
createRequest( basedir, reporter ).setGoals(
Arrays.asList( "org.apache.maven.errortest:missing-req-mojo-param-maven-plugin:1:test" ) );
maven.execute( request );
@ -802,11 +629,6 @@ public class ErrorReporterPointcutTest
public void testReportMojoExecutionException()
throws IOException
{
if ( !checkOnline() )
{
return;
}
File projectDir = prepareProjectDir( "mojo-exec-err" );
buildTestAccessory( new File( projectDir, "plugin" ) );
@ -819,12 +641,9 @@ public class ErrorReporterPointcutTest
reporterCtl.replay();
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( basedir )
.setShowErrors( true )
.setErrorReporter( reporter )
.setGoals( Arrays.asList( new String[] {
"org.apache.maven.errortest:mojo-exec-err-maven-plugin:1:test"
} ) );
MavenExecutionRequest request =
createRequest( basedir, reporter ).setGoals(
Arrays.asList( "org.apache.maven.errortest:mojo-exec-err-maven-plugin:1:test" ) );
maven.execute( request );
@ -834,11 +653,6 @@ public class ErrorReporterPointcutTest
public void testReportMojoLookupError()
throws IOException
{
if ( !checkOnline() )
{
return;
}
File projectDir = prepareProjectDir( "mojo-lookup-err" );
buildTestAccessory( new File( projectDir, "plugin" ) );
@ -849,12 +663,9 @@ public class ErrorReporterPointcutTest
reporterCtl.replay();
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( projectDir )
.setShowErrors( true )
.setErrorReporter( reporter )
.setGoals( Arrays.asList( new String[] {
"org.apache.maven.errortest:mojo-lookup-err-maven-plugin:1:test"
} ) );
MavenExecutionRequest request =
createRequest( projectDir, reporter ).setGoals(
Arrays.asList( "org.apache.maven.errortest:mojo-lookup-err-maven-plugin:1:test" ) );
maven.execute( request );
@ -869,9 +680,7 @@ public class ErrorReporterPointcutTest
reporterCtl.replay();
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setShowErrors( true )
.setErrorReporter( reporter )
.setGoals( Collections.EMPTY_LIST );
MavenExecutionRequest request = createRequest( reporter ).setGoals( Collections.EMPTY_LIST );
maven.execute( request );
@ -889,12 +698,7 @@ public class ErrorReporterPointcutTest
reporterCtl.replay();
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( projectDir )
.setShowErrors( true )
.setErrorReporter( reporter )
.setGoals( Arrays.asList( new String[] {
"initialize"
} ) );
MavenExecutionRequest request = createRequest( projectDir, reporter ).setGoals( Arrays.asList( "initialize" ) );
maven.execute( request );
@ -914,12 +718,7 @@ public class ErrorReporterPointcutTest
reporterCtl.replay();
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( projectDir )
.setShowErrors( true )
.setErrorReporter( reporter )
.setGoals( Arrays.asList( new String[] {
"compile"
} ) );
MavenExecutionRequest request = createRequest( projectDir, reporter ).setGoals( Arrays.asList( "compile" ) );
maven.execute( request );
@ -929,13 +728,7 @@ public class ErrorReporterPointcutTest
public void testReportProjectDependenciesUnresolvable()
throws IOException
{
if ( !checkOnline() )
{
return;
}
File projectDir = prepareProjectDir( "err-resolving-project-dep" );
File localRepo = new File( projectDir, "local-repo" );
File project = new File( projectDir, "project" );
reporter.reportProjectDependenciesUnresolvable( null, null, null );
@ -944,13 +737,7 @@ public class ErrorReporterPointcutTest
reporterCtl.replay();
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( project )
.setShowErrors( true )
.setLocalRepositoryPath( localRepo )
.setErrorReporter( reporter )
.setGoals( Arrays.asList( new String[] {
"compile"
} ) );
MavenExecutionRequest request = createRequest( project, reporter ).setGoals( Arrays.asList( "compile" ) );
maven.execute( request );
@ -968,13 +755,8 @@ public class ErrorReporterPointcutTest
reporterCtl.replay();
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( projectDir )
.setShowErrors( true )
.setErrorReporter( reporter )
.setGoals( Arrays.asList( new String[] {
"clean",
"package"
} ) );
MavenExecutionRequest request =
createRequest( projectDir, reporter ).setGoals( Arrays.asList( "clean", "package" ) );
maven.execute( request );
@ -998,13 +780,8 @@ public class ErrorReporterPointcutTest
reporterCtl.replay();
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( project )
.setShowErrors( true )
.setSettings( settings )
.setErrorReporter( reporter )
.setGoals( Arrays.asList( new String[] {
"initialize"
} ) );
MavenExecutionRequest request =
createRequest( project, reporter ).setSettings( settings ).setGoals( Arrays.asList( "initialize" ) );
maven.execute( request );
@ -1022,12 +799,7 @@ public class ErrorReporterPointcutTest
reporterCtl.replay();
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( projectDir )
.setShowErrors( true )
.setErrorReporter( reporter )
.setGoals( Arrays.asList( new String[] {
"initialize"
} ) );
MavenExecutionRequest request = createRequest( projectDir, reporter ).setGoals( Arrays.asList( "initialize" ) );
maven.execute( request );
@ -1037,11 +809,6 @@ public class ErrorReporterPointcutTest
public void testReportActivatorLookupError()
throws IOException
{
if ( !checkOnline() )
{
return;
}
File projectDir = prepareProjectDir( "profile-activator-lookup-err" );
buildTestAccessory( new File( projectDir, "ext" ) );
@ -1054,12 +821,7 @@ public class ErrorReporterPointcutTest
reporterCtl.replay();
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( project )
.setShowErrors( true )
.setErrorReporter( reporter )
.setGoals( Arrays.asList( new String[] {
"initialize"
} ) );
MavenExecutionRequest request = createRequest( project, reporter ).setGoals( Arrays.asList( "initialize" ) );
maven.execute( request );
@ -1077,12 +839,7 @@ public class ErrorReporterPointcutTest
reporterCtl.replay();
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( projectDir )
.setShowErrors( true )
.setErrorReporter( reporter )
.setGoals( Arrays.asList( new String[] {
"compile"
} ) );
MavenExecutionRequest request = createRequest( projectDir, reporter ).setGoals( Arrays.asList( "compile" ) );
maven.execute( request );
@ -1100,12 +857,7 @@ public class ErrorReporterPointcutTest
reporterCtl.replay();
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( projectDir )
.setShowErrors( true )
.setErrorReporter( reporter )
.setGoals( Arrays.asList( new String[] {
"initialize"
} ) );
MavenExecutionRequest request = createRequest( projectDir, reporter ).setGoals( Arrays.asList( "initialize" ) );
maven.execute( request );
@ -1123,12 +875,7 @@ public class ErrorReporterPointcutTest
reporterCtl.replay();
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( projectDir )
.setShowErrors( true )
.setErrorReporter( reporter )
.setGoals( Arrays.asList( new String[] {
"initialize"
} ) );
MavenExecutionRequest request = createRequest( projectDir, reporter ).setGoals( Arrays.asList( "initialize" ) );
maven.execute( request );
@ -1146,12 +893,7 @@ public class ErrorReporterPointcutTest
reporterCtl.replay();
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( projectDir )
.setShowErrors( true )
.setErrorReporter( reporter )
.setGoals( Arrays.asList( new String[] {
"compile"
} ) );
MavenExecutionRequest request = createRequest( projectDir, reporter ).setGoals( Arrays.asList( "compile" ) );
maven.execute( request );
@ -1169,12 +911,7 @@ public class ErrorReporterPointcutTest
reporterCtl.replay();
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( projectDir )
.setShowErrors( true )
.setErrorReporter( reporter )
.setGoals( Arrays.asList( new String[] {
"compile"
} ) );
MavenExecutionRequest request = createRequest( projectDir, reporter ).setGoals( Arrays.asList( "compile" ) );
maven.execute( request );
@ -1192,12 +929,7 @@ public class ErrorReporterPointcutTest
reporterCtl.replay();
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( projectDir )
.setShowErrors( true )
.setErrorReporter( reporter )
.setGoals( Arrays.asList( new String[] {
"compile"
} ) );
MavenExecutionRequest request = createRequest( projectDir, reporter ).setGoals( Arrays.asList( "compile" ) );
maven.execute( request );
@ -1218,12 +950,7 @@ public class ErrorReporterPointcutTest
reporterCtl.replay();
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( projectDir )
.setShowErrors( true )
.setErrorReporter( reporter )
.setGoals( Arrays.asList( new String[] {
"initialize"
} ) );
MavenExecutionRequest request = createRequest( projectDir, reporter ).setGoals( Arrays.asList( "initialize" ) );
maven.execute( request );
@ -1241,12 +968,7 @@ public class ErrorReporterPointcutTest
reporterCtl.replay();
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( projectDir )
.setShowErrors( true )
.setErrorReporter( reporter )
.setGoals( Arrays.asList( new String[] {
"initialize"
} ) );
MavenExecutionRequest request = createRequest( projectDir, reporter ).setGoals( Arrays.asList( "initialize" ) );
maven.execute( request );
@ -1265,12 +987,7 @@ public class ErrorReporterPointcutTest
reporterCtl.replay();
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( childDir )
.setShowErrors( true )
.setErrorReporter( reporter )
.setGoals( Arrays.asList( new String[] {
"initialize"
} ) );
MavenExecutionRequest request = createRequest( childDir, reporter ).setGoals( Arrays.asList( "initialize" ) );
maven.execute( request );
@ -1289,12 +1006,7 @@ public class ErrorReporterPointcutTest
reporterCtl.replay();
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( childDir )
.setShowErrors( true )
.setErrorReporter( reporter )
.setGoals( Arrays.asList( new String[] {
"initialize"
} ) );
MavenExecutionRequest request = createRequest( childDir, reporter ).setGoals( Arrays.asList( "initialize" ) );
maven.execute( request );
@ -1312,12 +1024,7 @@ public class ErrorReporterPointcutTest
reporterCtl.replay();
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( projectDir )
.setShowErrors( true )
.setErrorReporter( reporter )
.setGoals( Arrays.asList( new String[] {
"initialize"
} ) );
MavenExecutionRequest request = createRequest( projectDir, reporter ).setGoals( Arrays.asList( "initialize" ) );
maven.execute( request );
@ -1335,23 +1042,19 @@ public class ErrorReporterPointcutTest
reporterCtl.replay();
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setPom( new File(
projectDir,
"pom.xml" ) )
.setShowErrors( true )
.setErrorReporter( reporter )
.setGoals( Arrays.asList( new String[] {
"initialize"
} ) );
MavenExecutionRequest request =
createRequest( reporter ).setPom( new File( projectDir, "pom.xml" ) ).setGoals(
Arrays.asList( "initialize" ) );
maven.execute( request );
reporterCtl.verify();
}
// FIXME: Something keeps flip-flopping about this test, between the two reporter methods below...need to revisit this pronto.
// public void testReportErrorCreatingArtifactRepository_fromProfilesXml()
// throws IOException
// FIXME: Something keeps flip-flopping about this test, between the two reporter methods below...need to revisit
// this pronto.
// public void testReportErrorCreatingArtifactRepository_fromProfilesXml()
// throws IOException
// {
// File projectDir = prepareProjectDir( "bad-profile-repo" );
//
@ -1396,13 +1099,8 @@ public class ErrorReporterPointcutTest
reporterCtl.replay();
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( projectDir )
.setSettings( settings )
.setShowErrors( true )
.setErrorReporter( reporter )
.setGoals( Arrays.asList( new String[] {
"initialize"
} ) );
MavenExecutionRequest request =
createRequest( projectDir, reporter ).setSettings( settings ).setGoals( Arrays.asList( "initialize" ) );
maven.execute( request );
@ -1420,12 +1118,7 @@ public class ErrorReporterPointcutTest
reporterCtl.replay();
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( projectDir )
.setShowErrors( true )
.setErrorReporter( reporter )
.setGoals( Arrays.asList( new String[] {
"initialize"
} ) );
MavenExecutionRequest request = createRequest( projectDir, reporter ).setGoals( Arrays.asList( "initialize" ) );
maven.execute( request );
@ -1443,12 +1136,7 @@ public class ErrorReporterPointcutTest
reporterCtl.replay();
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( projectDir )
.setShowErrors( true )
.setErrorReporter( reporter )
.setGoals( Arrays.asList( new String[] {
"initialize"
} ) );
MavenExecutionRequest request = createRequest( projectDir, reporter ).setGoals( Arrays.asList( "initialize" ) );
maven.execute( request );
@ -1466,12 +1154,7 @@ public class ErrorReporterPointcutTest
reporterCtl.replay();
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( projectDir )
.setShowErrors( true )
.setErrorReporter( reporter )
.setGoals( Arrays.asList( new String[] {
"initialize"
} ) );
MavenExecutionRequest request = createRequest( projectDir, reporter ).setGoals( Arrays.asList( "initialize" ) );
maven.execute( request );
@ -1496,13 +1179,9 @@ public class ErrorReporterPointcutTest
reporterCtl.replay();
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( projectDir )
.setSettings( settings )
.setShowErrors( true )
.setErrorReporter( reporter )
.setGoals( Arrays.asList( new String[] {
"missing-direct-invoke-mojo:test"
} ) );
MavenExecutionRequest request =
createRequest( projectDir, reporter ).setSettings( settings ).setGoals(
Arrays.asList( "missing-direct-invoke-mojo:test" ) );
MavenExecutionResult result = maven.execute( request );
@ -1531,13 +1210,9 @@ public class ErrorReporterPointcutTest
reporterCtl.replay();
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( project )
.setSettings( settings )
.setShowErrors( true )
.setErrorReporter( reporter )
.setGoals( Arrays.asList( new String[] {
"duplicated-attachments:test"
} ) );
MavenExecutionRequest request =
createRequest( project, reporter ).setSettings( settings ).setGoals(
Arrays.asList( "duplicated-attachments:test" ) );
MavenExecutionResult result = maven.execute( request );

View File

@ -4,7 +4,7 @@
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.3.1</version>
<version>2.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
@ -29,4 +29,4 @@
</plugins>
</pluginManagement>
</build>
</project>
</project>

View File

@ -4,7 +4,7 @@
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.3.1</version>
<version>2.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
@ -33,4 +33,4 @@
</plugins>
</pluginManagement>
</build>
</project>
</project>

View File

@ -40,7 +40,7 @@ under the License.
<plugin>
<!-- it's here just for the extensions tag -->
<artifactId>maven-surefire-plugin</artifactId>
<version>RELEASE</version>
<version>2.3</version>
<extensions>true</extensions>
</plugin>
</plugins>