mirror of https://github.com/apache/maven.git
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:
parent
1c235317d7
commit
835488bada
|
@ -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>
|
|
@ -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>
|
|
@ -4,18 +4,17 @@
|
||||||
<artifactId>testReportProjectDependenciesUnresolvable</artifactId>
|
<artifactId>testReportProjectDependenciesUnresolvable</artifactId>
|
||||||
<version>1</version>
|
<version>1</version>
|
||||||
|
|
||||||
<repositories>
|
|
||||||
<repository>
|
|
||||||
<id>central</id>
|
|
||||||
<url>test://host/path</url>
|
|
||||||
</repository>
|
|
||||||
</repositories>
|
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>not</groupId>
|
<groupId>junit</groupId>
|
||||||
<artifactId>found</artifactId>
|
<artifactId>junit</artifactId>
|
||||||
<version>3.8.1</version>
|
<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>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
|
@ -667,28 +667,35 @@ public class ErrorReporterPointcutTest
|
||||||
reporterCtl.verify();
|
reporterCtl.verify();
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: Get the wagon to fail (in a way other than 'not found')
|
|
||||||
public void testReportProjectDependenciesUnresolvable()
|
public void testReportProjectDependenciesUnresolvable()
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
// File projectDir = prepareProjectDir();
|
if ( !checkOnline() )
|
||||||
//
|
{
|
||||||
// reporter.reportProjectDependenciesUnresolvable( null, null, null );
|
return;
|
||||||
// reporterCtl.setMatcher( MockControl.ALWAYS_MATCHER );
|
}
|
||||||
// reporterCtl.setVoidCallable();
|
|
||||||
//
|
File projectDir = prepareProjectDir();
|
||||||
// reporterCtl.replay();
|
File localRepo = new File( projectDir, "local-repo" );
|
||||||
//
|
File project = new File( projectDir, "project" );
|
||||||
// MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( projectDir )
|
|
||||||
// .setShowErrors( true )
|
reporter.reportProjectDependenciesUnresolvable( null, null, null );
|
||||||
// .setErrorReporter( reporter )
|
reporterCtl.setMatcher( MockControl.ALWAYS_MATCHER );
|
||||||
// .setGoals( Arrays.asList( new String[] {
|
reporterCtl.setVoidCallable();
|
||||||
// "compile"
|
|
||||||
// } ) );
|
reporterCtl.replay();
|
||||||
//
|
|
||||||
// maven.execute( request );
|
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( project )
|
||||||
//
|
.setShowErrors( true )
|
||||||
// reporterCtl.verify();
|
.setLocalRepositoryPath( localRepo )
|
||||||
|
.setErrorReporter( reporter )
|
||||||
|
.setGoals( Arrays.asList( new String[] {
|
||||||
|
"compile"
|
||||||
|
} ) );
|
||||||
|
|
||||||
|
maven.execute( request );
|
||||||
|
|
||||||
|
reporterCtl.verify();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testReportProjectMojoFailureException()
|
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()
|
public void testReportActivatorError()
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
|
@ -754,17 +760,11 @@ public class ErrorReporterPointcutTest
|
||||||
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( projectDir )
|
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( projectDir )
|
||||||
.setShowErrors( true )
|
.setShowErrors( true )
|
||||||
.setErrorReporter( reporter )
|
.setErrorReporter( reporter )
|
||||||
// .setErrorReporter( new DummyCoreErrorReporter() )
|
|
||||||
.setGoals( Arrays.asList( new String[] {
|
.setGoals( Arrays.asList( new String[] {
|
||||||
"initialize"
|
"initialize"
|
||||||
} ) );
|
} ) );
|
||||||
|
|
||||||
MavenExecutionResult result = maven.execute( request );
|
maven.execute( request );
|
||||||
|
|
||||||
// if ( result.hasExceptions() )
|
|
||||||
// {
|
|
||||||
// reportExceptions( result, projectDir );
|
|
||||||
// }
|
|
||||||
|
|
||||||
reporterCtl.verify();
|
reporterCtl.verify();
|
||||||
}
|
}
|
||||||
|
@ -792,17 +792,11 @@ public class ErrorReporterPointcutTest
|
||||||
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( project )
|
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( project )
|
||||||
.setShowErrors( true )
|
.setShowErrors( true )
|
||||||
.setErrorReporter( reporter )
|
.setErrorReporter( reporter )
|
||||||
// .setErrorReporter( new DummyCoreErrorReporter() )
|
|
||||||
.setGoals( Arrays.asList( new String[] {
|
.setGoals( Arrays.asList( new String[] {
|
||||||
"initialize"
|
"initialize"
|
||||||
} ) );
|
} ) );
|
||||||
|
|
||||||
MavenExecutionResult result = maven.execute( request );
|
maven.execute( request );
|
||||||
|
|
||||||
// if ( result.hasExceptions() )
|
|
||||||
// {
|
|
||||||
// reportExceptions( result, project );
|
|
||||||
// }
|
|
||||||
|
|
||||||
reporterCtl.verify();
|
reporterCtl.verify();
|
||||||
}
|
}
|
||||||
|
@ -1110,34 +1104,33 @@ public class ErrorReporterPointcutTest
|
||||||
reporterCtl.verify();
|
reporterCtl.verify();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Finish this test!
|
|
||||||
public void testReportParentPomArtifactNotFound()
|
public void testReportParentPomArtifactNotFound()
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
// File projectDir = prepareProjectDir();
|
File projectDir = prepareProjectDir();
|
||||||
//
|
File localRepo = new File( projectDir, "local-repo" );
|
||||||
// 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()
|
Settings settings = new Settings();
|
||||||
{
|
settings.setLocalRepository( localRepo.getAbsolutePath() );
|
||||||
// TODO Auto-generated method stub
|
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()
|
public void testReportProjectCollision()
|
||||||
|
|
Loading…
Reference in New Issue