Search in sources :

Example 1 with IssueAdapter

use of org.apache.maven.plugins.changes.IssueAdapter in project maven-plugins by apache.

the class IssueAdapterTest method testCustomIssueTypeMapping.

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

Example 2 with IssueAdapter

use of org.apache.maven.plugins.changes.IssueAdapter in project maven-plugins by apache.

the class IssueAdapterTest method testCustomIssueTypeMappingOveridesDefaultMapping.

public void testCustomIssueTypeMappingOveridesDefaultMapping() {
    IssueManagementSystem ims = new JIRAIssueManagmentSystem();
    ims.getIssueTypeMap().clear();
    IssueAdapter adapter = new IssueAdapter(ims);
    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());
}
Also used : IssueAdapter(org.apache.maven.plugins.changes.IssueAdapter) Action(org.apache.maven.plugins.changes.model.Action) Issue(org.apache.maven.plugins.issues.Issue) IssueManagementSystem(org.apache.maven.plugins.issues.IssueManagementSystem) JIRAIssueManagmentSystem(org.apache.maven.plugins.jira.JIRAIssueManagmentSystem)

Example 3 with IssueAdapter

use of org.apache.maven.plugins.changes.IssueAdapter 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

IssueAdapter (org.apache.maven.plugins.changes.IssueAdapter)3 Action (org.apache.maven.plugins.changes.model.Action)3 Issue (org.apache.maven.plugins.issues.Issue)3 JIRAIssueManagmentSystem (org.apache.maven.plugins.jira.JIRAIssueManagmentSystem)3 IssueManagementSystem (org.apache.maven.plugins.issues.IssueManagementSystem)2