Adding the remaining project-related error reporting unit tests.

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@612493 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
John Dennis Casey 2008-01-16 15:55:08 +00:00
parent 1c235317d7
commit 835488bada
6 changed files with 86 additions and 67 deletions

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?><project>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.maven.errortest</groupId>
<artifactId>testReportParentPomArtifactNotFound-parent</artifactId>
<version>1</version>
</parent>
<artifactId>testReportParentPomArtifactNotFound</artifactId>
</project>

View File

@ -0,0 +1,16 @@
<?xml version="1.0"?>
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.maven.errortest</groupId>
<artifactId>dep</artifactId>
<version>1</version>
<packaging>pom</packaging>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>[4.0,4.1]</version>
</dependency>
</dependencies>
</project>

View File

@ -4,18 +4,17 @@
<artifactId>testReportProjectDependenciesUnresolvable</artifactId>
<version>1</version>
<repositories>
<repository>
<id>central</id>
<url>test://host/path</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>not</groupId>
<artifactId>found</artifactId>
<version>3.8.1</version>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>[3.8.1,3.8.2]</version>
</dependency>
<dependency>
<groupId>org.apache.maven.errortest</groupId>
<artifactId>dep</artifactId>
<version>1</version>
<type>pom</type>
</dependency>
</dependencies>

View File

@ -667,28 +667,35 @@ public class ErrorReporterPointcutTest
reporterCtl.verify();
}
// FIXME: Get the wagon to fail (in a way other than 'not found')
public void testReportProjectDependenciesUnresolvable()
throws IOException
{
// File projectDir = prepareProjectDir();
//
// reporter.reportProjectDependenciesUnresolvable( 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[] {
// "compile"
// } ) );
//
// maven.execute( request );
//
// reporterCtl.verify();
if ( !checkOnline() )
{
return;
}
File projectDir = prepareProjectDir();
File localRepo = new File( projectDir, "local-repo" );
File project = new File( projectDir, "project" );
reporter.reportProjectDependenciesUnresolvable( null, null, null );
reporterCtl.setMatcher( MockControl.ALWAYS_MATCHER );
reporterCtl.setVoidCallable();
reporterCtl.replay();
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( project )
.setShowErrors( true )
.setLocalRepositoryPath( localRepo )
.setErrorReporter( reporter )
.setGoals( Arrays.asList( new String[] {
"compile"
} ) );
maven.execute( request );
reporterCtl.verify();
}
public void testReportProjectMojoFailureException()
@ -739,7 +746,6 @@ public class ErrorReporterPointcutTest
}
// FIXME: How can I test this when it's masked by reportActivatorErrorWhileGettingRepositoriesFromProfiles?
public void testReportActivatorError()
throws IOException
{
@ -754,17 +760,11 @@ public class ErrorReporterPointcutTest
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( projectDir )
.setShowErrors( true )
.setErrorReporter( reporter )
// .setErrorReporter( new DummyCoreErrorReporter() )
.setGoals( Arrays.asList( new String[] {
"initialize"
} ) );
MavenExecutionResult result = maven.execute( request );
// if ( result.hasExceptions() )
// {
// reportExceptions( result, projectDir );
// }
maven.execute( request );
reporterCtl.verify();
}
@ -792,17 +792,11 @@ public class ErrorReporterPointcutTest
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( project )
.setShowErrors( true )
.setErrorReporter( reporter )
// .setErrorReporter( new DummyCoreErrorReporter() )
.setGoals( Arrays.asList( new String[] {
"initialize"
} ) );
MavenExecutionResult result = maven.execute( request );
// if ( result.hasExceptions() )
// {
// reportExceptions( result, project );
// }
maven.execute( request );
reporterCtl.verify();
}
@ -1110,34 +1104,33 @@ public class ErrorReporterPointcutTest
reporterCtl.verify();
}
// TODO: Finish this test!
public void testReportParentPomArtifactNotFound()
throws IOException
{
// 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();
}
File projectDir = prepareProjectDir();
File localRepo = new File( projectDir, "local-repo" );
public void testReportParentPomArtifactUnresolvable()
{
// TODO Auto-generated method stub
Settings settings = new Settings();
settings.setLocalRepository( localRepo.getAbsolutePath() );
settings.setOffline( true );
reporter.reportParentPomArtifactNotFound( null, null, null, null, null, null );
reporterCtl.setMatcher( MockControl.ALWAYS_MATCHER );
reporterCtl.setVoidCallable();
reporterCtl.replay();
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( projectDir )
.setSettings( settings )
.setShowErrors( true )
.setErrorReporter( reporter )
.setGoals( Arrays.asList( new String[] {
"initialize"
} ) );
maven.execute( request );
reporterCtl.verify();
}
public void testReportProjectCollision()