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


Java WebLink类代码示例

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


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

示例1: testGroupsPreservedOnZoom

import com.meterware.httpunit.WebLink; //导入依赖的package包/类
public void testGroupsPreservedOnZoom() throws IOException, SAXException
{
	WebLink theLink = m_response.getLinkWithName("zoomIn");
	String linkUrl = theLink.getURLString();
	String endOfExpectedUrl = "&resultLimit=5&dynamic=false&view=LOCAL_IP" +
			"&selectGroupIndex=Test";
	String endOfLinkUrl = linkUrl.substring(linkUrl.indexOf("&res"));
	assertEquals(endOfExpectedUrl, endOfLinkUrl);
	
	theLink = m_response.getLinkWithName("zoomOut");
	linkUrl = theLink.getURLString();
	endOfLinkUrl = linkUrl.substring(linkUrl.indexOf("&res"));
	
	endOfExpectedUrl = "&resultLimit=5&dynamic=false&view=LOCAL_IP" +
			"&selectGroupIndex=Test";
	
	assertEquals(endOfExpectedUrl, endOfLinkUrl);
}
 
开发者ID:aptivate,项目名称:pmgraph,代码行数:19,代码来源:UrlBuilderTest.java

示例2: testMain

import com.meterware.httpunit.WebLink; //导入依赖的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

示例3: doTest

import com.meterware.httpunit.WebLink; //导入依赖的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

示例4: doTest

import com.meterware.httpunit.WebLink; //导入依赖的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());
    }

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

    Assert.assertEquals("Link text is wrong.", "/context/dynlink?param=Raja%26Siva", links[0].getURLString());
}
 
开发者ID:webbfontaine,项目名称:displaytag,代码行数:23,代码来源:Displ147Test.java

示例5: doTest

import com.meterware.httpunit.WebLink; //导入依赖的package包/类
/**
 * Generated link should be https.
 * @param jspName jsp name, with full path
 * @throws Exception any axception thrown during test.
 */
