You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by jd...@apache.org on 2007/07/13 05:52:35 UTC

svn commit: r555862 - in /maven/sandbox/trunk/plugins/maven-component-it-plugin/src: main/java/org/apache/maven/plugin/componentit/ test/java/org/apache/maven/plugin/componentit/

Author: jdcasey
Date: Thu Jul 12 20:52:34 2007
New Revision: 555862

URL: http://svn.apache.org/viewvc?view=rev&rev=555862
Log:
One more rename.

Added:
    maven/sandbox/trunk/plugins/maven-component-it-plugin/src/main/java/org/apache/maven/plugin/componentit/StagingBuildMojo.java   (with props)
    maven/sandbox/trunk/plugins/maven-component-it-plugin/src/test/java/org/apache/maven/plugin/componentit/StagingBuildMojoTest.java
      - copied, changed from r555861, maven/sandbox/trunk/plugins/maven-component-it-plugin/src/test/java/org/apache/maven/plugin/componentit/StagePluginMojoTest.java
Removed:
    maven/sandbox/trunk/plugins/maven-component-it-plugin/src/main/java/org/apache/maven/plugin/componentit/StagePluginMojo.java
    maven/sandbox/trunk/plugins/maven-component-it-plugin/src/test/java/org/apache/maven/plugin/componentit/StagePluginMojoTest.java

Added: maven/sandbox/trunk/plugins/maven-component-it-plugin/src/main/java/org/apache/maven/plugin/componentit/StagingBuildMojo.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/plugins/maven-component-it-plugin/src/main/java/org/apache/maven/plugin/componentit/StagingBuildMojo.java?view=auto&rev=555862
==============================================================================
--- maven/sandbox/trunk/plugins/maven-component-it-plugin/src/main/java/org/apache/maven/plugin/componentit/StagingBuildMojo.java (added)
+++ maven/sandbox/trunk/plugins/maven-component-it-plugin/src/main/java/org/apache/maven/plugin/componentit/StagingBuildMojo.java Thu Jul 12 20:52:34 2007
@@ -0,0 +1,104 @@
+package org.apache.maven.plugin.componentit;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.shared.test.plugin.ComponentTestTool;
+import org.apache.maven.shared.test.plugin.TestToolsException;
+
+import java.io.File;
+
+/**
+ * Stage a plugin jar out to a testing local repository location, and rewrite the plugin's version
+ * (for the tests only) to a specified value (ideally this value won't correspond to a deployed 
+ * version, so the plugin is never resolved remotely by accident).
+ * 
+ * @goal stage
+ * @phase pre-integration-test
+ * 
+ * @author jdcasey
+ */
+public class StagingBuildMojo
+    extends AbstractMojo
+{
+    
+    /**
+     * Whether to allow the plugin's unit tests to run when the plugin jar is generated for 
+     * installation in the test local repository. This should be false if your plugin's unit tests
+     * run maven builds that need to have the plugin staged (via this plugin). In most cases, this
+     * plugin will not execute unless unit tests are run, so it should still be OK to skip unit
+     * tests here for improved performance.
+     * 
+     * @parameter default-value="true"
+     */
+    private boolean skipUnitTests;
+
+    /**
+     * Version to use when installing the plugin into the testing-only local repository.
+     * 
+     * @parameter default-value="testing"
+     * @required
+     */
+    private String pluginVersion;
+
+    /**
+     * The location of the testing-only local repository.
+     * 
+     * @parameter default-value="${project.build.directory}/local-repository"
+     * @required
+     */
+    private File repositoryDirectory;
+
+    /**
+     * The POM file.
+     * 
+     * @parameter default-value="${project.file}"
+     * @required
+     */
+    private File pomFile;
+
+    /**
+     * Component that orchestrates staging. This plugin is really just a wrapper around
+     * the ComponentTestTool.
+     * 
+     * @component
+     */
+    private ComponentTestTool componentTestTool;
+    
+    public StagingBuildMojo()
+    {
+        // used by Maven
+    }
+
+    StagingBuildMojo( File pomFile, boolean skipUnitTests, String pluginVersion, File repositoryDirectory,
+                     ComponentTestTool componentTestTool )
+    {
+        this.pomFile = pomFile;
+        this.skipUnitTests = skipUnitTests;
+        this.pluginVersion = pluginVersion;
+        this.repositoryDirectory = repositoryDirectory;
+        this.componentTestTool = componentTestTool;
+    }
+
+    public void execute()
+        throws MojoExecutionException, MojoFailureException
+    {
+        try
+        {
+            if ( skipUnitTests )
+            {
+                componentTestTool.prepareComponentForUnitTestingWithMavenBuilds( pomFile, pluginVersion, repositoryDirectory );
+            }
+            else
+            {
+                componentTestTool.prepareComponentForIntegrationTesting( pomFile, pluginVersion, repositoryDirectory );
+            }
+        }
+        catch ( TestToolsException e )
+        {
+            throw new MojoExecutionException( "Failed to stage plugin with version: " + pluginVersion
+                + " to test local repository: " + repositoryDirectory, e );
+        }
+    }
+
+}

