diff --git a/maven-embedder/src/test/error-reporting-projects/testReportParentPomArtifactNotFound/pom.xml b/maven-embedder/src/test/error-reporting-projects/testReportParentPomArtifactNotFound/pom.xml new file mode 100644 index 0000000000..86f537dff6 --- /dev/null +++ b/maven-embedder/src/test/error-reporting-projects/testReportParentPomArtifactNotFound/pom.xml @@ -0,0 +1,11 @@ + + 4.0.0 + + org.apache.maven.errortest + testReportParentPomArtifactNotFound-parent + 1 + + + testReportParentPomArtifactNotFound + + \ No newline at end of file diff --git a/maven-embedder/src/test/error-reporting-projects/testReportProjectDependenciesUnresolvable/local-repo/org/apache/maven/errortest/dep/1/dep-1.pom b/maven-embedder/src/test/error-reporting-projects/testReportProjectDependenciesUnresolvable/local-repo/org/apache/maven/errortest/dep/1/dep-1.pom new file mode 100644 index 0000000000..e6dd7a2be6 --- /dev/null +++ b/maven-embedder/src/test/error-reporting-projects/testReportProjectDependenciesUnresolvable/local-repo/org/apache/maven/errortest/dep/1/dep-1.pom @@ -0,0 +1,16 @@ + + + 4.0.0 + org.apache.maven.errortest + dep + 1 + pom + + + + junit + junit + [4.0,4.1] + + + \ No newline at end of file diff --git a/maven-embedder/src/test/error-reporting-projects/testReportProjectDependenciesUnresolvable/pom.xml b/maven-embedder/src/test/error-reporting-projects/testReportProjectDependenciesUnresolvable/project/pom.xml similarity index 52% rename from maven-embedder/src/test/error-reporting-projects/testReportProjectDependenciesUnresolvable/pom.xml rename to maven-embedder/src/test/error-reporting-projects/testReportProjectDependenciesUnresolvable/project/pom.xml index af4d45e699..72a9930197 100644 --- a/maven-embedder/src/test/error-reporting-projects/testReportProjectDependenciesUnresolvable/pom.xml +++ b/maven-embedder/src/test/error-reporting-projects/testReportProjectDependenciesUnresolvable/project/pom.xml @@ -4,18 +4,17 @@ testReportProjectDependenciesUnresolvable 1 - - - central - test://host/path - - - - not - found - 3.8.1 + junit + junit + [3.8.1,3.8.2] + + + org.apache.maven.errortest + dep + 1 + pom diff --git a/maven-embedder/src/test/error-reporting-projects/testReportProjectDependenciesUnresolvable/src/main/java/org/apache/maven/test/error/mojoFailure/App.java b/maven-embedder/src/test/error-reporting-projects/testReportProjectDependenciesUnresolvable/project/src/main/java/org/apache/maven/test/error/mojoFailure/App.java similarity index 100% rename from maven-embedder/src/test/error-reporting-projects/testReportProjectDependenciesUnresolvable/src/main/java/org/apache/maven/test/error/mojoFailure/App.java rename to maven-embedder/src/test/error-reporting-projects/testReportProjectDependenciesUnresolvable/project/src/main/java/org/apache/maven/test/error/mojoFailure/App.java diff --git a/maven-embedder/src/test/error-reporting-projects/testReportProjectDependenciesUnresolvable/src/test/java/org/apache/maven/test/error/mojoFailure/AppTest.java b/maven-embedder/src/test/error-reporting-projects/testReportProjectDependenciesUnresolvable/project/src/test/java/org/apache/maven/test/error/mojoFailure/AppTest.java similarity index 100% rename from maven-embedder/src/test/error-reporting-projects/testReportProjectDependenciesUnresolvable/src/test/java/org/apache/maven/test/error/mojoFailure/AppTest.java rename to maven-embedder/src/test/error-reporting-projects/testReportProjectDependenciesUnresolvable/project/src/test/java/org/apache/maven/test/error/mojoFailure/AppTest.java diff --git a/maven-embedder/src/test/java/org/apache/maven/error/ErrorReporterPointcutTest.java b/maven-embedder/src/test/java/org/apache/maven/error/ErrorReporterPointcutTest.java index 5e63c44d70..56da48cbd7 100644 --- a/maven-embedder/src/test/java/org/apache/maven/error/ErrorReporterPointcutTest.java +++ b/maven-embedder/src/test/java/org/apache/maven/error/ErrorReporterPointcutTest.java @@ -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()