File path: /jakarta-jmeter-2.3.2/test/src/org/apache/jmeter/protocol/http/modifier/TestAnchorModifier.java | File path: /jakarta-jmeter-2.3.2/test/src/org/apache/jmeter/protocol/http/modifier/TestAnchorModifier.java | |||
Method name: void testSimpleParse2()
|
Method name: void testSimpleParse3()
|
|||
Number of AST nodes: 13 | Number of AST nodes: 14 | |||
1 | HTTPSamplerBase config = makeUrlConfig("/index\\.html↵ | 1 | HTTPSamplerBase config = makeUrlConfig(".*index.*");↵ | |
2 | ");↵ | 2 | config.getArguments().addArgument("param1", "value1");↵ | |
3 | HTTPSamplerBase context = makeContext("http://www.apache.org/subdir/previous.html");↵ | 3 | HTTPSamplerBase context = makeContext("http://www.apache.org/subdir/previous.html");↵ | |
4 | String responseText = "<html><head><title>Test page</title></head><body>"↵ | 4 | String responseText = "<html><head><title>Test page</title></head><body>"↵ | |
5 | + "<a href=\"/index.html\">Goto index page</a>" + "hfdfjiudfjdfjkjfkdjf"↵ | 5 | + "<a href=\"/home/index.html↵ | |
6 | + "<b>bold text</b><a href=lowerdir/index.html>lower</a>" + "</body></html>";↵ | 6 | ?param1=value1\">" + "Goto index page</a></body></html>";↵ | |
7 | HTTPSampleResult result = new HTTPSampleResult();↵ | 7 | HTTPSampleResult result = new HTTPSampleResult();↵ | |
8 | result.setResponseData(responseText.getBytes());↵ | 8 | result.setResponseData(responseText.getBytes());↵ | |
9 | result.setSampleLabel(context.toString());↵ | 9 | result.setSampleLabel(context.toString());↵ | |
10 | result.setURL(context.getUrl());↵ | 10 | result.setURL(context.getUrl());↵ | |
11 | jmctx.setCurrentSampler(context);↵ | 11 | jmctx.setCurrentSampler(context);↵ | |
12 | jmctx.setCurrentSampler(config);↵ | 12 | jmctx.setCurrentSampler(config);↵ | |
13 | jmctx.setPreviousResult(result);↵ | 13 | jmctx.setPreviousResult(result);↵ | |
14 | parser.process();↵ | 14 | parser.process();↵ | |
15 | String newUrl = config.getUrl().toString();↵ | 15 | String newUrl = config.getUrl().toString();↵ | |
16 | assertTrue("http://www.apache.org/index.html".equals(newUrl)↵ | 16 | assert↵ | |
17 | || "http://www.apache.org/subdir/lowerdir/index.html".equals(newUrl)); | 17 | Equals("http://www.apache.org/home/index.html?param1=value1", newUrl); | |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.0 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 106 |
Number of mapped statements | 13 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 0.0 |
Clone type | Type 3 |
ID | Statement | ID | Statement | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | HTTPSamplerBase config = makeUrlConfig("/index\\.html"); |
| 1 | HTTPSamplerBase config = makeUrlConfig(".*index.*"); | |||||||||||||||||||||
| 2 | config.getArguments().addArgument("param1", "value1"); | |||||||||||||||||||||||
2 | HTTPSamplerBase context = makeContext("http://www.apache.org/subdir/previous.html"); | 3 | HTTPSamplerBase context = makeContext("http://www.apache.org/subdir/previous.html"); | ||||||||||||||||||||||
3 | String responseText = "<html><head><title>Test page</title></head><body>" + "<a href=\"/index.html\">Goto index page</a>" + "hfdfjiudfjdfjkjfkdjf" + "<b>bold text</b><a href=lowerdir/index.html>lower</a>" + "</body></html>"; |
| 4 | String responseText = "<html><head><title>Test page</title></head><body>" + "<a href=\"/home/index.html?param1=value1\">" + "Goto index page</a></body></html>"; | |||||||||||||||||||||
4 | HTTPSampleResult result = new HTTPSampleResult(); | 5 | HTTPSampleResult result = new HTTPSampleResult(); | ||||||||||||||||||||||
5 | result.setResponseData(responseText.getBytes()); | 6 | result.setResponseData(responseText.getBytes()); | ||||||||||||||||||||||
6 | result.setSampleLabel(context.toString()); | 7 | result.setSampleLabel(context.toString()); | ||||||||||||||||||||||
7 | result.setURL(context.getUrl()); | 8 | result.setURL(context.getUrl()); | ||||||||||||||||||||||
8 | jmctx.setCurrentSampler(context); | 9 | jmctx.setCurrentSampler(context); | ||||||||||||||||||||||
9 | jmctx.setCurrentSampler(config); | 10 | jmctx.setCurrentSampler(config); | ||||||||||||||||||||||
10 | jmctx.setPreviousResult(result); | 11 | jmctx.setPreviousResult(result); | ||||||||||||||||||||||
11 | parser.process(); | 12 | parser.process(); | ||||||||||||||||||||||
12 | String newUrl = config.getUrl().toString(); | 13 | String newUrl = config.getUrl().toString(); | ||||||||||||||||||||||
13 | assertTrue("http://www.apache.org/index.html".equals(newUrl) || "http://www.apache.org/subdir/lowerdir/index.html".equals(newUrl)); |
| 14 | assertEquals("http://www.apache.org/home/index.html?param1=value1", newUrl); |
Row | Violation |
---|---|
1 | Expression assertTrue("http://www.apache.org/index.html".equals(newUrl) || "http://www.apache.org/subdir/lowerdir/index.html".equals(newUrl)) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression assertEquals("http://www.apache.org/home/index.html?param1=value1",newUrl) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression assertTrue("http://www.apache.org/index.html".equals(newUrl) || "http://www.apache.org/subdir/lowerdir/index.html".equals(newUrl)) is a void method call, and thus it cannot be parameterized |
4 | Expression assertEquals("http://www.apache.org/home/index.html?param1=value1",newUrl) is a void method call, and thus it cannot be parameterized |
5 | Expression assertTrue("http://www.apache.org/index.html".equals(newUrl) || "http://www.apache.org/subdir/lowerdir/index.html".equals(newUrl)) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
6 | Expression assertEquals("http://www.apache.org/home/index.html?param1=value1",newUrl) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
7 | Expression assertTrue("http://www.apache.org/index.html".equals(newUrl) || "http://www.apache.org/subdir/lowerdir/index.html".equals(newUrl)) is a void method call, and thus it cannot be parameterized |
8 | Expression assertEquals("http://www.apache.org/home/index.html?param1=value1",newUrl) is a void method call, and thus it cannot be parameterized |
9 | Clone fragment #1 returns variables , while Clone fragment #2 returns variables config |