more unit tests.

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@612010 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
John Dennis Casey 2008-01-15 04:15:07 +00:00
parent a07cafc3fa
commit cc43012a5b
3 changed files with 91 additions and 33 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>testReportInvalidRepositoryWhileGettingRepositoriesFromProfiles</artifactId>
<version>1</version>
</project>

View File

@ -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>

View File

@ -26,7 +26,6 @@ import java.io.IOException;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.io.StringReader; import java.io.StringReader;
import java.io.StringWriter; import java.io.StringWriter;
import java.net.URISyntaxException;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.Iterator; import java.util.Iterator;
@ -146,7 +145,7 @@ public class ErrorReporterPointcutTest
} }
private File prepareProjectDir() private File prepareProjectDir()
throws URISyntaxException, IOException throws IOException
{ {
String method = getTestMethodName(); String method = getTestMethodName();
@ -217,7 +216,7 @@ public class ErrorReporterPointcutTest
} }
public void testReportErrorResolvingExtensionDirectDependencies() public void testReportErrorResolvingExtensionDirectDependencies()
throws URISyntaxException, IOException throws IOException
{ {
File projectDir = prepareProjectDir(); File projectDir = prepareProjectDir();
File localRepo = new File( projectDir, "local-repo" ); File localRepo = new File( projectDir, "local-repo" );
@ -248,7 +247,7 @@ public class ErrorReporterPointcutTest
} }
public void testReportAggregatedMojoFailureException() public void testReportAggregatedMojoFailureException()
throws URISyntaxException, IOException throws IOException
{ {
if ( !checkOnline() ) if ( !checkOnline() )
{ {
@ -292,7 +291,7 @@ public class ErrorReporterPointcutTest
} }
public void testReportErrorConfiguringExtensionPluginRealm() public void testReportErrorConfiguringExtensionPluginRealm()
throws URISyntaxException, IOException throws IOException
{ {
File projectDir = prepareProjectDir(); File projectDir = prepareProjectDir();
@ -319,7 +318,7 @@ public class ErrorReporterPointcutTest
} }
public void testReportErrorFormulatingBuildPlan() public void testReportErrorFormulatingBuildPlan()
throws URISyntaxException, IOException throws IOException
{ {
if ( !checkOnline() ) if ( !checkOnline() )
{ {
@ -351,7 +350,7 @@ public class ErrorReporterPointcutTest
} }
public void testReportErrorInterpolatingModel_UsingProjectInstance() public void testReportErrorInterpolatingModel_UsingProjectInstance()
throws URISyntaxException, IOException throws IOException
{ {
if ( !checkOnline() ) if ( !checkOnline() )
{ {
@ -388,7 +387,7 @@ public class ErrorReporterPointcutTest
} }
public void testReportErrorManagingRealmForExtension() public void testReportErrorManagingRealmForExtension()
throws URISyntaxException, IOException throws IOException
{ {
File projectDir = prepareProjectDir(); File projectDir = prepareProjectDir();
@ -415,7 +414,7 @@ public class ErrorReporterPointcutTest
} }
public void testReportErrorResolvingExtensionDependencies() public void testReportErrorResolvingExtensionDependencies()
throws URISyntaxException, IOException throws IOException
{ {
File projectDir = prepareProjectDir(); File projectDir = prepareProjectDir();
File localRepo = new File( projectDir, "local-repo" ); File localRepo = new File( projectDir, "local-repo" );
@ -471,7 +470,7 @@ public class ErrorReporterPointcutTest
} }
public void testReportInvalidMavenVersion() public void testReportInvalidMavenVersion()
throws URISyntaxException, IOException throws IOException
{ {
File projectDir = prepareProjectDir(); File projectDir = prepareProjectDir();
@ -494,7 +493,7 @@ public class ErrorReporterPointcutTest
} }
public void testReportInvalidPluginExecutionEnvironment() public void testReportInvalidPluginExecutionEnvironment()
throws URISyntaxException, IOException throws IOException
{ {
File projectDir = prepareProjectDir(); File projectDir = prepareProjectDir();
@ -517,7 +516,7 @@ public class ErrorReporterPointcutTest
} }
public void testReportLifecycleLoaderErrorWhileValidatingTask() public void testReportLifecycleLoaderErrorWhileValidatingTask()
throws URISyntaxException, IOException throws IOException
{ {
File projectDir = prepareProjectDir(); File projectDir = prepareProjectDir();
File localRepo = new File( projectDir, "local-repo" ); File localRepo = new File( projectDir, "local-repo" );
@ -618,7 +617,7 @@ public class ErrorReporterPointcutTest
} }
public void testReportProjectCycle() public void testReportProjectCycle()
throws URISyntaxException, IOException throws IOException
{ {
File projectDir = prepareProjectDir(); File projectDir = prepareProjectDir();
@ -641,7 +640,7 @@ public class ErrorReporterPointcutTest
} }
public void testReportProjectDependenciesNotFound() public void testReportProjectDependenciesNotFound()
throws URISyntaxException, IOException throws IOException
{ {
File projectDir = prepareProjectDir(); File projectDir = prepareProjectDir();
@ -665,7 +664,7 @@ public class ErrorReporterPointcutTest
// FIXME: Get the wagon to fail (in a way other than 'not found') // FIXME: Get the wagon to fail (in a way other than 'not found')
public void testReportProjectDependenciesUnresolvable() public void testReportProjectDependenciesUnresolvable()
throws URISyntaxException, IOException throws IOException
{ {
// File projectDir = prepareProjectDir(); // File projectDir = prepareProjectDir();
// //
@ -688,7 +687,7 @@ public class ErrorReporterPointcutTest
} }
public void testReportProjectMojoFailureException() public void testReportProjectMojoFailureException()
throws URISyntaxException, IOException throws IOException
{ {
File projectDir = prepareProjectDir(); File projectDir = prepareProjectDir();
@ -737,7 +736,7 @@ public class ErrorReporterPointcutTest
// FIXME: How can I test this when it's masked by reportActivatorErrorWhileGettingRepositoriesFromProfiles? // FIXME: How can I test this when it's masked by reportActivatorErrorWhileGettingRepositoriesFromProfiles?
public void testReportActivatorError() public void testReportActivatorError()
throws URISyntaxException, IOException throws IOException
{ {
File projectDir = prepareProjectDir(); File projectDir = prepareProjectDir();
@ -766,7 +765,7 @@ public class ErrorReporterPointcutTest
} }
public void testReportBadDependencyVersion() public void testReportBadDependencyVersion()
throws URISyntaxException, IOException throws IOException
{ {
File projectDir = prepareProjectDir(); File projectDir = prepareProjectDir();
@ -789,7 +788,7 @@ public class ErrorReporterPointcutTest
} }
public void testReportBadManagedDependencyVersion() public void testReportBadManagedDependencyVersion()
throws URISyntaxException, IOException throws IOException
{ {
File projectDir = prepareProjectDir(); File projectDir = prepareProjectDir();
@ -812,7 +811,7 @@ public class ErrorReporterPointcutTest
} }
public void testReportBadNonDependencyProjectArtifactVersion() public void testReportBadNonDependencyProjectArtifactVersion()
throws URISyntaxException, IOException throws IOException
{ {
File projectDir = prepareProjectDir(); File projectDir = prepareProjectDir();
@ -835,7 +834,7 @@ public class ErrorReporterPointcutTest
} }
public void testReportErrorCreatingArtifactRepository() public void testReportErrorCreatingArtifactRepository()
throws URISyntaxException, IOException throws IOException
{ {
File projectDir = prepareProjectDir(); File projectDir = prepareProjectDir();
@ -858,7 +857,7 @@ public class ErrorReporterPointcutTest
} }
public void testReportErrorCreatingDeploymentArtifactRepository() public void testReportErrorCreatingDeploymentArtifactRepository()
throws URISyntaxException, IOException throws IOException
{ {
File projectDir = prepareProjectDir(); File projectDir = prepareProjectDir();
@ -881,7 +880,7 @@ public class ErrorReporterPointcutTest
} }
public void testReportErrorInterpolatingModel_UsingModelInstance() public void testReportErrorInterpolatingModel_UsingModelInstance()
throws URISyntaxException, IOException throws IOException
{ {
File projectDir = prepareProjectDir(); File projectDir = prepareProjectDir();
@ -904,7 +903,7 @@ public class ErrorReporterPointcutTest
} }
public void testReportErrorLoadingExternalProfilesFromFile_XmlPullParserException() public void testReportErrorLoadingExternalProfilesFromFile_XmlPullParserException()
throws URISyntaxException, IOException throws IOException
{ {
File projectDir = prepareProjectDir(); File projectDir = prepareProjectDir();
@ -927,7 +926,7 @@ public class ErrorReporterPointcutTest
} }
public void testReportErrorLoadingExternalProfilesFromFile_IOException() public void testReportErrorLoadingExternalProfilesFromFile_IOException()
throws URISyntaxException, IOException throws IOException
{ {
File projectDir = prepareProjectDir(); File projectDir = prepareProjectDir();
@ -950,7 +949,7 @@ public class ErrorReporterPointcutTest
} }
public void testReportErrorParsingParentProjectModel_XmlPullParserException() public void testReportErrorParsingParentProjectModel_XmlPullParserException()
throws URISyntaxException, IOException throws IOException
{ {
File projectDir = prepareProjectDir(); File projectDir = prepareProjectDir();
File childDir = new File( projectDir, "child" ); File childDir = new File( projectDir, "child" );
@ -974,7 +973,7 @@ public class ErrorReporterPointcutTest
} }
public void testReportErrorParsingParentProjectModel_IOException() public void testReportErrorParsingParentProjectModel_IOException()
throws URISyntaxException, IOException throws IOException
{ {
File projectDir = prepareProjectDir(); File projectDir = prepareProjectDir();
File childDir = new File( projectDir, "child" ); File childDir = new File( projectDir, "child" );
@ -998,7 +997,7 @@ public class ErrorReporterPointcutTest
} }
public void testReportErrorParsingProjectModel_XmlPullParserException() public void testReportErrorParsingProjectModel_XmlPullParserException()
throws URISyntaxException, IOException throws IOException
{ {
File projectDir = prepareProjectDir(); File projectDir = prepareProjectDir();
@ -1021,7 +1020,7 @@ public class ErrorReporterPointcutTest
} }
public void testReportErrorParsingProjectModel_IOException() public void testReportErrorParsingProjectModel_IOException()
throws URISyntaxException, IOException throws IOException
{ {
File projectDir = prepareProjectDir(); File projectDir = prepareProjectDir();
@ -1046,15 +1045,49 @@ public class ErrorReporterPointcutTest
} }
public void testReportInvalidRepositoryWhileGettingRepositoriesFromProfiles() 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() 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() public void testReportParentPomArtifactUnresolvable()
@ -1064,7 +1097,7 @@ public class ErrorReporterPointcutTest
} }
public void testReportProjectCollision() public void testReportProjectCollision()
throws URISyntaxException, IOException throws IOException
{ {
File projectDir = prepareProjectDir(); File projectDir = prepareProjectDir();
@ -1087,7 +1120,7 @@ public class ErrorReporterPointcutTest
} }
public void testReportProjectValidationFailure() public void testReportProjectValidationFailure()
throws URISyntaxException, IOException throws IOException
{ {
File projectDir = prepareProjectDir(); File projectDir = prepareProjectDir();