You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jmeter-dev@jakarta.apache.org by ms...@apache.org on 2002/07/24 23:40:25 UTC

cvs commit: jakarta-jmeter/src_1/org/apache/jmeter/protocol/http/parser HtmlParser.java

mstover1    2002/07/24 14:40:25

  Modified:    src_1/org/apache/jmeter/junit/protocol/http/parser
                        HtmlParserTester.java
               src_1/org/apache/jmeter/protocol/http/parser HtmlParser.java
  Log:
  Fixing bug in HtmlParser
  
  Revision  Changes    Path
  1.7       +17 -2     jakarta-jmeter/src_1/org/apache/jmeter/junit/protocol/http/parser/HtmlParserTester.java
  
  Index: HtmlParserTester.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jmeter/src_1/org/apache/jmeter/junit/protocol/http/parser/HtmlParserTester.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- HtmlParserTester.java	19 Jul 2002 21:35:37 -0000	1.6
  +++ HtmlParserTester.java	24 Jul 2002 21:40:25 -0000	1.7
  @@ -118,17 +118,32 @@
   
   	public void testFailSimpleParse1() throws Exception
   	{
  -		HTTPSampler config = makeUrlConfig(".*index.*param2=.+1");
  +		HTTPSampler config = makeUrlConfig(".*index.*?param2=.+1");
   		HTTPSampler context = makeContext("http://www.apache.org/subdir/previous.html");
   		String responseText = "<html><head><title>Test page</title></head><body>" +
   				"<a href=\"/home/index.html?param1=value1\">Goto index page</a></body></html>";
   		SampleResult result = new SampleResult();
  +		String newUrl = config.getUrl().toString();
   		result.setResponseData(responseText.getBytes());
   		result.setSampleLabel(context.toString());
   		result.setSamplerData(context);
   		parser.modifyEntry(config, result);
  +		assertEquals(newUrl,config.getUrl().toString());
  +	}
  +	
  +	public void testFailSimpleParse3() throws Exception
  +	{
  +		HTTPSampler config = makeUrlConfig("/home/index.html");
  +		HTTPSampler context = makeContext("http://www.apache.org/subdir/previous.html");
  +		String responseText = "<html><head><title>Test page</title></head><body>" +
  +				"<a href=\"/home/index.html?param1=value1\">Goto index page</a></body></html>";
  +		SampleResult result = new SampleResult();
   		String newUrl = config.getUrl().toString();
  -		assertEquals(config.getUrl().toString(),newUrl);
  +		result.setResponseData(responseText.getBytes());
  +		result.setSampleLabel(context.toString());
  +		result.setSamplerData(context);
  +		parser.modifyEntry(config, result);
  +		assertEquals(newUrl+"?param1=value1",config.getUrl().toString());
   	}
   
   	public void testFailSimpleParse2() throws Exception
  
  
  
  1.8       +4 -4      jakarta-jmeter/src_1/org/apache/jmeter/protocol/http/parser/HtmlParser.java
  
  Index: HtmlParser.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jmeter/src_1/org/apache/jmeter/protocol/http/parser/HtmlParser.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- HtmlParser.java	19 Jul 2002 21:35:37 -0000	1.7
  +++ HtmlParser.java	24 Jul 2002 21:40:25 -0000	1.8
  @@ -156,8 +156,8 @@
   				return false;
   		}
   
  -		if(!(ok = ok && !newLink.getPath().equals(config.getPath()) && matcher.matches(newLink.getPath(), 
  -				compiler.compile("[/]*" + config.getPath()))))
  +		if(!newLink.getPath().equals(config.getPath()) && !matcher.matches(newLink.getPath(), 
  +				compiler.compile("[/]*" + config.getPath())))
   			return false;
   
   		if(!(ok = ok && matcher.matches(newLink.getProtocol(), compiler.compile(config.getProtocol()))))
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>