use of org.apache.maven.plugins.jira.JiraMojo in project maven-plugins by apache.
the class JiraUnicodeTestCase method testUnicodeReport.
public void testUnicodeReport() throws Exception {
File pom = new File(getBasedir(), "/src/test/unit/jira-plugin-config.xml");
assertNotNull(pom);
assertTrue(pom.exists());
JiraMojo mojo = (JiraMojo) lookupMojo("jira-report", pom);
MavenProject project = new JiraUnicodeTestProjectStub();
MavenSession session = newMavenSession(project);
DefaultRepositorySystemSession repoSession = (DefaultRepositorySystemSession) session.getRepositorySession();
repoSession.setLocalRepositoryManager(new SimpleLocalRepositoryManager("target/local-repo"));
setVariableValueToObject(mojo, "project", project);
setVariableValueToObject(mojo, "mavenSession", session);
InputStream testJiraXmlStream = JiraUnicodeTestCase.class.getResourceAsStream("unicode-jira-results.xml");
String jiraXml = null;
try {
jiraXml = IOUtils.toString(testJiraXmlStream, "utf-8");
} finally {
testJiraXmlStream.close();
}
MockJiraDownloader mockDownloader = new MockJiraDownloader();
mockDownloader.setJiraXml(jiraXml);
mojo.setMockDownloader(mockDownloader);
File outputDir = new File("target/jira-test-output");
outputDir.mkdirs();
mojo.setReportOutputDirectory(outputDir);
mojo.execute();
String reportHtml = FileUtils.readFileToString(new File(outputDir, "jira-report.html"), "utf-8");
int turtleIndex = reportHtml.indexOf(TEST_TURTLES);
assertTrue(turtleIndex >= 0);
}
Aggregations