From 3acaa63cf8a167a0c8f10116dbd7545f1929d128 Mon Sep 17 00:00:00 2001 From: Brett Leslie Porter Date: Wed, 18 Jun 2008 16:56:56 +0000 Subject: [PATCH] adjust the embedder tests: - remove a number of downloads from central that were slowing the build significantly - ensure the tests will run with a repo manager and no central access - ensure the tests will run offline if the local repository is populated The technique for populating the repository is very hacky. We really need the tests to be doing this themselves. Perhaps moving these IT-like tests into the IT section and alongside the core ITs is the way to go - but this is a start. git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@669222 13f79535-47bb-0310-9956-ffa450edef68 --- maven-embedder/pom.xml | 34 + .../aggregate-mojo-failure/plugin/pom.xml | 2 +- .../bad-build-plan/plugin/pom.xml | 2 +- .../bad-ext-plugin-dep-ver-maven-plugin-1.pom | 2 +- .../bad-ext-plugin-dep-ver/plugin/pom.xml | 2 +- ...ad-ext-plugin-maven-ver-maven-plugin-1.pom | 2 +- .../bad-ext-plugin-maven-ver/plugin/pom.xml | 2 +- .../config-rdonly-mojo-param/plugin/pom.xml | 2 +- .../duplicated-attachments/plugin/pom.xml | 2 +- .../1/err-loading-plugin-maven-plugin-1.pom | 2 +- ...rr-resolving-ext-plugin-maven-plugin-1.pom | 2 +- .../apache/maven/errortest/dep/1/dep-1.pom | 0 .../err-resolving-project-dep/project/pom.xml | 6 + ...plugin-artifact-missing-maven-plugin-1.pom | 2 +- .../ext-plugin-realm-error/plugin/pom.xml | 4 +- .../ext-plugin-version-err-maven-plugin-1.pom | 2 +- .../ext-plugin-version-err/plugin/pom.xml | 2 +- .../ext-realm-error/ext/pom.xml | 2 +- .../org/test/bad-pom/1/bad-pom-1.pom | 0 .../interp-from-project/project/pom.xml | 6 + .../missing-direct-invoke-mojo/plugin/pom.xml | 2 +- .../missing-req-mojo-param/plugin/pom.xml | 2 +- .../mojo-config-error/plugin/pom.xml | 2 +- .../mojo-exec-err/plugin/pom.xml | 2 +- .../mojo-lookup-err/plugin/pom.xml | 2 +- .../profile-activator-lookup-err/ext/pom.xml | 2 +- .../embedder/AbstractEmbedderTestCase.java | 2 + ...bedderProjectWithExtensionReadingTest.java | 19 + .../EmbedderUsingEclipsePluginTest.java | 2 +- .../execution/EmbedderUsingScmPluginTest.java | 2 +- .../error/ErrorReporterPointcutTest.java | 587 ++++-------------- .../plugin-version-references/jar-pom.xml | 4 +- .../maven-plugin-pom.xml | 4 +- maven-embedder/src/test/resources/pom2.xml | 2 +- 34 files changed, 227 insertions(+), 485 deletions(-) rename maven-embedder/src/test/error-reporting-projects/err-resolving-project-dep/{ => project}/local-repo/org/apache/maven/errortest/dep/1/dep-1.pom (100%) rename maven-embedder/src/test/error-reporting-projects/interp-from-project/{ => project}/local-repo/org/test/bad-pom/1/bad-pom-1.pom (100%) diff --git a/maven-embedder/pom.xml b/maven-embedder/pom.xml index f80f0dcd96..66ee2ddbb2 100644 --- a/maven-embedder/pom.xml +++ b/maven-embedder/pom.xml @@ -106,6 +106,40 @@ under the License. + + + + org.apache.maven.plugins + maven-plugin-plugin + 2.3 + true + + + org.apache.maven.plugins + maven-surefire-plugin + 2.2 + true + + + org.apache.maven.plugins + maven-resources-plugin + 2.2 + true + + + org.apache.maven.plugins + maven-scm-plugin + 1.0 + true + + + org.apache.maven.plugins + maven-eclipse-plugin + 2.3 + true + diff --git a/maven-embedder/src/test/error-reporting-projects/aggregate-mojo-failure/plugin/pom.xml b/maven-embedder/src/test/error-reporting-projects/aggregate-mojo-failure/plugin/pom.xml index 6c99348b29..a0dfb082f9 100644 --- a/maven-embedder/src/test/error-reporting-projects/aggregate-mojo-failure/plugin/pom.xml +++ b/maven-embedder/src/test/error-reporting-projects/aggregate-mojo-failure/plugin/pom.xml @@ -17,7 +17,7 @@ maven-surefire-plugin - 2.3.1 + 2.2 maven-deploy-plugin diff --git a/maven-embedder/src/test/error-reporting-projects/bad-build-plan/plugin/pom.xml b/maven-embedder/src/test/error-reporting-projects/bad-build-plan/plugin/pom.xml index 7eac7cceb0..0a0c0d7774 100644 --- a/maven-embedder/src/test/error-reporting-projects/bad-build-plan/plugin/pom.xml +++ b/maven-embedder/src/test/error-reporting-projects/bad-build-plan/plugin/pom.xml @@ -17,7 +17,7 @@ maven-surefire-plugin - 2.3.1 + 2.2 maven-deploy-plugin diff --git a/maven-embedder/src/test/error-reporting-projects/bad-ext-plugin-dep-ver/local-repo/org/apache/maven/errortest/bad-ext-plugin-dep-ver-maven-plugin/1/bad-ext-plugin-dep-ver-maven-plugin-1.pom b/maven-embedder/src/test/error-reporting-projects/bad-ext-plugin-dep-ver/local-repo/org/apache/maven/errortest/bad-ext-plugin-dep-ver-maven-plugin/1/bad-ext-plugin-dep-ver-maven-plugin-1.pom index 747d10bb91..3c7f3f3fb2 100644 --- a/maven-embedder/src/test/error-reporting-projects/bad-ext-plugin-dep-ver/local-repo/org/apache/maven/errortest/bad-ext-plugin-dep-ver-maven-plugin/1/bad-ext-plugin-dep-ver-maven-plugin-1.pom +++ b/maven-embedder/src/test/error-reporting-projects/bad-ext-plugin-dep-ver/local-repo/org/apache/maven/errortest/bad-ext-plugin-dep-ver-maven-plugin/1/bad-ext-plugin-dep-ver-maven-plugin-1.pom @@ -23,7 +23,7 @@ maven-surefire-plugin - 2.3.1 + 2.2 maven-deploy-plugin diff --git a/maven-embedder/src/test/error-reporting-projects/bad-ext-plugin-dep-ver/plugin/pom.xml b/maven-embedder/src/test/error-reporting-projects/bad-ext-plugin-dep-ver/plugin/pom.xml index fa10957791..9139736b91 100644 --- a/maven-embedder/src/test/error-reporting-projects/bad-ext-plugin-dep-ver/plugin/pom.xml +++ b/maven-embedder/src/test/error-reporting-projects/bad-ext-plugin-dep-ver/plugin/pom.xml @@ -25,7 +25,7 @@ maven-surefire-plugin - 2.3.1 + 2.2 maven-deploy-plugin diff --git a/maven-embedder/src/test/error-reporting-projects/bad-ext-plugin-maven-ver/local-repo/org/apache/maven/errortest/bad-ext-plugin-maven-ver-maven-plugin/1/bad-ext-plugin-maven-ver-maven-plugin-1.pom b/maven-embedder/src/test/error-reporting-projects/bad-ext-plugin-maven-ver/local-repo/org/apache/maven/errortest/bad-ext-plugin-maven-ver-maven-plugin/1/bad-ext-plugin-maven-ver-maven-plugin-1.pom index cc10930cfe..ffe6141e4a 100644 --- a/maven-embedder/src/test/error-reporting-projects/bad-ext-plugin-maven-ver/local-repo/org/apache/maven/errortest/bad-ext-plugin-maven-ver-maven-plugin/1/bad-ext-plugin-maven-ver-maven-plugin-1.pom +++ b/maven-embedder/src/test/error-reporting-projects/bad-ext-plugin-maven-ver/local-repo/org/apache/maven/errortest/bad-ext-plugin-maven-ver-maven-plugin/1/bad-ext-plugin-maven-ver-maven-plugin-1.pom @@ -22,7 +22,7 @@ maven-surefire-plugin - 2.3.1 + 2.2 maven-deploy-plugin diff --git a/maven-embedder/src/test/error-reporting-projects/bad-ext-plugin-maven-ver/plugin/pom.xml b/maven-embedder/src/test/error-reporting-projects/bad-ext-plugin-maven-ver/plugin/pom.xml index fa10957791..9139736b91 100644 --- a/maven-embedder/src/test/error-reporting-projects/bad-ext-plugin-maven-ver/plugin/pom.xml +++ b/maven-embedder/src/test/error-reporting-projects/bad-ext-plugin-maven-ver/plugin/pom.xml @@ -25,7 +25,7 @@ maven-surefire-plugin - 2.3.1 + 2.2 maven-deploy-plugin diff --git a/maven-embedder/src/test/error-reporting-projects/config-rdonly-mojo-param/plugin/pom.xml b/maven-embedder/src/test/error-reporting-projects/config-rdonly-mojo-param/plugin/pom.xml index 71fccf8560..73a965832a 100644 --- a/maven-embedder/src/test/error-reporting-projects/config-rdonly-mojo-param/plugin/pom.xml +++ b/maven-embedder/src/test/error-reporting-projects/config-rdonly-mojo-param/plugin/pom.xml @@ -17,7 +17,7 @@ maven-surefire-plugin - 2.3.1 + 2.2 maven-deploy-plugin diff --git a/maven-embedder/src/test/error-reporting-projects/duplicated-attachments/plugin/pom.xml b/maven-embedder/src/test/error-reporting-projects/duplicated-attachments/plugin/pom.xml index 144ec91c21..21222df6e8 100644 --- a/maven-embedder/src/test/error-reporting-projects/duplicated-attachments/plugin/pom.xml +++ b/maven-embedder/src/test/error-reporting-projects/duplicated-attachments/plugin/pom.xml @@ -22,7 +22,7 @@ maven-surefire-plugin - 2.3.1 + 2.2 maven-deploy-plugin diff --git a/maven-embedder/src/test/error-reporting-projects/err-loading-plugin/local-repo/org/apache/maven/errortest/err-loading-plugin-maven-plugin/1/err-loading-plugin-maven-plugin-1.pom b/maven-embedder/src/test/error-reporting-projects/err-loading-plugin/local-repo/org/apache/maven/errortest/err-loading-plugin-maven-plugin/1/err-loading-plugin-maven-plugin-1.pom index b97f1b2012..7ac049095d 100644 --- a/maven-embedder/src/test/error-reporting-projects/err-loading-plugin/local-repo/org/apache/maven/errortest/err-loading-plugin-maven-plugin/1/err-loading-plugin-maven-plugin-1.pom +++ b/maven-embedder/src/test/error-reporting-projects/err-loading-plugin/local-repo/org/apache/maven/errortest/err-loading-plugin-maven-plugin/1/err-loading-plugin-maven-plugin-1.pom @@ -23,7 +23,7 @@ maven-surefire-plugin - 2.3.1 + 2.2 maven-deploy-plugin diff --git a/maven-embedder/src/test/error-reporting-projects/err-resolving-ext-plugin/local-repo/org/apache/maven/errortest/err-resolving-ext-plugin-maven-plugin/1/err-resolving-ext-plugin-maven-plugin-1.pom b/maven-embedder/src/test/error-reporting-projects/err-resolving-ext-plugin/local-repo/org/apache/maven/errortest/err-resolving-ext-plugin-maven-plugin/1/err-resolving-ext-plugin-maven-plugin-1.pom index bc11bd4994..e520ccc9ac 100644 --- a/maven-embedder/src/test/error-reporting-projects/err-resolving-ext-plugin/local-repo/org/apache/maven/errortest/err-resolving-ext-plugin-maven-plugin/1/err-resolving-ext-plugin-maven-plugin-1.pom +++ b/maven-embedder/src/test/error-reporting-projects/err-resolving-ext-plugin/local-repo/org/apache/maven/errortest/err-resolving-ext-plugin-maven-plugin/1/err-resolving-ext-plugin-maven-plugin-1.pom @@ -28,7 +28,7 @@ maven-surefire-plugin - 2.3.1 + 2.2 maven-deploy-plugin diff --git a/maven-embedder/src/test/error-reporting-projects/err-resolving-project-dep/local-repo/org/apache/maven/errortest/dep/1/dep-1.pom b/maven-embedder/src/test/error-reporting-projects/err-resolving-project-dep/project/local-repo/org/apache/maven/errortest/dep/1/dep-1.pom similarity index 100% rename from maven-embedder/src/test/error-reporting-projects/err-resolving-project-dep/local-repo/org/apache/maven/errortest/dep/1/dep-1.pom rename to maven-embedder/src/test/error-reporting-projects/err-resolving-project-dep/project/local-repo/org/apache/maven/errortest/dep/1/dep-1.pom diff --git a/maven-embedder/src/test/error-reporting-projects/err-resolving-project-dep/project/pom.xml b/maven-embedder/src/test/error-reporting-projects/err-resolving-project-dep/project/pom.xml index 7eb729f53f..2a142afe14 100644 --- a/maven-embedder/src/test/error-reporting-projects/err-resolving-project-dep/project/pom.xml +++ b/maven-embedder/src/test/error-reporting-projects/err-resolving-project-dep/project/pom.xml @@ -18,4 +18,10 @@ + + + repo + file://localhost/${basedir}/local-repo + + diff --git a/maven-embedder/src/test/error-reporting-projects/ext-plugin-artifact-missing/local-repo/org/apache/maven/errortest/ext-plugin-artifact-missing-maven-plugin/1/ext-plugin-artifact-missing-maven-plugin-1.pom b/maven-embedder/src/test/error-reporting-projects/ext-plugin-artifact-missing/local-repo/org/apache/maven/errortest/ext-plugin-artifact-missing-maven-plugin/1/ext-plugin-artifact-missing-maven-plugin-1.pom index 50b97dfed3..b7f7d52993 100644 --- a/maven-embedder/src/test/error-reporting-projects/ext-plugin-artifact-missing/local-repo/org/apache/maven/errortest/ext-plugin-artifact-missing-maven-plugin/1/ext-plugin-artifact-missing-maven-plugin-1.pom +++ b/maven-embedder/src/test/error-reporting-projects/ext-plugin-artifact-missing/local-repo/org/apache/maven/errortest/ext-plugin-artifact-missing-maven-plugin/1/ext-plugin-artifact-missing-maven-plugin-1.pom @@ -23,7 +23,7 @@ maven-surefire-plugin - 2.3.1 + 2.2 maven-deploy-plugin diff --git a/maven-embedder/src/test/error-reporting-projects/ext-plugin-realm-error/plugin/pom.xml b/maven-embedder/src/test/error-reporting-projects/ext-plugin-realm-error/plugin/pom.xml index 963b785da5..e8e5218cc4 100644 --- a/maven-embedder/src/test/error-reporting-projects/ext-plugin-realm-error/plugin/pom.xml +++ b/maven-embedder/src/test/error-reporting-projects/ext-plugin-realm-error/plugin/pom.xml @@ -17,7 +17,7 @@ maven-surefire-plugin - 2.3.1 + 2.2 maven-deploy-plugin @@ -46,4 +46,4 @@ - \ No newline at end of file + diff --git a/maven-embedder/src/test/error-reporting-projects/ext-plugin-version-err/local-repo/org/apache/maven/errortest/ext-plugin-version-err-maven-plugin/1/ext-plugin-version-err-maven-plugin-1.pom b/maven-embedder/src/test/error-reporting-projects/ext-plugin-version-err/local-repo/org/apache/maven/errortest/ext-plugin-version-err-maven-plugin/1/ext-plugin-version-err-maven-plugin-1.pom index c214b730f0..5aab61d99c 100644 --- a/maven-embedder/src/test/error-reporting-projects/ext-plugin-version-err/local-repo/org/apache/maven/errortest/ext-plugin-version-err-maven-plugin/1/ext-plugin-version-err-maven-plugin-1.pom +++ b/maven-embedder/src/test/error-reporting-projects/ext-plugin-version-err/local-repo/org/apache/maven/errortest/ext-plugin-version-err-maven-plugin/1/ext-plugin-version-err-maven-plugin-1.pom @@ -18,7 +18,7 @@ maven-surefire-plugin - 2.3.1 + 2.2 maven-deploy-plugin diff --git a/maven-embedder/src/test/error-reporting-projects/ext-plugin-version-err/plugin/pom.xml b/maven-embedder/src/test/error-reporting-projects/ext-plugin-version-err/plugin/pom.xml index fa10957791..9139736b91 100644 --- a/maven-embedder/src/test/error-reporting-projects/ext-plugin-version-err/plugin/pom.xml +++ b/maven-embedder/src/test/error-reporting-projects/ext-plugin-version-err/plugin/pom.xml @@ -25,7 +25,7 @@ maven-surefire-plugin - 2.3.1 + 2.2 maven-deploy-plugin diff --git a/maven-embedder/src/test/error-reporting-projects/ext-realm-error/ext/pom.xml b/maven-embedder/src/test/error-reporting-projects/ext-realm-error/ext/pom.xml index 3dc160f386..40b95f0c50 100644 --- a/maven-embedder/src/test/error-reporting-projects/ext-realm-error/ext/pom.xml +++ b/maven-embedder/src/test/error-reporting-projects/ext-realm-error/ext/pom.xml @@ -10,7 +10,7 @@ maven-surefire-plugin - 2.3.1 + 2.2 maven-deploy-plugin diff --git a/maven-embedder/src/test/error-reporting-projects/interp-from-project/local-repo/org/test/bad-pom/1/bad-pom-1.pom b/maven-embedder/src/test/error-reporting-projects/interp-from-project/project/local-repo/org/test/bad-pom/1/bad-pom-1.pom similarity index 100% rename from maven-embedder/src/test/error-reporting-projects/interp-from-project/local-repo/org/test/bad-pom/1/bad-pom-1.pom rename to maven-embedder/src/test/error-reporting-projects/interp-from-project/project/local-repo/org/test/bad-pom/1/bad-pom-1.pom diff --git a/maven-embedder/src/test/error-reporting-projects/interp-from-project/project/pom.xml b/maven-embedder/src/test/error-reporting-projects/interp-from-project/project/pom.xml index 4c637bdb28..0fe11709be 100644 --- a/maven-embedder/src/test/error-reporting-projects/interp-from-project/project/pom.xml +++ b/maven-embedder/src/test/error-reporting-projects/interp-from-project/project/pom.xml @@ -13,4 +13,10 @@ + + + repo + file://localhost/${basedir}/local-repo + + diff --git a/maven-embedder/src/test/error-reporting-projects/missing-direct-invoke-mojo/plugin/pom.xml b/maven-embedder/src/test/error-reporting-projects/missing-direct-invoke-mojo/plugin/pom.xml index 1e2a6daf8a..5895c2a960 100644 --- a/maven-embedder/src/test/error-reporting-projects/missing-direct-invoke-mojo/plugin/pom.xml +++ b/maven-embedder/src/test/error-reporting-projects/missing-direct-invoke-mojo/plugin/pom.xml @@ -17,7 +17,7 @@ maven-surefire-plugin - 2.3.1 + 2.2 maven-deploy-plugin diff --git a/maven-embedder/src/test/error-reporting-projects/missing-req-mojo-param/plugin/pom.xml b/maven-embedder/src/test/error-reporting-projects/missing-req-mojo-param/plugin/pom.xml index 442f7e68aa..6e53240d2b 100644 --- a/maven-embedder/src/test/error-reporting-projects/missing-req-mojo-param/plugin/pom.xml +++ b/maven-embedder/src/test/error-reporting-projects/missing-req-mojo-param/plugin/pom.xml @@ -17,7 +17,7 @@ maven-surefire-plugin - 2.3.1 + 2.2 maven-deploy-plugin diff --git a/maven-embedder/src/test/error-reporting-projects/mojo-config-error/plugin/pom.xml b/maven-embedder/src/test/error-reporting-projects/mojo-config-error/plugin/pom.xml index a2151a10c2..0b52969b46 100644 --- a/maven-embedder/src/test/error-reporting-projects/mojo-config-error/plugin/pom.xml +++ b/maven-embedder/src/test/error-reporting-projects/mojo-config-error/plugin/pom.xml @@ -17,7 +17,7 @@ maven-surefire-plugin - 2.3.1 + 2.2 maven-deploy-plugin diff --git a/maven-embedder/src/test/error-reporting-projects/mojo-exec-err/plugin/pom.xml b/maven-embedder/src/test/error-reporting-projects/mojo-exec-err/plugin/pom.xml index 30f277559c..3347d3c74d 100644 --- a/maven-embedder/src/test/error-reporting-projects/mojo-exec-err/plugin/pom.xml +++ b/maven-embedder/src/test/error-reporting-projects/mojo-exec-err/plugin/pom.xml @@ -17,7 +17,7 @@ maven-surefire-plugin - 2.3.1 + 2.2 maven-deploy-plugin diff --git a/maven-embedder/src/test/error-reporting-projects/mojo-lookup-err/plugin/pom.xml b/maven-embedder/src/test/error-reporting-projects/mojo-lookup-err/plugin/pom.xml index 41e5386d3d..66adaf0061 100644 --- a/maven-embedder/src/test/error-reporting-projects/mojo-lookup-err/plugin/pom.xml +++ b/maven-embedder/src/test/error-reporting-projects/mojo-lookup-err/plugin/pom.xml @@ -22,7 +22,7 @@ maven-surefire-plugin - 2.3.1 + 2.2 maven-deploy-plugin diff --git a/maven-embedder/src/test/error-reporting-projects/profile-activator-lookup-err/ext/pom.xml b/maven-embedder/src/test/error-reporting-projects/profile-activator-lookup-err/ext/pom.xml index a6bb1579f6..e802e70379 100644 --- a/maven-embedder/src/test/error-reporting-projects/profile-activator-lookup-err/ext/pom.xml +++ b/maven-embedder/src/test/error-reporting-projects/profile-activator-lookup-err/ext/pom.xml @@ -10,7 +10,7 @@ maven-surefire-plugin - 2.3.1 + 2.2 maven-deploy-plugin diff --git a/maven-embedder/src/test/java/org/apache/maven/embedder/AbstractEmbedderTestCase.java b/maven-embedder/src/test/java/org/apache/maven/embedder/AbstractEmbedderTestCase.java index b04186a6db..ec51e066cf 100644 --- a/maven-embedder/src/test/java/org/apache/maven/embedder/AbstractEmbedderTestCase.java +++ b/maven-embedder/src/test/java/org/apache/maven/embedder/AbstractEmbedderTestCase.java @@ -19,6 +19,8 @@ package org.apache.maven.embedder; * under the License. */ +import java.io.File; + import org.codehaus.plexus.PlexusTestCase; public abstract class AbstractEmbedderTestCase diff --git a/maven-embedder/src/test/java/org/apache/maven/embedder/MavenEmbedderProjectWithExtensionReadingTest.java b/maven-embedder/src/test/java/org/apache/maven/embedder/MavenEmbedderProjectWithExtensionReadingTest.java index 8cbf3b3879..a9b5e2e904 100644 --- a/maven-embedder/src/test/java/org/apache/maven/embedder/MavenEmbedderProjectWithExtensionReadingTest.java +++ b/maven-embedder/src/test/java/org/apache/maven/embedder/MavenEmbedderProjectWithExtensionReadingTest.java @@ -1,5 +1,24 @@ package org.apache.maven.embedder; +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + import org.apache.maven.artifact.handler.ArtifactHandler; import org.apache.maven.execution.DefaultMavenExecutionRequest; import org.apache.maven.execution.MavenExecutionRequest; diff --git a/maven-embedder/src/test/java/org/apache/maven/embedder/execution/EmbedderUsingEclipsePluginTest.java b/maven-embedder/src/test/java/org/apache/maven/embedder/execution/EmbedderUsingEclipsePluginTest.java index 59ec2f6e13..fd57a73244 100644 --- a/maven-embedder/src/test/java/org/apache/maven/embedder/execution/EmbedderUsingEclipsePluginTest.java +++ b/maven-embedder/src/test/java/org/apache/maven/embedder/execution/EmbedderUsingEclipsePluginTest.java @@ -33,7 +33,7 @@ public class EmbedderUsingEclipsePluginTest public void testRunningEclipsePlugin() throws Exception { - File basedir = runWithProject( "eclipse:eclipse" ); + File basedir = runWithProject( "org.apache.maven.plugins:maven-eclipse-plugin:2.3:eclipse" ); assertFileExists( new File( basedir, ".classpath" ) ); diff --git a/maven-embedder/src/test/java/org/apache/maven/embedder/execution/EmbedderUsingScmPluginTest.java b/maven-embedder/src/test/java/org/apache/maven/embedder/execution/EmbedderUsingScmPluginTest.java index a3ef4bd753..fabf2e3645 100644 --- a/maven-embedder/src/test/java/org/apache/maven/embedder/execution/EmbedderUsingScmPluginTest.java +++ b/maven-embedder/src/test/java/org/apache/maven/embedder/execution/EmbedderUsingScmPluginTest.java @@ -46,7 +46,7 @@ public class EmbedderUsingScmPluginTest p.setProperty( "connectionUrl", "scm:svn:http://svn.apache.org/repos/asf/maven/components/trunk/maven-embedder" ); - File basedir = runWithProject( "scm:diff", p ); + File basedir = runWithProject( "org.apache.maven.plugins:maven-scm-plugin:1.0:diff", p ); } } } 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 dac1447ff8..026dec016b 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 @@ -1,10 +1,34 @@ package org.apache.maven.error; -import org.apache.commons.httpclient.HttpClient; -import org.apache.commons.httpclient.HttpConnectionManager; -import org.apache.commons.httpclient.HttpException; -import org.apache.commons.httpclient.HttpStatus; -import org.apache.commons.httpclient.methods.GetMethod; +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.File; +import java.io.IOException; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; + +import junit.framework.TestCase; + import org.apache.maven.artifact.resolver.MultipleArtifactsNotFoundException; import org.apache.maven.embedder.Configuration; import org.apache.maven.embedder.DefaultConfiguration; @@ -14,30 +38,15 @@ import org.apache.maven.errors.CoreErrorReporter; import org.apache.maven.execution.DefaultMavenExecutionRequest; import org.apache.maven.execution.MavenExecutionRequest; 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.util.FileUtils; import org.codehaus.plexus.util.xml.pull.XmlPullParserException; import org.easymock.MockControl; -import java.io.File; -import java.io.IOException; -import java.io.PrintWriter; -import java.io.StringReader; -import java.io.StringWriter; -import java.util.Arrays; -import java.util.Collections; -import java.util.Iterator; - -import junit.framework.TestCase; - public class ErrorReporterPointcutTest extends TestCase { - - private static final int ONE_SECOND = 1000; - private MockControl reporterCtl; private CoreErrorReporter reporter; @@ -46,10 +55,6 @@ public class ErrorReporterPointcutTest private String basedir; - private static boolean isOffline; - - private static boolean offlineIsSet = false; - public void setUp() throws Exception { @@ -84,74 +89,6 @@ public class ErrorReporterPointcutTest maven.stop(); } - private boolean checkOnline() - { - if ( !offlineIsSet ) - { - HttpClient client = new HttpClient(); - GetMethod get = new GetMethod( - "http://repo1.maven.org/maven2/org/apache/maven/maven-core/2.0/maven-core-2.0.pom" ); - - HttpConnectionManager mgr = client.getHttpConnectionManager(); - mgr.getParams().setConnectionTimeout( 3 * ONE_SECOND ); - - try - { - int result = client.executeMethod( get ); - if ( result == HttpStatus.SC_OK ) - { - String body = get.getResponseBodyAsString(); - new MavenXpp3Reader().read( new StringReader( body ) ); - isOffline = false; - } - else - { - System.out.println( "Got HTTP status of: " + result ); - System.out.println( "System is offline" ); - isOffline = true; - } - } - catch ( HttpException e ) - { - System.out.println( "Got error: " + e.getMessage() ); - System.out.println( "System is offline" ); - isOffline = true; - } - catch ( IOException e ) - { - System.out.println( "Got error: " + e.getMessage() ); - System.out.println( "System is offline" ); - isOffline = true; - } - catch ( XmlPullParserException e ) - { - System.out.println( "Got error: " + e.getMessage() ); - System.out.println( "System is offline" ); - isOffline = true; - } - finally - { - offlineIsSet = true; - } - } - - if ( isOffline ) - { - String method = getTestMethodName(); - System.out.println( "Test: " + method - + " requires an access to the Maven central repository. SKIPPING." ); - return false; - } - - return true; - } - - private String getTestMethodName() - { - String method = new Throwable().getStackTrace()[2].getMethodName(); - return method; - } - private File prepareProjectDir( String basename ) throws IOException { @@ -186,13 +123,8 @@ public class ErrorReporterPointcutTest private void buildTestAccessory( File basedir ) { - MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( basedir ) - .setShowErrors( true ) - .setErrorReporter( new DummyCoreErrorReporter() ) - .setGoals( Arrays.asList( new String[] { - "clean", - "install" - } ) ); + MavenExecutionRequest request = + createRequest( basedir, new DummyCoreErrorReporter() ).setGoals( Arrays.asList( "clean", "install" ) ); MavenExecutionResult result = maven.execute( request ); @@ -202,6 +134,16 @@ public class ErrorReporterPointcutTest } } + private MavenExecutionRequest createRequest( File basedir, CoreErrorReporter reporter ) + { + return createRequest( reporter ).setBaseDirectory( basedir ); + } + + private MavenExecutionRequest createRequest( CoreErrorReporter reporter ) + { + return new DefaultMavenExecutionRequest().setShowErrors( true ).setErrorReporter( reporter ); + } + private void reportExceptions( MavenExecutionResult result, File basedir ) { @@ -221,9 +163,8 @@ public class ErrorReporterPointcutTest writer.write( basedir.getPath() ); writer.write( "\nEncountered the following errors:" ); - for ( Iterator it = result.getExceptions().iterator(); it.hasNext(); ) + for ( Throwable error : (Collection) result.getExceptions() ) { - Throwable error = (Throwable) it.next(); writer.write( "\n\n" ); error.printStackTrace( pWriter ); } @@ -256,13 +197,9 @@ public class ErrorReporterPointcutTest reporterCtl.replay(); - MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( project ) - .setLocalRepositoryPath( localRepo ) - .setShowErrors( true ) - .setErrorReporter( reporter ) - .setGoals( Arrays.asList( new String[] { - "initialize" - } ) ); + MavenExecutionRequest request = + createRequest( project, reporter ).setLocalRepositoryPath( localRepo ).setGoals( + Arrays.asList( "initialize" ) ); maven.execute( request ); @@ -272,11 +209,6 @@ public class ErrorReporterPointcutTest public void testReportAggregatedMojoFailureException() throws IOException { - if ( !checkOnline() ) - { - return; - } - File projectDir = prepareProjectDir( "aggregate-mojo-failure"); buildTestAccessory( new File( projectDir, "plugin" ) ); @@ -289,12 +221,9 @@ public class ErrorReporterPointcutTest reporterCtl.replay(); - MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( basedir ) - .setShowErrors( true ) - .setErrorReporter( reporter ) - .setGoals( Arrays.asList( new String[] { - "org.apache.maven.errortest:aggregate-mojo-failure-maven-plugin:1:test" - } ) ); + MavenExecutionRequest request = + createRequest( basedir, reporter ).setGoals( + Arrays.asList( "org.apache.maven.errortest:aggregate-mojo-failure-maven-plugin:1:test" ) ); maven.execute( request ); @@ -304,11 +233,6 @@ public class ErrorReporterPointcutTest public void testReportAttemptToOverrideUneditableMojoParameter() throws IOException { - if ( !checkOnline() ) - { - return; - } - File projectDir = prepareProjectDir( "config-rdonly-mojo-param"); buildTestAccessory( new File( projectDir, "plugin" ) ); @@ -328,12 +252,7 @@ public class ErrorReporterPointcutTest reporterCtl.replay(); - MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( basedir ) - .setShowErrors( true ) - .setErrorReporter( reporter ) - .setGoals( Arrays.asList( new String[] { - "initialize" - } ) ); + MavenExecutionRequest request = createRequest( basedir, reporter ).setGoals( Arrays.asList( "initialize" ) ); maven.execute( request ); @@ -343,11 +262,6 @@ public class ErrorReporterPointcutTest public void testReportErrorApplyingMojoConfiguration() throws IOException { - if ( !checkOnline() ) - { - return; - } - File projectDir = prepareProjectDir( "mojo-config-error"); File plugin = new File( projectDir, "plugin" ); File project = new File( projectDir, "project" ); @@ -360,12 +274,9 @@ public class ErrorReporterPointcutTest reporterCtl.replay(); - MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( project ) - .setShowErrors( true ) - .setErrorReporter( reporter ) - .setGoals( Arrays.asList( new String[] { - "org.apache.maven.errortest:mojo-config-error-maven-plugin:1:test" - } ) ); + MavenExecutionRequest request = + createRequest( project, reporter ).setGoals( + Arrays.asList( "org.apache.maven.errortest:mojo-config-error-maven-plugin:1:test" ) ); maven.execute( request ); @@ -391,12 +302,7 @@ public class ErrorReporterPointcutTest reporterCtl.replay(); - MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( project ) - .setShowErrors( true ) - .setErrorReporter( reporter ) - .setGoals( Arrays.asList( new String[] { - "initialize" - } ) ); + MavenExecutionRequest request = createRequest( project, reporter ).setGoals( Arrays.asList( "initialize" ) ); maven.execute( request ); @@ -406,11 +312,6 @@ public class ErrorReporterPointcutTest public void testReportErrorFormulatingBuildPlan() throws IOException { - if ( !checkOnline() ) - { - return; - } - File projectDir = prepareProjectDir( "bad-build-plan" ); buildTestAccessory( new File( projectDir, "plugin" ) ); @@ -423,12 +324,9 @@ public class ErrorReporterPointcutTest reporterCtl.replay(); - MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( basedir ) - .setShowErrors( true ) - .setErrorReporter( reporter ) - .setGoals( Arrays.asList( new String[] { - "org.apache.maven.errortest:bad-build-plan-maven-plugin:1:test" - } ) ); + MavenExecutionRequest request = + createRequest( basedir, reporter ).setGoals( + Arrays.asList( "org.apache.maven.errortest:bad-build-plan-maven-plugin:1:test" ) ); maven.execute( request ); @@ -438,13 +336,7 @@ public class ErrorReporterPointcutTest public void testReportErrorInterpolatingModel_UsingProjectInstance() throws IOException { - if ( !checkOnline() ) - { - return; - } - File projectDir = prepareProjectDir( "interp-from-project"); - File localRepo = new File( projectDir, "local-repo" ); File project = new File( projectDir, "project" ); reporter.reportErrorInterpolatingModel( null, null, null ); @@ -453,13 +345,7 @@ public class ErrorReporterPointcutTest reporterCtl.replay(); - MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( project ) - .setLocalRepositoryPath( localRepo ) - .setShowErrors( true ) - .setErrorReporter( reporter ) - .setGoals( Arrays.asList( new String[] { - "compile" - } ) ); + MavenExecutionRequest request = createRequest( project, reporter ).setGoals( Arrays.asList( "compile" ) ); maven.execute( request ); @@ -483,13 +369,9 @@ public class ErrorReporterPointcutTest reporterCtl.replay(); - MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( project ) - .setSettings( settings ) - .setShowErrors( true ) - .setErrorReporter( reporter ) - .setGoals( Arrays.asList( new String[] { - "org.apache.maven.errortest:err-loading-plugin-maven-plugin:1:test" - } ) ); + MavenExecutionRequest request = + createRequest( project, reporter ).setSettings( settings ).setGoals( + Arrays.asList( "org.apache.maven.errortest:err-loading-plugin-maven-plugin:1:test" ) ); maven.execute( request ); @@ -499,11 +381,6 @@ public class ErrorReporterPointcutTest public void testReportErrorManagingRealmForExtension() throws IOException { - if ( !checkOnline() ) - { - return; - } - File projectDir = prepareProjectDir( "ext-realm-error" ); buildTestAccessory( new File( projectDir, "ext" ) ); @@ -516,12 +393,7 @@ public class ErrorReporterPointcutTest reporterCtl.replay(); - MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( project ) - .setShowErrors( true ) - .setErrorReporter( reporter ) - .setGoals( Arrays.asList( new String[] { - "initialize" - } ) ); + MavenExecutionRequest request = createRequest( project, reporter ).setGoals( Arrays.asList( "initialize" ) ); maven.execute( request ); @@ -541,13 +413,9 @@ public class ErrorReporterPointcutTest reporterCtl.replay(); - MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( project ) - .setLocalRepositoryPath( localRepo ) - .setShowErrors( true ) - .setErrorReporter( reporter ) - .setGoals( Arrays.asList( new String[] { - "initialize" - } ) ); + MavenExecutionRequest request = + createRequest( project, reporter ).setLocalRepositoryPath( localRepo ).setGoals( + Arrays.asList( "initialize" ) ); maven.execute( request ); @@ -567,13 +435,9 @@ public class ErrorReporterPointcutTest reporterCtl.replay(); - MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( project ) - .setShowErrors( true ) - .setLocalRepositoryPath( localRepo ) - .setErrorReporter( reporter ) - .setGoals( Arrays.asList( new String[] { - "initialize" - } ) ); + MavenExecutionRequest request = + createRequest( project, reporter ).setLocalRepositoryPath( localRepo ).setGoals( + Arrays.asList( "initialize" ) ); maven.execute( request ); @@ -597,13 +461,8 @@ public class ErrorReporterPointcutTest reporterCtl.replay(); - MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( project ) - .setShowErrors( true ) - .setSettings( settings ) - .setErrorReporter( reporter ) - .setGoals( Arrays.asList( new String[] { - "initialize" - } ) ); + MavenExecutionRequest request = + createRequest( project, reporter ).setSettings( settings ).setGoals( Arrays.asList( "initialize" ) ); maven.execute( request ); @@ -629,13 +488,9 @@ public class ErrorReporterPointcutTest reporterCtl.replay(); - MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( project ) - .setShowErrors( true ) - .setLocalRepositoryPath( localRepo ) - .setErrorReporter( reporter ) - .setGoals( Arrays.asList( new String[] { - "initialize" - } ) ); + MavenExecutionRequest request = + createRequest( project, reporter ).setLocalRepositoryPath( localRepo ).setGoals( + Arrays.asList( "initialize" ) ); maven.execute( request ); @@ -660,13 +515,9 @@ public class ErrorReporterPointcutTest reporterCtl.replay(); - MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( project ) - .setShowErrors( true ) - .setLocalRepositoryPath( localRepo ) - .setErrorReporter( reporter ) - .setGoals( Arrays.asList( new String[] { - "initialize" - } ) ); + MavenExecutionRequest request = + createRequest( project, reporter ).setLocalRepositoryPath( localRepo ).setGoals( + Arrays.asList( "initialize" ) ); maven.execute( request ); @@ -684,12 +535,7 @@ public class ErrorReporterPointcutTest reporterCtl.replay(); - MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( projectDir ) - .setShowErrors( true ) - .setErrorReporter( reporter ) - .setGoals( Arrays.asList( new String[] { - "initialize" - } ) ); + MavenExecutionRequest request = createRequest( projectDir, reporter ).setGoals( Arrays.asList( "initialize" ) ); maven.execute( request ); @@ -707,12 +553,9 @@ public class ErrorReporterPointcutTest reporterCtl.replay(); - MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( projectDir ) - .setShowErrors( true ) - .setErrorReporter( reporter ) - .setGoals( Arrays.asList( new String[] { - "compiler:compile" - } ) ); + MavenExecutionRequest request = + createRequest( projectDir, reporter ).setGoals( + Arrays.asList( "org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile" ) ); maven.execute( request ); @@ -735,13 +578,8 @@ public class ErrorReporterPointcutTest reporterCtl.replay(); - MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( projectDir ) - .setShowErrors( true ) - .setSettings( settings ) - .setErrorReporter( reporter ) - .setGoals( Arrays.asList( new String[] { - "invalid:test" - } ) ); + MavenExecutionRequest request = + createRequest( projectDir, reporter ).setSettings( settings ).setGoals( Arrays.asList( "invalid:test" ) ); maven.execute( request ); @@ -756,11 +594,8 @@ public class ErrorReporterPointcutTest reporterCtl.replay(); - MavenExecutionRequest request = new DefaultMavenExecutionRequest().setShowErrors( true ) - .setErrorReporter( reporter ) - .setGoals( Arrays.asList( new String[] { - "name:of:invalid:direct:mojo:for:test" - } ) ); + MavenExecutionRequest request = + createRequest( reporter ).setGoals( Arrays.asList( "name:of:invalid:direct:mojo:for:test" ) ); maven.execute( request ); @@ -770,11 +605,6 @@ public class ErrorReporterPointcutTest public void testReportMissingRequiredMojoParameter() throws IOException { - if ( !checkOnline() ) - { - return; - } - File projectDir = prepareProjectDir( "missing-req-mojo-param" ); buildTestAccessory( new File( projectDir, "plugin" ) ); @@ -787,12 +617,9 @@ public class ErrorReporterPointcutTest reporterCtl.replay(); - MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( basedir ) - .setShowErrors( true ) - .setErrorReporter( reporter ) - .setGoals( Arrays.asList( new String[] { - "org.apache.maven.errortest:missing-req-mojo-param-maven-plugin:1:test" - } ) ); + MavenExecutionRequest request = + createRequest( basedir, reporter ).setGoals( + Arrays.asList( "org.apache.maven.errortest:missing-req-mojo-param-maven-plugin:1:test" ) ); maven.execute( request ); @@ -802,11 +629,6 @@ public class ErrorReporterPointcutTest public void testReportMojoExecutionException() throws IOException { - if ( !checkOnline() ) - { - return; - } - File projectDir = prepareProjectDir( "mojo-exec-err" ); buildTestAccessory( new File( projectDir, "plugin" ) ); @@ -819,12 +641,9 @@ public class ErrorReporterPointcutTest reporterCtl.replay(); - MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( basedir ) - .setShowErrors( true ) - .setErrorReporter( reporter ) - .setGoals( Arrays.asList( new String[] { - "org.apache.maven.errortest:mojo-exec-err-maven-plugin:1:test" - } ) ); + MavenExecutionRequest request = + createRequest( basedir, reporter ).setGoals( + Arrays.asList( "org.apache.maven.errortest:mojo-exec-err-maven-plugin:1:test" ) ); maven.execute( request ); @@ -834,11 +653,6 @@ public class ErrorReporterPointcutTest public void testReportMojoLookupError() throws IOException { - if ( !checkOnline() ) - { - return; - } - File projectDir = prepareProjectDir( "mojo-lookup-err" ); buildTestAccessory( new File( projectDir, "plugin" ) ); @@ -849,12 +663,9 @@ public class ErrorReporterPointcutTest reporterCtl.replay(); - MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( projectDir ) - .setShowErrors( true ) - .setErrorReporter( reporter ) - .setGoals( Arrays.asList( new String[] { - "org.apache.maven.errortest:mojo-lookup-err-maven-plugin:1:test" - } ) ); + MavenExecutionRequest request = + createRequest( projectDir, reporter ).setGoals( + Arrays.asList( "org.apache.maven.errortest:mojo-lookup-err-maven-plugin:1:test" ) ); maven.execute( request ); @@ -869,9 +680,7 @@ public class ErrorReporterPointcutTest reporterCtl.replay(); - MavenExecutionRequest request = new DefaultMavenExecutionRequest().setShowErrors( true ) - .setErrorReporter( reporter ) - .setGoals( Collections.EMPTY_LIST ); + MavenExecutionRequest request = createRequest( reporter ).setGoals( Collections.EMPTY_LIST ); maven.execute( request ); @@ -889,12 +698,7 @@ public class ErrorReporterPointcutTest reporterCtl.replay(); - MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( projectDir ) - .setShowErrors( true ) - .setErrorReporter( reporter ) - .setGoals( Arrays.asList( new String[] { - "initialize" - } ) ); + MavenExecutionRequest request = createRequest( projectDir, reporter ).setGoals( Arrays.asList( "initialize" ) ); maven.execute( request ); @@ -914,12 +718,7 @@ public class ErrorReporterPointcutTest reporterCtl.replay(); - MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( projectDir ) - .setShowErrors( true ) - .setErrorReporter( reporter ) - .setGoals( Arrays.asList( new String[] { - "compile" - } ) ); + MavenExecutionRequest request = createRequest( projectDir, reporter ).setGoals( Arrays.asList( "compile" ) ); maven.execute( request ); @@ -929,13 +728,7 @@ public class ErrorReporterPointcutTest public void testReportProjectDependenciesUnresolvable() throws IOException { - if ( !checkOnline() ) - { - return; - } - File projectDir = prepareProjectDir( "err-resolving-project-dep" ); - File localRepo = new File( projectDir, "local-repo" ); File project = new File( projectDir, "project" ); reporter.reportProjectDependenciesUnresolvable( null, null, null ); @@ -944,13 +737,7 @@ public class ErrorReporterPointcutTest reporterCtl.replay(); - MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( project ) - .setShowErrors( true ) - .setLocalRepositoryPath( localRepo ) - .setErrorReporter( reporter ) - .setGoals( Arrays.asList( new String[] { - "compile" - } ) ); + MavenExecutionRequest request = createRequest( project, reporter ).setGoals( Arrays.asList( "compile" ) ); maven.execute( request ); @@ -968,13 +755,8 @@ public class ErrorReporterPointcutTest reporterCtl.replay(); - MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( projectDir ) - .setShowErrors( true ) - .setErrorReporter( reporter ) - .setGoals( Arrays.asList( new String[] { - "clean", - "package" - } ) ); + MavenExecutionRequest request = + createRequest( projectDir, reporter ).setGoals( Arrays.asList( "clean", "package" ) ); maven.execute( request ); @@ -998,13 +780,8 @@ public class ErrorReporterPointcutTest reporterCtl.replay(); - MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( project ) - .setShowErrors( true ) - .setSettings( settings ) - .setErrorReporter( reporter ) - .setGoals( Arrays.asList( new String[] { - "initialize" - } ) ); + MavenExecutionRequest request = + createRequest( project, reporter ).setSettings( settings ).setGoals( Arrays.asList( "initialize" ) ); maven.execute( request ); @@ -1022,12 +799,7 @@ public class ErrorReporterPointcutTest reporterCtl.replay(); - MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( projectDir ) - .setShowErrors( true ) - .setErrorReporter( reporter ) - .setGoals( Arrays.asList( new String[] { - "initialize" - } ) ); + MavenExecutionRequest request = createRequest( projectDir, reporter ).setGoals( Arrays.asList( "initialize" ) ); maven.execute( request ); @@ -1037,11 +809,6 @@ public class ErrorReporterPointcutTest public void testReportActivatorLookupError() throws IOException { - if ( !checkOnline() ) - { - return; - } - File projectDir = prepareProjectDir( "profile-activator-lookup-err" ); buildTestAccessory( new File( projectDir, "ext" ) ); @@ -1054,12 +821,7 @@ public class ErrorReporterPointcutTest reporterCtl.replay(); - MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( project ) - .setShowErrors( true ) - .setErrorReporter( reporter ) - .setGoals( Arrays.asList( new String[] { - "initialize" - } ) ); + MavenExecutionRequest request = createRequest( project, reporter ).setGoals( Arrays.asList( "initialize" ) ); maven.execute( request ); @@ -1077,12 +839,7 @@ public class ErrorReporterPointcutTest reporterCtl.replay(); - MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( projectDir ) - .setShowErrors( true ) - .setErrorReporter( reporter ) - .setGoals( Arrays.asList( new String[] { - "compile" - } ) ); + MavenExecutionRequest request = createRequest( projectDir, reporter ).setGoals( Arrays.asList( "compile" ) ); maven.execute( request ); @@ -1100,12 +857,7 @@ public class ErrorReporterPointcutTest reporterCtl.replay(); - MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( projectDir ) - .setShowErrors( true ) - .setErrorReporter( reporter ) - .setGoals( Arrays.asList( new String[] { - "initialize" - } ) ); + MavenExecutionRequest request = createRequest( projectDir, reporter ).setGoals( Arrays.asList( "initialize" ) ); maven.execute( request ); @@ -1123,12 +875,7 @@ public class ErrorReporterPointcutTest reporterCtl.replay(); - MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( projectDir ) - .setShowErrors( true ) - .setErrorReporter( reporter ) - .setGoals( Arrays.asList( new String[] { - "initialize" - } ) ); + MavenExecutionRequest request = createRequest( projectDir, reporter ).setGoals( Arrays.asList( "initialize" ) ); maven.execute( request ); @@ -1146,12 +893,7 @@ public class ErrorReporterPointcutTest reporterCtl.replay(); - MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( projectDir ) - .setShowErrors( true ) - .setErrorReporter( reporter ) - .setGoals( Arrays.asList( new String[] { - "compile" - } ) ); + MavenExecutionRequest request = createRequest( projectDir, reporter ).setGoals( Arrays.asList( "compile" ) ); maven.execute( request ); @@ -1169,12 +911,7 @@ public class ErrorReporterPointcutTest reporterCtl.replay(); - MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( projectDir ) - .setShowErrors( true ) - .setErrorReporter( reporter ) - .setGoals( Arrays.asList( new String[] { - "compile" - } ) ); + MavenExecutionRequest request = createRequest( projectDir, reporter ).setGoals( Arrays.asList( "compile" ) ); maven.execute( request ); @@ -1192,12 +929,7 @@ public class ErrorReporterPointcutTest reporterCtl.replay(); - MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( projectDir ) - .setShowErrors( true ) - .setErrorReporter( reporter ) - .setGoals( Arrays.asList( new String[] { - "compile" - } ) ); + MavenExecutionRequest request = createRequest( projectDir, reporter ).setGoals( Arrays.asList( "compile" ) ); maven.execute( request ); @@ -1218,12 +950,7 @@ public class ErrorReporterPointcutTest reporterCtl.replay(); - MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( projectDir ) - .setShowErrors( true ) - .setErrorReporter( reporter ) - .setGoals( Arrays.asList( new String[] { - "initialize" - } ) ); + MavenExecutionRequest request = createRequest( projectDir, reporter ).setGoals( Arrays.asList( "initialize" ) ); maven.execute( request ); @@ -1241,12 +968,7 @@ public class ErrorReporterPointcutTest reporterCtl.replay(); - MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( projectDir ) - .setShowErrors( true ) - .setErrorReporter( reporter ) - .setGoals( Arrays.asList( new String[] { - "initialize" - } ) ); + MavenExecutionRequest request = createRequest( projectDir, reporter ).setGoals( Arrays.asList( "initialize" ) ); maven.execute( request ); @@ -1265,12 +987,7 @@ public class ErrorReporterPointcutTest reporterCtl.replay(); - MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( childDir ) - .setShowErrors( true ) - .setErrorReporter( reporter ) - .setGoals( Arrays.asList( new String[] { - "initialize" - } ) ); + MavenExecutionRequest request = createRequest( childDir, reporter ).setGoals( Arrays.asList( "initialize" ) ); maven.execute( request ); @@ -1289,12 +1006,7 @@ public class ErrorReporterPointcutTest reporterCtl.replay(); - MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( childDir ) - .setShowErrors( true ) - .setErrorReporter( reporter ) - .setGoals( Arrays.asList( new String[] { - "initialize" - } ) ); + MavenExecutionRequest request = createRequest( childDir, reporter ).setGoals( Arrays.asList( "initialize" ) ); maven.execute( request ); @@ -1312,12 +1024,7 @@ public class ErrorReporterPointcutTest reporterCtl.replay(); - MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( projectDir ) - .setShowErrors( true ) - .setErrorReporter( reporter ) - .setGoals( Arrays.asList( new String[] { - "initialize" - } ) ); + MavenExecutionRequest request = createRequest( projectDir, reporter ).setGoals( Arrays.asList( "initialize" ) ); maven.execute( request ); @@ -1335,23 +1042,19 @@ public class ErrorReporterPointcutTest reporterCtl.replay(); - MavenExecutionRequest request = new DefaultMavenExecutionRequest().setPom( new File( - projectDir, - "pom.xml" ) ) - .setShowErrors( true ) - .setErrorReporter( reporter ) - .setGoals( Arrays.asList( new String[] { - "initialize" - } ) ); + MavenExecutionRequest request = + createRequest( reporter ).setPom( new File( projectDir, "pom.xml" ) ).setGoals( + Arrays.asList( "initialize" ) ); maven.execute( request ); reporterCtl.verify(); } - // FIXME: Something keeps flip-flopping about this test, between the two reporter methods below...need to revisit this pronto. -// public void testReportErrorCreatingArtifactRepository_fromProfilesXml() -// throws IOException + // FIXME: Something keeps flip-flopping about this test, between the two reporter methods below...need to revisit + // this pronto. +// public void testReportErrorCreatingArtifactRepository_fromProfilesXml() +// throws IOException // { // File projectDir = prepareProjectDir( "bad-profile-repo" ); // @@ -1396,13 +1099,8 @@ public class ErrorReporterPointcutTest reporterCtl.replay(); - MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( projectDir ) - .setSettings( settings ) - .setShowErrors( true ) - .setErrorReporter( reporter ) - .setGoals( Arrays.asList( new String[] { - "initialize" - } ) ); + MavenExecutionRequest request = + createRequest( projectDir, reporter ).setSettings( settings ).setGoals( Arrays.asList( "initialize" ) ); maven.execute( request ); @@ -1420,12 +1118,7 @@ public class ErrorReporterPointcutTest reporterCtl.replay(); - MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( projectDir ) - .setShowErrors( true ) - .setErrorReporter( reporter ) - .setGoals( Arrays.asList( new String[] { - "initialize" - } ) ); + MavenExecutionRequest request = createRequest( projectDir, reporter ).setGoals( Arrays.asList( "initialize" ) ); maven.execute( request ); @@ -1443,12 +1136,7 @@ public class ErrorReporterPointcutTest reporterCtl.replay(); - MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( projectDir ) - .setShowErrors( true ) - .setErrorReporter( reporter ) - .setGoals( Arrays.asList( new String[] { - "initialize" - } ) ); + MavenExecutionRequest request = createRequest( projectDir, reporter ).setGoals( Arrays.asList( "initialize" ) ); maven.execute( request ); @@ -1466,12 +1154,7 @@ public class ErrorReporterPointcutTest reporterCtl.replay(); - MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( projectDir ) - .setShowErrors( true ) - .setErrorReporter( reporter ) - .setGoals( Arrays.asList( new String[] { - "initialize" - } ) ); + MavenExecutionRequest request = createRequest( projectDir, reporter ).setGoals( Arrays.asList( "initialize" ) ); maven.execute( request ); @@ -1496,13 +1179,9 @@ public class ErrorReporterPointcutTest reporterCtl.replay(); - MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( projectDir ) - .setSettings( settings ) - .setShowErrors( true ) - .setErrorReporter( reporter ) - .setGoals( Arrays.asList( new String[] { - "missing-direct-invoke-mojo:test" - } ) ); + MavenExecutionRequest request = + createRequest( projectDir, reporter ).setSettings( settings ).setGoals( + Arrays.asList( "missing-direct-invoke-mojo:test" ) ); MavenExecutionResult result = maven.execute( request ); @@ -1531,13 +1210,9 @@ public class ErrorReporterPointcutTest reporterCtl.replay(); - MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( project ) - .setSettings( settings ) - .setShowErrors( true ) - .setErrorReporter( reporter ) - .setGoals( Arrays.asList( new String[] { - "duplicated-attachments:test" - } ) ); + MavenExecutionRequest request = + createRequest( project, reporter ).setSettings( settings ).setGoals( + Arrays.asList( "duplicated-attachments:test" ) ); MavenExecutionResult result = maven.execute( request ); diff --git a/maven-embedder/src/test/plugin-version-references/jar-pom.xml b/maven-embedder/src/test/plugin-version-references/jar-pom.xml index dab47068fb..1cce9991db 100644 --- a/maven-embedder/src/test/plugin-version-references/jar-pom.xml +++ b/maven-embedder/src/test/plugin-version-references/jar-pom.xml @@ -4,7 +4,7 @@ maven-surefire-plugin - 2.3.1 + 2.2 maven-deploy-plugin @@ -29,4 +29,4 @@ - \ No newline at end of file + diff --git a/maven-embedder/src/test/plugin-version-references/maven-plugin-pom.xml b/maven-embedder/src/test/plugin-version-references/maven-plugin-pom.xml index 6fdd2b7ec9..7cfd6a2feb 100644 --- a/maven-embedder/src/test/plugin-version-references/maven-plugin-pom.xml +++ b/maven-embedder/src/test/plugin-version-references/maven-plugin-pom.xml @@ -4,7 +4,7 @@ maven-surefire-plugin - 2.3.1 + 2.2 maven-deploy-plugin @@ -33,4 +33,4 @@ - \ No newline at end of file + diff --git a/maven-embedder/src/test/resources/pom2.xml b/maven-embedder/src/test/resources/pom2.xml index 6aee58d7cc..3e2620300a 100644 --- a/maven-embedder/src/test/resources/pom2.xml +++ b/maven-embedder/src/test/resources/pom2.xml @@ -40,7 +40,7 @@ under the License. maven-surefire-plugin - RELEASE + 2.3 true