use of org.apache.maven.plugins.changes.model.Action in project maven-plugins by apache.
the class ChangesReportGenerator method constructComponent.
/**
* Constructs table rows for specified release component. It will create header row for component name and action
* rows for all component issues.
*
* @param sink Sink
* @param bundle Resource bundle
* @param component Release component to generate content for.
*/
private void constructComponent(Sink sink, ResourceBundle bundle, Component component) {
if (!component.getActions().isEmpty()) {
sink.tableRow();
sink.tableHeaderCell();
sink.tableHeaderCell_();
sink.tableHeaderCell();
sink.text(component.getName());
sink.tableHeaderCell_();
sink.tableHeaderCell();
sink.tableHeaderCell_();
if (isAddActionDate()) {
sink.tableHeaderCell();
sink.tableHeaderCell_();
}
sink.tableRow_();
for (Action action : component.getActions()) {
constructAction(sink, bundle, action);
}
}
}
use of org.apache.maven.plugins.changes.model.Action in project maven-plugins by apache.
the class IssueAdapter method createAction.
/**
* Create an <code>Action</code> from an issue.
*
* @param issue The issue to extract the information from
* @return An <code>Action</code>
*/
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());
// Try to map the IMS-specific issue type to one that is used in a changes.xml file
IssueType type;
if (getIssueTypeMap().containsKey(issue.getType())) {
type = getIssueTypeMap().get(issue.getType());
action.setType(type.modelRepresentation());
} else {
action.setType(UNKNOWN_ISSUE_TYPE);
}
action.setDev(issue.getAssignee());
action.setDueTo(issue.getReporter() == null ? "" : issue.getReporter());
action.setAction(issue.getSummary());
return action;
}
use of org.apache.maven.plugins.changes.model.Action 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());
}
use of org.apache.maven.plugins.changes.model.Action 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());
}
use of org.apache.maven.plugins.changes.model.Action in project maven-plugins by apache.
the class ChangesReportGenerator method constructRelease.
/**
* Constructs document section for specified release.
*
* @param sink Sink
* @param bundle Resource bundle
* @param release Release to create document section for
*/
private void constructRelease(Sink sink, ResourceBundle bundle, Release release) {
sink.section2();
final String date = (release.getDateRelease() == null) ? "" : " – " + release.getDateRelease();
SinkEventAttributes attrs = new SinkEventAttributeSet();
attrs.addAttribute(SinkEventAttributes.ID, HtmlTools.encodeId(release.getVersion()));
sink.sectionTitle(Sink.SECTION_LEVEL_2, attrs);
sink.text(bundle.getString("report.changes.label.release") + " " + release.getVersion() + date);
sink.sectionTitle_(Sink.SECTION_LEVEL_2);
if (isReleaseEmpty(release)) {
sink.paragraph();
sink.text(bundle.getString("report.changes.text.no.changes"));
sink.paragraph_();
} else {
sink.table();
sink.tableRow();
sinkHeader(sink, bundle.getString("report.issues.label.type"));
sinkHeader(sink, bundle.getString("report.issues.label.summary"));
sinkHeader(sink, bundle.getString("report.issues.label.assignee"));
if (this.isAddActionDate()) {
sinkHeader(sink, bundle.getString("report.issues.label.updated"));
}
sink.tableRow_();
for (Action action : release.getActions()) {
constructAction(sink, bundle, action);
}
for (Object o : release.getComponents()) {
Component component = (Component) o;
constructComponent(sink, bundle, component);
}
sink.table_();
}
sink.section2_();
}
Aggregations