File path: /jakarta-jmeter-2.3.2/test/src/org/apache/jmeter/protocol/http/control/TestCookieManager.java | File path: /jakarta-jmeter-2.3.2/test/src/org/apache/jmeter/protocol/http/control/TestCookieManager.java | |||
Method name: void testCookieOrdering2()
|
Method name: void testCookiePolicyNetscape()
|
|||
Number of AST nodes: 16 | Number of AST nodes: 16 | |||
1 | URL url = new URL("http://order.now/sub1/moo.html");↵ | 1 | URL url = new URL("http://order.now/sub1/moo.html");↵ | |
2 | man.addCookieFromHeader("test1=moo1;", url);↵ | 2 | man.addCookieFromHeader("test1=moo1;", url);↵ | |
3 | man.addCookieFromHeader("test2=moo2;path=/sub1", url);↵ | 3 | man.addCookieFromHeader("test2=moo2;path=/sub1", url);↵ | |
4 | man.addCookieFromHeader("test2=moo3;path=/", url);↵ | 4 | man.addCookieFromHeader("test2=moo3;path=/", url);↵ | |
5 | assertEquals(3,man.getCookieCount());↵ | 5 | assertEquals(3,man.getCookieCount());↵ | |
6 | assertEquals("/sub1",man.get(0).getPath()); // Defaults to caller URL↵ | 6 | assertEquals("/sub1",man.get(0).getPath());↵ | |
7 | assertEquals("/sub1",man.get(1).getPath());↵ | 7 | assertEquals("/sub1",man.get(1).getPath());↵ | |
8 | assertEquals("/",man.get(2).getPath());↵ | 8 | assertEquals("/",man.get(2).getPath());↵ | |
9 | String s = man.getCookieHeaderForURL(url);↵ | 9 | String s = man.getCookieHeaderForURL(url);↵ | |
10 | assertNotNull(s);↵ | 10 | assertNotNull(s);↵ | |
11 | org.apache.commons.httpclient.Cookie[] c = man.getCookiesForUrl(url);↵ | 11 | org.apache.commons.httpclient.Cookie[] c = man.getCookiesForUrl(url);↵ | |
12 | assertEquals("/sub1",c[0].getPath());↵ | 12 | assertEquals("/sub1",c[0].getPath());↵ | |
13 | assertFalse(c[0].isPathAttributeSpecified());↵ | 13 | assertFalse(c[0].isPathAttributeSpecified());↵ | |
14 | assertEquals("/sub1",c[1].getPath());↵ | 14 | assertEquals("/sub1",c[1].getPath());↵ | |
15 | assertTrue(c[1].isPathAttributeSpecified());↵ | 15 | assertTrue(c[1].isPathAttributeSpecified());↵ | |
16 | assertEquals("/",c[2].getPath()); | 16 |
| |
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 | 226 |
Number of mapped statements | 16 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 0.0 |
Clone type | Type 1 |
ID | Statement | ID | Statement | |
---|---|---|---|---|
1 | URL url = new URL("http://order.now/sub1/moo.html"); | 2 | URL url = new URL("http://order.now/sub1/moo.html"); | |
2 | man.addCookieFromHeader("test1=moo1;", url); | 3 | man.addCookieFromHeader("test1=moo1;", url); | |
3 | man.addCookieFromHeader("test2=moo2;path=/sub1", url); | 4 | man.addCookieFromHeader("test2=moo2;path=/sub1", url); | |
4 | man.addCookieFromHeader("test2=moo3;path=/", url); | 5 | man.addCookieFromHeader("test2=moo3;path=/", url); | |
5 | assertEquals(3, man.getCookieCount()); | 6 | assertEquals(3, man.getCookieCount()); | |
6 | assertEquals("/sub1", man.get(0).getPath()); | 7 | assertEquals("/sub1", man.get(0).getPath()); | |
7 | assertEquals("/sub1", man.get(1).getPath()); | 8 | assertEquals("/sub1", man.get(1).getPath()); | |
8 | assertEquals("/", man.get(2).getPath()); | 9 | assertEquals("/", man.get(2).getPath()); | |
9 | String s = man.getCookieHeaderForURL(url); | 10 | String s = man.getCookieHeaderForURL(url); | |
10 | assertNotNull(s); | 11 | assertNotNull(s); | |
11 | org.apache.commons.httpclient.Cookie[] c = man.getCookiesForUrl(url); | 12 | org.apache.commons.httpclient.Cookie[] c = man.getCookiesForUrl(url); | |
12 | assertEquals("/sub1", c[0].getPath()); | 13 | assertEquals("/sub1", c[0].getPath()); | |
13 | assertFalse(c[0].isPathAttributeSpecified()); | 14 | assertFalse(c[0].isPathAttributeSpecified()); | |
14 | assertEquals("/sub1", c[1].getPath()); | 15 | assertEquals("/sub1", c[1].getPath()); | |
15 | assertTrue(c[1].isPathAttributeSpecified()); | 16 | assertTrue(c[1].isPathAttributeSpecified()); | |
16 | assertEquals("/", c[2].getPath()); | 17 | assertEquals("/", c[2].getPath()); |
Row | Violation |
---|---|
1 | Clone fragment #1 returns variables s , while Clone fragment #2 returns variables c, s |