Search in sources :

Example 1 with TextBlock

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

the class CiManagementReportTest method testReport.

/**
     * Test report
     *
     * @throws Exception if any
     */
public void testReport() throws Exception {
    generateReport("cim", "ci-management-plugin-config.xml");
    assertTrue("Test html generated", getGeneratedReport("integration.html").exists());
    URL reportURL = getGeneratedReport("integration.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.ci-management.name"), getString("report.ci-management.title"));
    assertEquals(expectedTitle, response.getTitle());
    // Test the texts
    TextBlock[] textBlocks = response.getTextBlocks();
    assertEquals(getString("report.ci-management.name"), textBlocks[0].getText());
    assertEquals(getString("report.ci-management.nocim"), textBlocks[1].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 2 with TextBlock

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

the class DependenciesReportTest method testReport.

/**
     * Test report
     *
     * @throws Exception if any
     */
public void testReport() throws Exception {
    generateReport("dependencies", "dependencies-plugin-config.xml");
    assertTrue("Test html generated", getGeneratedReport("dependencies.html").exists());
    URL reportURL = getGeneratedReport("dependencies.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.dependencies.name"), getString("report.dependencies.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().getDependencies().size());
    // Test the texts
    TextBlock[] textBlocks = response.getTextBlocks();
    assertEquals(getString("report.dependencies.title"), textBlocks[0].getText());
    assertEquals("test", textBlocks[1].getText());
    assertEquals(getString("report.dependencies.intro.test"), textBlocks[2].getText());
    assertEquals(getString("report.dependencies.transitive.title"), textBlocks[3].getText());
    assertEquals(getString("report.dependencies.transitive.nolist"), textBlocks[4].getText());
    assertEquals(getString("report.dependencies.graph.title"), textBlocks[5].getText());
    assertEquals(getString("report.dependencies.graph.tree.title"), textBlocks[6].getText());
    assertEquals(getString("report.dependencies.graph.tables.licenses"), textBlocks[7].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 3 with TextBlock

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

the class DependencyConvergenceReportTest method testReport.

/**
     * Test report
     *
     * @throws Exception if any
     */
public void testReport() throws Exception {
    generateReport("dependency-convergence", "dependency-convergence-plugin-config.xml");
    assertTrue("Test html generated", getGeneratedReport("dependency-convergence.html").exists());
    URL reportURL = getGeneratedReport("dependency-convergence.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-convergence.name"), getString("report.dependency-convergence.reactor.title"));
    assertEquals(expectedTitle, response.getTitle());
    // Test the texts
    TextBlock[] textBlocks = response.getTextBlocks();
    assertEquals(getString("report.dependency-convergence.reactor.name"), textBlocks[0].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 4 with TextBlock

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

the class LicensesReportTest method testReport.

/**
     * Test report
     *
     * @throws Exception if any
     */
public void testReport() throws Exception {
    generateReport("license", "licenses-plugin-config.xml");
    assertTrue("Test html generated", getGeneratedReport("license.html").exists());
    URL reportURL = getGeneratedReport("license.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.licenses.name"), getString("report.licenses.title"));
    assertEquals(expectedTitle, response.getTitle());
    // Test the texts
    TextBlock[] textBlocks = response.getTextBlocks();
    assertEquals(getString("report.licenses.overview.title"), textBlocks[0].getText());
    assertEquals(getString("report.licenses.overview.intro"), textBlocks[1].getText());
    assertEquals(getString("report.licenses.title"), textBlocks[2].getText());
    assertEquals("The Apache Software License, Version 2.0", textBlocks[3].getText());
    // only 1 link in default report
    final WebLink[] links = response.getLinks();
    assertEquals(1, links.length);
    assertEquals("http://maven.apache.org/", links[0].getURLString());
}
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) WebLink(com.meterware.httpunit.WebLink)

Example 5 with TextBlock

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

the class MailingListsReportTest method testReport.

/**
     * Test report
     *
     * @throws Exception if any
     */
public void testReport() throws Exception {
    generateReport("mailing-list", "mailing-lists-plugin-config.xml");
    assertTrue("Test html generated", getGeneratedReport("mail-lists.html").exists());
    URL reportURL = getGeneratedReport("mail-lists.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.mailing-lists.name"), getString("report.mailing-lists.title"));
    assertEquals(expectedTitle, response.getTitle());
    // Test the texts
    TextBlock[] textBlocks = response.getTextBlocks();
    assertEquals(getString("report.mailing-lists.title"), textBlocks[0].getText());
    assertEquals(getString("report.mailing-lists.intro"), textBlocks[1].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)

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