use of org.apache.maven.plugins.issues.Issue in project maven-plugins by apache.
the class IssueUtilsTestCase method testFilterIssuesWithVersionPrefix.
public void testFilterIssuesWithVersionPrefix() {
Issue issue_1;
issue_1 = new Issue();
issue_1.setId("1");
issue_1.addFixVersion("myPrefix-1.0");
Issue issue_2;
issue_2 = new Issue();
issue_2.setId("2");
issue_2.addFixVersion("1.0");
List<Issue> issueList = new ArrayList<Issue>();
issueList.add(issue_1);
issueList.add(issue_2);
List<Issue> filteredIssues;
try {
filteredIssues = IssueUtils.filterIssuesWithVersionPrefix(issueList, null);
assertEquals(2, filteredIssues.size());
filteredIssues = IssueUtils.filterIssuesWithVersionPrefix(issueList, "");
assertEquals(2, filteredIssues.size());
filteredIssues = IssueUtils.filterIssuesWithVersionPrefix(issueList, "myPrefix-");
assertEquals(1, filteredIssues.size());
} catch (MojoExecutionException e) {
fail(e.getMessage());
}
try {
IssueUtils.filterIssuesWithVersionPrefix(issueList, "yourPrefix-");
fail("No issues should be found.");
} catch (MojoExecutionException e) {
// Expected
}
}
use of org.apache.maven.plugins.issues.Issue in project maven-plugins by apache.
the class GitHubDownloader method createIssue.
protected Issue createIssue(org.eclipse.egit.github.core.Issue githubIssue) {
Issue issue = new Issue();
issue.setKey(String.valueOf(githubIssue.getNumber()));
issue.setId(String.valueOf(githubIssue.getNumber()));
issue.setLink(this.githubIssueURL + githubIssue.getNumber());
issue.setCreated(githubIssue.getCreatedAt());
issue.setUpdated(githubIssue.getUpdatedAt());
if (githubIssue.getAssignee() != null) {
if (githubIssue.getAssignee().getName() != null) {
issue.setAssignee(githubIssue.getAssignee().getName());
} else {
issue.setAssignee(githubIssue.getAssignee().getLogin());
}
}
issue.setTitle(githubIssue.getTitle());
issue.setSummary(githubIssue.getTitle());
if (githubIssue.getMilestone() != null) {
issue.addFixVersion(githubIssue.getMilestone().getTitle());
}
issue.setReporter(githubIssue.getUser().getLogin());
if (githubIssue.getClosedAt() != null) {
issue.setStatus("closed");
} else {
issue.setStatus("open");
}
List<Label> labels = githubIssue.getLabels();
if (labels != null && !labels.isEmpty()) {
issue.setType(labels.get(0).getName());
}
return issue;
}
use of org.apache.maven.plugins.issues.Issue in project maven-plugins by apache.
the class GitHubMojo method executeReport.
@Override
protected void executeReport(Locale locale) throws MavenReportException {
// Validate parameters
List<Integer> columnIds = IssuesReportHelper.getColumnIds(columnNames, githubColumns);
if (columnIds.size() == 0) {
// This can happen if the user has configured column names and they are all invalid
throw new MavenReportException("maven-changes-plugin: None of the configured columnNames '" + columnNames + "' are valid.");
}
try {
// Download issues
GitHubDownloader issueDownloader = new GitHubDownloader(project, githubAPIScheme, githubAPIPort, includeOpenIssues, onlyMilestoneIssues);
issueDownloader.configureAuthentication(settingsDecrypter, githubAPIServerId, settings, getLog());
List<Issue> issueList = issueDownloader.getIssueList();
if (onlyCurrentVersion) {
issueList = IssueUtils.getIssuesForVersion(issueList, project.getVersion());
getLog().info("The GitHub Report will contain issues only for the current version.");
}
// Generate the report
IssuesReportGenerator report = new IssuesReportGenerator(IssuesReportHelper.toIntArray(columnIds));
if (issueList.isEmpty()) {
report.doGenerateEmptyReport(getBundle(locale), getSink());
getLog().warn("No issue was matched.");
} else {
report.doGenerateReport(getBundle(locale), getSink(), issueList);
}
} catch (MalformedURLException e) {
// Rethrow this error so that the build fails
throw new MavenReportException("The Github URL is incorrect.");
} catch (Exception e) {
throw new MavenReportException(e.getMessage(), e);
}
}
use of org.apache.maven.plugins.issues.Issue in project maven-plugins by apache.
the class JiraXML method startElement.
public void startElement(String namespaceURI, String sName, String qName, Attributes attrs) throws SAXException {
if (qName.equals("item")) {
issue = new Issue();
currentParent = "item";
} else if (qName.equals("key")) {
String id = attrs.getValue("id");
if (id != null) {
issue.setId(id.trim());
}
} else if (qName.equals("build-info")) {
currentParent = "build-info";
}
}
use of org.apache.maven.plugins.issues.Issue 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());
}
Aggregations