use of org.apache.maven.plugins.changes.model.Action in project maven-plugins by apache.
the class IssueAdapter method getReleases.
/**
* 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>();
// Loop through all issues looking for fixVersions
for (Issue issue : issues) {
// Do NOT create a release for issues that lack a fixVersion
if (issue.getFixVersions() != null) {
for (String fixVersion : issue.getFixVersions()) {
// Try to get a matching Release from the map
Release release = releasesMap.get(fixVersion);
if (release == null) {
// Add a new Release to the Map if it wasn't there
release = new Release();
release.setVersion(fixVersion);
releasesMap.put(fixVersion, release);
}
// Add this issue as an Action to this release
Action action = createAction(issue);
release.addAction(action);
}
}
}
// Extract the releases from the Map to a List
List<Release> releasesList = new ArrayList<Release>();
for (Release release : releasesMap.values()) {
releasesList.add(release);
}
return releasesList;
}
use of org.apache.maven.plugins.changes.model.Action in project maven-plugins by apache.
the class ReleaseUtils method logRelease.
protected void logRelease(Release release) {
Action action;
for (Action action1 : release.getActions()) {
action = action1;
getLog().debug("o " + action.getType());
getLog().debug("issue : " + action.getIssue());
getLog().debug("action : " + action.getAction());
getLog().debug("dueTo : " + action.getDueTo());
}
}
use of org.apache.maven.plugins.changes.model.Action in project maven-plugins by apache.
the class ChangesXMLTest method testParseChangesFile.
public void testParseChangesFile() throws Exception {
File changesFile = new File(getBasedir() + "/src/test/unit/changes.xml");
ChangesXML changesXML = new ChangesXML(changesFile, new MockLog());
assertNotNull(changesXML.getChangesDocument());
assertEquals("Changes report Project", changesXML.getTitle());
List<Release> releases = changesXML.getReleaseList();
assertEquals(2, releases.size());
for (Release release : releases) {
if ("1.0".equals(release.getVersion())) {
Action action = release.getActions().get(0);
assertEquals(2, action.getFixedIssues().size());
assertEquals("JIRA-XXX", action.getFixedIssues().get(0).getIssue());
assertEquals("JIRA-YYY", action.getFixedIssues().get(1).getIssue());
assertEquals(2, action.getDueTos().size());
}
}
}
use of org.apache.maven.plugins.changes.model.Action in project maven-plugins by apache.
the class IssueAdapterTest method testDefaultIssueTypeMapping.
public void testDefaultIssueTypeMapping() {
IssueAdapter adapter = new IssueAdapter(new JIRAIssueManagmentSystem());
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());
}
Aggregations