diff -Nru maven-plugin-testing-1.3/debian/changelog maven-plugin-testing-2.1/debian/changelog --- maven-plugin-testing-1.3/debian/changelog 2014-01-09 06:16:17.000000000 +0000 +++ maven-plugin-testing-2.1/debian/changelog 2017-07-17 23:36:35.000000000 +0000 @@ -1,3 +1,19 @@ +maven-plugin-testing (2.1-1) unstable; urgency=medium + + * Team upload. + * New upstream release + - Refreshed the patches + - Build depend on junit4 instead of junit + - Build depend on libplexus-component-metadata-java instead + of libplexus-maven-plugin-java + - Depend on libmaven3-core-java instead of libmaven2-core-java + * Build with the DH sequencer instead of CDBS + * Moved the package to Git + * Standards-Version updated to 4.0.0 + * Switch to debhelper level 10 + + -- Emmanuel Bourg Tue, 18 Jul 2017 01:36:35 +0200 + maven-plugin-testing (1.3-2) unstable; urgency=medium * Team upload. diff -Nru maven-plugin-testing-1.3/debian/compat maven-plugin-testing-2.1/debian/compat --- maven-plugin-testing-1.3/debian/compat 2013-11-23 21:59:22.000000000 +0000 +++ maven-plugin-testing-2.1/debian/compat 2017-07-17 22:05:41.000000000 +0000 @@ -1 +1 @@ -9 +10 diff -Nru maven-plugin-testing-1.3/debian/control maven-plugin-testing-2.1/debian/control --- maven-plugin-testing-1.3/debian/control 2013-11-23 21:59:22.000000000 +0000 +++ maven-plugin-testing-2.1/debian/control 2017-07-17 23:31:33.000000000 +0000 @@ -3,23 +3,23 @@ Priority: optional Maintainer: Debian Java Maintainers Uploaders: Ludovic Claude -Build-Depends: cdbs, debhelper (>= 9), default-jdk, maven-debian-helper (>= 1.4) -Build-Depends-Indep: default-jdk-doc, - junit, - libeasymock-java, - libmaven-invoker-java, - libmaven-javadoc-plugin-java, - libmaven2-core-java, - libmaven2-core-java-doc, - libplexus-archiver-java, - libplexus-container-default-java, - libplexus-container-default-java-doc, - libplexus-maven-plugin-java (>= 1.3.8-9~), - libplexus-utils-java, - libplexus-utils-java-doc -Standards-Version: 3.9.5 -Vcs-Svn: svn://anonscm.debian.org/pkg-java/trunk/maven-plugin-testing -Vcs-Browser: http://anonscm.debian.org/viewvc/pkg-java/trunk/maven-plugin-testing +Build-Depends: + debhelper (>= 10), + default-jdk, + default-jdk-doc, + junit4, + libeasymock-java, + libmaven-invoker-java, + libmaven-javadoc-plugin-java, + libmaven3-core-java, + libplexus-archiver-java, + libplexus-component-metadata-java, + libplexus-utils-java, + libplexus-utils-java-doc, + maven-debian-helper (>= 2.2) +Standards-Version: 4.0.0 +Vcs-Git: https://anonscm.debian.org/git/pkg-java/maven-plugin-testing.git +Vcs-Browser: https://anonscm.debian.org/cgit/pkg-java/maven-plugin-testing.git Homepage: http://maven.apache.org/plugin-testing/ Package: libmaven-plugin-testing-java diff -Nru maven-plugin-testing-1.3/debian/copyright maven-plugin-testing-2.1/debian/copyright --- maven-plugin-testing-1.3/debian/copyright 2013-11-23 21:59:22.000000000 +0000 +++ maven-plugin-testing-2.1/debian/copyright 2017-07-17 23:31:13.000000000 +0000 @@ -18,6 +18,5 @@ License: GPL-3+ On Debian GNU/Linux system you can find the complete text of the - GNU General Public License version 3 license in + GNU General Public License version 3 license in '/usr/share/common-licenses/GPL-3'. - diff -Nru maven-plugin-testing-1.3/debian/libmaven-plugin-testing-java-doc.install maven-plugin-testing-2.1/debian/libmaven-plugin-testing-java-doc.install --- maven-plugin-testing-1.3/debian/libmaven-plugin-testing-java-doc.install 2013-11-23 21:59:21.000000000 +0000 +++ maven-plugin-testing-2.1/debian/libmaven-plugin-testing-java-doc.install 2017-07-17 23:31:13.000000000 +0000 @@ -1,2 +1 @@ target/site/apidocs/* usr/share/doc/libmaven-plugin-testing-java/api - diff -Nru maven-plugin-testing-1.3/debian/maven.properties maven-plugin-testing-2.1/debian/maven.properties --- maven-plugin-testing-1.3/debian/maven.properties 2013-11-23 21:59:22.000000000 +0000 +++ maven-plugin-testing-2.1/debian/maven.properties 2017-07-17 23:13:29.000000000 +0000 @@ -3,3 +3,5 @@ # maven.test.skip=true maven.test.failure.ignore=true + +plexusVersion=1.5.5 diff -Nru maven-plugin-testing-1.3/debian/maven.rules maven-plugin-testing-2.1/debian/maven.rules --- maven-plugin-testing-1.3/debian/maven.rules 2013-11-23 21:59:21.000000000 +0000 +++ maven-plugin-testing-2.1/debian/maven.rules 2017-07-17 23:19:12.000000000 +0000 @@ -16,10 +16,15 @@ # and version starting with 3., replacing the version with 3.x # junit junit jar s/3\\..*/3.x/ -junit junit jar s/3\..*/3.x/ * * -org.codehaus.plexus plexus-container-default jar s/1\.0-alpha.*/1.0-alpha/ * * +junit junit jar s/.*/4.x/ * * s/easymock/org.easymock/ easymock * s/.*/debian/ * * s/org.apache.maven.shared/org.apache.maven.plugin-testing/ maven-plugin-testing-harness * s/.*/debian/ * * s/org.apache.maven.shared/org.apache.maven.plugin-testing/ maven-plugin-testing-tools * s/.*/debian/ * * s/org.apache.maven.shared/org.apache.maven.plugin-testing/ maven-plugin-testing * s/.*/debian/ * * s/org.apache.maven.shared/org.apache.maven.plugin-testing/ maven-test-tools * s/.*/debian/ * * + +org.apache.maven maven-core * s/.*/3.x/ * * +org.apache.maven maven-compat * s/.*/3.x/ * * +org.apache.maven maven-model * s/.*/3.x/ * * +org.apache.maven maven-plugin-api * s/.*/3.x/ * * +org.apache.maven maven-aether-provider * s/.*/3.x/ * * diff -Nru maven-plugin-testing-1.3/debian/patches/0001-easymock-upgrade.patch maven-plugin-testing-2.1/debian/patches/0001-easymock-upgrade.patch --- maven-plugin-testing-1.3/debian/patches/0001-easymock-upgrade.patch 2013-11-23 21:59:22.000000000 +0000 +++ maven-plugin-testing-2.1/debian/patches/0001-easymock-upgrade.patch 2017-07-17 23:09:18.000000000 +0000 @@ -3,8 +3,8 @@ Bug: https://github.com/apache/maven-plugin-testing/pull/2 --- a/maven-test-tools/src/main/java/org/apache/maven/shared/tools/easymock/MockManager.java +++ b/maven-test-tools/src/main/java/org/apache/maven/shared/tools/easymock/MockManager.java -@@ -23,13 +23,13 @@ - import java.util.Iterator; +@@ -22,7 +22,7 @@ + import java.util.ArrayList; import java.util.List; -import org.easymock.MockControl; @@ -12,14 +12,13 @@ /** * Manager of MockControl - * - * @version $Id: MockManager.java 677117 2008-07-16 00:29:56Z vsiveton $ -- * @see MockControl -+ * @see IMocksControl +@@ -32,12 +32,12 @@ */ public class MockManager { -@@ -38,7 +38,7 @@ +- private List mockControls = new ArrayList(); ++ private List mockControls = new ArrayList(); + /** * @param control to be add to the manager */ @@ -28,21 +27,21 @@ { mockControls.add( control ); } -@@ -58,7 +58,7 @@ +@@ -55,7 +55,7 @@ + */ + public void replayAll() { - for ( Iterator it = mockControls.iterator(); it.hasNext(); ) +- for ( MockControl control : mockControls ) ++ for ( IMocksControl control : mockControls ) { -- MockControl control = (MockControl) it.next(); -+ IMocksControl control = (IMocksControl) it.next(); - control.replay(); } -@@ -71,7 +71,7 @@ +@@ -66,7 +66,7 @@ + */ + public void verifyAll() { - for ( Iterator it = mockControls.iterator(); it.hasNext(); ) +- for ( MockControl control : mockControls ) ++ for ( IMocksControl control : mockControls ) { -- MockControl control = (MockControl) it.next(); -+ IMocksControl control = (IMocksControl) it.next(); - control.verify(); } diff -Nru maven-plugin-testing-1.3/debian/patches/0002-fix-dependency-on-maven-test-tools.patch maven-plugin-testing-2.1/debian/patches/0002-fix-dependency-on-maven-test-tools.patch --- maven-plugin-testing-1.3/debian/patches/0002-fix-dependency-on-maven-test-tools.patch 2014-01-09 06:05:08.000000000 +0000 +++ maven-plugin-testing-2.1/debian/patches/0002-fix-dependency-on-maven-test-tools.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,22 +0,0 @@ -From: Torsten Werner -Date: Tue, 23 Aug 2011 22:58:07 +0200 -Subject: [PATCH] fix dependency on maven-test-tools - ---- - maven-plugin-testing-tools/pom.xml | 4 ++-- - 1 files changed, 2 insertions(+), 2 deletions(-) - ---- a/maven-plugin-testing-tools/pom.xml -+++ b/maven-plugin-testing-tools/pom.xml -@@ -73,9 +73,9 @@ - 2.0.9 - - -- org.apache.maven.shared -+ org.apache.maven.plugin-testing - maven-test-tools -- 1.0-alpha-2 -+ 1.3 - test - - diff -Nru maven-plugin-testing-1.3/debian/patches/0003-maven-compatibility.patch maven-plugin-testing-2.1/debian/patches/0003-maven-compatibility.patch --- maven-plugin-testing-1.3/debian/patches/0003-maven-compatibility.patch 1970-01-01 00:00:00.000000000 +0000 +++ maven-plugin-testing-2.1/debian/patches/0003-maven-compatibility.patch 2017-07-17 23:29:02.000000000 +0000 @@ -0,0 +1,186 @@ +Description: Fixes the compatibility with the latest version of Maven +Origin: backport, https://svn.apache.org/r1505991 +--- a/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/AbstractMojoTestCase.java ++++ b/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/AbstractMojoTestCase.java +@@ -49,10 +49,12 @@ + import org.apache.maven.plugin.logging.Log; + import org.apache.maven.project.MavenProject; + import org.apache.maven.repository.RepositorySystem; +-import org.apache.maven.repository.internal.MavenRepositorySystemSession; ++import org.apache.maven.repository.internal.MavenAetherModule; ++import org.apache.maven.repository.internal.MavenRepositorySystemUtils; + import org.codehaus.plexus.ContainerConfiguration; + import org.codehaus.plexus.DefaultContainerConfiguration; + import org.codehaus.plexus.DefaultPlexusContainer; ++import org.codehaus.plexus.PlexusConstants; + import org.codehaus.plexus.PlexusContainer; + import org.codehaus.plexus.PlexusContainerException; + import org.codehaus.plexus.PlexusTestCase; +@@ -169,7 +171,13 @@ + { + ClassWorld classWorld = new ClassWorld( "plexus.core", Thread.currentThread().getContextClassLoader() ); + +- return new DefaultContainerConfiguration().setClassWorld( classWorld ).setName( "embedder" ); ++ ContainerConfiguration cc = new DefaultContainerConfiguration() ++ .setClassWorld( classWorld ) ++ .setClassPathScanning( PlexusConstants.SCANNING_INDEX ) ++ .setAutoWiring( true ) ++ .setName( "maven" ); ++ ++ return cc; + } + + protected PlexusContainer getContainer() +@@ -373,7 +381,7 @@ + MavenExecutionRequest request = new DefaultMavenExecutionRequest(); + MavenExecutionResult result = new DefaultMavenExecutionResult(); + +- MavenSession session = new MavenSession( container, new MavenRepositorySystemSession(), request, result ); ++ MavenSession session = new MavenSession( container, MavenRepositorySystemUtils.newSession(), request, result ); + session.setCurrentProject( project ); + session.setProjects( Arrays.asList( project ) ); + return session; +--- a/maven-plugin-testing-tools/src/main/java/org/apache/maven/shared/test/plugin/ProjectTool.java ++++ b/maven-plugin-testing-tools/src/main/java/org/apache/maven/shared/test/plugin/ProjectTool.java +@@ -50,7 +50,7 @@ + import org.apache.maven.project.ProjectBuildingException; + import org.apache.maven.project.ProjectBuildingRequest; + import org.apache.maven.project.artifact.ProjectArtifactMetadata; +-import org.apache.maven.repository.internal.MavenRepositorySystemSession; ++import org.apache.maven.repository.internal.MavenRepositorySystemUtils; + import org.codehaus.plexus.component.annotations.Component; + import org.codehaus.plexus.component.annotations.Requirement; + import org.codehaus.plexus.util.FileUtils; +@@ -241,7 +241,7 @@ + { + ProjectBuildingRequest request = new DefaultProjectBuildingRequest(); + request.setLocalRepository( artifactRepositoryFactory.createArtifactRepository( "local", new File( "target/localrepo" ).getCanonicalFile().toURL().toExternalForm(), "default", null, null ) ); +- request.setRepositorySession( new MavenRepositorySystemSession() ); ++ request.setRepositorySession( MavenRepositorySystemUtils.newSession() ); + MavenProject project = projectBuilder.build( pomInfo.getPomFile(), request ).getProject(); + + Artifact artifact = artifactFactory.createArtifact( project.getGroupId(), project.getArtifactId(), project +--- a/maven-plugin-testing-tools/src/main/java/org/apache/maven/shared/test/plugin/RepositoryTool.java ++++ b/maven-plugin-testing-tools/src/main/java/org/apache/maven/shared/test/plugin/RepositoryTool.java +@@ -40,7 +40,7 @@ + import org.apache.maven.plugin.LegacySupport; + import org.apache.maven.project.MavenProject; + import org.apache.maven.project.artifact.ProjectArtifactMetadata; +-import org.apache.maven.repository.internal.MavenRepositorySystemSession; ++import org.apache.maven.repository.internal.MavenRepositorySystemUtils; + import org.apache.maven.settings.MavenSettingsBuilder; + import org.apache.maven.settings.Settings; + import org.codehaus.plexus.PlexusConstants; +@@ -218,7 +218,7 @@ + destination.getParentFile().mkdirs(); + } + +- legacySupport.setSession( new MavenSession( container, new MavenRepositorySystemSession(), ++ legacySupport.setSession( new MavenSession( container, MavenRepositorySystemUtils.newSession(), + new DefaultMavenExecutionRequest(), + new DefaultMavenExecutionResult() ) ); + try +--- a/maven-plugin-testing-tools/src/test/java/org/apache/maven/shared/test/plugin/ProjectToolTest.java ++++ b/maven-plugin-testing-tools/src/test/java/org/apache/maven/shared/test/plugin/ProjectToolTest.java +@@ -29,6 +29,8 @@ + import org.apache.maven.project.MavenProject; + import org.apache.maven.project.artifact.ProjectArtifactMetadata; + import org.apache.maven.shared.test.plugin.ProjectTool.PomInfo; ++import org.codehaus.plexus.ContainerConfiguration; ++import org.codehaus.plexus.PlexusConstants; + import org.codehaus.plexus.PlexusTestCase; + import org.codehaus.plexus.util.FileUtils; + import org.codehaus.plexus.util.StringUtils; +@@ -110,4 +112,11 @@ + + assertTrue( foundPomMetadata ); + } ++ ++ @Override ++ protected void customizeContainerConfiguration(ContainerConfiguration configuration) ++ { ++ configuration.setClassPathScanning( PlexusConstants.SCANNING_INDEX ); ++ configuration.setAutoWiring( true ); ++ } + } +--- a/maven-plugin-testing-tools/src/test/java/org/apache/maven/shared/test/plugin/RepositoryToolTest.java ++++ b/maven-plugin-testing-tools/src/test/java/org/apache/maven/shared/test/plugin/RepositoryToolTest.java +@@ -26,6 +26,8 @@ + import org.apache.maven.project.MavenProject; + import org.apache.maven.project.artifact.ProjectArtifactMetadata; + import org.apache.maven.shared.tools.easymock.TestFileManager; ++import org.codehaus.plexus.ContainerConfiguration; ++import org.codehaus.plexus.PlexusConstants; + import org.codehaus.plexus.PlexusTestCase; + + /** +@@ -84,4 +86,11 @@ + fileManager.assertFileContents( targetLocalRepoBasedir, "group/artifact/test/artifact-test.jar", jarContent ); + + } ++ ++ @Override ++ protected void customizeContainerConfiguration(ContainerConfiguration configuration) ++ { ++ configuration.setClassPathScanning( PlexusConstants.SCANNING_INDEX ); ++ configuration.setAutoWiring( true ); ++ } + } +--- a/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/StubArtifactResolver.java ++++ b/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/StubArtifactResolver.java +@@ -141,7 +141,7 @@ + * @see org.apache.maven.artifact.resolver.ArtifactResolver#resolveTransitively(java.util.Set, org.apache.maven.artifact.Artifact, java.util.Map, org.apache.maven.artifact.repository.ArtifactRepository, java.util.List, org.apache.maven.artifact.metadata.ArtifactMetadataSource) + */ + public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, +- Map managedVersions, ArtifactRepository localRepository, ++ Map managedVersions, ArtifactRepository localRepository, + List remoteRepositories, ArtifactMetadataSource source ) + throws ArtifactResolutionException, ArtifactNotFoundException + { +@@ -153,7 +153,7 @@ + * @see org.apache.maven.artifact.resolver.ArtifactResolver#resolveTransitively(java.util.Set, org.apache.maven.artifact.Artifact, java.util.Map, org.apache.maven.artifact.repository.ArtifactRepository, java.util.List, org.apache.maven.artifact.metadata.ArtifactMetadataSource, org.apache.maven.artifact.resolver.filter.ArtifactFilter) + */ + public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, +- Map managedVersions, ArtifactRepository localRepository, ++ Map managedVersions, ArtifactRepository localRepository, + List remoteRepositories, ArtifactMetadataSource source, + ArtifactFilter filter ) + throws ArtifactResolutionException, ArtifactNotFoundException +@@ -166,7 +166,7 @@ + * @see org.apache.maven.artifact.resolver.ArtifactResolver#resolveTransitively(java.util.Set, org.apache.maven.artifact.Artifact, java.util.Map, org.apache.maven.artifact.repository.ArtifactRepository, java.util.List, org.apache.maven.artifact.metadata.ArtifactMetadataSource, org.apache.maven.artifact.resolver.filter.ArtifactFilter, java.util.List) + */ + public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, +- Map managedVersions, ArtifactRepository localRepository, ++ Map managedVersions, ArtifactRepository localRepository, + List remoteRepositories, ArtifactMetadataSource source, + ArtifactFilter filter, List listeners ) + throws ArtifactResolutionException, ArtifactNotFoundException +--- a/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/StubArtifactCollector.java ++++ b/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/StubArtifactCollector.java +@@ -51,7 +51,7 @@ + } + + public ArtifactResolutionResult collect( Set artifacts, Artifact originatingArtifact, +- Map managedVersions, ArtifactResolutionRequest repositoryRequest, ++ Map managedVersions, ArtifactResolutionRequest repositoryRequest, + ArtifactMetadataSource source, ArtifactFilter filter, + List listeners, + List conflictResolvers ) +@@ -60,7 +60,7 @@ + } + + public ArtifactResolutionResult collect( Set artifacts, Artifact originatingArtifact, +- Map managedVersions, ArtifactRepository localRepository, ++ Map managedVersions, ArtifactRepository localRepository, + List remoteRepositories, + ArtifactMetadataSource source, ArtifactFilter filter, + List listeners, +@@ -70,7 +70,7 @@ + } + + public ArtifactResolutionResult collect( Set artifacts, Artifact originatingArtifact, +- Map managedVersions, ArtifactRepository localRepository, ++ Map managedVersions, ArtifactRepository localRepository, + List remoteRepositories, + ArtifactMetadataSource source, ArtifactFilter filter, + List listeners ) diff -Nru maven-plugin-testing-1.3/debian/patches/series maven-plugin-testing-2.1/debian/patches/series --- maven-plugin-testing-1.3/debian/patches/series 2013-11-23 21:59:22.000000000 +0000 +++ maven-plugin-testing-2.1/debian/patches/series 2017-07-17 23:20:57.000000000 +0000 @@ -1,2 +1,2 @@ 0001-easymock-upgrade.patch -0002-fix-dependency-on-maven-test-tools.patch +0003-maven-compatibility.patch diff -Nru maven-plugin-testing-1.3/debian/rules maven-plugin-testing-2.1/debian/rules --- maven-plugin-testing-1.3/debian/rules 2013-11-23 21:59:21.000000000 +0000 +++ maven-plugin-testing-2.1/debian/rules 2017-07-17 22:05:41.000000000 +0000 @@ -1,10 +1,7 @@ #!/usr/bin/make -f -include /usr/share/cdbs/1/rules/debhelper.mk -include /usr/share/cdbs/1/class/maven.mk - -JAVA_HOME := /usr/lib/jvm/default-java -DEB_MAVEN_DOC_TARGET := javadoc:jar javadoc:aggregate +%: + dh $@ get-orig-source: - uscan --download-version $(DEB_UPSTREAM_VERSION) --force-download --rename + uscan --download-current-version --force-download --rename diff -Nru maven-plugin-testing-1.3/.gitignore maven-plugin-testing-2.1/.gitignore --- maven-plugin-testing-1.3/.gitignore 2012-05-20 14:34:15.000000000 +0000 +++ maven-plugin-testing-2.1/.gitignore 2012-05-20 14:31:57.000000000 +0000 @@ -6,3 +6,4 @@ #idea *.iml .idea + diff -Nru maven-plugin-testing-1.3/maven-plugin-testing-harness/pom.xml maven-plugin-testing-2.1/maven-plugin-testing-harness/pom.xml --- maven-plugin-testing-1.3/maven-plugin-testing-harness/pom.xml 2012-09-24 16:02:32.000000000 +0000 +++ maven-plugin-testing-2.1/maven-plugin-testing-harness/pom.xml 2012-09-23 18:59:07.000000000 +0000 @@ -25,7 +25,7 @@ org.apache.maven.plugin-testing maven-plugin-testing - 1.3 + 2.1 maven-plugin-testing-harness @@ -33,32 +33,24 @@ The Maven Plugin Testing Harness provides mechanisms to manage tests on Mojo. - scm:svn:http://svn.apache.org/repos/asf/maven/plugin-testing/tags/maven-plugin-testing-1.3/maven-plugin-testing-harness - scm:svn:https://svn.apache.org/repos/asf/maven/plugin-testing/tags/maven-plugin-testing-1.3/maven-plugin-testing-harness - http://svn.apache.org/viewvc/maven/plugin-testing/tags/maven-plugin-testing-1.3/maven-plugin-testing-harness + scm:svn:http://svn.apache.org/repos/asf/maven/plugin-testing/tags/maven-plugin-testing-2.1/maven-plugin-testing-harness + scm:svn:https://svn.apache.org/repos/asf/maven/plugin-testing/tags/maven-plugin-testing-2.1/maven-plugin-testing-harness + http://svn.apache.org/viewvc/maven/plugin-testing/tags/maven-plugin-testing-2.1/maven-plugin-testing-harness org.apache.maven - maven-project - - - org.apache.maven maven-core org.apache.maven - maven-model - - - org.apache.maven - maven-artifact + maven-compat org.apache.maven - maven-artifact-manager + maven-model org.apache.maven @@ -66,7 +58,7 @@ org.apache.maven - maven-settings + maven-aether-provider @@ -77,6 +69,7 @@ org.codehaus.plexus plexus-archiver + 2.2 diff -Nru maven-plugin-testing-1.3/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/AbstractMojoTestCase.java maven-plugin-testing-2.1/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/AbstractMojoTestCase.java --- maven-plugin-testing-1.3/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/AbstractMojoTestCase.java 2011-03-26 21:40:19.000000000 +0000 +++ maven-plugin-testing-2.1/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/AbstractMojoTestCase.java 2012-06-02 05:52:30.000000000 +0000 @@ -19,27 +19,59 @@ * under the License. */ +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStream; +import java.io.Reader; +import java.lang.reflect.AccessibleObject; +import java.lang.reflect.Field; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +import org.apache.maven.artifact.Artifact; +import org.apache.maven.execution.DefaultMavenExecutionRequest; +import org.apache.maven.execution.DefaultMavenExecutionResult; +import org.apache.maven.execution.MavenExecutionRequest; +import org.apache.maven.execution.MavenExecutionResult; +import org.apache.maven.execution.MavenSession; +import org.apache.maven.lifecycle.internal.MojoDescriptorCreator; +import org.apache.maven.model.Plugin; import org.apache.maven.monitor.logging.DefaultLog; import org.apache.maven.plugin.Mojo; +import org.apache.maven.plugin.MojoExecution; +import org.apache.maven.plugin.PluginParameterExpressionEvaluator; +import org.apache.maven.plugin.descriptor.MojoDescriptor; +import org.apache.maven.plugin.descriptor.Parameter; +import org.apache.maven.plugin.descriptor.PluginDescriptor; +import org.apache.maven.plugin.descriptor.PluginDescriptorBuilder; import org.apache.maven.plugin.logging.Log; +import org.apache.maven.project.MavenProject; +import org.apache.maven.repository.RepositorySystem; +import org.apache.maven.repository.internal.MavenRepositorySystemSession; +import org.codehaus.plexus.ContainerConfiguration; +import org.codehaus.plexus.DefaultContainerConfiguration; +import org.codehaus.plexus.DefaultPlexusContainer; +import org.codehaus.plexus.PlexusContainer; +import org.codehaus.plexus.PlexusContainerException; import org.codehaus.plexus.PlexusTestCase; +import org.codehaus.plexus.classworlds.ClassWorld; +import org.codehaus.plexus.component.configurator.ComponentConfigurationException; import org.codehaus.plexus.component.configurator.ComponentConfigurator; import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator; +import org.codehaus.plexus.component.repository.ComponentDescriptor; import org.codehaus.plexus.configuration.PlexusConfiguration; import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration; -import org.codehaus.plexus.util.IOUtil; +import org.codehaus.plexus.logging.LoggerManager; +import org.codehaus.plexus.util.InterpolationFilterReader; import org.codehaus.plexus.util.ReaderFactory; import org.codehaus.plexus.util.ReflectionUtils; +import org.codehaus.plexus.util.StringUtils; +import org.codehaus.plexus.util.xml.XmlStreamReader; import org.codehaus.plexus.util.xml.Xpp3Dom; import org.codehaus.plexus.util.xml.Xpp3DomBuilder; -import java.io.File; -import java.io.Reader; -import java.util.Map; -import java.util.HashMap; -import java.lang.reflect.Field; -import java.lang.reflect.AccessibleObject; - /** * TODO: add a way to use the plugin POM for the lookup so that the user doesn't have to provide the a:g:v:goal * as the role hint for the mojo lookup. @@ -51,29 +83,105 @@ * descriptor and make this entirely declarative! * * @author jesse - * @version $Id: AbstractMojoTestCase.java 1085807 2011-03-26 21:40:19Z hboutemy $ + * @version $Id: AbstractMojoTestCase.java 1345446 2012-06-02 05:52:30Z hboutemy $ */ public abstract class AbstractMojoTestCase extends PlexusTestCase { private ComponentConfigurator configurator; + private PlexusContainer container; + + private Map mojoDescriptors; + /* * for the harness I think we have decided against going the route of using the maven project builder. * instead I think we are going to try and make an instance of the localrespository and assign that * to either the project stub or into the mojo directly with injection...not sure yet though. */ //private MavenProjectBuilder projectBuilder; + protected void setUp() throws Exception { - super.setUp(); + configurator = getContainer().lookup( ComponentConfigurator.class, "basic" ); + + InputStream is = getClass().getResourceAsStream( "/" + getPluginDescriptorLocation() ); + + XmlStreamReader reader = ReaderFactory.newXmlReader( is ); - configurator = (ComponentConfigurator) getContainer().lookup( ComponentConfigurator.ROLE, "basic" ); + InterpolationFilterReader interpolationFilterReader = + new InterpolationFilterReader( new BufferedReader( reader ), container.getContext().getContextData() ); - //projectBuilder = (MavenProjectBuilder) getContainer().lookup( MavenProjectBuilder.ROLE ); + PluginDescriptor pluginDescriptor = new PluginDescriptorBuilder().build( interpolationFilterReader ); + + Artifact artifact = + lookup( RepositorySystem.class ).createArtifact( pluginDescriptor.getGroupId(), + pluginDescriptor.getArtifactId(), + pluginDescriptor.getVersion(), ".jar" ); + artifact.setFile( new File( getBasedir() ).getCanonicalFile() ); + pluginDescriptor.setPluginArtifact( artifact ); + pluginDescriptor.setArtifacts( Arrays.asList( artifact ) ); + + for ( ComponentDescriptor desc : pluginDescriptor.getComponents() ) + { + getContainer().addComponentDescriptor( desc ); + } + + mojoDescriptors = new HashMap(); + for ( MojoDescriptor mojoDescriptor : pluginDescriptor.getMojos() ) + { + mojoDescriptors.put( mojoDescriptor.getGoal(), mojoDescriptor ); + } + } + + protected InputStream getPublicDescriptorStream() + throws Exception + { + return new FileInputStream( new File( getPluginDescriptorPath() ) ); + } + + protected String getPluginDescriptorPath() + { + return getBasedir() + "/target/classes/META-INF/maven/plugin.xml"; } + protected String getPluginDescriptorLocation() + { + return "META-INF/maven/plugin.xml"; + } + + protected void setupContainer() + { + ContainerConfiguration cc = setupContainerConfiguration(); + try + { + container = new DefaultPlexusContainer( cc ); + } + catch ( PlexusContainerException e ) + { + e.printStackTrace(); + fail( "Failed to create plexus container." ); + } + } + + protected ContainerConfiguration setupContainerConfiguration() + { + ClassWorld classWorld = new ClassWorld( "plexus.core", Thread.currentThread().getContextClassLoader() ); + + return new DefaultContainerConfiguration().setClassWorld( classWorld ).setName( "embedder" ); + } + + protected PlexusContainer getContainer() + { + if ( container == null ) + { + setupContainer(); + } + + return container; + } + /** * Lookup the mojo leveraging the subproject pom * @@ -115,27 +223,17 @@ { File pluginPom = new File( getBasedir(), "pom.xml" ); - Reader reader = null; - try - { - reader = ReaderFactory.newXmlReader( pluginPom ); + Xpp3Dom pluginPomDom = Xpp3DomBuilder.build( ReaderFactory.newXmlReader( pluginPom ) ); - Xpp3Dom pluginPomDom = Xpp3DomBuilder.build( reader ); - - String artifactId = pluginPomDom.getChild( "artifactId" ).getValue(); - - String groupId = resolveFromRootThenParent( pluginPomDom, "groupId" ); - - String version = resolveFromRootThenParent( pluginPomDom, "version" ); - - PlexusConfiguration pluginConfiguration = extractPluginConfiguration( artifactId, pom ); - - return lookupMojo( groupId, artifactId, version, goal, pluginConfiguration ); - } - finally - { - IOUtil.close( reader ); - } + String artifactId = pluginPomDom.getChild( "artifactId" ).getValue(); + + String groupId = resolveFromRootThenParent( pluginPomDom, "groupId" ); + + String version = resolveFromRootThenParent( pluginPomDom, "version" ); + + PlexusConfiguration pluginConfiguration = extractPluginConfiguration( artifactId, pom ); + + return lookupMojo( groupId, artifactId, version, goal, pluginConfiguration ); } /** @@ -151,25 +249,15 @@ { File pluginPom = new File( getBasedir(), "pom.xml" ); - Reader reader = null; - try - { - reader = ReaderFactory.newXmlReader( pluginPom ); + Xpp3Dom pluginPomDom = Xpp3DomBuilder.build( ReaderFactory.newXmlReader( pluginPom ) ); - Xpp3Dom pluginPomDom = Xpp3DomBuilder.build( reader ); + String artifactId = pluginPomDom.getChild( "artifactId" ).getValue(); - String artifactId = pluginPomDom.getChild( "artifactId" ).getValue(); + String groupId = resolveFromRootThenParent( pluginPomDom, "groupId" ); - String groupId = resolveFromRootThenParent( pluginPomDom, "groupId" ); + String version = resolveFromRootThenParent( pluginPomDom, "version" ); - String version = resolveFromRootThenParent( pluginPomDom, "version" ); - - return lookupMojo( groupId, artifactId, version, goal, null ); - } - finally - { - IOUtil.close( reader ); - } + return lookupMojo( groupId, artifactId, version, goal, null ); } /* @@ -202,7 +290,9 @@ Mojo mojo = (Mojo) lookup( Mojo.ROLE, groupId + ":" + artifactId + ":" + version + ":" + goal ); - Log mojoLogger = new DefaultLog( getContainer().getLoggerManager().getLoggerForComponent( Mojo.ROLE ) ); + LoggerManager loggerManager = (LoggerManager) getContainer().lookup( LoggerManager.class ); + + Log mojoLogger = new DefaultLog( loggerManager.getLoggerForComponent( Mojo.ROLE ) ); mojo.setLog( mojoLogger ); @@ -221,27 +311,151 @@ } /** - * @param artifactId - * @param pom - * @return the plexus configuration + * + * @param project + * @param goal + * @return * @throws Exception + * @since 2.0 */ - protected PlexusConfiguration extractPluginConfiguration( String artifactId, File pom ) + protected Mojo lookupConfiguredMojo( MavenProject project, String goal ) throws Exception { - Reader reader = null; - try + return lookupConfiguredMojo( newMavenSession( project ), newMojoExecution( goal ) ); + } + + /** + * + * @param session + * @param execution + * @return + * @throws Exception + * @throws ComponentConfigurationException + * @since 2.0 + */ + protected Mojo lookupConfiguredMojo( MavenSession session, MojoExecution execution ) + throws Exception, ComponentConfigurationException + { + MavenProject project = session.getCurrentProject(); + MojoDescriptor mojoDescriptor = execution.getMojoDescriptor(); + + Mojo mojo = (Mojo) lookup( mojoDescriptor.getRole(), mojoDescriptor.getRoleHint() ); + + ExpressionEvaluator evaluator = new PluginParameterExpressionEvaluator( session, execution ); + + Xpp3Dom configuration = null; + Plugin plugin = project.getPlugin( mojoDescriptor.getPluginDescriptor().getPluginLookupKey() ); + if ( plugin != null ) + { + configuration = (Xpp3Dom) plugin.getConfiguration(); + } + if ( configuration == null ) { - reader = ReaderFactory.newXmlReader( pom ); + configuration = new Xpp3Dom( "configuration" ); + } + configuration = Xpp3Dom.mergeXpp3Dom( execution.getConfiguration(), configuration ); + + PlexusConfiguration pluginConfiguration = new XmlPlexusConfiguration( configuration ); + + configurator.configureComponent( mojo, pluginConfiguration, evaluator, getContainer().getContainerRealm() ); + + return mojo; + } + + /** + * + * @param project + * @return + * @since 2.0 + */ + protected MavenSession newMavenSession( MavenProject project ) + { + MavenExecutionRequest request = new DefaultMavenExecutionRequest(); + MavenExecutionResult result = new DefaultMavenExecutionResult(); + + MavenSession session = new MavenSession( container, new MavenRepositorySystemSession(), request, result ); + session.setCurrentProject( project ); + session.setProjects( Arrays.asList( project ) ); + return session; + } + + /** + * + * @param goal + * @return + * @since 2.0 + */ + protected MojoExecution newMojoExecution( String goal ) + { + MojoDescriptor mojoDescriptor = mojoDescriptors.get( goal ); + assertNotNull( mojoDescriptor ); + MojoExecution execution = new MojoExecution( mojoDescriptor ); + finalizeMojoConfiguration( execution ); + return execution; + } - Xpp3Dom pomDom = Xpp3DomBuilder.build( reader ); + // copy&paste from org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.finalizeMojoConfiguration(MojoExecution) + private void finalizeMojoConfiguration( MojoExecution mojoExecution ) + { + MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor(); - return extractPluginConfiguration( artifactId, pomDom ); + Xpp3Dom executionConfiguration = mojoExecution.getConfiguration(); + if ( executionConfiguration == null ) + { + executionConfiguration = new Xpp3Dom( "configuration" ); } - finally + + Xpp3Dom defaultConfiguration = MojoDescriptorCreator.convert( mojoDescriptor );; + + Xpp3Dom finalConfiguration = new Xpp3Dom( "configuration" ); + + if ( mojoDescriptor.getParameters() != null ) { - IOUtil.close( reader ); + for ( Parameter parameter : mojoDescriptor.getParameters() ) + { + Xpp3Dom parameterConfiguration = executionConfiguration.getChild( parameter.getName() ); + + if ( parameterConfiguration == null ) + { + parameterConfiguration = executionConfiguration.getChild( parameter.getAlias() ); + } + + Xpp3Dom parameterDefaults = defaultConfiguration.getChild( parameter.getName() ); + + parameterConfiguration = Xpp3Dom.mergeXpp3Dom( parameterConfiguration, parameterDefaults, Boolean.TRUE ); + + if ( parameterConfiguration != null ) + { + parameterConfiguration = new Xpp3Dom( parameterConfiguration, parameter.getName() ); + + if ( StringUtils.isEmpty( parameterConfiguration.getAttribute( "implementation" ) ) + && StringUtils.isNotEmpty( parameter.getImplementation() ) ) + { + parameterConfiguration.setAttribute( "implementation", parameter.getImplementation() ); + } + + finalConfiguration.addChild( parameterConfiguration ); + } + } } + + mojoExecution.setConfiguration( finalConfiguration ); + } + + /** + * @param artifactId + * @param pom + * @return the plexus configuration + * @throws Exception + */ + protected PlexusConfiguration extractPluginConfiguration( String artifactId, File pom ) + throws Exception + { + Reader reader = ReaderFactory.newXmlReader( pom ); + + Xpp3Dom pomDom = Xpp3DomBuilder.build( reader ); + + return extractPluginConfiguration( artifactId, pomDom ); } /** @@ -264,10 +478,8 @@ { Xpp3Dom[] pluginElements = pluginsRootElement.getChildren(); - for ( int i = 0; i < pluginElements.length; i++ ) + for ( Xpp3Dom pluginElement : pluginElements ) { - Xpp3Dom pluginElement = pluginElements[i]; - String pluginElementArtifactId = pluginElement.getChild( "artifactId" ).getValue(); if ( pluginElementArtifactId.equals( artifactId ) ) @@ -366,7 +578,7 @@ * @param object * @return map of variable names and values */ - protected Map getVariablesAndValuesFromObject( Object object ) + protected Map getVariablesAndValuesFromObject( Object object ) throws IllegalAccessException { return getVariablesAndValuesFromObject( object.getClass(), object ); @@ -381,24 +593,21 @@ * @param object * @return map of variable names and values */ - protected Map getVariablesAndValuesFromObject( Class clazz, Object object ) + protected Map getVariablesAndValuesFromObject( Class clazz, Object object ) throws IllegalAccessException { - Map map = new HashMap(); + Map map = new HashMap(); Field[] fields = clazz.getDeclaredFields(); AccessibleObject.setAccessible( fields, true ); - for ( int i = 0; i < fields.length; ++i ) + for ( Field field : fields ) { - Field field = fields[i]; - map.put( field.getName(), field.get( object ) ); - } - Class superclass = clazz.getSuperclass(); + Class superclass = clazz.getSuperclass(); if ( !Object.class.equals( superclass ) ) { diff -Nru maven-plugin-testing-1.3/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/ArtifactStubFactory.java maven-plugin-testing-2.1/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/ArtifactStubFactory.java --- maven-plugin-testing-1.3/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/ArtifactStubFactory.java 2011-03-26 21:40:19.000000000 +0000 +++ maven-plugin-testing-2.1/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/ArtifactStubFactory.java 2012-05-20 14:48:44.000000000 +0000 @@ -47,7 +47,7 @@ * plugins that need to simulate artifacts for unit tests. * * @author Brian Fox - * @version $Id: ArtifactStubFactory.java 1085807 2011-03-26 21:40:19Z hboutemy $ + * @version $Id: ArtifactStubFactory.java 1340745 2012-05-20 14:48:44Z hboutemy $ */ public class ArtifactStubFactory { @@ -242,7 +242,8 @@ { if ( workingDir == null ) { - throw new IllegalArgumentException( "The workingDir must be set." ); + throw new IllegalArgumentException( + "The workingDir must be set." ); } String fileName = getFormattedFileName( artifact, false ); @@ -262,15 +263,11 @@ } catch ( NoSuchArchiverException e ) { - IOException ioe = new IOException( "NoSuchArchiverException: " + e.getMessage() ); - ioe.initCause( e ); - throw ioe; + throw new IOException( "NoSuchArchiverException: " + e.getMessage() ); } catch ( ArchiverException e ) { - IOException ioe = new IOException( "ArchiverException: " + e.getMessage() ); - ioe.initCause( e ); - throw ioe; + throw new IOException( "ArchiverException: " + e.getMessage() ); } } else @@ -287,7 +284,7 @@ */ public static String getUnpackableFileName( Artifact artifact ) { - return artifact.getGroupId() + "-" + artifact.getArtifactId() + "-" + artifact.getVersion() + "-" + return "" + artifact.getGroupId() + "-" + artifact.getArtifactId() + "-" + artifact.getVersion() + "-" + artifact.getClassifier() + "-" + artifact.getType() + ".txt"; } @@ -352,10 +349,10 @@ * @see #getReleaseArtifact() * @see #getSnapshotArtifact() */ - public Set getReleaseAndSnapshotArtifacts() + public Set getReleaseAndSnapshotArtifacts() throws IOException { - Set set = new HashSet(); + Set set = new HashSet(); set.add( getReleaseArtifact() ); set.add( getSnapshotArtifact() ); return set; @@ -366,10 +363,10 @@ * g:provided:jar:1.0, g:compile:jar:1.0, g:system:jar:1.0, g:test:jar:1.0, g:runtime:jar:1.0 * @throws IOException if any */ - public Set getScopedArtifacts() + public Set getScopedArtifacts() throws IOException { - Set set = new HashSet(); + Set set = new HashSet(); set.add( createArtifact( "g", "compile", "1.0", Artifact.SCOPE_COMPILE ) ); set.add( createArtifact( "g", "provided", "1.0", Artifact.SCOPE_PROVIDED ) ); set.add( createArtifact( "g", "test", "1.0", Artifact.SCOPE_TEST ) ); @@ -383,10 +380,10 @@ * g:d:zip:1.0, g:a:war:1.0, g:b:jar:1.0, g:c:sources:1.0, g:e:rar:1.0 * @throws IOException if any */ - public Set getTypedArtifacts() + public Set getTypedArtifacts() throws IOException { - Set set = new HashSet(); + Set set = new HashSet(); set.add( createArtifact( "g", "a", "1.0", Artifact.SCOPE_COMPILE, "war", null ) ); set.add( createArtifact( "g", "b", "1.0", Artifact.SCOPE_COMPILE, "jar", null ) ); set.add( createArtifact( "g", "c", "1.0", Artifact.SCOPE_COMPILE, "sources", null ) ); @@ -400,10 +397,10 @@ * g:c:jar:three:1.0, g:b:jar:two:1.0, g:d:jar:four:1.0, g:a:jar:one:1.0 * @throws IOException if any */ - public Set getClassifiedArtifacts() + public Set getClassifiedArtifacts() throws IOException { - Set set = new HashSet(); + Set set = new HashSet(); set.add( createArtifact( "g", "a", "1.0", Artifact.SCOPE_COMPILE, "jar", "one" ) ); set.add( createArtifact( "g", "b", "1.0", Artifact.SCOPE_COMPILE, "jar", "two" ) ); set.add( createArtifact( "g", "c", "1.0", Artifact.SCOPE_COMPILE, "jar", "three" ) ); @@ -416,10 +413,10 @@ * g:d:zip:1.0, g:a:war:1.0, g:b:jar:1.0, g:e:rar:1.0 * @throws IOException if any */ - public Set getTypedArchiveArtifacts() + public Set getTypedArchiveArtifacts() throws IOException { - Set set = new HashSet(); + Set set = new HashSet(); set.add( createArtifact( "g", "a", "1.0", Artifact.SCOPE_COMPILE, "war", null ) ); set.add( createArtifact( "g", "b", "1.0", Artifact.SCOPE_COMPILE, "jar", null ) ); set.add( createArtifact( "g", "d", "1.0", Artifact.SCOPE_COMPILE, "zip", null ) ); @@ -432,10 +429,10 @@ * g:one:jar:a:1.0, g:two:jar:a:1.0, g:four:jar:a:1.0, g:three:jar:a:1.0 * @throws IOException if any */ - public Set getArtifactArtifacts() + public Set getArtifactArtifacts() throws IOException { - Set set = new HashSet(); + Set set = new HashSet(); set.add( createArtifact( "g", "one", "1.0", Artifact.SCOPE_COMPILE, "jar", "a" ) ); set.add( createArtifact( "g", "two", "1.0", Artifact.SCOPE_COMPILE, "jar", "a" ) ); set.add( createArtifact( "g", "three", "1.0", Artifact.SCOPE_COMPILE, "jar", "a" ) ); @@ -449,10 +446,10 @@ * two:group-two:jar:a:1.0 * @throws IOException if any */ - public Set getGroupIdArtifacts() + public Set getGroupIdArtifacts() throws IOException { - Set set = new HashSet(); + Set set = new HashSet(); set.add( createArtifact( "one", "group-one", "1.0", Artifact.SCOPE_COMPILE, "jar", "a" ) ); set.add( createArtifact( "two", "group-two", "1.0", Artifact.SCOPE_COMPILE, "jar", "a" ) ); set.add( createArtifact( "three", "group-three", "1.0", Artifact.SCOPE_COMPILE, "jar", "a" ) ); @@ -467,10 +464,10 @@ * @see #getScopedArtifacts() * @see #getReleaseAndSnapshotArtifacts() */ - public Set getMixedArtifacts() + public Set getMixedArtifacts() throws IOException { - Set set = new HashSet(); + Set set = new HashSet(); set.addAll( getTypedArtifacts() ); set.addAll( getScopedArtifacts() ); set.addAll( getReleaseAndSnapshotArtifacts() ); diff -Nru maven-plugin-testing-1.3/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/SilentLog.java maven-plugin-testing-2.1/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/SilentLog.java --- maven-plugin-testing-1.3/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/SilentLog.java 2008-03-18 11:39:00.000000000 +0000 +++ maven-plugin-testing-2.1/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/SilentLog.java 2009-06-17 00:00:18.000000000 +0000 @@ -27,7 +27,7 @@ * to turn off logs during testing where they aren't desired. * * @author Brian Fox - * @version $Id: SilentLog.java 638332 2008-03-18 11:39:00Z bentmann $ + * @version $Id: SilentLog.java 785452 2009-06-17 00:00:18Z olamy $ */ public class SilentLog implements Log, Logger @@ -325,4 +325,10 @@ { return null; } + + public void setThreshold( int threshold ) + { + // TODO Auto-generated method stub + + } } diff -Nru maven-plugin-testing-1.3/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/ArtifactStub.java maven-plugin-testing-2.1/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/ArtifactStub.java --- maven-plugin-testing-1.3/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/ArtifactStub.java 2012-09-24 15:59:18.000000000 +0000 +++ maven-plugin-testing-2.1/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/ArtifactStub.java 2012-05-20 15:20:59.000000000 +0000 @@ -19,24 +19,24 @@ * under the License. */ -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.versioning.VersionRange; -import org.apache.maven.artifact.versioning.ArtifactVersion; -import org.apache.maven.artifact.versioning.OverConstrainedVersionException; -import org.apache.maven.artifact.handler.ArtifactHandler; -import org.apache.maven.artifact.resolver.filter.ArtifactFilter; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.metadata.ArtifactMetadata; - import java.io.File; import java.util.Collection; import java.util.List; +import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.handler.ArtifactHandler; +import org.apache.maven.artifact.metadata.ArtifactMetadata; +import org.apache.maven.artifact.repository.ArtifactRepository; +import org.apache.maven.artifact.resolver.filter.ArtifactFilter; +import org.apache.maven.artifact.versioning.ArtifactVersion; +import org.apache.maven.artifact.versioning.OverConstrainedVersionException; +import org.apache.maven.artifact.versioning.VersionRange; + /** * Stub class for {@link Artifact} testing. * * @author jesse - * @version $Id: ArtifactStub.java 1389449 2012-09-24 15:59:18Z krosenvold $ + * @version $Id: ArtifactStub.java 1340752 2012-05-20 15:20:59Z hboutemy $ */ public class ArtifactStub implements Artifact @@ -67,12 +67,6 @@ return 0; } - - public ArtifactMetadata getMetadata( Class aClass ) - { - return null; - } - /** {@inheritDoc} */ public String getGroupId() { @@ -177,7 +171,14 @@ */ public String getDependencyConflictId() { - return getGroupId() + ':' + getArtifactId() + ':' + getType() + getClassifier(); + StringBuffer buffer = new StringBuffer(); + + buffer.append( getGroupId() ); + buffer.append( ":" ).append( getArtifactId() ); + buffer.append( ":" ).append( getType() ); + buffer.append( ":" ).append( getClassifier() ); + + return buffer.toString(); } /** @@ -194,7 +195,7 @@ * @return null. * @see org.apache.maven.artifact.Artifact#getMetadataList() */ - public Collection getMetadataList() + public Collection getMetadataList() { return null; } @@ -272,7 +273,7 @@ * @return null. * @see org.apache.maven.artifact.Artifact#getDependencyTrail() */ - public List getDependencyTrail() + public List getDependencyTrail() { return null; } @@ -282,7 +283,7 @@ * * @see org.apache.maven.artifact.Artifact#setDependencyTrail(java.util.List) */ - public void setDependencyTrail( List list ) + public void setDependencyTrail( List list ) { // nop } @@ -406,7 +407,7 @@ * @return null. * @see org.apache.maven.artifact.Artifact#getAvailableVersions() */ - public List getAvailableVersions() + public List getAvailableVersions() { return null; } @@ -416,7 +417,7 @@ * * @see org.apache.maven.artifact.Artifact#setAvailableVersions(java.util.List) */ - public void setAvailableVersions( List list ) + public void setAvailableVersions( List list ) { // nop } @@ -496,4 +497,14 @@ sb.append( getClassifier() ); } } + + public boolean isFromAuthoritativeRepository() + { + return true; + } + + public void setFromAuthoritativeRepository( boolean fromAuthoritativeRepository ) + { + // nothing + } } diff -Nru maven-plugin-testing-1.3/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/DefaultArtifactHandlerStub.java maven-plugin-testing-2.1/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/DefaultArtifactHandlerStub.java --- maven-plugin-testing-1.3/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/DefaultArtifactHandlerStub.java 2011-03-26 21:40:19.000000000 +0000 +++ maven-plugin-testing-2.1/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/DefaultArtifactHandlerStub.java 2008-03-18 11:39:00.000000000 +0000 @@ -25,7 +25,7 @@ * Minimal artifact handler used by the stub factory to create unpackable archives. * * @author Brian Fox - * @version $Id: DefaultArtifactHandlerStub.java 1085807 2011-03-26 21:40:19Z hboutemy $ + * @version $Id: DefaultArtifactHandlerStub.java 638332 2008-03-18 11:39:00Z bentmann $ */ public class DefaultArtifactHandlerStub implements ArtifactHandler @@ -54,7 +54,7 @@ { type = t; classifier = c; - if ( "test-jar".equals( t ) ) + if ( t.equals( "test-jar" ) ) { extension = "jar"; } diff -Nru maven-plugin-testing-1.3/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/MavenProjectStub.java maven-plugin-testing-2.1/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/MavenProjectStub.java --- maven-plugin-testing-1.3/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/MavenProjectStub.java 2011-03-26 21:40:19.000000000 +0000 +++ maven-plugin-testing-2.1/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/MavenProjectStub.java 2012-05-20 15:20:59.000000000 +0000 @@ -21,7 +21,6 @@ import java.io.File; import java.io.IOException; -import java.io.Reader; import java.io.Writer; import java.util.ArrayList; import java.util.Collections; @@ -38,9 +37,11 @@ import org.apache.maven.model.Build; import org.apache.maven.model.CiManagement; import org.apache.maven.model.Contributor; +import org.apache.maven.model.Dependency; import org.apache.maven.model.DependencyManagement; import org.apache.maven.model.Developer; import org.apache.maven.model.DistributionManagement; +import org.apache.maven.model.Extension; import org.apache.maven.model.IssueManagement; import org.apache.maven.model.License; import org.apache.maven.model.MailingList; @@ -49,14 +50,15 @@ import org.apache.maven.model.Plugin; import org.apache.maven.model.PluginManagement; import org.apache.maven.model.Prerequisites; +import org.apache.maven.model.Profile; +import org.apache.maven.model.ReportPlugin; import org.apache.maven.model.Reporting; +import org.apache.maven.model.Repository; import org.apache.maven.model.Resource; import org.apache.maven.model.Scm; import org.apache.maven.model.io.xpp3.MavenXpp3Reader; import org.apache.maven.project.MavenProject; -import org.apache.maven.project.artifact.InvalidDependencyVersionException; import org.codehaus.plexus.PlexusTestCase; -import org.codehaus.plexus.util.IOUtil; import org.codehaus.plexus.util.ReaderFactory; import org.codehaus.plexus.util.xml.Xpp3Dom; import org.codehaus.plexus.util.xml.pull.XmlPullParserException; @@ -66,7 +68,7 @@ * useful as a stub though. * * @author jesse - * @version $Id: MavenProjectStub.java 1085807 2011-03-26 21:40:19Z hboutemy $ + * @version $Id: MavenProjectStub.java 1340752 2012-05-20 15:20:59Z hboutemy $ */ public class MavenProjectStub extends MavenProject @@ -83,65 +85,65 @@ private File file; - private List collectedProjects; + private List collectedProjects; - private List attachedArtifacts; + private List attachedArtifacts; - private List compileSourceRoots; + private List compileSourceRoots; - private List testCompileSourceRoots; + private List testCompileSourceRoots; - private List scriptSourceRoots; + private List scriptSourceRoots; - private List pluginArtifactRepositories; + private List pluginArtifactRepositories; private ArtifactRepository releaseArtifactRepository; private ArtifactRepository snapshotArtifactRepository; - private List activeProfiles; + private List activeProfiles; - private Set dependencyArtifacts; + private Set dependencyArtifacts; private Artifact artifact; - private Map artifactMap; + private Map artifactMap; private Model originalModel; - private Map pluginArtifactMap; + private Map pluginArtifactMap; - private Map reportArtifactMap; + private Map reportArtifactMap; - private Map extensionArtifactMap; + private Map extensionArtifactMap; - private Map projectReferences; + private Map projectReferences; private Build buildOverlay; private boolean executionRoot; - private List compileArtifacts; + private List compileArtifacts; - private List compileDependencies; + private List compileDependencies; - private List systemDependencies; + private List systemDependencies; - private List testClasspathElements; + private List testClasspathElements; - private List testDependencies; + private List testDependencies; - private List systemClasspathElements; + private List systemClasspathElements; - private List systemArtifacts; + private List systemArtifacts; - private List testArtifacts; + private List testArtifacts; - private List runtimeArtifacts; + private List runtimeArtifacts; - private List runtimeDependencies; + private List runtimeDependencies; - private List runtimeClasspathElements; + private List runtimeClasspathElements; private String modelVersion; @@ -157,7 +159,7 @@ private String defaultGoal; - private List licenses; + private List licenses; private Build build; @@ -191,11 +193,9 @@ { pomFile = new File( getBasedir(), pomFile.getPath() ); } - Reader reader = null; try { - reader = ReaderFactory.newXmlReader( pomFile ); - setModel( new MavenXpp3Reader().read( reader ) ); + setModel( new MavenXpp3Reader().read( ReaderFactory.newXmlReader( pomFile ) ) ); } catch ( IOException e ) { @@ -205,10 +205,6 @@ { throw new RuntimeException( "Failed to parse POM file: " + pomFile, e ); } - finally - { - IOUtil.close( reader ); - } } /** @@ -267,7 +263,7 @@ * * @see org.apache.maven.project.MavenProject#setRemoteArtifactRepositories(java.util.List) */ - public void setRemoteArtifactRepositories( List list ) + public void setRemoteArtifactRepositories( List list ) { // nop } @@ -277,15 +273,20 @@ * * @see org.apache.maven.project.MavenProject#getRemoteArtifactRepositories() */ - public List getRemoteArtifactRepositories() + public List getRemoteArtifactRepositories() { - return Collections.EMPTY_LIST; + return Collections.emptyList(); } /** {@inheritDoc} */ public boolean hasParent() { - return ( parent != null ); + if ( parent != null ) + { + return true; + } + + return false; } /** {@inheritDoc} */ @@ -311,7 +312,7 @@ * * @see org.apache.maven.project.MavenProject#setDependencies(java.util.List) */ - public void setDependencies( List list ) + public void setDependencies( List list ) { // nop } @@ -321,9 +322,9 @@ * * @see org.apache.maven.project.MavenProject#getDependencies() */ - public List getDependencies() + public List getDependencies() { - return Collections.EMPTY_LIST; + return Collections.emptyList(); } /** @@ -341,7 +342,7 @@ { if ( compileSourceRoots == null ) { - compileSourceRoots = new ArrayList( Collections.singletonList( string ) ); + compileSourceRoots = new ArrayList( Collections.singletonList( string ) ); } else { @@ -354,7 +355,7 @@ { if ( scriptSourceRoots == null ) { - scriptSourceRoots = new ArrayList( Collections.singletonList( string ) ); + scriptSourceRoots = new ArrayList( Collections.singletonList( string ) ); } else { @@ -367,7 +368,7 @@ { if ( testCompileSourceRoots == null ) { - testCompileSourceRoots = new ArrayList( Collections.singletonList( string ) ); + testCompileSourceRoots = new ArrayList( Collections.singletonList( string ) ); } else { @@ -376,25 +377,25 @@ } /** {@inheritDoc} */ - public List getCompileSourceRoots() + public List getCompileSourceRoots() { return compileSourceRoots; } /** {@inheritDoc} */ - public List getScriptSourceRoots() + public List getScriptSourceRoots() { return scriptSourceRoots; } /** {@inheritDoc} */ - public List getTestCompileSourceRoots() + public List getTestCompileSourceRoots() { return testCompileSourceRoots; } /** {@inheritDoc} */ - public List getCompileClasspathElements() + public List getCompileClasspathElements() throws DependencyResolutionRequiredException { return compileSourceRoots; @@ -403,70 +404,70 @@ /** * @param compileArtifacts */ - public void setCompileArtifacts( List compileArtifacts ) + public void setCompileArtifacts( List compileArtifacts ) { this.compileArtifacts = compileArtifacts; } /** {@inheritDoc} */ - public List getCompileArtifacts() + public List getCompileArtifacts() { return compileArtifacts; } /** {@inheritDoc} */ - public List getCompileDependencies() + public List getCompileDependencies() { return compileDependencies; } /** {@inheritDoc} */ - public List getTestClasspathElements() + public List getTestClasspathElements() throws DependencyResolutionRequiredException { return testClasspathElements; } /** {@inheritDoc} */ - public List getTestArtifacts() + public List getTestArtifacts() { return testArtifacts; } /** {@inheritDoc} */ - public List getTestDependencies() + public List getTestDependencies() { return testDependencies; } /** {@inheritDoc} */ - public List getRuntimeClasspathElements() + public List getRuntimeClasspathElements() throws DependencyResolutionRequiredException { return runtimeClasspathElements; } /** {@inheritDoc} */ - public List getRuntimeArtifacts() + public List getRuntimeArtifacts() { return runtimeArtifacts; } /** {@inheritDoc} */ - public List getRuntimeDependencies() + public List getRuntimeDependencies() { return runtimeDependencies; } /** {@inheritDoc} */ - public List getSystemClasspathElements() + public List getSystemClasspathElements() throws DependencyResolutionRequiredException { return systemClasspathElements; } /** {@inheritDoc} */ - public List getSystemArtifacts() + public List getSystemArtifacts() { return systemArtifacts; } @@ -474,7 +475,7 @@ /** * @param runtimeClasspathElements */ - public void setRuntimeClasspathElements( List runtimeClasspathElements ) + public void setRuntimeClasspathElements( List runtimeClasspathElements ) { this.runtimeClasspathElements = runtimeClasspathElements; } @@ -482,7 +483,7 @@ /** * @param attachedArtifacts */ - public void setAttachedArtifacts( List attachedArtifacts ) + public void setAttachedArtifacts( List attachedArtifacts ) { this.attachedArtifacts = attachedArtifacts; } @@ -490,7 +491,7 @@ /** * @param compileSourceRoots */ - public void setCompileSourceRoots( List compileSourceRoots ) + public void setCompileSourceRoots( List compileSourceRoots ) { this.compileSourceRoots = compileSourceRoots; } @@ -498,7 +499,7 @@ /** * @param testCompileSourceRoots */ - public void setTestCompileSourceRoots( List testCompileSourceRoots ) + public void setTestCompileSourceRoots( List testCompileSourceRoots ) { this.testCompileSourceRoots = testCompileSourceRoots; } @@ -506,7 +507,7 @@ /** * @param scriptSourceRoots */ - public void setScriptSourceRoots( List scriptSourceRoots ) + public void setScriptSourceRoots( List scriptSourceRoots ) { this.scriptSourceRoots = scriptSourceRoots; } @@ -514,7 +515,7 @@ /** * @param artifactMap */ - public void setArtifactMap( Map artifactMap ) + public void setArtifactMap( Map artifactMap ) { this.artifactMap = artifactMap; } @@ -522,7 +523,7 @@ /** * @param pluginArtifactMap */ - public void setPluginArtifactMap( Map pluginArtifactMap ) + public void setPluginArtifactMap( Map pluginArtifactMap ) { this.pluginArtifactMap = pluginArtifactMap; } @@ -530,7 +531,7 @@ /** * @param reportArtifactMap */ - public void setReportArtifactMap( Map reportArtifactMap ) + public void setReportArtifactMap( Map reportArtifactMap ) { this.reportArtifactMap = reportArtifactMap; } @@ -538,7 +539,7 @@ /** * @param extensionArtifactMap */ - public void setExtensionArtifactMap( Map extensionArtifactMap ) + public void setExtensionArtifactMap( Map extensionArtifactMap ) { this.extensionArtifactMap = extensionArtifactMap; } @@ -546,7 +547,7 @@ /** * @param projectReferences */ - public void setProjectReferences( Map projectReferences ) + public void setProjectReferences( Map projectReferences ) { this.projectReferences = projectReferences; } @@ -562,7 +563,7 @@ /** * @param compileDependencies */ - public void setCompileDependencies( List compileDependencies ) + public void setCompileDependencies( List compileDependencies ) { this.compileDependencies = compileDependencies; } @@ -570,7 +571,7 @@ /** * @param systemDependencies */ - public void setSystemDependencies( List systemDependencies ) + public void setSystemDependencies( List systemDependencies ) { this.systemDependencies = systemDependencies; } @@ -578,7 +579,7 @@ /** * @param testClasspathElements */ - public void setTestClasspathElements( List testClasspathElements ) + public void setTestClasspathElements( List testClasspathElements ) { this.testClasspathElements = testClasspathElements; } @@ -586,7 +587,7 @@ /** * @param testDependencies */ - public void setTestDependencies( List testDependencies ) + public void setTestDependencies( List testDependencies ) { this.testDependencies = testDependencies; } @@ -594,7 +595,7 @@ /** * @param systemClasspathElements */ - public void setSystemClasspathElements( List systemClasspathElements ) + public void setSystemClasspathElements( List systemClasspathElements ) { this.systemClasspathElements = systemClasspathElements; } @@ -602,7 +603,7 @@ /** * @param systemArtifacts */ - public void setSystemArtifacts( List systemArtifacts ) + public void setSystemArtifacts( List systemArtifacts ) { this.systemArtifacts = systemArtifacts; } @@ -610,7 +611,7 @@ /** * @param testArtifacts */ - public void setTestArtifacts( List testArtifacts ) + public void setTestArtifacts( List testArtifacts ) { this.testArtifacts = testArtifacts; } @@ -618,7 +619,7 @@ /** * @param runtimeArtifacts */ - public void setRuntimeArtifacts( List runtimeArtifacts ) + public void setRuntimeArtifacts( List runtimeArtifacts ) { this.runtimeArtifacts = runtimeArtifacts; } @@ -626,7 +627,7 @@ /** * @param runtimeDependencies */ - public void setRuntimeDependencies( List runtimeDependencies ) + public void setRuntimeDependencies( List runtimeDependencies ) { this.runtimeDependencies = runtimeDependencies; } @@ -640,7 +641,7 @@ } /** {@inheritDoc} */ - public List getSystemDependencies() + public List getSystemDependencies() { return systemDependencies; } @@ -878,7 +879,7 @@ * * @see org.apache.maven.project.MavenProject#setMailingLists(java.util.List) */ - public void setMailingLists( List list ) + public void setMailingLists( List list ) { // nop } @@ -888,9 +889,9 @@ * * @see org.apache.maven.project.MavenProject#getMailingLists() */ - public List getMailingLists() + public List getMailingLists() { - return Collections.EMPTY_LIST; + return Collections.emptyList(); } /** @@ -908,7 +909,7 @@ * * @see org.apache.maven.project.MavenProject#setDevelopers(java.util.List) */ - public void setDevelopers( List list ) + public void setDevelopers( List list ) { // nop } @@ -918,9 +919,9 @@ * * @see org.apache.maven.project.MavenProject#getDevelopers() */ - public List getDevelopers() + public List getDevelopers() { - return Collections.EMPTY_LIST; + return Collections.emptyList(); } /** @@ -938,7 +939,7 @@ * * @see org.apache.maven.project.MavenProject#setContributors(java.util.List) */ - public void setContributors( List list ) + public void setContributors( List list ) { // nop } @@ -948,9 +949,9 @@ * * @see org.apache.maven.project.MavenProject#getContributors() */ - public List getContributors() + public List getContributors() { - return Collections.EMPTY_LIST; + return Collections.emptyList(); } /** @@ -980,9 +981,9 @@ * * @see org.apache.maven.project.MavenProject#getResources() */ - public List getResources() + public List getResources() { - return Collections.EMPTY_LIST; + return Collections.emptyList(); } /** @@ -990,9 +991,9 @@ * * @see org.apache.maven.project.MavenProject#getTestResources() */ - public List getTestResources() + public List getTestResources() { - return Collections.EMPTY_LIST; + return Collections.emptyList(); } /** @@ -1036,13 +1037,13 @@ } /** {@inheritDoc} */ - public void setLicenses( List licenses ) + public void setLicenses( List licenses ) { this.licenses = licenses; } /** {@inheritDoc} */ - public List getLicenses() + public List getLicenses() { return licenses; } @@ -1062,7 +1063,7 @@ * * @see org.apache.maven.project.MavenProject#setArtifacts(java.util.Set) */ - public void setArtifacts( Set set ) + public void setArtifacts( Set set ) { // nop } @@ -1072,9 +1073,9 @@ * * @see org.apache.maven.project.MavenProject#getArtifacts() */ - public Set getArtifacts() + public Set getArtifacts() { - return Collections.EMPTY_SET; + return Collections.emptySet(); } /** @@ -1082,9 +1083,9 @@ * * @see org.apache.maven.project.MavenProject#getArtifactMap() */ - public Map getArtifactMap() + public Map getArtifactMap() { - return Collections.EMPTY_MAP; + return Collections.emptyMap(); } /** @@ -1092,7 +1093,7 @@ * * @see org.apache.maven.project.MavenProject#setPluginArtifacts(java.util.Set) */ - public void setPluginArtifacts( Set set ) + public void setPluginArtifacts( Set set ) { // nop } @@ -1102,9 +1103,9 @@ * * @see org.apache.maven.project.MavenProject#getPluginArtifacts() */ - public Set getPluginArtifacts() + public Set getPluginArtifacts() { - return Collections.EMPTY_SET; + return Collections.emptySet(); } /** @@ -1112,9 +1113,9 @@ * * @see org.apache.maven.project.MavenProject#getPluginArtifactMap() */ - public Map getPluginArtifactMap() + public Map getPluginArtifactMap() { - return Collections.EMPTY_MAP; + return Collections.emptyMap(); } /** @@ -1122,7 +1123,7 @@ * * @see org.apache.maven.project.MavenProject#setReportArtifacts(java.util.Set) */ - public void setReportArtifacts( Set set ) + public void setReportArtifacts( Set set ) { // nop } @@ -1132,9 +1133,9 @@ * * @see org.apache.maven.project.MavenProject#getReportArtifacts() */ - public Set getReportArtifacts() + public Set getReportArtifacts() { - return Collections.EMPTY_SET; + return Collections.emptySet(); } /** @@ -1142,9 +1143,9 @@ * * @see org.apache.maven.project.MavenProject#getReportArtifactMap() */ - public Map getReportArtifactMap() + public Map getReportArtifactMap() { - return Collections.EMPTY_MAP; + return Collections.emptyMap(); } /** @@ -1152,7 +1153,7 @@ * * @see org.apache.maven.project.MavenProject#setExtensionArtifacts(java.util.Set) */ - public void setExtensionArtifacts( Set set ) + public void setExtensionArtifacts( Set set ) { // nop } @@ -1162,9 +1163,9 @@ * * @see org.apache.maven.project.MavenProject#getExtensionArtifacts() */ - public Set getExtensionArtifacts() + public Set getExtensionArtifacts() { - return Collections.EMPTY_SET; + return Collections.emptySet(); } /** @@ -1172,9 +1173,9 @@ * * @see org.apache.maven.project.MavenProject#getExtensionArtifactMap() */ - public Map getExtensionArtifactMap() + public Map getExtensionArtifactMap() { - return Collections.EMPTY_MAP; + return Collections.emptyMap(); } /** @@ -1202,9 +1203,9 @@ * * @see org.apache.maven.project.MavenProject#getRepositories() */ - public List getRepositories() + public List getRepositories() { - return Collections.EMPTY_LIST; + return Collections.emptyList(); } /** @@ -1212,9 +1213,9 @@ * * @see org.apache.maven.project.MavenProject#getReportPlugins() */ - public List getReportPlugins() + public List getReportPlugins() { - return Collections.EMPTY_LIST; + return Collections.emptyList(); } /** @@ -1222,9 +1223,9 @@ * * @see org.apache.maven.project.MavenProject#getBuildPlugins() */ - public List getBuildPlugins() + public List getBuildPlugins() { - return Collections.EMPTY_LIST; + return Collections.emptyList(); } /** @@ -1232,9 +1233,9 @@ * * @see org.apache.maven.project.MavenProject#getModules() */ - public List getModules() + public List getModules() { - return Collections.EMPTY_LIST; + return Collections.emptyList(); } /** @@ -1268,25 +1269,25 @@ } /** {@inheritDoc} */ - public List getCollectedProjects() + public List getCollectedProjects() { return collectedProjects; } /** {@inheritDoc} */ - public void setCollectedProjects( List list ) + public void setCollectedProjects( List list ) { this.collectedProjects = list; } /** {@inheritDoc} */ - public void setPluginArtifactRepositories( List list ) + public void setPluginArtifactRepositories( List list ) { this.pluginArtifactRepositories = list; } /** {@inheritDoc} */ - public List getPluginArtifactRepositories() + public List getPluginArtifactRepositories() { return pluginArtifactRepositories; } @@ -1306,19 +1307,19 @@ * * @see org.apache.maven.project.MavenProject#getPluginRepositories() */ - public List getPluginRepositories() + public List getPluginRepositories() { - return Collections.EMPTY_LIST; + return Collections.emptyList(); } /** {@inheritDoc} */ - public void setActiveProfiles( List list ) + public void setActiveProfiles( List list ) { activeProfiles = list; } /** {@inheritDoc} */ - public List getActiveProfiles() + public List getActiveProfiles() { return activeProfiles; } @@ -1328,7 +1329,7 @@ { if ( attachedArtifacts == null ) { - this.attachedArtifacts = new ArrayList( Collections.singletonList( artifact ) ); + this.attachedArtifacts = new ArrayList( Collections.singletonList( artifact ) ); } else { @@ -1337,7 +1338,7 @@ } /** {@inheritDoc} */ - public List getAttachedArtifacts() + public List getAttachedArtifacts() { return attachedArtifacts; } @@ -1405,13 +1406,13 @@ } /** {@inheritDoc} */ - public Set getDependencyArtifacts() + public Set getDependencyArtifacts() { return dependencyArtifacts; } /** {@inheritDoc} */ - public void setDependencyArtifacts( Set set ) + public void setDependencyArtifacts( Set set ) { this.dependencyArtifacts = set; } @@ -1445,9 +1446,9 @@ * * @see org.apache.maven.project.MavenProject#getBuildExtensions() */ - public List getBuildExtensions() + public List getBuildExtensions() { - return Collections.EMPTY_LIST; + return Collections.emptyList(); } /** @@ -1455,10 +1456,9 @@ * * @see org.apache.maven.project.MavenProject#createArtifacts(org.apache.maven.artifact.factory.ArtifactFactory, java.lang.String, org.apache.maven.artifact.resolver.filter.ArtifactFilter) */ - public Set createArtifacts( ArtifactFactory artifactFactory, String string, ArtifactFilter artifactFilter ) - throws InvalidDependencyVersionException + public Set createArtifacts( ArtifactFactory artifactFactory, String string, ArtifactFilter artifactFilter ) { - return Collections.EMPTY_SET; + return Collections.emptySet(); } /** @@ -1496,9 +1496,9 @@ * * @see org.apache.maven.project.MavenProject#getFilters() */ - public List getFilters() + public List getFilters() { - return Collections.EMPTY_LIST; + return Collections.emptyList(); } /** @@ -1506,9 +1506,9 @@ * * @see org.apache.maven.project.MavenProject#getProjectReferences() */ - public Map getProjectReferences() + public Map getProjectReferences() { - return Collections.EMPTY_MAP; + return Collections.emptyMap(); } /** {@inheritDoc} */ diff -Nru maven-plugin-testing-1.3/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/StubArtifactCollector.java maven-plugin-testing-2.1/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/StubArtifactCollector.java --- maven-plugin-testing-1.3/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/StubArtifactCollector.java 2008-03-18 11:39:00.000000000 +0000 +++ maven-plugin-testing-2.1/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/StubArtifactCollector.java 2009-11-11 15:40:37.000000000 +0000 @@ -19,8 +19,6 @@ * under the License. */ -import java.util.HashSet; -import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; @@ -28,15 +26,18 @@ import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.metadata.ArtifactMetadataSource; import org.apache.maven.artifact.repository.ArtifactRepository; +import org.apache.maven.artifact.repository.RepositoryRequest; import org.apache.maven.artifact.resolver.ArtifactCollector; import org.apache.maven.artifact.resolver.ArtifactResolutionException; +import org.apache.maven.artifact.resolver.ArtifactResolutionRequest; import org.apache.maven.artifact.resolver.ArtifactResolutionResult; -import org.apache.maven.artifact.resolver.ResolutionNode; +import org.apache.maven.artifact.resolver.ResolutionListener; import org.apache.maven.artifact.resolver.filter.ArtifactFilter; +import org.apache.maven.repository.legacy.resolver.conflict.ConflictResolver; /** * @author Brian Fox - * @version $Id: StubArtifactCollector.java 638332 2008-03-18 11:39:00Z bentmann $ + * @version $Id: StubArtifactCollector.java 834917 2009-11-11 15:40:37Z olamy $ */ public class StubArtifactCollector implements ArtifactCollector @@ -49,41 +50,42 @@ super(); } - /** {@inheritDoc} */ - public ArtifactResolutionResult collect( Set theArtifacts, Artifact theOriginatingArtifact, - ArtifactRepository theLocalRepository, List theRemoteRepositories, - ArtifactMetadataSource theSource, ArtifactFilter theFilter, - List theListeners ) - throws ArtifactResolutionException + public ArtifactResolutionResult collect( Set artifacts, Artifact originatingArtifact, + Map managedVersions, ArtifactResolutionRequest repositoryRequest, + ArtifactMetadataSource source, ArtifactFilter filter, + List listeners, + List conflictResolvers ) { - Set nodes = new HashSet(); - ArtifactResolutionResult arr = new ArtifactResolutionResult(); + return new ArtifactResolutionResult(); + } - Iterator iter = theArtifacts.iterator(); - while ( iter.hasNext() ) - { - nodes.add( new ResolutionNode( (Artifact) iter.next(), theRemoteRepositories ) ); - } - arr.setArtifactResolutionNodes( nodes ); - return arr; + public ArtifactResolutionResult collect( Set artifacts, Artifact originatingArtifact, + Map managedVersions, ArtifactRepository localRepository, + List remoteRepositories, + ArtifactMetadataSource source, ArtifactFilter filter, + List listeners, + List conflictResolvers ) + { + return new ArtifactResolutionResult(); } - /** {@inheritDoc} */ - public ArtifactResolutionResult collect( Set theArtifacts, Artifact theOriginatingArtifact, Map theManagedVersions, - ArtifactRepository theLocalRepository, List theRemoteRepositories, - ArtifactMetadataSource theSource, ArtifactFilter theFilter, - List theListeners ) - throws ArtifactResolutionException + public ArtifactResolutionResult collect( Set artifacts, Artifact originatingArtifact, + Map managedVersions, ArtifactRepository localRepository, + List remoteRepositories, + ArtifactMetadataSource source, ArtifactFilter filter, + List listeners ) { - Set nodes = new HashSet(); - ArtifactResolutionResult arr = new ArtifactResolutionResult(); + return new ArtifactResolutionResult(); + } - Iterator iter = theArtifacts.iterator(); - while ( iter.hasNext() ) - { - nodes.add( new ResolutionNode( (Artifact) iter.next(), theRemoteRepositories ) ); - } - arr.setArtifactResolutionNodes( nodes ); - return arr; + public ArtifactResolutionResult collect( Set artifacts, Artifact originatingArtifact, + ArtifactRepository localRepository, + List remoteRepositories, + ArtifactMetadataSource source, ArtifactFilter filter, + List listeners ) + throws ArtifactResolutionException + { + return new ArtifactResolutionResult(); } + } diff -Nru maven-plugin-testing-1.3/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/StubArtifactRepository.java maven-plugin-testing-2.1/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/StubArtifactRepository.java --- maven-plugin-testing-1.3/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/StubArtifactRepository.java 2008-03-18 11:39:00.000000000 +0000 +++ maven-plugin-testing-2.1/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/StubArtifactRepository.java 2011-11-25 21:41:59.000000000 +0000 @@ -23,11 +23,17 @@ import org.apache.maven.artifact.metadata.ArtifactMetadata; import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy; +import org.apache.maven.artifact.repository.Authentication; import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; +import org.apache.maven.repository.Proxy; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; /** * @author Brian Fox - * @version $Id: StubArtifactRepository.java 638332 2008-03-18 11:39:00Z bentmann $ + * @version $Id: StubArtifactRepository.java 1206336 2011-11-25 21:41:59Z olamy $ */ public class StubArtifactRepository implements ArtifactRepository @@ -170,4 +176,75 @@ { return false; } + + public Artifact find( Artifact artifact ) + { + // TODO Auto-generated method stub + return null; + } + + public Authentication getAuthentication() + { + return null; + } + + public Proxy getProxy() + { + return null; + } + + public void setAuthentication( Authentication authentication ) + { + + } + + public void setId( String id ) + { + + } + + public void setLayout( ArtifactRepositoryLayout layout ) + { + + } + + public void setProxy( Proxy proxy ) + { + + } + + public void setReleaseUpdatePolicy( ArtifactRepositoryPolicy policy ) + { + + } + + public void setSnapshotUpdatePolicy( ArtifactRepositoryPolicy policy ) + { + + } + + public void setUrl( String url ) + { + + } + + public List findVersions( Artifact artifact ) + { + return Collections.emptyList(); + } + + public boolean isProjectAware() + { + return false; + } + + public List getMirroredRepositories() + { + return new ArrayList( 0 ); + } + + public void setMirroredRepositories( List artifactRepositories ) + { + // no op + } } diff -Nru maven-plugin-testing-1.3/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/StubArtifactResolver.java maven-plugin-testing-2.1/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/StubArtifactResolver.java --- maven-plugin-testing-1.3/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/StubArtifactResolver.java 2008-03-18 11:39:00.000000000 +0000 +++ maven-plugin-testing-2.1/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/StubArtifactResolver.java 2012-05-20 15:20:59.000000000 +0000 @@ -29,16 +29,19 @@ import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.resolver.ArtifactNotFoundException; import org.apache.maven.artifact.resolver.ArtifactResolutionException; +import org.apache.maven.artifact.resolver.ArtifactResolutionRequest; import org.apache.maven.artifact.resolver.ArtifactResolutionResult; import org.apache.maven.artifact.resolver.ArtifactResolver; +import org.apache.maven.artifact.resolver.ResolutionListener; import org.apache.maven.artifact.resolver.filter.ArtifactFilter; import org.apache.maven.plugin.testing.ArtifactStubFactory; +import org.apache.maven.wagon.events.TransferListener; /** * Stub resolver. The constructor allows the specification of the exception to throw so that handling can be tested too. * * @author Brian Fox - * @version $Id: StubArtifactResolver.java 638332 2008-03-18 11:39:00Z bentmann $ + * @version $Id: StubArtifactResolver.java 1340752 2012-05-20 15:20:59Z hboutemy $ */ public class StubArtifactResolver implements ArtifactResolver @@ -69,7 +72,7 @@ * * @see org.apache.maven.artifact.resolver.ArtifactResolver#resolve(org.apache.maven.artifact.Artifact, java.util.List, org.apache.maven.artifact.repository.ArtifactRepository) */ - public void resolve( Artifact artifact, List remoteRepositories, ArtifactRepository localRepository ) + public void resolve( Artifact artifact, List remoteRepositories, ArtifactRepository localRepository ) throws ArtifactResolutionException, ArtifactNotFoundException { if ( !this.throwArtifactNotFoundException && !this.throwArtifactResolutionException ) @@ -101,8 +104,8 @@ * @return null. * @see org.apache.maven.artifact.resolver.ArtifactResolver#resolveTransitively(java.util.Set, org.apache.maven.artifact.Artifact, java.util.List, org.apache.maven.artifact.repository.ArtifactRepository, org.apache.maven.artifact.metadata.ArtifactMetadataSource) */ - public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, - List remoteRepositories, ArtifactRepository localRepository, + public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, + List remoteRepositories, ArtifactRepository localRepository, ArtifactMetadataSource source ) throws ArtifactResolutionException, ArtifactNotFoundException { @@ -113,9 +116,9 @@ * @return null. * @see org.apache.maven.artifact.resolver.ArtifactResolver#resolveTransitively(java.util.Set, org.apache.maven.artifact.Artifact, java.util.List, org.apache.maven.artifact.repository.ArtifactRepository, org.apache.maven.artifact.metadata.ArtifactMetadataSource, java.util.List) */ - public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, - List remoteRepositories, ArtifactRepository localRepository, - ArtifactMetadataSource source, List listeners ) + public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, + List remoteRepositories, ArtifactRepository localRepository, + ArtifactMetadataSource source, List listeners ) throws ArtifactResolutionException, ArtifactNotFoundException { return null; @@ -125,8 +128,8 @@ * @return null. * @see org.apache.maven.artifact.resolver.ArtifactResolver#resolveTransitively(java.util.Set, org.apache.maven.artifact.Artifact, org.apache.maven.artifact.repository.ArtifactRepository, java.util.List, org.apache.maven.artifact.metadata.ArtifactMetadataSource, org.apache.maven.artifact.resolver.filter.ArtifactFilter) */ - public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, - ArtifactRepository localRepository, List remoteRepositories, + public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, + ArtifactRepository localRepository, List remoteRepositories, ArtifactMetadataSource source, ArtifactFilter filter ) throws ArtifactResolutionException, ArtifactNotFoundException { @@ -137,9 +140,9 @@ * @return null. * @see org.apache.maven.artifact.resolver.ArtifactResolver#resolveTransitively(java.util.Set, org.apache.maven.artifact.Artifact, java.util.Map, org.apache.maven.artifact.repository.ArtifactRepository, java.util.List, org.apache.maven.artifact.metadata.ArtifactMetadataSource) */ - public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, + public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, Map managedVersions, ArtifactRepository localRepository, - List remoteRepositories, ArtifactMetadataSource source ) + List remoteRepositories, ArtifactMetadataSource source ) throws ArtifactResolutionException, ArtifactNotFoundException { return null; @@ -149,9 +152,9 @@ * @return null. * @see org.apache.maven.artifact.resolver.ArtifactResolver#resolveTransitively(java.util.Set, org.apache.maven.artifact.Artifact, java.util.Map, org.apache.maven.artifact.repository.ArtifactRepository, java.util.List, org.apache.maven.artifact.metadata.ArtifactMetadataSource, org.apache.maven.artifact.resolver.filter.ArtifactFilter) */ - public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, + public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, Map managedVersions, ArtifactRepository localRepository, - List remoteRepositories, ArtifactMetadataSource source, + List remoteRepositories, ArtifactMetadataSource source, ArtifactFilter filter ) throws ArtifactResolutionException, ArtifactNotFoundException { @@ -162,10 +165,10 @@ * @return null. * @see org.apache.maven.artifact.resolver.ArtifactResolver#resolveTransitively(java.util.Set, org.apache.maven.artifact.Artifact, java.util.Map, org.apache.maven.artifact.repository.ArtifactRepository, java.util.List, org.apache.maven.artifact.metadata.ArtifactMetadataSource, org.apache.maven.artifact.resolver.filter.ArtifactFilter, java.util.List) */ - public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, + public ArtifactResolutionResult resolveTransitively( Set artifacts, Artifact originatingArtifact, Map managedVersions, ArtifactRepository localRepository, - List remoteRepositories, ArtifactMetadataSource source, - ArtifactFilter filter, List listeners ) + List remoteRepositories, ArtifactMetadataSource source, + ArtifactFilter filter, List listeners ) throws ArtifactResolutionException, ArtifactNotFoundException { return null; @@ -176,9 +179,27 @@ * * @see org.apache.maven.artifact.resolver.ArtifactResolver#resolveAlways(org.apache.maven.artifact.Artifact, java.util.List, org.apache.maven.artifact.repository.ArtifactRepository) */ - public void resolveAlways( Artifact artifact, List remoteRepositories, ArtifactRepository localRepository ) + public void resolveAlways( Artifact artifact, List remoteRepositories, ArtifactRepository localRepository ) throws ArtifactResolutionException, ArtifactNotFoundException { // nop } + + public void resolve( Artifact artifact, List remoteRepositories, ArtifactRepository localRepository, + TransferListener downloadMonitor ) + throws ArtifactResolutionException, ArtifactNotFoundException + { + // TODO Auto-generated method stub + + } + + public ArtifactResolutionResult collect( ArtifactResolutionRequest request ) + { + return null; + } + + public ArtifactResolutionResult resolve( ArtifactResolutionRequest request ) + { + return null; + } } diff -Nru maven-plugin-testing-1.3/maven-plugin-testing-harness/src/site/apt/examples/artifact.apt maven-plugin-testing-2.1/maven-plugin-testing-harness/src/site/apt/examples/artifact.apt --- maven-plugin-testing-1.3/maven-plugin-testing-harness/src/site/apt/examples/artifact.apt 2008-03-18 11:39:00.000000000 +0000 +++ maven-plugin-testing-2.1/maven-plugin-testing-harness/src/site/apt/examples/artifact.apt 2012-06-02 04:53:53.000000000 +0000 @@ -30,17 +30,14 @@ Sometimes, your Mojo uses project artifact and ArtifactHandler mechanisms. For instance, you could need to filter on Java projects, i.e.: ------ ++---+ public class MyMojo extends AbstractMojo { /** * The Maven Project. - * - * @parameter expression="${project}" - * @required - * @readonly */ + @Component protected MavenProject project; public void execute() @@ -57,11 +54,11 @@ ... } } ------ ++---+ * Create Stubs ------ ++---+ public class MyArtifactHandlerStub extends DefaultArtifactHandler { @@ -82,9 +79,9 @@ this.language = language; } } ------ ++---+ ------ ++---+ public class MyArtifactStub extends ArtifactStub { @@ -192,9 +189,9 @@ this.handler = handler; } } ------ ++---+ ------ ++---+ public class MyProjectStub extends MavenProjectStub { @@ -215,4 +212,4 @@ ... } ------ ++---+ diff -Nru maven-plugin-testing-1.3/maven-plugin-testing-harness/src/site/apt/examples/complex-mojo-parameters.apt maven-plugin-testing-2.1/maven-plugin-testing-harness/src/site/apt/examples/complex-mojo-parameters.apt --- maven-plugin-testing-1.3/maven-plugin-testing-harness/src/site/apt/examples/complex-mojo-parameters.apt 2008-03-18 11:39:00.000000000 +0000 +++ maven-plugin-testing-2.1/maven-plugin-testing-harness/src/site/apt/examples/complex-mojo-parameters.apt 2012-06-02 04:53:53.000000000 +0000 @@ -32,7 +32,7 @@ Suppose that you have the following dependencies in the maven-my-plugin pom: ------ ++---+ ... @@ -49,51 +49,42 @@ ... ------ ++---+ You will add the following in the <<>>: ------ ++---+ public class MyMojo extends AbstractMojo { /** * The Maven Project. - * - * @parameter expression="${project}" - * @required - * @readonly */ + @Component protected MavenProject project; /** * Local Repository. - * - * @parameter expression="${localRepository}" - * @required - * @readonly */ + @Parameter( defaultValue = "${localRepository}", readonly = true, required = true ) protected ArtifactRepository localRepository; /** * The Maven Settings. - * - * @parameter default-value="${settings}" - * @required - * @readonly */ + @Component private Settings settings; ... } ------ ++---+ * Create Stubs You need to create stub objects to run <<>>. By convention, the package name should reflect the stubs, i.e. in our case <<>>. ------ ++---+ public class MyProjectStub extends MavenProjectStub { @@ -145,9 +136,9 @@ return new File( super.getBasedir() + "/src/test/resources/unit/project-to-test/" ); } } ------ ++---+ ------ ++---+ public class SettingsStub extends Settings { @@ -157,11 +148,11 @@ return Collections.EMPTY_LIST; } } ------ ++---+ * Configure <<>> pom ------ ++---+ ... @@ -183,4 +174,4 @@ ------ ++---+ diff -Nru maven-plugin-testing-1.3/maven-plugin-testing-harness/src/site/apt/examples/multiproject.apt maven-plugin-testing-2.1/maven-plugin-testing-harness/src/site/apt/examples/multiproject.apt --- maven-plugin-testing-1.3/maven-plugin-testing-harness/src/site/apt/examples/multiproject.apt 2008-03-18 11:39:00.000000000 +0000 +++ maven-plugin-testing-2.1/maven-plugin-testing-harness/src/site/apt/examples/multiproject.apt 2012-06-02 04:53:53.000000000 +0000 @@ -29,7 +29,20 @@ Your Mojo should have <<<@aggregator>>> parameter, i.e.: ------- + * with java annotations ({{{/plugin-tools/}maven-plugin-plugin 3.x}}): + ++----+ +@Mojo( name = "touch", aggregator = true ) +public class MyMojo + extends AbstractMojo +{ + ... +} ++----+ + + * or with javadoc tags: + ++----+ /** * @goal touch * @aggregator @@ -39,7 +52,9 @@ { ... } ------- ++----+ + + [] To test a Mojo in a multiproject area, you need to define several stubs, i.e. for the main test project and its modules. @@ -47,7 +62,7 @@ Stub for the main test project: ------ ++----+ public class MyProjectStub extends MavenProjectStub { @@ -67,11 +82,11 @@ return this; } } ------ ++----+ Stubs for the subprojects: ------ ++----+ public class SubProject1Stub extends MavenProjectStub { @@ -83,9 +98,9 @@ ... } } ------ ++----+ ------ ++----+ public class SubProject2Stub extends MavenProjectStub { @@ -97,11 +112,11 @@ ... } } ------ ++----+ * Configure <<>> pom ------ ++----+ ... @@ -120,4 +135,4 @@ ------ ++----+ diff -Nru maven-plugin-testing-1.3/maven-plugin-testing-harness/src/site/apt/examples/repositories.apt maven-plugin-testing-2.1/maven-plugin-testing-harness/src/site/apt/examples/repositories.apt --- maven-plugin-testing-1.3/maven-plugin-testing-harness/src/site/apt/examples/repositories.apt 2008-03-18 11:39:00.000000000 +0000 +++ maven-plugin-testing-2.1/maven-plugin-testing-harness/src/site/apt/examples/repositories.apt 2012-06-02 04:53:53.000000000 +0000 @@ -30,31 +30,26 @@ When developing a Maven plugin you often need to play with repositories. Suppose that the MyMojo needs to download artifacts into your local repository, i.e.: ------ ++----+ public class MyMojo extends AbstractMojo { /** * Used for resolving artifacts - * - * @component */ + @Component private ArtifactResolver resolver; /** * Factory for creating artifact objects - * - * @component */ + @Component private ArtifactFactory factory; /** * Local Repository. - * - * @parameter expression="${localRepository}" - * @required - * @readonly */ + @Parameter( defaultValue = "${localRepository}", readonly = true, required = true ) private ArtifactRepository localRepository; public void execute() @@ -79,13 +74,13 @@ ... } } ------ ++----+ * Create Stubs Stub for the test project: ------ ++----+ public class MyProjectStub extends MavenProjectStub { @@ -100,17 +95,17 @@ /** {@inheritDoc} */ public List getRemoteArtifactRepositories() { - ArtifactRepository repository = new DefaultArtifactRepository( "central", "http://repo1.maven.org/maven2", + ArtifactRepository repository = new DefaultArtifactRepository( "central", "http://repo.maven.apache.org/maven2", new DefaultRepositoryLayout() ); return Collections.singletonList( repository ); } } ------ ++----+ * Configure <<>> pom ------ ++----+ ... @@ -131,7 +126,7 @@ ------ ++----+ ** Execute test diff -Nru maven-plugin-testing-1.3/maven-plugin-testing-harness/src/site/apt/getting-started/index.apt maven-plugin-testing-2.1/maven-plugin-testing-harness/src/site/apt/getting-started/index.apt --- maven-plugin-testing-1.3/maven-plugin-testing-harness/src/site/apt/getting-started/index.apt 2008-08-27 22:52:11.000000000 +0000 +++ maven-plugin-testing-2.1/maven-plugin-testing-harness/src/site/apt/getting-started/index.apt 2012-06-02 04:41:19.000000000 +0000 @@ -33,16 +33,16 @@ We assume that you have already created a plugin. In this cookbook, we make reference to <<>> in <<>> which is generated by the Maven Archetype Plugin, i.e.: ------ ++---+ mvn archetype:create \ -DgroupId=org.apache.maven.plugin.my \ -DartifactId=maven-my-plugin \ -DarchetypeArtifactId=maven-archetype-mojo ------ ++---+ The generated structure should be: ------ ++---+ maven-my-plugin |- pom.xml +- src/ @@ -54,7 +54,7 @@ +- plugin/ +- my/ |- MyMojo.java ------ ++---+ * Recipe @@ -62,7 +62,7 @@ As usual, just add <<>> as following in your pom. Be sure to specify <<>> scope. ------ ++---+ ... @@ -75,14 +75,16 @@ ... ------ ++---+ ** Create a <<>> Create a <<>> (by convention) class in <<>> directory. This class should extend <<>> from <<>>. ------ ++---+ +import org.apache.maven.plugin.testing.AbstractMojoTestCase; + public class MyMojoTest extends AbstractMojoTestCase { @@ -123,7 +125,7 @@ ... } } ------ ++---+ In this case, <<>> will test <<>> against a Maven project called <<>>. @@ -133,11 +135,10 @@ Just create a pom as usual. The names for groupId and artifactId don't really matter since this project will not be deployed. ------ ++---+ + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 org.apache.maven.plugin.my.unit @@ -167,15 +168,15 @@ ------ ++---+ ** Execute test As usual, just call: ------ ++---+ mvn test ------ ++---+ * Resources diff -Nru maven-plugin-testing-1.3/maven-plugin-testing-harness/src/site/apt/index.apt maven-plugin-testing-2.1/maven-plugin-testing-harness/src/site/apt/index.apt --- maven-plugin-testing-1.3/maven-plugin-testing-harness/src/site/apt/index.apt 2008-09-12 09:30:54.000000000 +0000 +++ maven-plugin-testing-2.1/maven-plugin-testing-harness/src/site/apt/index.apt 2012-05-20 21:27:50.000000000 +0000 @@ -29,18 +29,18 @@ {{{http://plexus.codehaus.org}Plexus}} components, providing stub objects for Maven functionality such as projects, and populating fields from an XML file that resembles the plugin configuration in the POM. - The best way to start is to read the cookbook {{{getting-started/index.html}How to use Maven Plugin Testing Harness}}. + The best way to start is to read the cookbook {{{./getting-started/index.html}How to use Maven Plugin Testing Harness}}. * Examples The following examples shows how to use the Testing Harness in more advanced usecases: - * {{{examples/complex-mojo-parameters.html}Testing Complex Mojo Parameters}} + * {{{./examples/complex-mojo-parameters.html}Testing Complex Mojo Parameters}} - * {{{examples/multiproject.html}Testing Multiproject}} + * {{{./examples/multiproject.html}Testing Multiproject}} - * {{{examples/repositories.html}Testing Using Repositories}} + * {{{./examples/repositories.html}Testing Using Repositories}} - * {{{examples/artifact.html}Testing Project Artifact}} + * {{{./examples/artifact.html}Testing Project Artifact}} [] diff -Nru maven-plugin-testing-1.3/maven-plugin-testing-harness/src/site/fml/faq.fml maven-plugin-testing-2.1/maven-plugin-testing-harness/src/site/fml/faq.fml --- maven-plugin-testing-1.3/maven-plugin-testing-harness/src/site/fml/faq.fml 2008-08-28 16:34:11.000000000 +0000 +++ maven-plugin-testing-2.1/maven-plugin-testing-harness/src/site/fml/faq.fml 2012-05-23 03:16:04.000000000 +0000 @@ -30,7 +30,9 @@ Unit tests are designed to be fast.

