Author: dennisl
Date: Mon Sep 10 17:34:32 2012
New Revision: 1382996
URL: http://svn.apache.org/viewvc?rev=1382996&view=rev
Log:
[MCHANGES-267] Add ability to skip JIRA report creation
Submitted by: Joshua Hyde
Reviewed by: Dennis Lundberg
- I had to rework the parameter specification a bit, because the plugin had
moved to annotations after the patch was created.
Added:
maven/plugins/trunk/maven-changes-plugin/src/test/java/org/apache/maven/plugin/jira/JiraMojoTest.java
(with props)
Modified:
maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/JiraMojo.java
Modified:
maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/JiraMojo.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/JiraMojo.java?rev=1382996&r1=1382995&r2=1382996&view=diff
==============================================================================
---
maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/JiraMojo.java
(original)
+++
maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/JiraMojo.java
Mon Sep 10 17:34:32 2012
@@ -92,6 +92,7 @@ public class JiraMojo
/**
* Use the JIRA query language instead of the JIRA query based on HTTP
parameters.
* From JIRA 5.1 and up only JQL is supported. JIRA 4.4 supports both JQL
and URL parameter based queries.
+ *
* @since 2.8
*/
@Parameter( defaultValue = "false" )
@@ -198,6 +199,14 @@ public class JiraMojo
private Settings settings;
/**
+ * If set to <code>true</code>, then the JIRA report will not be generated.
+ *
+ * @since 2.8
+ */
+ @Parameter( property = "changes.jira.skip", defaultValue = "false" )
+ private boolean skip;
+
+ /**
* Sets the column names that you want to sort the report by. Add
* <code>DESC</code> following the column name
* to specify <i>descending</i> sequence. For
@@ -306,6 +315,10 @@ public class JiraMojo
*/
public boolean canGenerateReport()
{
+ if ( skip )
+ {
+ return false;
+ }
if ( mockDownloader != null )
{
return true;
Added:
maven/plugins/trunk/maven-changes-plugin/src/test/java/org/apache/maven/plugin/jira/JiraMojoTest.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/test/java/org/apache/maven/plugin/jira/JiraMojoTest.java?rev=1382996&view=auto
==============================================================================
---
maven/plugins/trunk/maven-changes-plugin/src/test/java/org/apache/maven/plugin/jira/JiraMojoTest.java
(added)
+++
maven/plugins/trunk/maven-changes-plugin/src/test/java/org/apache/maven/plugin/jira/JiraMojoTest.java
Mon Sep 10 17:34:32 2012
@@ -0,0 +1,45 @@
+package org.apache.maven.plugin.jira;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.plugin.testing.AbstractMojoTestCase;
+
+/**
+ * Unit tests for {@link JiraMojo}.
+ *
+ * @author jrh3k5
+ * @since 2.8
+ */
+
+public class JiraMojoTest extends AbstractMojoTestCase
+{
+ private final JiraMojo mojo = new JiraMojo();
+
+ /**
+ * If the mojo has been marked to be skipped, then it should indicate that
the report cannot be generated.
+ *
+ * @throws Exception If any errors occur during the test run.
+ */
+ public void testCanGenerateReportSkipped() throws Exception
+ {
+ setVariableValueToObject( mojo, "skip", Boolean.TRUE );
+ assertFalse( mojo.canGenerateReport() );
+ }
+}
Propchange:
maven/plugins/trunk/maven-changes-plugin/src/test/java/org/apache/maven/plugin/jira/JiraMojoTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
maven/plugins/trunk/maven-changes-plugin/src/test/java/org/apache/maven/plugin/jira/JiraMojoTest.java
------------------------------------------------------------------------------
svn:keywords = Date Revision Author Id