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


Java WebTable.getCellAsText方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: testTableWithDefaultLimits

import com.meterware.httpunit.WebTable; //导入方法依赖的package包/类
public void testTableWithDefaultLimits(WebTable table, boolean isLong) throws IOException
{
	if (table != null)
	{
		assertEquals("Check the number of rows is limited to default value.", Configuration
				.getResultLimit(), (Integer) (table.getRowCount() - 4));

		// Columns in the table are Color,Host IP,Host
		// Name,Downloaded,Uploaded, average downloaded, average uploaded
		// (the last two are checked in other test)
		// Get data from the last row and check if it contains the
		// information for the rest of Ip's
		String hostIP = table.getCellAsText(Configuration.getResultLimit() + 2, 1);
		String downloaded = table.getCellAsText(Configuration.getResultLimit() + 2, 3);
		String uploaded = table.getCellAsText(Configuration.getResultLimit() + 2, 4);
		assertEquals("Check the IP Address", "Others", hostIP);
		assertEquals("Check the Downloaded Value", "<1", downloaded);
		if(isLong)
		{
			assertEquals("Check the Upload Value", "23", uploaded);
		}
		else
		{
			assertEquals("Check the Upload Value", "23625", uploaded);
		}
	}
}
 
开发者ID:aptivate,项目名称:pmgraph,代码行数:28,代码来源:LegendTest.java

示例6: testTableWithCustomLimits

import com.meterware.httpunit.WebTable; //导入方法依赖的package包/类
public void testTableWithCustomLimits(WebTable table, boolean isLong)
{
	if (table != null)
	{
		assertEquals("Check the number of rows is limited to default value.", (Integer) 8,
				(Integer) (table.getRowCount() - 4));

		// Columns in the table are Color,Host IP,Host
		// Name,Downloaded,Uploaded
		// Get data from the last row and check if it contains the
		// information for the rest of Ip's
		String hostIP = table.getCellAsText(8 + 2, 1);
		String downloaded = table.getCellAsText(8 + 2, 3);
		String uploaded = table.getCellAsText(8 + 2, 4);
		assertEquals("Check the IP Address", "Others", hostIP);
		assertEquals("Check the Downloaded Value", "<1", downloaded);
		
		if(isLong)
		{
			assertEquals("Check the Upload Value", "8", uploaded);
		}
		else
		{
			assertEquals("Check the Upload Value", "9000", uploaded);
		}
	}
}
 
开发者ID:aptivate,项目名称:pmgraph,代码行数:28,代码来源:LegendTest.java

示例7: testClerkAccess

