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


Java WebResponse.getFormWithID方法代码示例

本文整理汇总了Java中com.meterware.httpunit.WebResponse.getFormWithID方法的典型用法代码示例。如果您正苦于以下问题:Java WebResponse.getFormWithID方法的具体用法?Java WebResponse.getFormWithID怎么用?Java WebResponse.getFormWithID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.meterware.httpunit.WebResponse的用法示例。


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

示例1: testDeleteAllSubnets

import com.meterware.httpunit.WebResponse; //导入方法依赖的package包/类
public void testDeleteAllSubnets() throws InstantiationException, IllegalAccessException, 
ClassNotFoundException, SQLException, IOException, SAXException
{
	TestUtils theTestUtils = new TestUtils();		
	WebResponse response = loadUrl (theTestUtils);
	WebForm configurationForm = response.getFormWithID("config");
	
	int numSubnets = Integer.parseInt(configurationForm.getParameterValue("numSubnets"));
	String aux = "?";
	for (int i = 1; i <= numSubnets; i++)
		aux += "delSubnet"+i+"=delSubnet"+i+"&";
	aux +="numSubnets="+numSubnets;			
	WebRequest request = new GetMethodWebRequest(theTestUtils.getUrlPmgraph() + "configure.jsp"+aux);
    response = m_conversation.getResponse(request);
	
	configurationForm = response.getFormWithID("config");
	int newNumSubnets = Integer.parseInt(configurationForm.getParameterValue("numSubnets"));
	assertEquals(numSubnets, newNumSubnets);		
    HTMLElement result = response.getElementWithID("unsuccessResult");
    String resultString = result.getNode().getFirstChild().getNextSibling().getFirstChild().getNodeValue();
    assertTrue(resultString.equals("You can't delete all the subnets"));
}
 
开发者ID:aptivate,项目名称:pmgraph,代码行数:23,代码来源:TestMultiSubnets.java

示例2: testAddSubnet

import com.meterware.httpunit.WebResponse; //导入方法依赖的package包/类
public void testAddSubnet() throws InstantiationException, IllegalAccessException, 
           ClassNotFoundException, SQLException, IOException, SAXException
{		
	TestUtils theTestUtils = new TestUtils();
	WebRequest request = new GetMethodWebRequest(theTestUtils.getUrlPmgraph() + "configure.jsp");
	WebResponse response = m_conversation.getResponse(request);
	
	WebForm configurationForm = response.getFormWithID("config");
	WebTable table = response.getTableWithID("TableLocalSubnets");
	int oldNumSubnets = table.getRowCount() - SIZE_HEADS;
	String newSubnet = "99.99.99.";
	configurationForm.setParameter("newSubnet", newSubnet);
	configurationForm.submit();
	
	theTestUtils = new TestUtils();
	response = loadUrl (theTestUtils);
	table = response.getTableWithID("TableLocalSubnets");
	int numSubnets = table.getRowCount() - SIZE_HEADS;
	assertTrue(numSubnets > oldNumSubnets);
    	assertEquals(table.getCellAsText(numSubnets,0), newSubnet);
    	
    	configurationForm = response.getFormWithID("config");
    FormControl aux = configurationForm.getControlWithID("delSubnet"+numSubnets);
	aux.toggle();
	configurationForm.submit();	
	
	response = loadUrl (theTestUtils);
	table = response.getTableWithID("TableLocalSubnets");
	numSubnets = table.getRowCount() - SIZE_HEADS;
	assertTrue(numSubnets == oldNumSubnets);
}
 
开发者ID:aptivate,项目名称:pmgraph,代码行数:32,代码来源:TestMultiSubnets.java

示例3: testFormatSubnetZeros

import com.meterware.httpunit.WebResponse; //导入方法依赖的package包/类
public void testFormatSubnetZeros() throws InstantiationException, IllegalAccessException, 
ClassNotFoundException, SQLException, IOException, SAXException
{	
	TestUtils theTestUtils = new TestUtils();		
	WebResponse response = loadUrl (theTestUtils);
	WebForm configurationForm = response.getFormWithID("config");
	WebTable table = response.getTableWithID("TableLocalSubnets");
	int oldNumSubnets = table.getRowCount() - SIZE_HEADS;
	String newSubnet = "99.99.99.";		
	configurationForm.setParameter("newSubnet", newSubnet);
	configurationForm.submit();		
	String newSubnet2 = "000.015.255.";
	configurationForm.setParameter("newSubnet", newSubnet2);
	response = configurationForm.submit();
	HTMLElement result = response.getElementWithID("unsuccessResult");
    String resultString =  result.getNode().getFirstChild().getNextSibling().getFirstChild().getNodeValue();
    assertEquals("Incorrect new subnet format. Please try again as follows: 0-255.0-255.0-255.", resultString);
    
	theTestUtils = new TestUtils();
	response = loadUrl (theTestUtils);
	table = response.getTableWithID("TableLocalSubnets");
	int numSubnets = table.getRowCount() - SIZE_HEADS;
	assertTrue(numSubnets > oldNumSubnets);
    	assertEquals(newSubnet, table.getCellAsText((numSubnets),0));
    	//assertEquals(table., "0.15.255.");
    	
    	WebRequest request = new GetMethodWebRequest(theTestUtils.getUrlPmgraph() + "configure.jsp?newSubnet=099.099.099.&numSubnets="+numSubnets);
    response = m_conversation.getResponse(request);
    result = response.getElementWithID("unsuccessResult");
    resultString =  result.getNode().getFirstChild().getNextSibling().getFirstChild().getNodeValue();
    assertEquals("Incorrect new subnet format. Please try again as follows: 0-255.0-255.0-255.", resultString);
	
    response = loadUrl (theTestUtils);
    	configurationForm = response.getFormWithID("config");
    FormControl aux = configurationForm.getControlWithID("delSubnet"+numSubnets);
	aux.toggle();
	configurationForm.submit();	
	
	response = loadUrl (theTestUtils);
	table = response.getTableWithID("TableLocalSubnets");
	numSubnets = table.getRowCount() - SIZE_HEADS;
	assertEquals(oldNumSubnets, numSubnets);
}
 
开发者ID:aptivate,项目名称:pmgraph,代码行数:44,代码来源:TestMultiSubnets.java


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