more unit tests.

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@611979 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
John Dennis Casey 2008-01-15 00:39:03 +00:00
parent 6e230d611a
commit 1071c589dc
7 changed files with 149 additions and 25 deletions

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?><project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.maven.errortest</groupId>
<artifactId>testReportErrorInterpolatingModel_UsingModelInstance</artifactId>
<version>${version}</version>
</project>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?><project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.test</groupId>
<artifactId>bad-pom</artifactId>
<version>1</version>
<packaging>${packaging}</packaging>
</project>

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?><project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.maven.errortest</groupId>
<artifactId>testReportErrorInterpolatingModel_UsingProjectInstance</artifactId>
<version>1</version>
<dependencies>
<dependency>
<groupId>org.test</groupId>
<artifactId>bad-pom</artifactId>
<version>1</version>
<type>pom</type>
</dependency>
</dependencies>
</project>

View File

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

View File

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

View File

@ -0,0 +1,4 @@
<profilesXml>
<profiles>
</profile>
</profilesXml>

View File

@ -17,7 +17,6 @@ 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.logging.Logger;
import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
import org.easymock.MockControl;
@ -352,9 +351,34 @@ public class ErrorReporterPointcutTest
}
public void testReportErrorInterpolatingModel_UsingProjectInstance()
throws URISyntaxException, IOException
{
// TODO Auto-generated method stub
if ( !checkOnline() )
{
return;
}
File projectDir = prepareProjectDir();
File localRepo = new File( projectDir, "local-repo" );
File project = new File( projectDir, "project" );
reporter.reportErrorInterpolatingModel( null, null, null );
reporterCtl.setMatcher( MockControl.ALWAYS_MATCHER );
reporterCtl.setVoidCallable();
reporterCtl.replay();
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( project )
.setLocalRepositoryPath( localRepo )
.setShowErrors( true )
.setErrorReporter( reporter )
.setGoals( Arrays.asList( new String[] {
"compile"
} ) );
maven.execute( request );
reporterCtl.verify();
}
public void testReportErrorLoadingPlugin()
@ -510,7 +534,6 @@ public class ErrorReporterPointcutTest
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( projectDir )
.setShowErrors( true )
.setLoggingLevel( Logger.LEVEL_DEBUG )
.setSettings( settings )
.setErrorReporter( reporter )
.setGoals( Arrays.asList( new String[] {
@ -640,27 +663,28 @@ public class ErrorReporterPointcutTest
reporterCtl.verify();
}
// FIXME: Get the wagon to fail (in a way other than 'not found')
public void testReportProjectDependenciesUnresolvable()
throws URISyntaxException, 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();
// 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();
}
public void testReportProjectMojoFailureException()
@ -857,21 +881,72 @@ public class ErrorReporterPointcutTest
}
public void testReportErrorInterpolatingModel_UsingModelInstance()
throws URISyntaxException, IOException
{
// TODO Auto-generated method stub
File projectDir = prepareProjectDir();
reporter.reportErrorInterpolatingModel( null, 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[] {
"compile"
} ) );
maven.execute( request );
reporterCtl.verify();
}
public void testReportErrorLoadingExternalProfilesFromFile_XmlPullParserException()
throws URISyntaxException, IOException
{
// TODO Auto-generated method stub
File projectDir = prepareProjectDir();
reporter.reportErrorLoadingExternalProfilesFromFile( null, null, null, (XmlPullParserException) 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 testReportErrorLoadingExternalProfilesFromFile_IOException()
throws URISyntaxException, IOException
{
// TODO Auto-generated method stub
File projectDir = prepareProjectDir();
reporter.reportErrorLoadingExternalProfilesFromFile( null, null, null, (IOException) 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 testReportErrorParsingParentProjectModel_XmlPullParserException()
@ -898,7 +973,6 @@ public class ErrorReporterPointcutTest
reporterCtl.replay();
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( projectDir )
.setLoggingLevel( Logger.LEVEL_DEBUG )
.setShowErrors( true )
.setErrorReporter( reporter )
.setGoals( Arrays.asList( new String[] {