当前位置: 首页>>代码示例>>Java>>正文


Java WebTable类代码示例

本文整理汇总了Java中com.meterware.httpunit.WebTable的典型用法代码示例。如果您正苦于以下问题:Java WebTable类的具体用法?Java WebTable怎么用?Java WebTable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


WebTable类属于com.meterware.httpunit包,在下文中一共展示了WebTable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testSomeFailures

import com.meterware.httpunit.WebTable; //导入依赖的package包/类
public void testSomeFailures() throws Exception {
    ServletUnitClient client = newClient();

    WebResponse wr = client.getResponse( "http://localhost/JUnit?test=" + FailingTests.class.getName() );
    final WebTable resultsTable = wr.getTableWithID( "results" );
    assertNotNull( "Did not find results table", resultsTable );
    final String[][] results = resultsTable.asText();
    assertEquals( "Num rows", 4, results.length );
    assertEquals( "Num columns", 3, results[0].length );
    assertEquals( "First header", "3 tests", results[0][0] );
    assertEquals( "Status", "Problems Occurred", results[0][2] );
    assertEquals( "Failure header", "2 failures", results[1][1] );
    assertEquals( "Failure index 1", "1", results[2][0] );
    assertEquals( "Failure index 2", "2", results[3][0] );
    assertTrue( "Test class not found", results[2][1].indexOf( '(' + FailingTests.class.getName() + ')' ) >= 0 );
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:17,代码来源:JUnitServletTest.java

示例2: testScriptedServletAccess

import com.meterware.httpunit.WebTable; //导入依赖的package包/类
public void testScriptedServletAccess() throws Exception {
    WebXMLString wxs = new WebXMLString();
    Properties params = new Properties();
    params.setProperty( "color", "red" );
    params.setProperty( "age", "12" );
    wxs.addServlet( "simple", "/SimpleServlet", SimpleGetServlet.class, params );
    wxs.addServlet( "/JUnit", TestRunnerServlet.class );

    MyFactory._runner = _runner = new ServletRunner( wxs.asInputStream() );
    ServletUnitClient client = _runner.newClient();
    WebResponse wr = client.getResponse( "http://localhost/JUnit?test=" + ServletAccessTest.class.getName() );

    final WebTable resultsTable = wr.getTableWithID( "results" );
    assertNotNull( "Did not find results table", resultsTable );
    final String[][] results = resultsTable.asText();
    assertEquals( "Status", "OK", results[0][2] );
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:18,代码来源:JUnitServletTest.java

示例3: testPolicy1

import com.meterware.httpunit.WebTable; //导入依赖的package包/类
public void testPolicy1() {
    try {
        WebConversation wc = new WebConversation();
        WebResponse resp = logOn(wc, "startComponent.do?component=Material.ItemFinder&displayResultsScreen=true", "MAHESH", "dummy");


        WebTable table = resp.getTableWithID("material_itemFinderResultsForm_rows");
        assertNotNull("Found Table For Checks", table);
        String text = null;

        text = table.getCellAsText(1,2);
        assertTrue("Serial is not D", text.equals("A"));
        text = table.getCellAsText(2,2);
        assertTrue("Serial is not  E", text.equals("B") );
        text = table.getCellAsText(3,2);
        assertTrue("Serial is not D", text.equals("C"));
        text = table.getCellAsText(4,2);
        assertTrue("Serial is not  E", text.equals("D") );
        text = table.getCellAsText(5,2);
        assertTrue("Serial is not  E", text.equals("E") );

    } catch (Exception e) {
        e.printStackTrace();
        fail();
    }
}
 
开发者ID:jaffa-projects,项目名称:jaffa-framework,代码行数:27,代码来源:JDBCPluginTest.java

示例4: testPolicy2

import com.meterware.httpunit.WebTable; //导入依赖的package包/类
public void testPolicy2() {
    try {
        WebConversation wc = new WebConversation();
        WebResponse resp = logOn(wc, "startComponent.do?component=Material.ItemFinder&displayResultsScreen=true", "PAUL", "dummy");

        WebTable table = resp.getTableWithID("material_itemFinderResultsForm_rows");
        assertNotNull("Found Table For Checks", table);
        String text = null;


        text = table.getCellAsText(1,2);
        assertTrue("Serial is not A",text.equals("A") );

        text = table.getCellAsText(2,2);
        assertTrue( "Serial is not B", text.equals("B"));


    } catch (Exception e) {
        e.printStackTrace();
        fail();
    }
}
 
开发者ID:jaffa-projects,项目名称:jaffa-framework,代码行数:23,代码来源:JDBCPluginTest.java

示例5: testCheckSubnet

import com.meterware.httpunit.WebTable; //导入依赖的package包/类
public void testCheckSubnet() throws InstantiationException, IllegalAccessException, 
        ClassNotFoundException, SQLException, IOException, SAXException
{
	TestUtils theTestUtils = new TestUtils();
	WebResponse response = loadUrl(theTestUtils);  
	String subnet1 = "10.0.156.";
	String subnet2 = "10.21.21.";
	
	
	boolean isSubnet1 = false;
	boolean isSubnet2 = false;
    WebTable table = response.getTableWithID("TableLocalSubnets");
	for (int i = 1; i < table.getRowCount(); i++)
	{
		String currentSubnet = table.getCellAsText(i, 0);
		if (currentSubnet.equals(subnet1))
			isSubnet1 = true;
		if (currentSubnet.equals(subnet2))
			isSubnet2 = true;
	}
	
	assertTrue(isSubnet1);
	assertFalse(isSubnet2);
}
 
开发者ID:aptivate,项目名称:pmgraph,代码行数:25,代码来源:TestMultiSubnets.java

示例6: testCompareSubnets

import com.meterware.httpunit.WebTable; //导入依赖的package包/类
public void testCompareSubnets() throws InstantiationException, IllegalAccessException, 
  ClassNotFoundException, SQLException, IOException, SAXException
  {		
String[] vectSubnets = Configuration.getLocalSubnet();

TestUtils theTestUtils = new TestUtils();
WebResponse response = loadUrl(theTestUtils);
WebTable table = response.getTableWithID("TableLocalSubnets");
int numSubnet = table.getRowCount() - SIZE_HEADS;
      assertEquals(numSubnet, vectSubnets.length);
      
      if (numSubnet == vectSubnets.length)
      	for (int i = 0; i < numSubnet; i++)
      	{
      		String currentSubnet = table.getCellAsText(i+1, 0);
      		assertTrue(currentSubnet.equals(vectSubnets[i]));
      	}
  }
 
开发者ID:aptivate,项目名称:pmgraph,代码行数:19,代码来源:TestMultiSubnets.java

示例7: testMain

import com.meterware.httpunit.WebTable; //导入依赖的package包/类
/**
 * Tests the administrator main page (main.jsp), by inspectin the treewidget
 * (actually a table) and verifying that there's the corect number of rows in
 * it in collapsed and expanded form.
 * @throws Exception
 */
@Test
public void testMain() throws Exception {
  getPage("index.jsp");
  clickOn("Click here to enter the Administrator Main Page.");
  login();
  
  // Check that the tree widget (in collapsed form) is of appropriate size.
  WebTable table = resp.getTables()[0];
  assertEquals( "rows", 5, table.getRowCount());
  assertEquals( "columns", 3, table.getColumnCount());
  
  // Expand the tree widget.
  WebLink link = table.getTableCell(0, 0).getLinks()[0];
  assertNotNull(link);
  link.click();
  resp = wc.getCurrentPage();
  
  // Check that the tree widget (in expanded form) is of appropriate size.
  table = resp.getTables()[0];
  assertEquals( "rows", 10, table.getRowCount());
  assertEquals( "columns", 3, table.getColumnCount());
  
}
 
开发者ID:ontopia,项目名称:ontopia,代码行数:30,代码来源:AccessctlTest.java

示例8: doTest

import com.meterware.httpunit.WebTable; //导入依赖的package包/类
/**
 * Test link generated using column attributes.
 * @param jspName jsp name, with full path
 * @throws Exception any axception thrown during test.
 */
@Override
@Test
public void doTest() throws Exception
{
    WebRequest request = new GetMethodWebRequest(getJspUrl(getJspName()));

    WebResponse response = runner.getResponse(request);
    if (log.isDebugEnabled())
    {
        log.debug(response.getText());
    }

    WebTable[] tables = response.getTables();
    Assert.assertEquals("Wrong number of tables.", 1, tables.length);

    WebLink[] links = response.getLinks();
    Assert.assertEquals("Wrong number of links in result.", 1, links.length);

    Assert.assertEquals(
        "Parameter in link should be encoded.",
        "/context/dynlink?param=1%2B1",
        links[0].getURLString());
}
 
开发者ID:webbfontaine,项目名称:displaytag,代码行数:29,代码来源:EncodedParametersTest.java

示例9: doTest

import com.meterware.httpunit.WebTable; //导入依赖的package包/类
/**
 * Check that column body is decorated.
 * @param jspName jsp name, with full path
 * @throws Exception any axception thrown during test.
 */
@Override
@Test
public void doTest() throws Exception
{
    WebRequest request = new GetMethodWebRequest(getJspUrl(getJspName()));
    WebResponse response = runner.getResponse(request);

    WebTable[] tables = response.getTables();
    Assert.assertEquals("Wrong number of tables.", 1, tables.length);

    Assert.assertEquals("Wrong number of columns.", 2, tables[0].getColumnCount());
    Assert.assertEquals("Wrong number of rows.", 2, tables[0].getRowCount());

    Assert.assertEquals("Wrong text in column 1", "decorated: ant", tables[0].getCellAsText(1, 0));
    Assert.assertEquals("Wrong text in column 2", "decorated: body", tables[0].getCellAsText(1, 1));
}
 
开发者ID:webbfontaine,项目名称:displaytag,代码行数:22,代码来源:Displ081Test.java

示例10: doTest

import com.meterware.httpunit.WebTable; //导入依赖的package包/类
/**
 * Only items from 2 to 4 should show up in the response.
 * @param jspName jsp name, with full path
 * @throws Exception any axception thrown during test.
 */
@Override
@Test
public void doTest() throws Exception
{

    WebRequest request = new GetMethodWebRequest(getJspUrl(getJspName()));

    WebResponse response = runner.getResponse(request);

    if (log.isDebugEnabled())
    {
        log.debug("RESPONSE: " + response.getText());
    }

    WebTable[] tables = response.getTables();

    Assert.assertEquals("Wrong number of tables.", 1, tables.length);

    Assert.assertEquals("Bad number of generated rows.", 3, tables[0].getRowCount());
    Assert.assertEquals("Wrong cell content.", "2", tables[0].getCellAsText(1, 0));
    Assert.assertEquals("Wrong cell content.", "3", tables[0].getCellAsText(2, 0));
}
 
开发者ID:webbfontaine,项目名称:displaytag,代码行数:28,代码来源:OffsetTest.java

示例11: doTest

import com.meterware.httpunit.WebTable; //导入依赖的package包/类
/**
 * Decorated object based on a pageContext attribute
 * @param jspName jsp name, with full path
 * @throws Exception any axception thrown during test.
 */
@Override
@Test
public void doTest() throws Exception
{
    WebRequest request = new GetMethodWebRequest(getJspUrl(getJspName()));

    WebResponse response = runner.getResponse(request);

    if (log.isDebugEnabled())
    {
        log.debug(response.getText());
    }

    WebTable[] tables = response.getTables();
    Assert.assertEquals("Wrong number of tables.", 1, tables.length);

    Assert.assertEquals("Wrong value", "1234567890...", tables[0].getCellAsText(1, 0));
    Assert.assertEquals("Wrong title", "1234567890123", tables[0].getTableCell(1, 0).getAttribute("title"));

    Assert.assertEquals("Wrong value", "1234567890", tables[0].getCellAsText(1, 1));
    Assert.assertEquals("Wrong title", "", tables[0].getTableCell(1, 1).getAttribute("title"));

}
 
开发者ID:webbfontaine,项目名称:displaytag,代码行数:29,代码来源:Displ174Test.java

示例12: doTest

import com.meterware.httpunit.WebTable; //导入依赖的package包/类
/**
 * Check that the "show header" property only affects the correct tables in the page.
 * @param jspName jsp name, with full path
 * @throws Exception any axception thrown during test.
 */
@Override
@Test
public void doTest() throws Exception
{

    WebRequest request = new GetMethodWebRequest(getJspUrl(getJspName()));

    WebResponse response = runner.getResponse(request);

    if (log.isDebugEnabled())
    {
        log.debug("RESPONSE: " + response.getText());
    }

    WebTable[] tables = response.getTables();

    Assert.assertEquals("Expected 3 table in result.", 3, tables.length);

    Assert.assertEquals("First table should contain one row only", 1, tables[0].getRowCount());
    Assert.assertEquals("Second table should contain header plus one row", 2, tables[1].getRowCount());
    Assert.assertEquals("Third table should contain one row only", 1, tables[2].getRowCount());
}
 
开发者ID:webbfontaine,项目名称:displaytag,代码行数:28,代码来源:SetPropertyTagTest.java

示例13: doTest

import com.meterware.httpunit.WebTable; //导入依赖的package包/类
/**
 * Check that css classes are set correctly according to the ones in setProperty tags.
 * @param jspName jsp name, with full path
 * @throws Exception any axception thrown during test.
 */
@Override
@Test
public void doTest() throws Exception
{

    WebRequest request = new GetMethodWebRequest(getJspUrl(getJspName()));

    WebResponse response = runner.getResponse(request);

    if (log.isDebugEnabled())
    {
        log.debug("RESPONSE: " + response.getText());
    }

    WebTable[] tables = response.getTables();

    Assert.assertEquals("Expected 1 table in result.", 1, tables.length);
    TableCell cell = tables[0].getTableCell(0, 0);
    Assert.assertTrue("Expected css class \"green\" not found", StringUtils.contains(cell.getClassName(), "green"));
    Assert.assertTrue(
        "Expected css class \"purple\" not found",
        StringUtils.contains(cell.getClassName(), "purple"));
}
 
开发者ID:webbfontaine,项目名称:displaytag,代码行数:29,代码来源:CssPropertyTest.java

示例14: doTest

import com.meterware.httpunit.WebTable; //导入依赖的package包/类
/**
 * Checks that the generated page contains a table with the expected footer.
 * @param jspName jsp name, with full path
 * @throws Exception any axception thrown during test.
 */
@Override
@Test
public void doTest() throws Exception
{
    WebRequest request = new GetMethodWebRequest(getJspUrl(getJspName()));

    WebResponse response = runner.getResponse(request);

    if (log.isDebugEnabled())
    {
        log.debug("RESPONSE: " + response.getText());
    }

    WebTable[] tables = response.getTables();

    Assert.assertEquals("Wrong number of tables.", 1, tables.length);

    Assert.assertEquals("Bad footer content.", "3footer", tables[0].getCellAsText(1, 0));
}
 
开发者ID:webbfontaine,项目名称:displaytag,代码行数:25,代码来源:FooterTagTest.java

示例15: doTest

import com.meterware.httpunit.WebTable; //导入依赖的package包/类
/**
 * Check if tables are generated with variable id and content in column is filled appropriately.
 * @param jspName jsp name, with full path
 * @throws Exception any axception thrown during test.
 */
@Override
@Test
public void doTest() throws Exception
{
    WebRequest request = new GetMethodWebRequest(getJspUrl(getJspName()));
    WebResponse response;

    response = runner.getResponse(request);

    if (log.isDebugEnabled())
    {
        log.debug(response.getText());
    }

    WebTable[] tables = response.getTables();
    Assert.assertEquals("Wrong number of tables in result.", 4, tables.length);

    for (int j = 0; j < tables.length; j++)
    {
        WebTable table = tables[j];
        Assert.assertEquals("Wrong number of rows in table " + (j + 1), 2, table.getRowCount());
        Assert.assertEquals("Wrong content in cell for table " + (j + 1), "ant", table.getCellAsText(1, 0));
        Assert.assertEquals("Wrong content in cell for table " + (j + 1), "bee", table.getCellAsText(1, 1));
    }
}
 
开发者ID:webbfontaine,项目名称:displaytag,代码行数:31,代码来源:Displ002Test.java


注:本文中的com.meterware.httpunit.WebTable类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。