Search in sources :

Example 1 with JiraMojo

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);
}
Also used : MavenSession(org.apache.maven.execution.MavenSession) SimpleLocalRepositoryManager(org.sonatype.aether.impl.internal.SimpleLocalRepositoryManager) MavenProject(org.apache.maven.project.MavenProject) DefaultRepositorySystemSession(org.sonatype.aether.util.DefaultRepositorySystemSession) InputStream(java.io.InputStream) JiraMojo(org.apache.maven.plugins.jira.JiraMojo) File(java.io.File)

Aggregations

File (java.io.File)1 InputStream (java.io.InputStream)1 MavenSession (org.apache.maven.execution.MavenSession)1 JiraMojo (org.apache.maven.plugins.jira.JiraMojo)1 MavenProject (org.apache.maven.project.MavenProject)1 SimpleLocalRepositoryManager (org.sonatype.aether.impl.internal.SimpleLocalRepositoryManager)1 DefaultRepositorySystemSession (org.sonatype.aether.util.DefaultRepositorySystemSession)1