- This testing library is NOT designed for integration or functional testing. + This testing library is NOT designed for integration or functional testing: + maven-invoker-plugin is the way to go if you need it, + which gives you a complete Maven environment at the cost of more resources and time consuptions.

@@ -44,8 +46,8 @@ the same way you'd write any other JUnit test cases, i.e. by writing a test class which extends TestCase.
TestCase from Plexus
-
Mojos are written to take specific advantage of the Plexus - container. If you need Plexus container services, you could write your class which extends PlexusTestCase, +
Mojos are written to take specific advantage of the Plexus + container. If you need Plexus container services, you could write your class which extends PlexusTestCase, instead of TestCase.
TestCase from Testing Harness
If you need to inject Maven objects into your mojo, you could use the maven-plugin-testing-harness. @@ -55,5 +57,16 @@

+ + Is Mojo Testing Harness 2.x compatible with Maven 2.x? + +

+ Mojo Testing Harness 2.0+ requires Maven 3.0. This does not necessary mean that your mojos will be + incompatible with Maven 2.x, it only means that mojo unit tests use Maven 3.x libraries to mock Maven + environment. Still, if you want to be absolutely sure your mojo is compatible with Maven 2.x, then you probably want + to use Mojo Testing Harness 1.x. +

+
+
- \ No newline at end of file + diff -Nru maven-plugin-testing-1.3/maven-plugin-testing-harness/src/site/site.xml maven-plugin-testing-2.1/maven-plugin-testing-harness/src/site/site.xml --- maven-plugin-testing-1.3/maven-plugin-testing-harness/src/site/site.xml 2008-09-12 09:30:54.000000000 +0000 +++ maven-plugin-testing-2.1/maven-plugin-testing-harness/src/site/site.xml 2012-05-20 14:43:25.000000000 +0000 @@ -19,11 +19,15 @@ under the License. --> - + + + diff -Nru maven-plugin-testing-1.3/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/ArtifactStubFactoryTest.java maven-plugin-testing-2.1/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/ArtifactStubFactoryTest.java --- maven-plugin-testing-1.3/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/ArtifactStubFactoryTest.java 2011-03-26 21:40:19.000000000 +0000 +++ maven-plugin-testing-2.1/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/ArtifactStubFactoryTest.java 2008-03-18 11:39:00.000000000 +0000 @@ -26,20 +26,18 @@ public class ArtifactStubFactoryTest extends TestCase { - public void testVersionChecks() - throws IOException + public void testVersionChecks() throws IOException { ArtifactStubFactory factory = new ArtifactStubFactory(); - assertTrue( factory.getReleaseArtifact().isRelease() ); - assertFalse( factory.getReleaseArtifact().isSnapshot() ); - assertTrue( factory.getSnapshotArtifact().isSnapshot() ); - assertFalse( factory.getSnapshotArtifact().isRelease() ); + assertTrue(factory.getReleaseArtifact().isRelease()); + assertFalse(factory.getReleaseArtifact().isSnapshot()); + assertTrue(factory.getSnapshotArtifact().isSnapshot()); + assertFalse(factory.getSnapshotArtifact().isRelease()); } - public void testCreateFiles() - throws IOException + public void testCreateFiles() throws IOException { ArtifactStubFactory factory = new ArtifactStubFactory(); - assertFalse( factory.isCreateFiles() ); + assertFalse(factory.isCreateFiles()); } } diff -Nru maven-plugin-testing-1.3/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/ExpressionEvaluatorTest.java maven-plugin-testing-2.1/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/ExpressionEvaluatorTest.java --- maven-plugin-testing-1.3/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/ExpressionEvaluatorTest.java 2011-03-26 21:40:19.000000000 +0000 +++ maven-plugin-testing-2.1/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/ExpressionEvaluatorTest.java 2008-03-18 11:39:00.000000000 +0000 @@ -28,7 +28,7 @@ /** * @author Edwin Punzalan - * @version $Id: ExpressionEvaluatorTest.java 1085807 2011-03-26 21:40:19Z hboutemy $ + * @version $Id: ExpressionEvaluatorTest.java 638332 2008-03-18 11:39:00Z bentmann $ */ public class ExpressionEvaluatorTest extends AbstractMojoTestCase @@ -43,21 +43,22 @@ { super.setUp(); - String pom = - "\n" - + " \n" - + " \n" - + " \n" - + " maven-test-mojo\n" - + " \n" - + " ${basedir}\n" - + " ${basedir}/workDirectory\n" - + " ${localRepository}\n" - + " \n" - + " \n" - + " \n" - + " \n" - + "\n"; + StringBuffer pom = new StringBuffer(); + + pom.append( "" ).append( "\n" ); + pom.append( " " ).append( "\n" ); + pom.append( " " ).append( "\n" ); + pom.append( " " ).append( "\n" ); + pom.append( " maven-test-mojo" ).append( "\n" ); + pom.append( " " ).append( "\n" ); + pom.append( " ${basedir}" ).append( "\n" ); + pom.append( " ${basedir}/workDirectory" ).append( "\n" ); + pom.append( " ${localRepository}" ).append( "\n" ); + pom.append( " " ).append( "\n" ); + pom.append( " " ).append( "\n" ); + pom.append( " " ).append( "\n" ); + pom.append( " " ).append( "\n" ); + pom.append( "" ).append( "\n" ); pomDom = Xpp3DomBuilder.build( new StringReader( pom.toString() ) ); diff -Nru maven-plugin-testing-1.3/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/MojoTestCaseTest.java maven-plugin-testing-2.1/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/MojoTestCaseTest.java --- maven-plugin-testing-1.3/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/MojoTestCaseTest.java 2011-03-26 21:40:19.000000000 +0000 +++ maven-plugin-testing-2.1/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/MojoTestCaseTest.java 2012-06-02 04:57:05.000000000 +0000 @@ -28,7 +28,7 @@ /** * @author Jason van Zyl - * @version $Id: MojoTestCaseTest.java 1085807 2011-03-26 21:40:19Z hboutemy $ + * @version $Id: MojoTestCaseTest.java 1345440 2012-06-02 04:57:05Z hboutemy $ */ public class MojoTestCaseTest extends AbstractMojoTestCase @@ -46,19 +46,19 @@ super.setUp(); pom = - "\n" - + " \n" - + " \n" - + " \n" - + " maven-simple-plugin\n" - + " \n" - + " valueOne\n" - + " valueTwo\n" - + " \n" - + " \n" - + " \n" - + " \n" - + "\n"; + "" + + "" + + "" + + "" + + "maven-simple-plugin" + + "" + + "valueOne" + + "valueTwo" + + "" + + "" + + "" + + "" + + ""; pomDom = Xpp3DomBuilder.build( new StringReader( pom ) ); @@ -116,7 +116,7 @@ mojo = (SimpleMojo) configureMojo( mojo, pluginConfiguration ); - Map map = getVariablesAndValuesFromObject( mojo ); + Map map = getVariablesAndValuesFromObject( mojo ); assertEquals( "valueOne", (String)map.get( "keyOne" ) ); @@ -136,6 +136,7 @@ setVariableValueToObject( mojo, "keyOne", "myValueOne" ); assertEquals( "myValueOne", (String)getVariableValueFromObject( mojo, "keyOne" ) ); + } } diff -Nru maven-plugin-testing-1.3/maven-plugin-testing-tools/pom.xml maven-plugin-testing-2.1/maven-plugin-testing-tools/pom.xml --- maven-plugin-testing-1.3/maven-plugin-testing-tools/pom.xml 2012-09-24 16:02:32.000000000 +0000 +++ maven-plugin-testing-2.1/maven-plugin-testing-tools/pom.xml 2012-09-23 18:59:07.000000000 +0000 @@ -25,57 +25,54 @@ org.apache.maven.plugin-testing maven-plugin-testing - 1.3 + 2.1 maven-plugin-testing-tools Maven Plugin Testing Tools - scm:svn:http://svn.apache.org/repos/asf/maven/plugin-testing/tags/maven-plugin-testing-1.3/maven-plugin-testing-tools - scm:svn:https://svn.apache.org/repos/asf/maven/plugin-testing/tags/maven-plugin-testing-1.3/maven-plugin-testing-tools - http://svn.apache.org/viewvc/maven/plugin-testing/tags/maven-plugin-testing-1.3/maven-plugin-testing-tools + scm:svn:http://svn.apache.org/repos/asf/maven/plugin-testing/tags/maven-plugin-testing-2.1/maven-plugin-testing-tools + scm:svn:https://svn.apache.org/repos/asf/maven/plugin-testing/tags/maven-plugin-testing-2.1/maven-plugin-testing-tools + http://svn.apache.org/viewvc/maven/plugin-testing/tags/maven-plugin-testing-2.1/maven-plugin-testing-tools org.codehaus.plexus - plexus-container-default - 1.0-alpha-9-stable-1 - - - org.codehaus.plexus plexus-utils - org.codehaus.plexus - plexus-interpolation - - org.apache.maven - maven-settings + maven-model org.apache.maven - maven-artifact - + maven-core + org.apache.maven - maven-project - + maven-compat + org.apache.maven - maven-model - + maven-aether-provider + org.apache.maven.shared maven-invoker - 2.0.9 + 2.0.11 - org.apache.maven.shared + org.apache.maven.plugin-testing maven-test-tools - 1.0-alpha-2 + ${project.version} + test + + + org.apache.maven.wagon + wagon-file + 2.1 test @@ -96,17 +93,17 @@ org.codehaus.plexus - plexus-maven-plugin - 1.3 + plexus-component-metadata + ${plexusVersion} - create-component-descriptor - descriptor + generate-metadata + diff -Nru maven-plugin-testing-1.3/maven-plugin-testing-tools/src/main/java/org/apache/maven/shared/test/plugin/BuildTool.java maven-plugin-testing-2.1/maven-plugin-testing-tools/src/main/java/org/apache/maven/shared/test/plugin/BuildTool.java --- maven-plugin-testing-1.3/maven-plugin-testing-tools/src/main/java/org/apache/maven/shared/test/plugin/BuildTool.java 2008-07-16 00:16:13.000000000 +0000 +++ maven-plugin-testing-2.1/maven-plugin-testing-tools/src/main/java/org/apache/maven/shared/test/plugin/BuildTool.java 2012-06-02 05:26:01.000000000 +0000 @@ -32,6 +32,7 @@ import org.apache.maven.shared.invoker.InvocationResult; import org.apache.maven.shared.invoker.Invoker; import org.apache.maven.shared.invoker.MavenInvocationException; +import org.codehaus.plexus.component.annotations.Component; import org.codehaus.plexus.personality.plexus.lifecycle.phase.Disposable; import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable; import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException; @@ -41,10 +42,10 @@ /** * Test-tool used to execute Maven builds in order to test plugin functionality. * - * @plexus.component role="org.apache.maven.shared.test.plugin.BuildTool" role-hint="default" * @author jdcasey - * @version $Id: BuildTool.java 677115 2008-07-16 00:16:13Z vsiveton $ + * @version $Id: BuildTool.java 1345442 2012-06-02 05:26:01Z hboutemy $ */ +@Component( role = BuildTool.class ) public class BuildTool implements Initializable, Disposable { @@ -67,7 +68,7 @@ * resulting from the Maven invocation. * @throws TestToolsException if any */ - public InvocationResult executeMaven( File pom, Properties properties, List goals, File buildLogFile ) + public InvocationResult executeMaven( File pom, Properties properties, List goals, File buildLogFile ) throws TestToolsException { InvocationRequest request = createBasicInvocationRequest( pom, properties, goals, buildLogFile ); @@ -131,7 +132,7 @@ } /** - * If we're logging output to a logfile using standard output handlers, make sure these are + * If we're logging output to a log file using standard output handlers, make sure these are * closed. * * @param request @@ -168,7 +169,7 @@ * @return The standardized InvocationRequest for the test build, ready for any necessary * customizations. */ - public InvocationRequest createBasicInvocationRequest( File pom, Properties properties, List goals, + public InvocationRequest createBasicInvocationRequest( File pom, Properties properties, List goals, File buildLogFile ) { InvocationRequest request = new DefaultInvocationRequest(); @@ -208,6 +209,7 @@ { try { + output.getParentFile().mkdirs(); writer = new FileWriter( output ); } catch ( IOException e ) diff -Nru maven-plugin-testing-1.3/maven-plugin-testing-tools/src/main/java/org/apache/maven/shared/test/plugin/ComponentTestTool.java maven-plugin-testing-2.1/maven-plugin-testing-tools/src/main/java/org/apache/maven/shared/test/plugin/ComponentTestTool.java --- maven-plugin-testing-1.3/maven-plugin-testing-tools/src/main/java/org/apache/maven/shared/test/plugin/ComponentTestTool.java 2008-07-18 15:13:08.000000000 +0000 +++ maven-plugin-testing-2.1/maven-plugin-testing-tools/src/main/java/org/apache/maven/shared/test/plugin/ComponentTestTool.java 2011-10-19 02:43:50.000000000 +0000 @@ -20,6 +20,8 @@ */ import org.apache.maven.project.MavenProject; +import org.codehaus.plexus.component.annotations.Component; +import org.codehaus.plexus.component.annotations.Requirement; import org.codehaus.plexus.util.FileUtils; import java.io.File; @@ -39,23 +41,19 @@ * component's ancestor POMs cannot be resolved. *