import com.meterware.httpunit.WebTable; //导入方法依赖的package包/类
public void testClerkAccess() {
    try {
        WebConversation wc = new WebConversation();
        WebResponse resp = logOn(wc, "startComponent.do?component=Test.Security.Test1", "GAUTAM", "dummy");
        assertEquals("Got To Main Page", "Test.Security.Test1.Page1", resp.getTitle());

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

        // Access Function1 - false
        text = table.getCellAsText(0,0);
        assertTrue("Empty Row 1", text == null || text.length() == 0);

        // No access Function1 - true
        text = table.getCellAsText(1,0);
        assertTrue("Not empty Row 2", text != null && text.length() > 0);

        // Access Function2 - false
        text = table.getCellAsText(2,0);
        assertTrue("Empty Row 3", text == null || text.length() == 0);

        // No access Function2 - true
        text = table.getCellAsText(3,0);
        assertTrue("Not empty Row 4", text != null && text.length() > 0);

        // Access FunctionX - false
        text = table.getCellAsText(4,0);
        assertTrue("Empty Row 5", text == null || text.length() == 0);

        // No access FunctionX - true
        text = table.getCellAsText(5,0);
        assertTrue("Not empty Row 6", text != null && text.length() > 0);

        // Access Component Test.Security.Test2 - false
        text = table.getCellAsText(6,0);
        assertTrue("Empty Row 7", text == null || text.length() == 0);

        // No access Component Test.Security.Test2 - true
        text = table.getCellAsText(7,0);
        assertTrue("Not empty Row 8", text != null && text.length() > 0);

        // Access Component Not.Real.Component - false
        text = table.getCellAsText(8,0);
        assertTrue("Not empty Row 9", text != null && text.length() > 0);

        // No access Component Not.Real.Component - true
        text = table.getCellAsText(9,0);
        assertTrue("Empty Row 10", text == null || text.length() == 0);

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

示例8: testManagerAccess

import com.meterware.httpunit.WebTable; //导入方法依赖的package包/类
public void testManagerAccess() {
    try {
        WebConversation wc = new WebConversation();
        WebResponse resp = logOn(wc, "startComponent.do?component=Test.Security.Test1", "PAUL", "dummy");
        assertEquals("Got To Main Page", "Test.Security.Test1.Page1", resp.getTitle());

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

        // Access Function1 - true
        text = table.getCellAsText(0,0);
        assertTrue("Empty Row 1", text != null && text.length() > 0);

        // No Access Function1 - false
        text = table.getCellAsText(1,0);
        assertTrue("Not empty Row 2", text == null || text.length() == 0);

        // Access Function2 - true
        text = table.getCellAsText(2,0);
        assertTrue("Not empty Row 3", text != null && text.length() > 0);

        // No Access Function2 - false
        text = table.getCellAsText(3,0);
        assertTrue("Empty Row 4", text == null || text.length() == 0);

        // Access FunctionX - false
        text = table.getCellAsText(4,0);
        assertTrue("Empty Row 5", text == null || text.length() == 0);

        // No access FunctionX - true
        text = table.getCellAsText(5,0);
        assertTrue("Not empty Row 6", text != null && text.length() > 0);

        // Access Component Test.Security.Test2 - true
        text = table.getCellAsText(6,0);
        assertTrue("Empty Row 7", text != null && text.length() > 0);

        // No Access Component Test.Security.Test2 - false
        text = table.getCellAsText(7,0);
        assertTrue("Not Empty Row 8", text == null || text.length() == 0);

        // Access Component Not.Real.Component - false
        text = table.getCellAsText(8,0);
        assertTrue("Not empty Row 9", text != null && text.length() > 0);

        // No access Component Not.Real.Component - true
        text = table.getCellAsText(9,0);
        assertTrue("Empty Row 10", text == null || text.length() == 0);

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

示例9: testHostName

import com.meterware.httpunit.WebTable; //导入方法依赖的package包/类
/**
 * Test hostname for different IPs
 * 
 * @throws ClassNotFoundException
 * @throws IllegalAccessException
 * @throws InstantiationException
 * @throws IOException
 * @throws SQLException
 * @throws SAXException
 */

public void testHostName() throws ClassNotFoundException, IllegalAccessException,
		InstantiationException, IOException, SQLException, SAXException
{
	TestUtils testUtils = new TestUtils();
	testUtils.CreateTable();
	// Insert rows into table
	for (int i = 0; i < 100; i++)
	{
		// Set the values
		testUtils.insertNewRow(500000, testUtils.t1, "224.0.0.255", "10.0.156.10", false);
		testUtils.insertNewRow(300000, testUtils.t1, "10.0.156.10", "224.0.0.254", false);

		testUtils.insertNewRow(100000, testUtils.t1, "224.0.0.251", "10.0.156.22", false);
		testUtils.insertNewRow(150000, testUtils.t2, "10.0.156.22", "224.0.0.251", false);

		testUtils.insertNewRow(400000, testUtils.t2, "224.0.0.255", "10.0.156.33", false);
		testUtils.insertNewRow(1140000, testUtils.t2, "10.0.156.33", "224.0.0.255", false);
	}

	String hostname1 = "fen-ndiyo3.fen.aptivate.org.";
	String hostname2 = "ap.int.aidworld.org.";
	String hostname3 = "Unknown Host";
	// Open a graph page

	// Obtain the upload page on web site
	WebRequest request = new GetMethodWebRequest(testUtils.getUrlPmgraph()
			+ "index.jsp?report=totals&start=0&end=300000&resultLimit=15");
	WebResponse response = m_conversation.getResponse(request);

	// get the table
	WebTable table = (WebTable) response.getElementWithID(TestUtils.LEGEND_TBL);

	if (table != null)
	{
		// Row 2
		String hostN1 = table.getCellAsText(2, 2);
		assertEquals("Check the host name", hostname1, hostN1);
		// Row 3
		String hostN2 = table.getCellAsText(3, 2);
		assertEquals("Check the host name", hostname2, hostN2);
		// Row 4
		String hostN3 = table.getCellAsText(4, 2);
		assertEquals("Check the host name", hostname3, hostN3);
	}
}
 
开发者ID:aptivate,项目名称:pmgraph,代码行数:57,代码来源:LegendTest.java

示例10: testUnitsThroughput

import com.meterware.httpunit.WebTable; //导入方法依赖的package包/类
public void testUnitsThroughput() throws IOException, SAXException, InstantiationException,
		IllegalAccessException, ClassNotFoundException, SQLException, ConfigurationException
{
	// Time periods to check, in minutes.
	long timePeriod[] = { 8, 250, 15500 };

	for (int i = 0; i < timePeriod.length; i++)
	{
		LegendData data = new LegendData();
		RequestParams requestParams = new RequestParams(0, timePeriod[i] * 60000,
				View.LOCAL_IP, 5);
		Hashtable<Integer,List<DataPoint>> resultsHash = data.getLegendData(requestParams.getSortBy(),
						requestParams.getOrder(), requestParams, false);
		String addUrl = "?start=0&end=" + (timePeriod[i] * 60000);			
		// Obtain the upload page on web site
		WebRequest request = new GetMethodWebRequest(m_testUtils.getUrlPmgraph() + addUrl);
		WebResponse response = m_conversation.getResponse(request);

		WebTable legend = (WebTable) response.getElementWithID(TestUtils.LEGEND_TBL);
		
		//Check if the legend units matches the period of time
		String totalThroughput = legend.getCellAsText(0, 3);
		String expectedLabel = null;
		if (timePeriod[i] < 10)
		{
			expectedLabel = "Totals (KB)";
		}
		else
		{
			if ((timePeriod[i] >= 10) && (timePeriod[i] < 14400))
			{
				expectedLabel ="Totals (MB)";
			}
			else
			{
				expectedLabel = "Totals (GB)";
			}
		}
		
		assertEquals("Check if the header in the legend matches the units we are using",
				totalThroughput, expectedLabel);
		
		//Check the values shown are correct
		long bitsToDivideBy;
		for (int j = 2; j < legend.getRowCount() - 1; j++)
		{
			// KB
			if (timePeriod[i] < 10)
				bitsToDivideBy = 1024;
			else{
				// MB
				if ((timePeriod[i] >= 10) && (timePeriod[i] < 14400))
					bitsToDivideBy = 1024*1024;
				// GB
				else
					bitsToDivideBy = 1024*1024*1024;
			}
			for (Enumeration e = resultsHash.keys (); e.hasMoreElements ();) 
			{
				int key = (Integer) e.nextElement();
				List<DataPoint> throughput = resultsHash.get(key);
				
				String databaseValueDown = String.valueOf(throughput.get(j-2).getDownloaded()/bitsToDivideBy);
				//if the result is zero change it for "<1" as in the legend
				if (databaseValueDown.equals("0"))
					databaseValueDown = "<1";
				String databaseValueUp = String.valueOf(throughput.get(j-2).getUploaded()/bitsToDivideBy);
				if (databaseValueUp.equals("0"))
					databaseValueUp = "<1";
				assertEquals(
					"Check if the downloaded throughput in the legend matches the units we are using",
						legend.getCellAsText(j, 3), databaseValueDown);
				assertEquals(
					"Check if the uploaded throughput in the legend matches the units we are using",
						legend.getCellAsText(j, 4), databaseValueUp );
			}
		}
	}
}
 
开发者ID:aptivate,项目名称:pmgraph,代码行数:80,代码来源:LegendTest.java


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