You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by bi...@apache.org on 2011/06/12 23:08:35 UTC
svn commit: r1134984 - 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/
Author: bimargulies
Date: Sun Jun 12 21:08:34 2011
New Revision: 1134984
URL: http://svn.apache.org/viewvc?rev=1134984&view=rev
Log:
[MCHANGES-259] Start to build some modularity that knows that we have multiple
issue management systems at work in here. This is just the beginning.
Added:
maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/AbstractIssueManagementSystem.java (with props)
maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/IssueManagementSystem.java (with props)
maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/IssueType.java (with props)
maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/JIRAIssueManagmentSystem.java (with props)
maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/TRACIssueManagmentSystem.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
maven/plugins/trunk/maven-changes-plugin/src/test/java/org/apache/maven/plugin/changes/IssueAdapterTest.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=1134984&r1=1134983&r2=1134984&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 Sun Jun 12 21:08:34 2011
@@ -30,9 +30,12 @@ import java.util.Map;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.changes.ChangesXML;
+import org.apache.maven.plugin.changes.JIRAIssueManagmentSystem;
import org.apache.maven.plugin.changes.IssueAdapter;
+import org.apache.maven.plugin.changes.IssueManagementSystem;
import org.apache.maven.plugin.changes.ProjectUtils;
import org.apache.maven.plugin.changes.ReleaseUtils;
+import org.apache.maven.plugin.changes.TRACIssueManagmentSystem;
import org.apache.maven.plugin.issues.Issue;
import org.apache.maven.plugin.issues.IssueUtils;
import org.apache.maven.plugin.jira.JiraDownloader;
@@ -455,11 +458,10 @@ public class AnnouncementMojo
issueManagementSystems.add( CHANGES_XML );
}
}
-
+
// Fetch releases from the configured issue management systems
List<Release> releases = null;
-
- if ( issueManagementSystems.contains( CHANGES_XML ) )
+ if ( issueManagementSystems.contains ( CHANGES_XML ) )
{
if ( getXmlPath().exists() )
{
@@ -474,7 +476,7 @@ public class AnnouncementMojo
}
}
- if ( issueManagementSystems.contains( JIRA ) )
+ if ( issueManagementSystems.contains( JIRA ) )
{
if ( ProjectUtils.validateIfIssueManagementComplete( project, JIRA, "JIRA announcement", getLog() ) )
{
@@ -717,7 +719,7 @@ public class AnnouncementMojo
+ " that matched the versionPrefix '" + versionPrefix + "'." );
}
- return getReleases( issueList );
+ return getReleases( issueList, new JIRAIssueManagmentSystem() );
}
catch ( Exception e )
{
@@ -725,15 +727,19 @@ public class AnnouncementMojo
}
}
- private List<Release> getReleases( List<Issue> issues )
+ private List<Release> getReleases( List<Issue> issues, IssueManagementSystem ims ) throws MojoExecutionException
{
+ if ( issueTypes != null )
+ {
+ ims.applyConfiguration( issueTypes );
+ }
if ( issues.isEmpty() )
{
return Collections.emptyList();
}
else
{
- IssueAdapter adapter = new IssueAdapter(issueTypes);
+ IssueAdapter adapter = new IssueAdapter(ims);
return adapter.getReleases( issues );
}
}
@@ -753,7 +759,7 @@ public class AnnouncementMojo
try
{
- return getReleases( issueDownloader.getIssueList() );
+ return getReleases( issueDownloader.getIssueList(), new TRACIssueManagmentSystem() );
}
catch ( Exception e )
{
Added: maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/AbstractIssueManagementSystem.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/AbstractIssueManagementSystem.java?rev=1134984&view=auto
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/AbstractIssueManagementSystem.java (added)
+++ maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/AbstractIssueManagementSystem.java Sun Jun 12 21:08:34 2011
@@ -0,0 +1,78 @@
+/*
+ * 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.
+ */
+package org.apache.maven.plugin.changes;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.maven.plugin.MojoExecutionException;
+
+/**
+ * Historically, this plugin started out working against an IMS-neutral XML file, and then added extensive support for
+ * JIRA with some small snippets of code for other issue management systems. This class is intended to start a cleaner
+ * modularity for support of multiple systems.<br>
+ * Initially, all it provides is a structure for mapping from per-IMS issue types to the three categories defined in
+ * {@link IssueAdapter}. <br/>
+ * Note that the map in here is <strong>not</strong> immutable. It contains the default
+ * configuration for an IMS. Users are expected to add entries to the map via configuration
+ * to reflect their customizations.
+ */
+public abstract class AbstractIssueManagementSystem implements IssueManagementSystem
+{
+ protected Map<String, IssueType> issueTypeMap;
+
+ protected AbstractIssueManagementSystem()
+ {
+ issueTypeMap = new HashMap<String, IssueType>();
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.maven.plugin.changes.IssueManagementSystem#getIssueTypeMap()
+ */
+ public Map<String, IssueType> getIssueTypeMap()
+ {
+ return issueTypeMap;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.maven.plugin.changes.IssueManagementSystem#getName()
+ */
+ public abstract String getName();
+
+ /* (non-Javadoc)
+ * @see org.apache.maven.plugin.changes.IssueManagementSystem#applyConfiguration(java.util.Map)
+ */
+ public void applyConfiguration( Map<String, String> issueTypes ) throws MojoExecutionException
+ {
+ for ( Map.Entry<String, String> me : issueTypes.entrySet() )
+ {
+ IssueType type = IssueType.lookupByKey( me.getValue() );
+ if ( type == null )
+ {
+ throw new MojoExecutionException( "Invalid issue action " + me.getValue() );
+ }
+ String imsTypes = me.getKey();
+ String[] imsTypeArray = imsTypes.split( "," );
+ for ( String imsType : imsTypeArray )
+ {
+ issueTypeMap.put( imsType, type );
+ }
+ }
+ }
+}
Propchange: maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/AbstractIssueManagementSystem.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/AbstractIssueManagementSystem.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
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=1134984&r1=1134983&r2=1134984&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 Sun Jun 12 21:08:34 2011
@@ -29,63 +29,37 @@ import java.util.List;
import java.util.Map;
/**
- * An adapter that can adapt issue management system data models to the data model used
- * in the changes.xml file.
- *
+ * An adapter that can adapt issue management system data models to the data model used in the changes.xml file.
+ *
* @author Dennis Lundberg
* @version $Id$
* @since 2.4
*/
public class IssueAdapter
{
- private static final String[] DEFAULT_ADD_TYPE = { "New Feature" };
+ private static final String UNKNOWN_ISSUE_TYPE = "";
+ private IssueManagementSystem ims;
- 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 )
+ public IssueAdapter( IssueManagementSystem ims )
{
- addIssueTypesToMap( "add", issueTypes, DEFAULT_ADD_TYPE );
- addIssueTypesToMap( "fix", issueTypes, DEFAULT_FIX_TYPE );
- addIssueTypesToMap( "update", issueTypes, DEFAULT_UPDATE_TYPE );
+ this.ims = ims;
}
- private void addIssueTypesToMap( String actionKey, Map<String, String> issueTypes, String[] defaultTypes )
+ private Map<String, IssueType> getIssueTypeMap()
{
- 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 );
- }
+ return ims.getIssueTypeMap();
}
-
+
/**
- * Adapt a <code>List</code> of <code>Issue</code>s to a
- * <code>List</code> of <code>Release</code>s.
- *
+ * Adapt a <code>List</code> of <code>Issue</code>s to a <code>List</code> of <code>Release</code>s.
+ *
* @param issues The issues
* @return A list of releases
*/
public List<Release> getReleases( List<Issue> issues )
{
// A Map of releases keyed by fixVersion
- Map<String,Release> releasesMap = new HashMap<String,Release>();
+ Map<String, Release> releasesMap = new HashMap<String, Release>();
// Loop through all issues looking for fixVersions
for ( Issue issue : issues )
@@ -123,7 +97,7 @@ public class IssueAdapter
/**
* Create an <code>Action</code> from an issue.
- *
+ *
* @param issue The issue to extract the information from
* @return An <code>Action</code>
*/
@@ -131,21 +105,24 @@ public class IssueAdapter
{
Action action = new Action();
- // @todo We need to add something like issue.getPresentationIdentifier() to be able to support other IMSes beside JIRA
+ // @todo We need to add something like issue.getPresentationIdentifier() to be able to support other IMSes
+ // beside JIRA
action.setIssue( issue.getKey() );
- String type = "";
- if ( issueMap.containsKey( issue.getType() ) )
+ IssueType type = null;
+ if ( getIssueTypeMap().containsKey( issue.getType() ) )
{
- type = issueMap.get( issue.getType() );
+ type = getIssueTypeMap().get( issue.getType() );
+ action.setType( type.modelRepresentation() );
+ } else {
+ action.setType( UNKNOWN_ISSUE_TYPE );
}
- action.setType( type );
action.setDev( issue.getAssignee() );
// Set dueTo to the empty String instead of null to make Velocity happy
action.setDueTo( "" );
- //action.setDueTo( issue.getReporter() );
+ // action.setDueTo( issue.getReporter() );
action.setAction( issue.getSummary() );
return action;
Added: maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/IssueManagementSystem.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/IssueManagementSystem.java?rev=1134984&view=auto
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/IssueManagementSystem.java (added)
+++ maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/IssueManagementSystem.java Sun Jun 12 21:08:34 2011
@@ -0,0 +1,41 @@
+/*
+ * 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.
+ */
+package org.apache.maven.plugin.changes;
+
+import java.util.Map;
+
+import org.apache.maven.plugin.MojoExecutionException;
+
+public interface IssueManagementSystem
+{
+
+ /**
+ * @return the map from keys used in poms and other config files to issue types.
+ */
+ public abstract Map<String, IssueType> getIssueTypeMap();
+
+ /**
+ * @return the name of the IMS.
+ */
+ public abstract String getName();
+
+ public abstract void applyConfiguration( Map<String, String> issueTypes )
+ throws MojoExecutionException;
+
+}
\ No newline at end of file
Propchange: maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/IssueManagementSystem.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/IssueManagementSystem.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/IssueType.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/IssueType.java?rev=1134984&view=auto
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/IssueType.java (added)
+++ maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/IssueType.java Sun Jun 12 21:08:34 2011
@@ -0,0 +1,48 @@
+/*
+ * 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.
+ */
+package org.apache.maven.plugin.changes;
+
+/**
+ * Cross-IMS types of issues.
+ */
+public enum IssueType
+{
+ ADD( "add" ), FIX( "fix" ), UPDATE( "update" );
+ private String configurationKey;
+
+ private IssueType( String configurationKey )
+ {
+ this.configurationKey = configurationKey;
+ }
+
+ public String configurationKey()
+ {
+ return configurationKey;
+ }
+
+ public String modelRepresentation()
+ {
+ return name().toLowerCase();
+ }
+
+ public static IssueType lookupByKey( String key )
+ {
+ return IssueType.valueOf( key.toUpperCase() );
+ }
+}
Propchange: maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/IssueType.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/IssueType.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/JIRAIssueManagmentSystem.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/JIRAIssueManagmentSystem.java?rev=1134984&view=auto
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/JIRAIssueManagmentSystem.java (added)
+++ maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/JIRAIssueManagmentSystem.java Sun Jun 12 21:08:34 2011
@@ -0,0 +1,44 @@
+/*
+ * 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.
+ */
+
+ package org.apache.maven.plugin.changes;
+
+/**
+ * The standard issue types for JIRA.
+ */
+public class JIRAIssueManagmentSystem extends AbstractIssueManagementSystem
+{
+ 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" ;
+
+ public JIRAIssueManagmentSystem() {
+ super();
+ issueTypeMap.put( DEFAULT_ADD_TYPE, IssueType.ADD );
+ issueTypeMap.put( DEFAULT_FIX_TYPE, IssueType.FIX );
+ issueTypeMap.put( DEFAULT_UPDATE_TYPE, IssueType.UPDATE );
+ }
+
+ @Override
+ public String getName()
+ {
+ return "JIRA";
+ }
+
+}
Propchange: maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/JIRAIssueManagmentSystem.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/JIRAIssueManagmentSystem.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/TRACIssueManagmentSystem.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/TRACIssueManagmentSystem.java?rev=1134984&view=auto
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/TRACIssueManagmentSystem.java (added)
+++ maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/TRACIssueManagmentSystem.java Sun Jun 12 21:08:34 2011
@@ -0,0 +1,44 @@
+/*
+ * 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.
+ */
+
+ package org.apache.maven.plugin.changes;
+
+/**
+ * The standard issue types for TRAC. (probably wrong).
+ */
+public class TRACIssueManagmentSystem extends AbstractIssueManagementSystem
+{
+ 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" ;
+
+ public TRACIssueManagmentSystem() {
+ super();
+ issueTypeMap.put( DEFAULT_ADD_TYPE, IssueType.ADD );
+ issueTypeMap.put( DEFAULT_FIX_TYPE, IssueType.FIX );
+ issueTypeMap.put( DEFAULT_UPDATE_TYPE, IssueType.UPDATE );
+ }
+
+ @Override
+ public String getName()
+ {
+ return "JIRA";
+ }
+
+}
Propchange: maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/TRACIssueManagmentSystem.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/changes/TRACIssueManagmentSystem.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: 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=1134984&r1=1134983&r2=1134984&view=diff
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/test/java/org/apache/maven/plugin/changes/IssueAdapterTest.java (original)
+++ maven/plugins/trunk/maven-changes-plugin/src/test/java/org/apache/maven/plugin/changes/IssueAdapterTest.java Sun Jun 12 21:08:34 2011
@@ -19,9 +19,6 @@ package org.apache.maven.plugin.changes;
* 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;
@@ -37,7 +34,7 @@ public class IssueAdapterTest
public void testDefaultIssueTypeMapping()
{
- IssueAdapter adapter = new IssueAdapter( null );
+ IssueAdapter adapter = new IssueAdapter( new JIRAIssueManagmentSystem( ) );
Issue issue = createIssue( "TST-1", "New Feature" );
Action action = adapter.createAction( issue );
@@ -58,11 +55,10 @@ public class IssueAdapterTest
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 );
+ IssueManagementSystem ims = new JIRAIssueManagmentSystem( );
+
+ ims.getIssueTypeMap().clear();
+ IssueAdapter adapter = new IssueAdapter( ims );
Issue issue = createIssue( "TST-1", "New Feature" );
Action action = adapter.createAction( issue );
@@ -83,10 +79,12 @@ public class IssueAdapterTest
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 );
+ IssueManagementSystem ims = new JIRAIssueManagmentSystem( );
+ ims.getIssueTypeMap().put( "Story", IssueType.ADD);
+ ims.getIssueTypeMap().put( "Epic", IssueType.ADD);
+ ims.getIssueTypeMap().put( "Defect", IssueType.FIX);
+ ims.getIssueTypeMap().put( "Error", IssueType.FIX);
+ IssueAdapter adapter = new IssueAdapter( ims );
Issue issue = createIssue( "TST-1", "Story" );
Action action = adapter.createAction( issue );