Search in sources :

Example 6 with Action

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;
}
Also used : Action(org.apache.maven.plugins.changes.model.Action) Issue(org.apache.maven.plugins.issues.Issue) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Release(org.apache.maven.plugins.changes.model.Release)

Example 7 with Action

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());
    }
}
Also used : Action(org.apache.maven.plugins.changes.model.Action)

Example 8 with Action

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());
        }
    }
}
Also used : Action(org.apache.maven.plugins.changes.model.Action) ChangesXML(org.apache.maven.plugins.changes.ChangesXML) File(java.io.File) Release(org.apache.maven.plugins.changes.model.Release)

Example 9 with Action

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());
}
Also used : IssueAdapter(org.apache.maven.plugins.changes.IssueAdapter) Action(org.apache.maven.plugins.changes.model.Action) Issue(org.apache.maven.plugins.issues.Issue) JIRAIssueManagmentSystem(org.apache.maven.plugins.jira.JIRAIssueManagmentSystem)

Aggregations

Action (org.apache.maven.plugins.changes.model.Action)9 Issue (org.apache.maven.plugins.issues.Issue)4 IssueAdapter (org.apache.maven.plugins.changes.IssueAdapter)3 JIRAIssueManagmentSystem (org.apache.maven.plugins.jira.JIRAIssueManagmentSystem)3 Release (org.apache.maven.plugins.changes.model.Release)2 IssueManagementSystem (org.apache.maven.plugins.issues.IssueManagementSystem)2 File (java.io.File)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 SinkEventAttributeSet (org.apache.maven.doxia.sink.SinkEventAttributeSet)1 SinkEventAttributes (org.apache.maven.doxia.sink.SinkEventAttributes)1 ChangesXML (org.apache.maven.plugins.changes.ChangesXML)1 Component (org.apache.maven.plugins.changes.model.Component)1