Search in sources :

Example 6 with TextBlock

use of com.meterware.httpunit.TextBlock in project maven-plugins by apache.

the class TeamReportTest method testReport.

/**
     * Test report
     *
     * @throws Exception if any
     */
public void testReport() throws Exception {
    File pluginXmlFile = new File(getBasedir(), "src/test/resources/plugin-configs/" + "team-plugin-config.xml");
    AbstractProjectInfoReport mojo = createReportMojo("project-team", pluginXmlFile);
    setVariableValueToObject(mojo, "showAvatarImages", Boolean.TRUE);
    generateReport(mojo, pluginXmlFile);
    assertTrue("Test html generated", getGeneratedReport("team-list.html").exists());
    URL reportURL = getGeneratedReport("team-list.html").toURI().toURL();
    assertNotNull(reportURL);
    // HTTPUnit
    WebRequest request = new GetMethodWebRequest(reportURL.toString());
    WebResponse response = WEB_CONVERSATION.getResponse(request);
    // Basic HTML tests
    assertTrue(response.isHTML());
    assertTrue(response.getContentLength() > 0);
    // Test the Page title
    String expectedTitle = prepareTitle(getString("report.team.name"), getString("report.team.title"));
    assertEquals(expectedTitle, response.getTitle());
    assertTrue(response.getText().contains("gravatar"));
    // Test the texts
    TextBlock[] textBlocks = response.getTextBlocks();
    assertEquals(textBlocks.length, 7);
    assertEquals(getString("report.team.intro.title"), textBlocks[0].getText());
    assertEquals(getString("report.team.intro.description1"), textBlocks[1].getText());
    assertEquals(getString("report.team.intro.description2"), textBlocks[2].getText());
    assertEquals(getString("report.team.developers.title"), textBlocks[3].getText());
    assertEquals(getString("report.team.developers.intro"), textBlocks[4].getText());
    assertEquals(getString("report.team.contributors.title"), textBlocks[5].getText());
    assertEquals(getString("report.team.nocontributor"), textBlocks[6].getText());
}
Also used : WebResponse(com.meterware.httpunit.WebResponse) WebRequest(com.meterware.httpunit.WebRequest) GetMethodWebRequest(com.meterware.httpunit.GetMethodWebRequest) File(java.io.File) GetMethodWebRequest(com.meterware.httpunit.GetMethodWebRequest) TextBlock(com.meterware.httpunit.TextBlock) URL(java.net.URL)

Example 7 with TextBlock

use of com.meterware.httpunit.TextBlock in project maven-plugins by apache.

the class SummaryReportTest method testReport.

/**
     * Test report
     *
     * @throws Exception if any
     */
public void testReport() throws Exception {
    generateReport("summary", "summary-plugin-config.xml");
    assertTrue("Test html generated", getGeneratedReport("project-summary.html").exists());
    URL reportURL = getGeneratedReport("project-summary.html").toURI().toURL();
    assertNotNull(reportURL);
    // HTTPUnit
    WebRequest request = new GetMethodWebRequest(reportURL.toString());
    WebResponse response = WEB_CONVERSATION.getResponse(request);
    // Basic HTML tests
    assertTrue(response.isHTML());
    assertTrue(response.getContentLength() > 0);
    // Test the Page title
    String expectedTitle = prepareTitle(getString("report.summary.name"), getString("report.summary.title"));
    assertEquals(expectedTitle, response.getTitle());
    // Test the texts
    TextBlock[] textBlocks = response.getTextBlocks();
    assertEquals(getString("report.summary.title"), textBlocks[0].getText());
    assertEquals(getString("report.summary.general.title"), textBlocks[1].getText());
    assertEquals(getString("report.summary.organization.title"), textBlocks[2].getText());
    assertEquals(getString("report.summary.noorganization"), textBlocks[3].getText());
    assertEquals(getString("report.summary.build.title"), textBlocks[4].getText());
}
Also used : WebResponse(com.meterware.httpunit.WebResponse) WebRequest(com.meterware.httpunit.WebRequest) GetMethodWebRequest(com.meterware.httpunit.GetMethodWebRequest) GetMethodWebRequest(com.meterware.httpunit.GetMethodWebRequest) TextBlock(com.meterware.httpunit.TextBlock) URL(java.net.URL)

Example 8 with TextBlock

use of com.meterware.httpunit.TextBlock in project maven-plugins by apache.

the class ScmReportTest method testReport.

/**
     * Test report
     *
     * @throws Exception if any
     */