* - * @plexus.component role="org.apache.maven.shared.test.plugin.ComponentTestTool" role-hint="default" * @author jdcasey - * @version $Id: ComponentTestTool.java 677929 2008-07-18 15:13:08Z vsiveton $ + * @version $Id: ComponentTestTool.java 1185951 2011-10-19 02:43:50Z ifedorenko $ */ +@Component( role = ComponentTestTool.class ) public class ComponentTestTool { /** Plexus role */ public static final String ROLE = ComponentTestTool.class.getName(); - /** - * @plexus.requirement role-hint="default" - */ + @Requirement private ProjectTool projectTool; - /** - * @plexus.requirement role-hint="default" - */ + @Requirement private RepositoryTool repositoryTool; /** diff -Nru maven-plugin-testing-1.3/maven-plugin-testing-tools/src/main/java/org/apache/maven/shared/test/plugin/PluginTestTool.java maven-plugin-testing-2.1/maven-plugin-testing-tools/src/main/java/org/apache/maven/shared/test/plugin/PluginTestTool.java --- maven-plugin-testing-1.3/maven-plugin-testing-tools/src/main/java/org/apache/maven/shared/test/plugin/PluginTestTool.java 2008-07-18 15:13:08.000000000 +0000 +++ maven-plugin-testing-2.1/maven-plugin-testing-tools/src/main/java/org/apache/maven/shared/test/plugin/PluginTestTool.java 2011-10-19 02:43:50.000000000 +0000 @@ -20,6 +20,8 @@ */ import org.apache.maven.project.MavenProject; +import org.codehaus.plexus.component.annotations.Component; +import org.codehaus.plexus.component.annotations.Requirement; import org.codehaus.plexus.util.FileUtils; import java.io.File; @@ -39,23 +41,19 @@ * plugin's ancestor POMs cannot be resolved. *

* - * @plexus.component role="org.apache.maven.shared.test.plugin.PluginTestTool" role-hint="default" * @author jdcasey - * @version $Id: PluginTestTool.java 677929 2008-07-18 15:13:08Z vsiveton $ + * @version $Id: PluginTestTool.java 1185951 2011-10-19 02:43:50Z ifedorenko $ */ +@Component( role = PluginTestTool.class ) public class PluginTestTool { /** Plexus role */ public static final String ROLE = PluginTestTool.class.getName(); - /** - * @plexus.requirement role-hint="default" - */ + @Requirement private ProjectTool projectTool; - /** - * @plexus.requirement role-hint="default" - */ + @Requirement private RepositoryTool repositoryTool; /** diff -Nru maven-plugin-testing-1.3/maven-plugin-testing-tools/src/main/java/org/apache/maven/shared/test/plugin/ProjectTool.java maven-plugin-testing-2.1/maven-plugin-testing-tools/src/main/java/org/apache/maven/shared/test/plugin/ProjectTool.java --- maven-plugin-testing-1.3/maven-plugin-testing-tools/src/main/java/org/apache/maven/shared/test/plugin/ProjectTool.java 2011-03-26 21:40:19.000000000 +0000 +++ maven-plugin-testing-2.1/maven-plugin-testing-tools/src/main/java/org/apache/maven/shared/test/plugin/ProjectTool.java 2012-06-02 05:26:01.000000000 +0000 @@ -29,12 +29,12 @@ import java.util.Properties; import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.UnknownRepositoryLayoutException; import org.apache.maven.artifact.factory.ArtifactFactory; import org.apache.maven.artifact.handler.ArtifactHandler; import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager; import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.resolver.ArtifactNotFoundException; -import org.apache.maven.artifact.resolver.ArtifactResolutionException; +import org.apache.maven.artifact.repository.ArtifactRepositoryFactory; import org.apache.maven.model.Build; import org.apache.maven.model.DeploymentRepository; import org.apache.maven.model.DistributionManagement; @@ -44,10 +44,15 @@ import org.apache.maven.model.Site; import org.apache.maven.model.io.xpp3.MavenXpp3Reader; import org.apache.maven.model.io.xpp3.MavenXpp3Writer; +import org.apache.maven.project.DefaultProjectBuildingRequest; import org.apache.maven.project.MavenProject; -import org.apache.maven.project.MavenProjectBuilder; +import org.apache.maven.project.ProjectBuilder; import org.apache.maven.project.ProjectBuildingException; +import org.apache.maven.project.ProjectBuildingRequest; import org.apache.maven.project.artifact.ProjectArtifactMetadata; +import org.apache.maven.repository.internal.MavenRepositorySystemSession; +import org.codehaus.plexus.component.annotations.Component; +import org.codehaus.plexus.component.annotations.Requirement; import org.codehaus.plexus.util.FileUtils; import org.codehaus.plexus.util.IOUtil; import org.codehaus.plexus.util.ReaderFactory; @@ -60,10 +65,10 @@ * files (package phase of the normal build process) for distribution to a test local repository * directory. * - * @plexus.component role="org.apache.maven.shared.test.plugin.ProjectTool" role-hint="default" * @author jdcasey - * @version $Id: ProjectTool.java 1085807 2011-03-26 21:40:19Z hboutemy $ + * @version $Id: ProjectTool.java 1345442 2012-06-02 05:26:01Z hboutemy $ */ +@Component( role = ProjectTool.class ) public class ProjectTool { /** Plexus role */ @@ -71,31 +76,24 @@ public static final String INTEGRATION_TEST_DEPLOYMENT_REPO_URL = "integration-test.deployment.repo.url"; - /** - * @plexus.requirement role-hint="default" - */ + @Requirement private BuildTool buildTool; - /** - * @plexus.requirement role-hint="default" - */ + @Requirement private RepositoryTool repositoryTool; - /** - * @plexus.requirement - */ - private MavenProjectBuilder projectBuilder; + @Requirement + private ProjectBuilder projectBuilder; - /** - * @plexus.requirement - */ + @Requirement private ArtifactHandlerManager artifactHandlerManager; - /** - * @plexus.requirement - */ + @Requirement private ArtifactFactory artifactFactory; + @Requirement + private ArtifactRepositoryFactory artifactRepositoryFactory; + /** * Construct a MavenProject instance from the specified POM file. * @@ -126,7 +124,8 @@ ArtifactRepository localRepository = repositoryTool .createLocalArtifactRepositoryInstance( localRepositoryBasedir ); - return projectBuilder.build( pomFile, localRepository, null ); + ProjectBuildingRequest request = new DefaultProjectBuildingRequest(); + return projectBuilder.build( pomFile, request ).getProject(); } catch ( ProjectBuildingException e ) { @@ -164,20 +163,13 @@ ArtifactRepository localRepository = repositoryTool .createLocalArtifactRepositoryInstance( localRepositoryBasedir ); - return projectBuilder.buildWithDependencies( pomFile, localRepository, null ); + ProjectBuildingRequest request = new DefaultProjectBuildingRequest(); + return projectBuilder.build( pomFile, request ).getProject(); } catch ( ProjectBuildingException e ) { throw new TestToolsException( "Error building MavenProject instance from test pom: " + pomFile, e ); } - catch ( ArtifactResolutionException e ) - { - throw new TestToolsException( "Error building MavenProject instance from test pom: " + pomFile, e ); - } - catch ( ArtifactNotFoundException e ) - { - throw new TestToolsException( "Error building MavenProject instance from test pom: " + pomFile, e ); - } } /** @@ -233,10 +225,10 @@ Properties properties = new Properties(); - List goals = new ArrayList(); + List goals = new ArrayList(); goals.add( "package" ); - File buildLog = ( logFile == null ) ? pomInfo.getBuildLogFile() : logFile; + File buildLog = logFile == null ? pomInfo.getBuildLogFile() : logFile; System.out.println( "Now Building test version of the plugin...\nUsing staged plugin-pom: " + pomInfo.getPomFile().getAbsolutePath() ); @@ -247,8 +239,10 @@ System.out.println( "Using IT Plugin Jar: " + artifactFile.getAbsolutePath() ); try { - MavenProject project = projectBuilder.build( pomInfo.getPomFile(), repositoryTool - .createLocalArtifactRepositoryInstance(), null ); + ProjectBuildingRequest request = new DefaultProjectBuildingRequest(); + request.setLocalRepository( artifactRepositoryFactory.createArtifactRepository( "local", new File( "target/localrepo" ).getCanonicalFile().toURL().toExternalForm(), "default", null, null ) ); + request.setRepositorySession( new MavenRepositorySystemSession() ); + MavenProject project = projectBuilder.build( pomInfo.getPomFile(), request ).getProject(); Artifact artifact = artifactFactory.createArtifact( project.getGroupId(), project.getArtifactId(), project .getVersion(), null, project.getPackaging() ); @@ -266,6 +260,18 @@ "Error building MavenProject instance from test pom: " + pomInfo.getPomFile(), e ); } + catch ( UnknownRepositoryLayoutException e ) + { + throw new TestToolsException( + "Error building ArtifactRepository instance from test pom: " + pomInfo.getPomFile(), + e ); + } + catch ( IOException e ) + { + throw new TestToolsException( + "Error building ArtifactRepository instance from test pom: " + pomInfo.getPomFile(), + e ); + } } /** @@ -384,12 +390,10 @@ if ( skipUnitTests ) { - List plugins = build.getPlugins(); + List plugins = build.getPlugins(); Plugin plugin = null; - for ( Iterator iter = plugins.iterator(); iter.hasNext(); ) + for ( Plugin plug : plugins ) { - Plugin plug = (Plugin) iter.next(); - if ( "maven-surefire-plugin".equals( plug.getArtifactId() ) ) { plugin = plug; diff -Nru maven-plugin-testing-1.3/maven-plugin-testing-tools/src/main/java/org/apache/maven/shared/test/plugin/RepositoryTool.java maven-plugin-testing-2.1/maven-plugin-testing-tools/src/main/java/org/apache/maven/shared/test/plugin/RepositoryTool.java --- maven-plugin-testing-1.3/maven-plugin-testing-tools/src/main/java/org/apache/maven/shared/test/plugin/RepositoryTool.java 2008-07-18 15:13:08.000000000 +0000 +++ maven-plugin-testing-2.1/maven-plugin-testing-tools/src/main/java/org/apache/maven/shared/test/plugin/RepositoryTool.java 2011-10-19 02:43:50.000000000 +0000 @@ -31,21 +31,29 @@ import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.repository.ArtifactRepositoryFactory; import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; +import org.apache.maven.execution.DefaultMavenExecutionRequest; +import org.apache.maven.execution.DefaultMavenExecutionResult; +import org.apache.maven.execution.MavenSession; import org.apache.maven.model.Model; import org.apache.maven.model.Parent; import org.apache.maven.model.io.xpp3.MavenXpp3Reader; +import org.apache.maven.plugin.LegacySupport; import org.apache.maven.project.MavenProject; import org.apache.maven.project.artifact.ProjectArtifactMetadata; +import org.apache.maven.repository.internal.MavenRepositorySystemSession; import org.apache.maven.settings.MavenSettingsBuilder; import org.apache.maven.settings.Settings; import org.codehaus.plexus.PlexusConstants; import org.codehaus.plexus.PlexusContainer; +import org.codehaus.plexus.component.annotations.Component; +import org.codehaus.plexus.component.annotations.Requirement; import org.codehaus.plexus.component.repository.exception.ComponentLookupException; import org.codehaus.plexus.context.Context; import org.codehaus.plexus.context.ContextException; import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable; import org.codehaus.plexus.util.IOUtil; import org.codehaus.plexus.util.ReaderFactory; +import org.codehaus.plexus.util.StringUtils; import org.codehaus.plexus.util.xml.pull.XmlPullParserException; /** @@ -59,36 +67,31 @@ * plugin's ancestor POMs cannot be resolved. *

* - * @plexus.component role="org.apache.maven.shared.test.plugin.RepositoryTool" role-hint="default" * @author jdcasey - * @version $Id: RepositoryTool.java 677929 2008-07-18 15:13:08Z vsiveton $ + * @version $Id: RepositoryTool.java 1185951 2011-10-19 02:43:50Z ifedorenko $ */ +@Component( role = RepositoryTool.class ) public class RepositoryTool implements Contextualizable { /** Plexus role */ public static final String ROLE = RepositoryTool.class.getName(); - /** - * @plexus.requirement - */ + @Requirement private ArtifactRepositoryFactory repositoryFactory; - /** - * @plexus.requirement - */ + @Requirement private MavenSettingsBuilder settingsBuilder; - /** - * @plexus.requirement - */ + @Requirement private ArtifactFactory artifactFactory; - /** - * @plexus.requirement - */ + @Requirement private ArtifactInstaller artifactInstaller; + @Requirement + private LegacySupport legacySupport; + // contextualized. private PlexusContainer container; @@ -101,10 +104,19 @@ public File findLocalRepositoryDirectory() throws TestToolsException { + String localRepo = System.getProperty( "maven.local.repo" ); + if ( StringUtils.isNotEmpty( localRepo ) ) + { + return new File( localRepo ); + } + Settings settings; try { - settings = settingsBuilder.buildSettings(); + DefaultMavenExecutionRequest request = new DefaultMavenExecutionRequest(); + request.setUserSettingsFile( new File( System.getProperty( "user.home" ), ".m2/settings.xml" ) ); + request.setGlobalSettingsFile( new File( System.getProperty( "maven.home" ), "conf/settings.xml" ) ); + settings = settingsBuilder.buildSettings( request ); } catch ( IOException e ) { @@ -206,6 +218,9 @@ destination.getParentFile().mkdirs(); } + legacySupport.setSession( new MavenSession( container, new MavenRepositorySystemSession(), + new DefaultMavenExecutionRequest(), + new DefaultMavenExecutionResult() ) ); try { artifactInstaller.install( artifact.getFile(), artifact, localRepository ); @@ -215,6 +230,10 @@ throw new TestToolsException( "Error installing plugin artifact to target local repository: " + targetLocalRepoBasedir, e ); } + finally + { + legacySupport.setSession( null ); + } installLocallyReachableAncestorPoms( realPomFile, localRepository ); } diff -Nru maven-plugin-testing-1.3/maven-plugin-testing-tools/src/site/apt/index.apt maven-plugin-testing-2.1/maven-plugin-testing-tools/src/site/apt/index.apt --- maven-plugin-testing-1.3/maven-plugin-testing-tools/src/site/apt/index.apt 2008-09-12 09:30:54.000000000 +0000 +++ maven-plugin-testing-2.1/maven-plugin-testing-tools/src/site/apt/index.apt 2012-05-20 21:27:50.000000000 +0000 @@ -36,7 +36,7 @@ (possibly after resolving them from a remote repository). Because of this, the only practical way to use the current plugin within an integration-test build is to install it into some sort of local repository, then direct Maven to use that local repository for the build. To avoid side effects in - other builds (remember, we're building Maven plugins here...and they're used to build other projects), + other builds (remember, we're building Maven plugins here... and they're used to build other projects), it's critical to avoid using the main local repository used for normal Maven builds. Therefore, plugin integration tests require a custom local repository, to which the integration-testing builds can be directed. Further complicating this testing scenario is the fact that the plugin's parent @@ -96,7 +96,7 @@ * Utilities Included in this Library - For more information on the APIs described below, see the {{{apidocs/index.html}JavaDocs}}. + For more information on the APIs described below, see the {{{./apidocs/index.html}JavaDocs}}. * <> - The main entry point for setting up the plugin-testing environment, this utility orchestrates the ProjectTool, RepositoryTool, and BuildTool in order to produce a local diff -Nru maven-plugin-testing-1.3/maven-plugin-testing-tools/src/site/site.xml maven-plugin-testing-2.1/maven-plugin-testing-tools/src/site/site.xml --- maven-plugin-testing-1.3/maven-plugin-testing-tools/src/site/site.xml 2008-09-12 09:30:54.000000000 +0000 +++ maven-plugin-testing-2.1/maven-plugin-testing-tools/src/site/site.xml 2012-05-20 14:43:25.000000000 +0000 @@ -19,10 +19,15 @@ under the License. --> - + + + + diff -Nru maven-plugin-testing-1.3/maven-plugin-testing-tools/src/test/java/org/apache/maven/shared/test/plugin/ProjectToolTest.java maven-plugin-testing-2.1/maven-plugin-testing-tools/src/test/java/org/apache/maven/shared/test/plugin/ProjectToolTest.java --- maven-plugin-testing-1.3/maven-plugin-testing-tools/src/test/java/org/apache/maven/shared/test/plugin/ProjectToolTest.java 2011-03-26 21:40:19.000000000 +0000 +++ maven-plugin-testing-2.1/maven-plugin-testing-tools/src/test/java/org/apache/maven/shared/test/plugin/ProjectToolTest.java 2012-06-02 05:26:01.000000000 +0000 @@ -20,6 +20,7 @@ */ import java.io.File; +import java.io.IOException; import java.util.Collection; import java.util.Iterator; @@ -29,27 +30,39 @@ import org.apache.maven.project.artifact.ProjectArtifactMetadata; import org.apache.maven.shared.test.plugin.ProjectTool.PomInfo; import org.codehaus.plexus.PlexusTestCase; +import org.codehaus.plexus.util.FileUtils; import org.codehaus.plexus.util.StringUtils; /** - * @version $Id: ProjectToolTest.java 1085807 2011-03-26 21:40:19Z hboutemy $ + * @version $Id: ProjectToolTest.java 1345442 2012-06-02 05:26:01Z hboutemy $ */ public class ProjectToolTest extends PlexusTestCase { + + private File getPom( String test ) + throws IOException + { + File src = new File( "src/test/resources/projects/" + test ); + File dst = new File( "target/unit/projects/" + test ); + + FileUtils.copyDirectoryStructureIfModified( src, dst ); + + return new File( dst, "pom.xml" ); + } + public void testManglePomForTesting_ShouldPopulateOutDirAndFinalName() throws Exception { ProjectTool tool = (ProjectTool) lookup( ProjectTool.ROLE, "default" ); - File pomFile = new File( "pom.xml" ); + File pomFile = getPom( "basic" ); PomInfo info = tool.manglePomForTesting( pomFile, "test", true ); - assertEquals( "target" + File.separatorChar + "it-build-target", info.getBuildDirectory() ); - assertEquals( "maven-plugin-testing-tools-test.jar", info.getFinalName() ); - assertEquals( "target" + File.separatorChar + "it-build-target" + File.separatorChar + "classes", - info.getBuildOutputDirectory() ); + assertEquals( "target"+File.separatorChar+"it-build-target", info.getBuildDirectory() ); + assertEquals( "maven-it-plugin-test.jar", info.getFinalName() ); + assertEquals( "target"+File.separatorChar+"it-build-target"+File.separatorChar+"classes",info.getBuildOutputDirectory() ); } public void testPackageProjectArtifact_ShouldPopulateArtifactFileWithJarLocation() @@ -57,11 +70,11 @@ { ProjectTool tool = (ProjectTool) lookup( ProjectTool.ROLE, "default" ); - File pomFile = new File( "pom.xml" ); + File pomFile = getPom( "basic" ); MavenProject project = tool.packageProjectArtifact( pomFile, "test", true ); - String expectedPath = "target/it-build-target/maven-plugin-testing-tools-test.jar"; + String expectedPath = "target/unit/projects/basic/target/it-build-target/maven-it-plugin-test.jar"; // be nice with windows String actualPath = StringUtils.replace( project.getArtifact().getFile().getPath(), "\\", "/" ); @@ -74,23 +87,21 @@ { ProjectTool tool = (ProjectTool) lookup( ProjectTool.ROLE, "default" ); - File pomFile = new File( "pom.xml" ); + File pomFile = getPom( "basic" ); MavenProject project = tool.packageProjectArtifact( pomFile, "test", true ); Artifact artifact = project.getArtifact(); - assertEquals( "jar", artifact.getType() ); - assertTrue( artifact.getFile().exists() ); + assertEquals( "maven-plugin", artifact.getType() ); + assertTrue( "Missing " + artifact.getFile(), artifact.getFile().exists() ); - Collection metadata = artifact.getMetadataList(); + Collection metadata = artifact.getMetadataList(); boolean foundPomMetadata = false; - for ( Iterator it = metadata.iterator(); it.hasNext(); ) + for ( ArtifactMetadata metadataItem : metadata ) { - ArtifactMetadata metadataItem = (ArtifactMetadata) it.next(); - if ( metadataItem instanceof ProjectArtifactMetadata ) { foundPomMetadata = true; diff -Nru maven-plugin-testing-1.3/maven-plugin-testing-tools/src/test/resources/projects/basic/pom.xml maven-plugin-testing-2.1/maven-plugin-testing-tools/src/test/resources/projects/basic/pom.xml --- maven-plugin-testing-1.3/maven-plugin-testing-tools/src/test/resources/projects/basic/pom.xml 1970-01-01 00:00:00.000000000 +0000 +++ maven-plugin-testing-2.1/maven-plugin-testing-tools/src/test/resources/projects/basic/pom.xml 2009-11-16 23:14:09.000000000 +0000 @@ -0,0 +1,39 @@ + + + + + + 4.0.0 + + org.apache.maven.its.plugins + maven-it-plugin + 2.0-SNAPSHOT + maven-plugin + + Maven IT Plugin + + + + org.apache.maven + maven-plugin-api + 2.0 + + + diff -Nru maven-plugin-testing-1.3/maven-plugin-testing-tools/src/test/resources/projects/basic/src/main/java/ItMojo.java maven-plugin-testing-2.1/maven-plugin-testing-tools/src/test/resources/projects/basic/src/main/java/ItMojo.java --- maven-plugin-testing-1.3/maven-plugin-testing-tools/src/test/resources/projects/basic/src/main/java/ItMojo.java 1970-01-01 00:00:00.000000000 +0000 +++ maven-plugin-testing-2.1/maven-plugin-testing-tools/src/test/resources/projects/basic/src/main/java/ItMojo.java 2009-11-16 23:14:09.000000000 +0000 @@ -0,0 +1,14 @@ +import org.apache.maven.plugin.*; + +/** + * @goal it + */ +public class ItMojo + extends AbstractMojo +{ + + public void execute() + { + } + +} diff -Nru maven-plugin-testing-1.3/maven-test-tools/pom.xml maven-plugin-testing-2.1/maven-test-tools/pom.xml --- maven-plugin-testing-1.3/maven-test-tools/pom.xml 2012-09-24 16:02:32.000000000 +0000 +++ maven-plugin-testing-2.1/maven-test-tools/pom.xml 2012-09-23 18:59:07.000000000 +0000 @@ -25,16 +25,16 @@ org.apache.maven.plugin-testing maven-plugin-testing - 1.3 + 2.1 maven-test-tools Maven Testing Tools - scm:svn:http://svn.apache.org/repos/asf/maven/plugin-testing/tags/maven-plugin-testing-1.3/maven-test-tools - scm:svn:https://svn.apache.org/repos/asf/maven/plugin-testing/tags/maven-plugin-testing-1.3/maven-test-tools - http://svn.apache.org/viewvc/maven/plugin-testing/tags/maven-plugin-testing-1.3/maven-test-tools + scm:svn:http://svn.apache.org/repos/asf/maven/plugin-testing/tags/maven-plugin-testing-2.1/maven-test-tools + scm:svn:https://svn.apache.org/repos/asf/maven/plugin-testing/tags/maven-plugin-testing-2.1/maven-test-tools + http://svn.apache.org/viewvc/maven/plugin-testing/tags/maven-plugin-testing-2.1/maven-test-tools @@ -45,6 +45,7 @@ org.easymock easymock + 2.5.2 org.codehaus.plexus diff -Nru maven-plugin-testing-1.3/maven-test-tools/src/main/java/org/apache/maven/shared/tools/easymock/MockManager.java maven-plugin-testing-2.1/maven-test-tools/src/main/java/org/apache/maven/shared/tools/easymock/MockManager.java --- maven-plugin-testing-1.3/maven-test-tools/src/main/java/org/apache/maven/shared/tools/easymock/MockManager.java 2008-07-16 00:29:56.000000000 +0000 +++ maven-plugin-testing-2.1/maven-test-tools/src/main/java/org/apache/maven/shared/tools/easymock/MockManager.java 2012-06-02 05:36:05.000000000 +0000 @@ -20,7 +20,6 @@ */ import java.util.ArrayList; -import java.util.Iterator; import java.util.List; import org.easymock.MockControl; @@ -28,12 +27,12 @@ /** * Manager of MockControl * - * @version $Id: MockManager.java 677117 2008-07-16 00:29:56Z vsiveton $ + * @version $Id: MockManager.java 1345444 2012-06-02 05:36:05Z hboutemy $ * @see MockControl */ public class MockManager { - private List mockControls = new ArrayList(); + private List mockControls = new ArrayList(); /** * @param control to be add to the manager @@ -56,10 +55,8 @@ */ public void replayAll() { - for ( Iterator it = mockControls.iterator(); it.hasNext(); ) + for ( MockControl control : mockControls ) { - MockControl control = (MockControl) it.next(); - control.replay(); } } @@ -69,10 +66,8 @@ */ public void verifyAll() { - for ( Iterator it = mockControls.iterator(); it.hasNext(); ) + for ( MockControl control : mockControls ) { - MockControl control = (MockControl) it.next(); - control.verify(); } } diff -Nru maven-plugin-testing-1.3/maven-test-tools/src/main/java/org/apache/maven/shared/tools/easymock/TestFileManager.java maven-plugin-testing-2.1/maven-test-tools/src/main/java/org/apache/maven/shared/tools/easymock/TestFileManager.java --- maven-plugin-testing-1.3/maven-test-tools/src/main/java/org/apache/maven/shared/tools/easymock/TestFileManager.java 2011-03-26 21:40:19.000000000 +0000 +++ maven-plugin-testing-2.1/maven-test-tools/src/main/java/org/apache/maven/shared/tools/easymock/TestFileManager.java 2012-06-02 05:36:05.000000000 +0000 @@ -23,10 +23,8 @@ import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; -import java.io.Reader; import java.io.StringReader; import java.io.StringWriter; -import java.io.Writer; import java.util.ArrayList; import java.util.Iterator; import java.util.List; @@ -37,14 +35,14 @@ import org.codehaus.plexus.util.IOUtil; /** - * @version $Id: TestFileManager.java 1085807 2011-03-26 21:40:19Z hboutemy $ + * @version $Id: TestFileManager.java 1345444 2012-06-02 05:36:05Z hboutemy $ */ public class TestFileManager { /** Temp dir from "java.io.tmpdir" property */ public static final String TEMP_DIR_PATH = System.getProperty( "java.io.tmpdir" ); - private List filesToDelete = new ArrayList(); + private List filesToDelete = new ArrayList(); private final String baseFilename; @@ -149,9 +147,9 @@ public void cleanUp() throws IOException { - for ( Iterator it = filesToDelete.iterator(); it.hasNext(); ) + for ( Iterator it = filesToDelete.iterator(); it.hasNext(); ) { - File file = (File) it.next(); + File file = it.next(); if ( file.exists() ) { @@ -203,7 +201,7 @@ File file = new File( dir, filename ); - Reader reader = null; + FileReader reader = null; StringWriter writer = new StringWriter(); try @@ -234,7 +232,7 @@ file.getParentFile().mkdirs(); - Writer writer = null; + FileWriter writer = null; try { @@ -262,7 +260,7 @@ { String result = null; - Reader reader = null; + FileReader reader = null; try { reader = new FileReader( file ); diff -Nru maven-plugin-testing-1.3/maven-test-tools/src/main/java/org/apache/maven/shared/tools/easymock/TestUtils.java maven-plugin-testing-2.1/maven-test-tools/src/main/java/org/apache/maven/shared/tools/easymock/TestUtils.java --- maven-plugin-testing-1.3/maven-test-tools/src/main/java/org/apache/maven/shared/tools/easymock/TestUtils.java 2011-03-26 21:40:19.000000000 +0000 +++ maven-plugin-testing-2.1/maven-test-tools/src/main/java/org/apache/maven/shared/tools/easymock/TestUtils.java 2008-07-16 00:29:56.000000000 +0000 @@ -26,12 +26,11 @@ import java.io.IOException; import java.io.PrintWriter; import java.io.StringWriter; -import java.io.Writer; import org.codehaus.plexus.util.IOUtil; /** - * @version $Id: TestUtils.java 1085807 2011-03-26 21:40:19Z hboutemy $ + * @version $Id: TestUtils.java 677117 2008-07-16 00:29:56Z vsiveton $ */ public final class TestUtils { @@ -48,7 +47,7 @@ public static void writeToFile( File file, String testStr ) throws IOException { - Writer fw = null; + FileWriter fw = null; try { fw = new FileWriter( file ); @@ -71,30 +70,21 @@ { StringBuffer buffer = new StringBuffer(); - BufferedReader reader = null; + BufferedReader reader = new BufferedReader( new FileReader( file ) ); - try - { - reader = new BufferedReader( new FileReader( file ) ); - - String line = null; + String line = null; - while ( ( line = reader.readLine() ) != null ) + while ( ( line = reader.readLine() ) != null ) + { + if ( buffer.length() > 0 ) { - if ( buffer.length() > 0 ) - { - buffer.append( '\n' ); - } - - buffer.append( line ); + buffer.append( '\n' ); } - return buffer.toString(); - } - finally - { - IOUtil.close( reader ); + buffer.append( line ); } + + return buffer.toString(); } /** diff -Nru maven-plugin-testing-1.3/maven-test-tools/src/main/java/org/apache/maven/shared/tools/test/ReflectiveSetter.java maven-plugin-testing-2.1/maven-test-tools/src/main/java/org/apache/maven/shared/tools/test/ReflectiveSetter.java --- maven-plugin-testing-1.3/maven-test-tools/src/main/java/org/apache/maven/shared/tools/test/ReflectiveSetter.java 2011-03-26 21:40:19.000000000 +0000 +++ maven-plugin-testing-2.1/maven-test-tools/src/main/java/org/apache/maven/shared/tools/test/ReflectiveSetter.java 2012-06-02 05:36:33.000000000 +0000 @@ -29,18 +29,18 @@ import org.codehaus.plexus.util.StringUtils; /** - * @version $Id: ReflectiveSetter.java 1085807 2011-03-26 21:40:19Z hboutemy $ + * @version $Id: ReflectiveSetter.java 1345445 2012-06-02 05:36:33Z hboutemy $ */ public class ReflectiveSetter { - private Map cachedPropertySetters = new HashMap(); + private Map cachedPropertySetters = new HashMap(); - private final Class targetClass; + private final Class targetClass; /** * @param targetClass */ - public ReflectiveSetter( Class targetClass ) + public ReflectiveSetter( Class targetClass ) { this.targetClass = targetClass; } diff -Nru maven-plugin-testing-1.3/maven-test-tools/src/site/site.xml maven-plugin-testing-2.1/maven-test-tools/src/site/site.xml --- maven-plugin-testing-1.3/maven-test-tools/src/site/site.xml 2008-09-12 09:30:54.000000000 +0000 +++ maven-plugin-testing-2.1/maven-test-tools/src/site/site.xml 2012-05-20 14:43:25.000000000 +0000 @@ -19,10 +19,15 @@ under the License. --> - + + + + diff -Nru maven-plugin-testing-1.3/pom.xml maven-plugin-testing-2.1/pom.xml --- maven-plugin-testing-1.3/pom.xml 2012-09-24 16:02:32.000000000 +0000 +++ maven-plugin-testing-2.1/pom.xml 2012-09-23 18:59:07.000000000 +0000 @@ -31,7 +31,7 @@ org.apache.maven.plugin-testing maven-plugin-testing - 1.3 + 2.1 pom Maven Plugin Testing @@ -113,12 +113,8 @@ - - 2.2.1 - - - ${mavenVersion} + 3.0 @@ -128,18 +124,14 @@ - scm:svn:http://svn.apache.org/repos/asf/maven/plugin-testing/tags/maven-plugin-testing-1.3 - scm:svn:https://svn.apache.org/repos/asf/maven/plugin-testing/tags/maven-plugin-testing-1.3 - http://svn.apache.org/viewvc/maven/plugin-testing/tags/maven-plugin-testing-1.3 + scm:svn:http://svn.apache.org/repos/asf/maven/plugin-testing/tags/maven-plugin-testing-2.1 + scm:svn:https://svn.apache.org/repos/asf/maven/plugin-testing/tags/maven-plugin-testing-2.1 + http://svn.apache.org/viewvc/maven/plugin-testing/tags/maven-plugin-testing-2.1 jira http://jira.codehaus.org/browse/MPLUGINTESTING - - Jenkins - https://builds.apache.org/job/maven-plugin-testing/ - apache.website @@ -147,85 +139,94 @@ + + 3.0.3 + 1.5.1 + + - - org.apache.maven - maven-project - ${mavenVersion} - + + org.apache.maven maven-core ${mavenVersion} + provided org.apache.maven - maven-model - ${mavenVersion} - - - org.apache.maven - maven-artifact + maven-compat ${mavenVersion} + provided org.apache.maven - maven-artifact-manager + maven-model ${mavenVersion} + provided org.apache.maven maven-plugin-api ${mavenVersion} - + provided + org.apache.maven - maven-settings + maven-aether-provider ${mavenVersion} - - - - junit - junit - 3.8.2 - + provided + + org.codehaus.plexus plexus-utils 3.0.8 - - - org.codehaus.plexus - plexus-interpolation - 1.15 - + provided + + - org.codehaus.plexus - plexus-archiver - 2.2 - - - org.easymock - easymock - 2.5.2 - + junit + junit + 4.10 + provided + + junit junit + - + + org.apache.maven.plugins + maven-surefire-plugin + + + + java.io.tmpdir + ${java.io.tmpdir} + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.4 + + maven-site-plugin 3.0 @@ -240,5 +241,33 @@ + + + maven-site-plugin + false + + + attach-descriptor + + attach-descriptor + + + + + + + + + reporting + + + + maven-javadoc-plugin + 2.8.1 + + + + + diff -Nru maven-plugin-testing-1.3/src/site/site.xml maven-plugin-testing-2.1/src/site/site.xml --- maven-plugin-testing-1.3/src/site/site.xml 2009-01-16 13:53:50.000000000 +0000 +++ maven-plugin-testing-2.1/src/site/site.xml 2009-11-16 17:36:41.000000000 +0000 @@ -20,12 +20,6 @@ --> - - - org.apache.maven.skins - maven-stylus-skin - 1.1 -