Propchange: maven/sandbox/trunk/plugins/maven-component-it-plugin/src/main/java/org/apache/maven/plugin/componentit/StagingBuildMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/sandbox/trunk/plugins/maven-component-it-plugin/src/main/java/org/apache/maven/plugin/componentit/StagingBuildMojo.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Copied: maven/sandbox/trunk/plugins/maven-component-it-plugin/src/test/java/org/apache/maven/plugin/componentit/StagingBuildMojoTest.java (from r555861, maven/sandbox/trunk/plugins/maven-component-it-plugin/src/test/java/org/apache/maven/plugin/componentit/StagePluginMojoTest.java)
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/plugins/maven-component-it-plugin/src/test/java/org/apache/maven/plugin/componentit/StagingBuildMojoTest.java?view=diff&rev=555862&p1=maven/sandbox/trunk/plugins/maven-component-it-plugin/src/test/java/org/apache/maven/plugin/componentit/StagePluginMojoTest.java&r1=555861&p2=maven/sandbox/trunk/plugins/maven-component-it-plugin/src/test/java/org/apache/maven/plugin/componentit/StagingBuildMojoTest.java&r2=555862
==============================================================================
--- maven/sandbox/trunk/plugins/maven-component-it-plugin/src/test/java/org/apache/maven/plugin/componentit/StagePluginMojoTest.java (original)
+++ maven/sandbox/trunk/plugins/maven-component-it-plugin/src/test/java/org/apache/maven/plugin/componentit/StagingBuildMojoTest.java Thu Jul 12 20:52:34 2007
@@ -2,7 +2,7 @@
 
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.plugin.componentit.StagePluginMojo;
+import org.apache.maven.plugin.componentit.StagingBuildMojo;
 import org.apache.maven.shared.test.plugin.ComponentTestTool;
 import org.apache.maven.shared.tools.easymock.TestFileManager;
 import org.codehaus.plexus.PlexusTestCase;
@@ -10,13 +10,13 @@
 import java.io.File;
 import java.io.IOException;
 
-public class StagePluginMojoTest
+public class StagingBuildMojoTest
     extends PlexusTestCase
 {
     
     private ComponentTestTool componentTestTool;
     
-    private TestFileManager fileManager = new TestFileManager( "StagePluginMojo.test", "" );
+    private TestFileManager fileManager = new TestFileManager( "StagingBuildMojo.test", "" );
     
     public void setUp() throws Exception
     {
@@ -41,7 +41,7 @@
         assertFalse( localRepo.exists() );
         
         // we must ALWAYS skip unit tests for this unit test...
-        new StagePluginMojo( new File( "pom.xml" ).getCanonicalFile(), true, "testing", localRepo, componentTestTool ).execute();
+        new StagingBuildMojo( new File( "pom.xml" ).getCanonicalFile(), true, "testing", localRepo, componentTestTool ).execute();
         
         assertTrue( localRepo.exists() );
     }