public void testReport() throws Exception {
    generateReport("scm", "scm-plugin-config.xml");
    assertTrue("Test html generated", getGeneratedReport("source-repository.html").exists());
    URL reportURL = getGeneratedReport("source-repository.html").toURI().toURL();
    assertNotNull(reportURL);
    // HTTPUnit
    WebRequest request = new GetMethodWebRequest(reportURL.toString());
    WebResponse response = WEB_CONVERSATION.getResponse(request);
    // Basic HTML tests
    assertTrue(response.isHTML());
    assertTrue(response.getContentLength() > 0);
    // Test the Page title
    String expectedTitle = prepareTitle(getString("report.scm.name"), getString("report.scm.title"));
    assertEquals(expectedTitle, response.getTitle());
    // Test the texts
    TextBlock[] textBlocks = response.getTextBlocks();
    assertEquals(textBlocks.length, 6);
    assertEquals(getString("report.scm.overview.title"), textBlocks[0].getText());
    assertEquals(getString("report.scm.general.intro"), textBlocks[1].getText());
    assertEquals(getString("report.scm.webaccess.title"), textBlocks[2].getText());
    assertEquals(getString("report.scm.webaccess.nourl"), textBlocks[3].getText());
    assertEquals(getString("report.scm.accessbehindfirewall.title"), textBlocks[4].getText());
    assertEquals(getString("report.scm.accessbehindfirewall.general.intro"), textBlocks[5].getText());
}
Also used : WebResponse(com.meterware.httpunit.WebResponse) WebRequest(com.meterware.httpunit.WebRequest) GetMethodWebRequest(com.meterware.httpunit.GetMethodWebRequest) GetMethodWebRequest(com.meterware.httpunit.GetMethodWebRequest) TextBlock(com.meterware.httpunit.TextBlock) URL(java.net.URL)

Example 9 with TextBlock

use of com.meterware.httpunit.TextBlock in project maven-plugins by apache.

the class DependencyManagementReportTest method testReport.

/**
     * Test report
     *
     * @throws Exception if any
     */
public void testReport() throws Exception {
    generateReport("dependency-management", "dependency-management-plugin-config.xml");
    assertTrue("Test html generated", getGeneratedReport("dependency-management.html").exists());
    URL reportURL = getGeneratedReport("dependency-management.html").toURI().toURL();
    assertNotNull(reportURL);
    // HTTPUnit
    WebRequest request = new GetMethodWebRequest(reportURL.toString());
    WebResponse response = WEB_CONVERSATION.getResponse(request);
    // Basic HTML tests
    assertTrue(response.isHTML());
    assertTrue(response.getContentLength() > 0);
    // Test the Page title
    String expectedTitle = prepareTitle(getString("report.dependency-management.name"), getString("report.dependency-management.title"));
    assertEquals(expectedTitle, response.getTitle());
    // Test the tables
    WebTable[] webTables = response.getTables();
    assertEquals(webTables.length, 1);
    assertEquals(webTables[0].getColumnCount(), 5);
    assertEquals(webTables[0].getRowCount(), 1 + getTestMavenProject().getDependencyManagement().getDependencies().size());
    // Test the texts
    TextBlock[] textBlocks = response.getTextBlocks();
    assertEquals(getString("report.dependency-management.title"), textBlocks[0].getText());
    assertEquals("test", textBlocks[1].getText());
}
Also used : WebResponse(com.meterware.httpunit.WebResponse) WebRequest(com.meterware.httpunit.WebRequest) GetMethodWebRequest(com.meterware.httpunit.GetMethodWebRequest) WebTable(com.meterware.httpunit.WebTable) GetMethodWebRequest(com.meterware.httpunit.GetMethodWebRequest) TextBlock(com.meterware.httpunit.TextBlock) URL(java.net.URL)

Example 10 with TextBlock

use of com.meterware.httpunit.TextBlock in project maven-plugins by apache.

the class PluginManagementReportTest method testReport.

/**
     * Test report
     *
     * @throws Exception if any
     */
public void testReport() throws Exception {
    generateReport("plugin-management", "plugin-management-plugin-config.xml");
    assertTrue("Test html generated", getGeneratedReport("plugin-management.html").exists());
    URL reportURL = getGeneratedReport("plugin-management.html").toURI().toURL();
    assertNotNull(reportURL);
    // HTTPUnit
    WebRequest request = new GetMethodWebRequest(reportURL.toString());
    WebResponse response = WEB_CONVERSATION.getResponse(request);
    // Basic HTML tests
    assertTrue(response.isHTML());
    assertTrue(response.getContentLength() > 0);
    // Test the Page title
    String expectedTitle = prepareTitle(getString("report.plugin-management.name"), getString("report.plugin-management.title"));
    assertEquals(expectedTitle, response.getTitle());
    // Test the tables
    WebTable[] webTables = response.getTables();
    assertEquals(1, webTables.length);
    assertEquals(3, webTables[0].getColumnCount());
    assertEquals(3, webTables[0].getRowCount());
    // Test the texts
    TextBlock[] textBlocks = response.getTextBlocks();
    assertEquals(getString("report.plugin-management.title"), textBlocks[0].getText());
}
Also used : WebResponse(com.meterware.httpunit.WebResponse) WebRequest(com.meterware.httpunit.WebRequest) GetMethodWebRequest(com.meterware.httpunit.GetMethodWebRequest) WebTable(com.meterware.httpunit.WebTable) GetMethodWebRequest(com.meterware.httpunit.GetMethodWebRequest) TextBlock(com.meterware.httpunit.TextBlock) URL(java.net.URL)

Aggregations

GetMethodWebRequest (com.meterware.httpunit.GetMethodWebRequest)14 TextBlock (com.meterware.httpunit.TextBlock)14 WebRequest (com.meterware.httpunit.WebRequest)14 WebResponse (com.meterware.httpunit.WebResponse)14 URL (java.net.URL)14 WebLink (com.meterware.httpunit.WebLink)3 WebTable (com.meterware.httpunit.WebTable)3 File (java.io.File)1