@Override
@Test
public void doTest() throws Exception
{
    String httpsUrl = StringUtils.replace(getJspUrl("DISPL-105.jsp"), "http://", "https://");
    WebRequest request = new GetMethodWebRequest(httpsUrl);

    WebResponse response = runner.getResponse(request);

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

    Assert.assertTrue("Generated link doesn't start with https: " + links[0].getURLString(), links[0]
        .getURLString()
        .startsWith("https://"));

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

示例6: doTest

import com.meterware.httpunit.WebLink; //导入依赖的package包/类
/**
 * Test link generated for paging and export.
 * @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.", 8, links.length);

    for (int j = 0; j < links.length; j++)
    {
        String url = links[j].getURLString();
        Assert.assertTrue("Invalid url: " + url, url.startsWith("/goforit"));
    }
}
 
开发者ID:webbfontaine,项目名称:displaytag,代码行数:30,代码来源:NoContextTest.java

示例7: doTest

import com.meterware.httpunit.WebLink; //导入依赖的package包/类
/**
 * Test link generated using href="".
 * @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()));
    ParamEncoder encoder = new ParamEncoder("table");
    request.setParameter(encoder.encodeParameterName(TableTagParameters.PARAMETER_ORDER), "2");
    request.setParameter(encoder.encodeParameterName(TableTagParameters.PARAMETER_SORT), "0");

    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);

    URLAssert.assertEquals("/context/goforit?param=ant&amp;d-148916-s=0&amp;d-148916-o=2", links[0].getURLString());
}
 
开发者ID:webbfontaine,项目名称:displaytag,代码行数:30,代码来源:Displ117Test.java

示例8: doTest

import com.meterware.httpunit.WebLink; //导入依赖的package包/类
/**
 * Check the content of the title 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("DISPL-001.jsp"));
    WebResponse response = runner.getResponse(request);

    WebTable[] tables = response.getTables();
    Assert.assertEquals("Expected 1 table in result.", 1, tables.length);
    Assert
        .assertEquals("Wrong title in column", "[email protected]", tables[0].getTableCell(1, 0).getTitle());

    WebLink[] links = tables[0].getTableCell(1, 0).getLinks();
    Assert.assertEquals("Expected link not found", 1, links.length);
    Assert.assertEquals("Wrong text in link", "[email protected]", links[0].getText());
    Assert.assertEquals("Wrong url in link", "mailto:[email protected]", links[0].getURLString());
}
 
开发者ID:webbfontaine,项目名称:displaytag,代码行数:23,代码来源:Displ001Test.java

示例9: doTest

import com.meterware.httpunit.WebLink; //导入依赖的package包/类
/**
 * Test link generated using href="".
 * @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()));
    ParamEncoder encoder = new ParamEncoder("table");
    request.setParameter(encoder.encodeParameterName(TableTagParameters.PARAMETER_ORDER), "2");
    request.setParameter(encoder.encodeParameterName(TableTagParameters.PARAMETER_SORT), "0");

    WebResponse response = runner.getResponse(request);

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

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

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

    URLAssert.assertEquals("?d-148916-s=0&d-148916-o=1", links[0].getURLString());
    URLAssert.assertEquals("?more=true&d-148916-s=0&d-148916-o=1", links[1].getURLString());
}
 
开发者ID:webbfontaine,项目名称:displaytag,代码行数:31,代码来源:Displ112Test.java

示例10: doTest

import com.meterware.httpunit.WebLink; //导入依赖的package包/类
/**
 * Verifies that the generated page contains a table with the expected number of columns.
 * @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);

    for (int j = 0; j < 4; j++)
    {
        WebLink[] links = response.getLinks();
        response = links[j].click();

        if (log.isDebugEnabled())
        {
            log.debug("After clicking on " + j + ":\n" + response.getText());
        }
        checkOnlyOneSorted(response, j);
    }

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

示例11: doTest

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

    WebLink[] links = response.getLinks();

    Assert.assertEquals("Wrong number of export links. ", 4, links.length);

    Set<String> linkTexts = new HashSet<String>();
    for (int j = 0; j < links.length; j++)
    {
        String url = links[j].getURLString();
        log.debug(url);
        if (linkTexts.contains(url))
        {
            Assert.fail("Found duplicated link in export banner: " + url);
        }
        linkTexts.add(url);
    }

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

示例12: doTest

import com.meterware.httpunit.WebLink; //导入依赖的package包/类
/**
 * Just a quick test to assure that you can avoid page numbers when displaying one 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());
    }

    WebLink[] links = response.getLinks();

    Assert.assertEquals("Wrong number of links in result.", 0, links.length);
    Assert.assertFalse(
        "Using setProperty you should not see any page number",
        StringUtils.contains(response.getText(), ">1<"));

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

示例13: multipleApplicationsLoginAndLogout

import com.meterware.httpunit.WebLink; //导入依赖的package包/类
private void multipleApplicationsLoginAndLogout() throws Exception {
	// login 1
	WebConversation conversation = new WebConversation();
	WebRequest request = new GetMethodWebRequest(webssoClient2URL);
	WebResponse response = tryGetResponse(conversation, request);
	request = applicationLogin(conversation, response);
	response = tryGetResponse(conversation, request);
	assertUserInformation(response);

	// login 2
	WebRequest request2 = new GetMethodWebRequest(webssoClient2URL);// login into application2
	WebResponse response2 = tryGetResponse(conversation, request2);
	assertUserInformation(response2);

	// logout
	WebLink link = response.getLinkWith("logout");
	link.click(); // logout of the application
	WebRequest newRequest = new GetMethodWebRequest(webssoClient1URL);
	WebResponse outputResponse = tryGetResponse(conversation, newRequest);
	WebTable usersData = outputResponse
			.getTableStartingWith("Single Sign On User Data");

	assertNull("users data must be null ", usersData); // return null for user data (ie) logged out of second application
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:25,代码来源:AssertWebSSOApplicationStep.java

示例14: testModelCharacteristics

import com.meterware.httpunit.WebLink; //导入依赖的package包/类
public void testModelCharacteristics() throws Exception {
  	navigateToModelForEditing(myModelName);

      WebLink theLink = myWebConversation.getCurrentPage().getFirstMatchingLink(WebLink.MATCH_URL_STRING,
"AnimalModelPopulateAction.do?method=populate");
      assertNotNull("Couldn't find link to model characteristics data", theLink);
      
WebResponse theCurrentPage = theLink.click();
assertCurrentPageContains("Is this model a tool strain?");
WebForm theForm = theCurrentPage.getFormWithName("modelCharacteristicsForm");		
  	
      theForm.setParameter("description", "Test Description");
  
      theCurrentPage = theForm.submit();
      assertCurrentPageContains("You have successfully edited the Model Characteristics."); 
  }
 
开发者ID:NCIP,项目名称:camod,代码行数:17,代码来源:EditModelCharacteristicsTest.java

示例15: testSearchPage

import com.meterware.httpunit.WebLink; //导入依赖的package包/类
/** This method tests the search Page. It also submits a query for cats and 
 * verifies that the result has at least two items */
private void testSearchPage(WebConversation wc, WebResponse resp) throws Exception {
    // Test the search page
    WebLink wl = resp.getLinkWith("Search");
    wl.click();
    resp = wc.getCurrentPage();
    // check if the search returns more than one result for "cat
    WebForm form = resp.getForms()[0];
    assertEquals("on", form.getParameterValue("searchForm:searchTags"));
    String searchText = "cat";
    form.setParameter("searchForm:searchString", searchText);
    form.submit();
    resp = wc.getCurrentPage();
    WebTable resultTable = resp.getTableStartingWithPrefix("Map");
    assertTrue(resultTable.getRowCount() > 2);
}
 
开发者ID:sugar-lang,项目名称:case-studies,代码行数:18,代码来源:PetStoreWebBlackBoxTest.java


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