1 | HTTPSamplerBase context = makeContext("http://www.apache.org/subdir/previous.html");↵ | | 1 | HTTPSamplerBase context = makeContext("http://www.apache.org/subdir/previous.html");↵
|
2 | String responseText = "<html><head><title>Test page</title></head><body>"↵ | | 2 | String responseText = "<html><head><title>Test page</title></head><body>"↵
|
3 | + "<A HREF=\"index.html\">Goto index page</A></body></html>";↵ | | 3 | + "<a href=\"/home/index.html?param1=value1\">" + "Goto index page</a></body></html>";↵
|
4 | HTTPSampleResult result = new HTTPSampleResult();↵ | | 4 | HTTPSampleResult result = new HTTPSampleResult();↵
|
5 | result.setResponseData(responseText.getBytes());↵ | | 5 | result.setResponseData(responseText.getBytes());↵
|
6 | result.setSampleLabel(context.toString());↵ | | 6 | result.setSampleLabel(context.toString());↵
|
7 | result.setURL(context.getUrl());↵ | | 7 | result.setURL(context.getUrl());↵
|
8 | jmctx.setCurrentSampler(context);↵ | | 8 | jmctx.setCurrentSampler(context);↵
|
9 | jmctx.setCurrentSampler(config);↵ | | 9 | jmctx.setCurrentSampler(config);↵
|
10 | jmctx.setPreviousResult(result);↵ | | 10 | jmctx.setPreviousResult(result);↵
|
11 | parser.process();↵ | | 11 | parser.process();↵
|
12 | String newUrl = config.getUrl().toString();↵ | | 12 | String newUrl = config.getUrl().toString();↵
|
13 | assertEquals("http://www.apache.org/subdir/index.html", newUrl);↵ | | 13 | assertEquals("http://www.apache.org/home/index.html?param1=value1", newUrl);↵
|
14 | }↵ | | 14 | }↵
|
|
15 | public void testSimpleParse5() throws Exception {↵ | | 15 | public void testSimpleParse4() throws Exception {↵
|
16 | HTTPSamplerBase config = makeUrlConfig("/subdir/index\\.h.*");↵ | | 16 | HTTPSamplerBase config = makeUrlConfig("/subdir/index\\..*");↵
|
17 | HTTPSamplerBase context = makeContext("http://www.apache.org/subdir/one/previous.html");↵ | | 17 | HTTPSamplerBase context = makeContext("http://www.apache.org/subdir/previous.html");↵
|
18 | String responseText = "<html><head><title>Test page</title></head><body>"↵ | | 18 | String responseText = "<html><head><title>Test page</title></head><body>"↵
|
19 | + "<a href=\"../index.html\">Goto index page</a></body></html>";↵ | | 19 | + "<A HREF=\"index.html\">Goto index page</A></body></html>";↵
|
20 | HTTPSampleResult result = new HTTPSampleResult();↵ | | 20 | HTTPSampleResult result = new HTTPSampleResult();↵
|
21 | result.setResponseData(responseText.getBytes());↵ | | 21 | result.setResponseData(responseText.getBytes());↵
|
22 | result.setSampleLabel(context.toString());↵ | | 22 | result.setSampleLabel(context.toString());↵
|
23 | result.setURL(context.getUrl());↵ | | 23 | result.setURL(context.getUrl());↵
|
24 | jmctx.setCurrentSampler(context);↵ | | 24 | jmctx.setCurrentSampler(context);↵
|
25 | jmctx.setCurrentSampler(config);↵ | | 25 | jmctx.setCurrentSampler(config);↵
|
26 | jmctx.setPreviousResult(result);↵ | | 26 | jmctx.setPreviousResult(result);↵
|
27 | parser.process();↵ | | 27 | parser.process();↵
|
28 | String newUrl = config.getUrl().toString();↵ | | 28 | String newUrl = config.getUrl().toString();↵
|
29 | assertEquals("http://www.apache.org/subdir/index.html", newUrl);↵ | | 29 | assertEquals("http://www.apache.org/subdir/index.html", newUrl);↵
|
30 | } | | 30 | }
|