Re: svn commit: r1131456 - in /maven/plugins/trunk/maven-changes-plugin/src: main/java/org/apache/maven/plugin/announcement/ main/java/org/apache/maven/plugin/changes/ test/java/org/apache/maven/plugin/changes/

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r1131456 - in /maven/plugins/trunk/maven-changes-plugin/src: main/java/org/apache/maven/plugin/announcement/ main/java/org/apache/maven/plugin/changes/ test/java/org/apache/maven/plugin/changes/

dennisl
Note that if we decide to keep this patch, the @since tags needs to be
updated to 2.6.

On 2011-06-04 20:13, [hidden email] wrote:

> Author: bimargulies
> Date: Sat Jun  4 18:13:08 2011
> New Revision: 1131456
>
> URL: http://svn.apache.org/viewvc?rev=1131456&view=rev
> Log:
> [MCHANGES-245]: customization of issue types (from Alan Parkinson)
>
> Added:
>     maven/plugins/trunk/maven-changes-plugin/src/test/java/org/apache/maven/plugin/changes/IssueAdapterTest.java   (with props)
> Modified:
>     maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/announcement/AnnouncementMojo.java
>     maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/IssueAdapter.java
>
> Modified: maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/announcement/AnnouncementMojo.java
> URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/announcement/AnnouncementMojo.java?rev=1131456&r1=1131455&r2=1131456&view=diff
> ==============================================================================
> --- maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/announcement/AnnouncementMojo.java (original)
> +++ maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/announcement/AnnouncementMojo.java Sat Jun  4 18:13:08 2011
> @@ -140,7 +140,20 @@ public class AnnouncementMojo
>       * @since 2.4
>       */
>      private List<String> issueManagementSystems;
> -
> +
> +    /**
> +     * Maps issues types to action types for grouping issues in announcements.
> +     * If issue types are not defined for a action type then the default issue type
> +     * will be applied.
> +     * <p>
> +     * Valid action types: <code>add</code>, <code>fix</code> and <code>update</code>.
> +     * </p>
> +     *
> +     * @parameter
> +     * @since 2.5
> +     */
> +    private Map<String, String> issueTypes;
> +    
>      /**
>       * Directory where the template file will be generated.
>       *
> @@ -720,7 +733,8 @@ public class AnnouncementMojo
>          }
>          else
>          {
> -            return IssueAdapter.getReleases( issues );
> +         IssueAdapter adapter = new IssueAdapter(issueTypes);
> +            return adapter.getReleases( issues );
>          }
>      }
>  
> @@ -800,6 +814,14 @@ public class AnnouncementMojo
>      {
>          this.introduction = introduction;
>      }
> +    
> + public void setIssueTypes(Map<String, String> issueTypes) {
> + this.issueTypes = issueTypes;
> + }
> +
> + public Map<String, String> getIssueTypes() {
> + return issueTypes;
> + }
>  
>      public File getOutputDirectory()
>      {
>
> Modified: maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/IssueAdapter.java
> URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/IssueAdapter.java?rev=1131456&r1=1131455&r2=1131456&view=diff
> ==============================================================================
> --- maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/IssueAdapter.java (original)
> +++ maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/IssueAdapter.java Sat Jun  4 18:13:08 2011
> @@ -25,7 +25,6 @@ import org.apache.maven.plugins.changes.
>  
>  import java.util.ArrayList;
>  import java.util.HashMap;
> -import java.util.Iterator;
>  import java.util.List;
>  import java.util.Map;
>  
> @@ -39,6 +38,43 @@ import java.util.Map;
>   */
>  public class IssueAdapter
>  {
> +    private static final String[] DEFAULT_ADD_TYPE = { "New Feature" };
> +
> +    private static final String[] DEFAULT_FIX_TYPE = { "Bug" };
> +
> +    private static final String[] DEFAULT_UPDATE_TYPE = { "Improvement" };
> +
> +    private Map<String, String> issueMap = new HashMap<String, String>();
> +
> +    public IssueAdapter() {
> +        this( null );
> +    }
> +                        
> +    public IssueAdapter( Map<String, String> issueTypes )
> +    {
> +        addIssueTypesToMap( "add", issueTypes, DEFAULT_ADD_TYPE );
> +        addIssueTypesToMap( "fix", issueTypes, DEFAULT_FIX_TYPE );
> +        addIssueTypesToMap( "update", issueTypes, DEFAULT_UPDATE_TYPE );
> +    }
> +
> +    private void addIssueTypesToMap( String actionKey, Map<String, String> issueTypes, String[] defaultTypes )
> +    {
> +        String[] types;
> +        if ( issueTypes != null && issueTypes.containsKey( actionKey ) )
> +        {
> +            types = issueTypes.get( actionKey ).split( "," );
> +        }
> +        else
> +        {
> +            types = defaultTypes;
> +        }
> +
> +        for ( String type : types )
> +        {
> +            issueMap.put( type.trim(), actionKey );
> +        }
> +    }
> +
>      /**
>       * Adapt a <code>List</code> of <code>Issue</code>s to a
>       * <code>List</code> of <code>Release</code>s.
> @@ -46,7 +82,7 @@ public class IssueAdapter
>       * @param issues The issues
>       * @return A list of releases
>       */
> -    public static List<Release> getReleases( List<Issue> issues )
> +    public List<Release> getReleases( List<Issue> issues )
>      {
>          // A Map of releases keyed by fixVersion
>          Map<String,Release> releasesMap = new HashMap<String,Release>();
> @@ -91,26 +127,17 @@ public class IssueAdapter
>       * @param issue The issue to extract the information from
>       * @return An <code>Action</code>
>       */
> -    public static Action createAction( Issue issue )
> +    public Action createAction( Issue issue )
>      {
>          Action action = new Action();
>  
>          // @todo We need to add something like issue.getPresentationIdentifier() to be able to support other IMSes beside JIRA
>          action.setIssue( issue.getKey() );
>  
> -        // @todo To support types for different IMSes we need some way to map these values to the ones used in a particular IMS
>          String type = "";
> -        if ( issue.getType().equals( "Bug" ) )
> -        {
> -            type = "fix";
> -        }
> -        else if ( issue.getType().equals( "New Feature" ) )
> -        {
> -            type = "add";
> -        }
> -        else if ( issue.getType().equals( "Improvement" ) )
> +        if ( issueMap.containsKey( issue.getType() ) )
>          {
> -            type = "update";
> +            type = issueMap.get( issue.getType() );
>          }
>          action.setType( type );
>  
>
> Added: maven/plugins/trunk/maven-changes-plugin/src/test/java/org/apache/maven/plugin/changes/IssueAdapterTest.java
> URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/test/java/org/apache/maven/plugin/changes/IssueAdapterTest.java?rev=1131456&view=auto
> ==============================================================================
> --- maven/plugins/trunk/maven-changes-plugin/src/test/java/org/apache/maven/plugin/changes/IssueAdapterTest.java (added)
> +++ maven/plugins/trunk/maven-changes-plugin/src/test/java/org/apache/maven/plugin/changes/IssueAdapterTest.java Sat Jun  4 18:13:08 2011
> @@ -0,0 +1,122 @@
> +package org.apache.maven.plugin.changes;
> +
> +/*
> + * Licensed to the Apache Software Foundation (ASF) under one
> + * or more contributor license agreements.  See the NOTICE file
> + * distributed with this work for additional information
> + * regarding copyright ownership.  The ASF licenses this file
> + * to you under the Apache License, Version 2.0 (the
> + * "License"); you may not use this file except in compliance
> + * with the License.  You may obtain a copy of the License at
> + *
> + *    http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicable law or agreed to in writing,
> + * software distributed under the License is distributed on an
> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> + * KIND, either express or implied.  See the License for the
> + * specific language governing permissions and limitations
> + * under the License.
> + */
> +
> +import java.util.HashMap;
> +import java.util.Map;
> +
> +import org.apache.maven.plugin.issues.Issue;
> +import org.apache.maven.plugins.changes.model.Action;
> +
> +import junit.framework.TestCase;
> +
> +/**
> + * @author Alan Parkinson
> + * @since 2.5
> + */
> +public class IssueAdapterTest
> +    extends TestCase
> +{
> +
> +    public void testDefaultIssueTypeMapping()
> +    {
> +        IssueAdapter adapter = new IssueAdapter( null );
> +
> +        Issue issue = createIssue( "TST-1", "New Feature" );
> +        Action action = adapter.createAction( issue );
> +        assertEquals( "add", action.getType() );
> +
> +        issue = createIssue( "TST-2", "Bug" );
> +        action = adapter.createAction( issue );
> +        assertEquals( "fix", action.getType() );
> +
> +        issue = createIssue( "TST-3", "Improvement" );
> +        action = adapter.createAction( issue );
> +        assertEquals( "update", action.getType() );
> +
> +        issue = createIssue( "TST-4", "Unknown Type" );
> +        action = adapter.createAction( issue );
> +        assertEquals( "", action.getType() );
> +    }
> +
> +    public void testCustomIssueTypeMappingOveridesDefaultMapping()
> +    {
> +        Map<String, String> typeMapping = new HashMap<String, String>();
> +        typeMapping.put( "add", "" );
> +        typeMapping.put( "fix", "" );
> +        typeMapping.put( "update", "" );
> +        IssueAdapter adapter = new IssueAdapter( typeMapping );
> +
> +        Issue issue = createIssue( "TST-1", "New Feature" );
> +        Action action = adapter.createAction( issue );
> +        assertEquals( "", action.getType() );
> +
> +        issue = createIssue( "TST-2", "Bug" );
> +        action = adapter.createAction( issue );
> +        assertEquals( "", action.getType() );
> +
> +        issue = createIssue( "TST-3", "Improvement" );
> +        action = adapter.createAction( issue );
> +        assertEquals( "", action.getType() );
> +
> +        issue = createIssue( "TST-4", "Unknown Type" );
> +        action = adapter.createAction( issue );
> +        assertEquals( "", action.getType() );
> +    }
> +
> +    public void testCustomIssueTypeMapping()
> +    {
> +        Map<String, String> typeMapping = new HashMap<String, String>();
> +        typeMapping.put( "add", "Story,Epic" );
> +        typeMapping.put( "fix", "Defect, Error" );
> +        IssueAdapter adapter = new IssueAdapter( typeMapping );
> +
> +        Issue issue = createIssue( "TST-1", "Story" );
> +        Action action = adapter.createAction( issue );
> +        assertEquals( "add", action.getType() );
> +
> +        issue = createIssue( "TST-2", "Epic" );
> +        action = adapter.createAction( issue );
> +        assertEquals( "add", action.getType() );
> +
> +        issue = createIssue( "TST-3", "Error" );
> +        action = adapter.createAction( issue );
> +        assertEquals( "fix", action.getType() );
> +
> +        issue = createIssue( "TST-4", "Defect" );
> +        action = adapter.createAction( issue );
> +        assertEquals( "fix", action.getType() );
> +
> +        // Test the default mapping for "update" hasn't been overridden
> +        issue = createIssue( "TST-5", "Improvement" );
> +        action = adapter.createAction( issue );
> +        assertEquals( "update", action.getType() );
> +    }
> +
> +    private Issue createIssue( String key, String type )
> +    {
> +        Issue issue = new Issue();
> +        issue.setKey( key );
> +        issue.setType( type );
> +        issue.setAssignee( "A User" );
> +        issue.setSummary( "The title of this issue" );
> +        return issue;
> +    }
> +}
>
> Propchange: maven/plugins/trunk/maven-changes-plugin/src/test/java/org/apache/maven/plugin/changes/IssueAdapterTest.java
> ------------------------------------------------------------------------------
>     svn:eol-style = native
>
> Propchange: maven/plugins/trunk/maven-changes-plugin/src/test/java/org/apache/maven/plugin/changes/IssueAdapterTest.java
> ------------------------------------------------------------------------------
>     svn:mime-type = text/plain
>
>
>


--
Dennis Lundberg

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r1131456 - in /maven/plugins/trunk/maven-changes-plugin/src: main/java/org/apache/maven/plugin/announcement/ main/java/org/apache/maven/plugin/changes/ test/java/org/apache/maven/plugin/changes/

Benson Margulies
oops. Well, sicne I see no reason not to keep it, I'll fix the since.

On Sat, Jun 4, 2011 at 5:22 PM, Dennis Lundberg <[hidden email]> wrote:

> Note that if we decide to keep this patch, the @since tags needs to be
> updated to 2.6.
>
> On 2011-06-04 20:13, [hidden email] wrote:
>> Author: bimargulies
>> Date: Sat Jun  4 18:13:08 2011
>> New Revision: 1131456
>>
>> URL: http://svn.apache.org/viewvc?rev=1131456&view=rev
>> Log:
>> [MCHANGES-245]: customization of issue types (from Alan Parkinson)
>>
>> Added:
>>     maven/plugins/trunk/maven-changes-plugin/src/test/java/org/apache/maven/plugin/changes/IssueAdapterTest.java   (with props)
>> Modified:
>>     maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/announcement/AnnouncementMojo.java
>>     maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/IssueAdapter.java
>>
>> Modified: maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/announcement/AnnouncementMojo.java
>> URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/announcement/AnnouncementMojo.java?rev=1131456&r1=1131455&r2=1131456&view=diff
>> ==============================================================================
>> --- maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/announcement/AnnouncementMojo.java (original)
>> +++ maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/announcement/AnnouncementMojo.java Sat Jun  4 18:13:08 2011
>> @@ -140,7 +140,20 @@ public class AnnouncementMojo
>>       * @since 2.4
>>       */
>>      private List<String> issueManagementSystems;
>> -
>> +
>> +    /**
>> +     * Maps issues types to action types for grouping issues in announcements.
>> +     * If issue types are not defined for a action type then the default issue type
>> +     * will be applied.
>> +     * <p>
>> +     * Valid action types: <code>add</code>, <code>fix</code> and <code>update</code>.
>> +     * </p>
>> +     *
>> +     * @parameter
>> +     * @since 2.5
>> +     */
>> +    private Map<String, String> issueTypes;
>> +
>>      /**
>>       * Directory where the template file will be generated.
>>       *
>> @@ -720,7 +733,8 @@ public class AnnouncementMojo
>>          }
>>          else
>>          {
>> -            return IssueAdapter.getReleases( issues );
>> +             IssueAdapter adapter = new IssueAdapter(issueTypes);
>> +            return adapter.getReleases( issues );
>>          }
>>      }
>>
>> @@ -800,6 +814,14 @@ public class AnnouncementMojo
>>      {
>>          this.introduction = introduction;
>>      }
>> +
>> +     public void setIssueTypes(Map<String, String> issueTypes) {
>> +             this.issueTypes = issueTypes;
>> +     }
>> +
>> +     public Map<String, String> getIssueTypes() {
>> +             return issueTypes;
>> +     }
>>
>>      public File getOutputDirectory()
>>      {
>>
>> Modified: maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/IssueAdapter.java
>> URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/IssueAdapter.java?rev=1131456&r1=1131455&r2=1131456&view=diff
>> ==============================================================================
>> --- maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/IssueAdapter.java (original)
>> +++ maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/IssueAdapter.java Sat Jun  4 18:13:08 2011
>> @@ -25,7 +25,6 @@ import org.apache.maven.plugins.changes.
>>
>>  import java.util.ArrayList;
>>  import java.util.HashMap;
>> -import java.util.Iterator;
>>  import java.util.List;
>>  import java.util.Map;
>>
>> @@ -39,6 +38,43 @@ import java.util.Map;
>>   */
>>  public class IssueAdapter
>>  {
>> +    private static final String[] DEFAULT_ADD_TYPE = { "New Feature" };
>> +
>> +    private static final String[] DEFAULT_FIX_TYPE = { "Bug" };
>> +
>> +    private static final String[] DEFAULT_UPDATE_TYPE = { "Improvement" };
>> +
>> +    private Map<String, String> issueMap = new HashMap<String, String>();
>> +
>> +    public IssueAdapter() {
>> +        this( null );
>> +    }
>> +
>> +    public IssueAdapter( Map<String, String> issueTypes )
>> +    {
>> +        addIssueTypesToMap( "add", issueTypes, DEFAULT_ADD_TYPE );
>> +        addIssueTypesToMap( "fix", issueTypes, DEFAULT_FIX_TYPE );
>> +        addIssueTypesToMap( "update", issueTypes, DEFAULT_UPDATE_TYPE );
>> +    }
>> +
>> +    private void addIssueTypesToMap( String actionKey, Map<String, String> issueTypes, String[] defaultTypes )
>> +    {
>> +        String[] types;
>> +        if ( issueTypes != null && issueTypes.containsKey( actionKey ) )
>> +        {
>> +            types = issueTypes.get( actionKey ).split( "," );
>> +        }
>> +        else
>> +        {
>> +            types = defaultTypes;
>> +        }
>> +
>> +        for ( String type : types )
>> +        {
>> +            issueMap.put( type.trim(), actionKey );
>> +        }
>> +    }
>> +
>>      /**
>>       * Adapt a <code>List</code> of <code>Issue</code>s to a
>>       * <code>List</code> of <code>Release</code>s.
>> @@ -46,7 +82,7 @@ public class IssueAdapter
>>       * @param issues The issues
>>       * @return A list of releases
>>       */
>> -    public static List<Release> getReleases( List<Issue> issues )
>> +    public List<Release> getReleases( List<Issue> issues )
>>      {
>>          // A Map of releases keyed by fixVersion
>>          Map<String,Release> releasesMap = new HashMap<String,Release>();
>> @@ -91,26 +127,17 @@ public class IssueAdapter
>>       * @param issue The issue to extract the information from
>>       * @return An <code>Action</code>
>>       */
>> -    public static Action createAction( Issue issue )
>> +    public Action createAction( Issue issue )
>>      {
>>          Action action = new Action();
>>
>>          // @todo We need to add something like issue.getPresentationIdentifier() to be able to support other IMSes beside JIRA
>>          action.setIssue( issue.getKey() );
>>
>> -        // @todo To support types for different IMSes we need some way to map these values to the ones used in a particular IMS
>>          String type = "";
>> -        if ( issue.getType().equals( "Bug" ) )
>> -        {
>> -            type = "fix";
>> -        }
>> -        else if ( issue.getType().equals( "New Feature" ) )
>> -        {
>> -            type = "add";
>> -        }
>> -        else if ( issue.getType().equals( "Improvement" ) )
>> +        if ( issueMap.containsKey( issue.getType() ) )
>>          {
>> -            type = "update";
>> +            type = issueMap.get( issue.getType() );
>>          }
>>          action.setType( type );
>>
>>
>> Added: maven/plugins/trunk/maven-changes-plugin/src/test/java/org/apache/maven/plugin/changes/IssueAdapterTest.java
>> URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/test/java/org/apache/maven/plugin/changes/IssueAdapterTest.java?rev=1131456&view=auto
>> ==============================================================================
>> --- maven/plugins/trunk/maven-changes-plugin/src/test/java/org/apache/maven/plugin/changes/IssueAdapterTest.java (added)
>> +++ maven/plugins/trunk/maven-changes-plugin/src/test/java/org/apache/maven/plugin/changes/IssueAdapterTest.java Sat Jun  4 18:13:08 2011
>> @@ -0,0 +1,122 @@
>> +package org.apache.maven.plugin.changes;
>> +
>> +/*
>> + * Licensed to the Apache Software Foundation (ASF) under one
>> + * or more contributor license agreements.  See the NOTICE file
>> + * distributed with this work for additional information
>> + * regarding copyright ownership.  The ASF licenses this file
>> + * to you under the Apache License, Version 2.0 (the
>> + * "License"); you may not use this file except in compliance
>> + * with the License.  You may obtain a copy of the License at
>> + *
>> + *    http://www.apache.org/licenses/LICENSE-2.0
>> + *
>> + * Unless required by applicable law or agreed to in writing,
>> + * software distributed under the License is distributed on an
>> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>> + * KIND, either express or implied.  See the License for the
>> + * specific language governing permissions and limitations
>> + * under the License.
>> + */
>> +
>> +import java.util.HashMap;
>> +import java.util.Map;
>> +
>> +import org.apache.maven.plugin.issues.Issue;
>> +import org.apache.maven.plugins.changes.model.Action;
>> +
>> +import junit.framework.TestCase;
>> +
>> +/**
>> + * @author Alan Parkinson
>> + * @since 2.5
>> + */
>> +public class IssueAdapterTest
>> +    extends TestCase
>> +{
>> +
>> +    public void testDefaultIssueTypeMapping()
>> +    {
>> +        IssueAdapter adapter = new IssueAdapter( null );
>> +
>> +        Issue issue = createIssue( "TST-1", "New Feature" );
>> +        Action action = adapter.createAction( issue );
>> +        assertEquals( "add", action.getType() );
>> +
>> +        issue = createIssue( "TST-2", "Bug" );
>> +        action = adapter.createAction( issue );
>> +        assertEquals( "fix", action.getType() );
>> +
>> +        issue = createIssue( "TST-3", "Improvement" );
>> +        action = adapter.createAction( issue );
>> +        assertEquals( "update", action.getType() );
>> +
>> +        issue = createIssue( "TST-4", "Unknown Type" );
>> +        action = adapter.createAction( issue );
>> +        assertEquals( "", action.getType() );
>> +    }
>> +
>> +    public void testCustomIssueTypeMappingOveridesDefaultMapping()
>> +    {
>> +        Map<String, String> typeMapping = new HashMap<String, String>();
>> +        typeMapping.put( "add", "" );
>> +        typeMapping.put( "fix", "" );
>> +        typeMapping.put( "update", "" );
>> +        IssueAdapter adapter = new IssueAdapter( typeMapping );
>> +
>> +        Issue issue = createIssue( "TST-1", "New Feature" );
>> +        Action action = adapter.createAction( issue );
>> +        assertEquals( "", action.getType() );
>> +
>> +        issue = createIssue( "TST-2", "Bug" );
>> +        action = adapter.createAction( issue );
>> +        assertEquals( "", action.getType() );
>> +
>> +        issue = createIssue( "TST-3", "Improvement" );
>> +        action = adapter.createAction( issue );
>> +        assertEquals( "", action.getType() );
>> +
>> +        issue = createIssue( "TST-4", "Unknown Type" );
>> +        action = adapter.createAction( issue );
>> +        assertEquals( "", action.getType() );
>> +    }
>> +
>> +    public void testCustomIssueTypeMapping()
>> +    {
>> +        Map<String, String> typeMapping = new HashMap<String, String>();
>> +        typeMapping.put( "add", "Story,Epic" );
>> +        typeMapping.put( "fix", "Defect, Error" );
>> +        IssueAdapter adapter = new IssueAdapter( typeMapping );
>> +
>> +        Issue issue = createIssue( "TST-1", "Story" );
>> +        Action action = adapter.createAction( issue );
>> +        assertEquals( "add", action.getType() );
>> +
>> +        issue = createIssue( "TST-2", "Epic" );
>> +        action = adapter.createAction( issue );
>> +        assertEquals( "add", action.getType() );
>> +
>> +        issue = createIssue( "TST-3", "Error" );
>> +        action = adapter.createAction( issue );
>> +        assertEquals( "fix", action.getType() );
>> +
>> +        issue = createIssue( "TST-4", "Defect" );
>> +        action = adapter.createAction( issue );
>> +        assertEquals( "fix", action.getType() );
>> +
>> +        // Test the default mapping for "update" hasn't been overridden
>> +        issue = createIssue( "TST-5", "Improvement" );
>> +        action = adapter.createAction( issue );
>> +        assertEquals( "update", action.getType() );
>> +    }
>> +
>> +    private Issue createIssue( String key, String type )
>> +    {
>> +        Issue issue = new Issue();
>> +        issue.setKey( key );
>> +        issue.setType( type );
>> +        issue.setAssignee( "A User" );
>> +        issue.setSummary( "The title of this issue" );
>> +        return issue;
>> +    }
>> +}
>>
>> Propchange: maven/plugins/trunk/maven-changes-plugin/src/test/java/org/apache/maven/plugin/changes/IssueAdapterTest.java
>> ------------------------------------------------------------------------------
>>     svn:eol-style = native
>>
>> Propchange: maven/plugins/trunk/maven-changes-plugin/src/test/java/org/apache/maven/plugin/changes/IssueAdapterTest.java
>> ------------------------------------------------------------------------------
>>     svn:mime-type = text/plain
>>
>>
>>
>
>
> --
> Dennis Lundberg
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]