You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by if...@apache.org on 2014/07/08 11:52:12 UTC

[4/4] git commit: MPLUGINTESTING-42 on-the-fly mojo execution configuration

MPLUGINTESTING-42 on-the-fly mojo execution configuration

Signed-off-by: Igor Fedorenko <if...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/maven-plugin-testing/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-plugin-testing/commit/46361087
Tree: http://git-wip-us.apache.org/repos/asf/maven-plugin-testing/tree/46361087
Diff: http://git-wip-us.apache.org/repos/asf/maven-plugin-testing/diff/46361087

Branch: refs/heads/master
Commit: 46361087de813bc38004833d52cae7d766bf8e9d
Parents: 3c981e5
Author: Igor Fedorenko <if...@apache.org>
Authored: Tue Jul 8 12:55:09 2014 +0400
Committer: Igor Fedorenko <if...@apache.org>
Committed: Tue Jul 8 13:49:00 2014 +0400

----------------------------------------------------------------------
 .../maven/plugin/testing/MojoParameters.java    | 37 ++++++++++++++++++++
 .../apache/maven/plugin/testing/MojoRule.java   | 28 +++++++++++++++
 2 files changed, 65 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-plugin-testing/blob/46361087/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/MojoParameters.java
----------------------------------------------------------------------
diff --git a/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/MojoParameters.java b/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/MojoParameters.java
new file mode 100644
index 0000000..7412bc4
--- /dev/null
+++ b/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/MojoParameters.java
@@ -0,0 +1,37 @@
+package org.apache.maven.plugin.testing;
+
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Static helpers to create and manipulate mojo execution configuration parameters
+ * 
+ * @since 3.2.0
+ */
+public class MojoParameters
+{
+    public static Xpp3Dom newParameter( String name, String value )
+    {
+        Xpp3Dom child = new Xpp3Dom( name );
+        child.setValue( value );
+        return child;
+    }
+}

http://git-wip-us.apache.org/repos/asf/maven-plugin-testing/blob/46361087/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/MojoRule.java
----------------------------------------------------------------------
diff --git a/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/MojoRule.java b/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/MojoRule.java
index a8c2db8..d4d57f0 100644
--- a/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/MojoRule.java
+++ b/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/MojoRule.java
@@ -367,6 +367,34 @@ public class MojoRule
     /**
      * @since 3.2.0
      */
+    public void executeMojo( MavenProject project, String goal, Xpp3Dom... parameters )
+        throws Exception
+    {
+        MavenSession session = newMavenSession( project );
+        executeMojo( session, project, goal, parameters );
+    }
+
+    /**
+     * @since 3.2.0
+     */
+    public void executeMojo( MavenSession session, MavenProject project, String goal, Xpp3Dom... parameters )
+        throws Exception
+    {
+        MojoExecution execution = newMojoExecution( goal );
+        if ( parameters != null )
+        {
+            Xpp3Dom configuration = execution.getConfiguration();
+            for ( Xpp3Dom parameter : parameters )
+            {
+                configuration.addChild( parameter );
+            }
+        }
+        executeMojo( session, project, execution );
+    }
+
+    /**
+     * @since 3.2.0
+     */
     public void executeMojo( MavenSession session, MavenProject project, MojoExecution execution )
         throws Exception
     {