assertEquals("/sub1",man.get(1).getPath()); assertEquals("/",man.get(2).getPath()); String s = man.getCookieHeaderForURL(url); assertNotNull(s); org.apache.commons.httpclient.Cookie[] c = man.getCookiesForUrl(url); assertEquals("/sub1",c[0].getPath()); assertFalse(c[0].isPathAttributeSpecified()); assertEquals("/sub1",c[1].getPath()); assertTrue(c[1].isPathAttributeSpecified()); assertEquals("/",c[2].getPath()); assertTrue(c[2].isPathAttributeSpecified()); assertEquals("$Version=0; test1=moo1; test2=moo2; $Path=/sub1; test2=moo3; $Path=/", s); } public void testCookiePolicyNetscape() throws Exception { man.setCookiePolicy(CookiePolicy.NETSCAPE); URL url = new URL("http://order.now/sub1/moo.html"); man.addCookieFromHeader("test1=moo1;", url); man.addCookieFromHeader("test2=moo2;path=/sub1", url); man.addCookieFromHeader("test2=moo3;path=/", url); assertEquals(3,man.getCookieCount())
assertEquals("/sub1",man.get(1).getPath()); assertEquals("/",man.get(2).getPath()); String s = man.getCookieHeaderForURL(url); assertNotNull(s); org.apache.commons.httpclient.Cookie[] c = man.getCookiesForUrl(url); assertEquals("/sub1",c[0].getPath()); assertFalse(c[0].isPathAttributeSpecified()); assertEquals("/sub1",c[1].getPath()); assertTrue(c[1].isPathAttributeSpecified()); assertEquals("/",c[2].getPath()); assertTrue(c[2].isPathAttributeSpecified()); assertEquals("test1=moo1; test2=moo2; test2=moo3", s); } public void testCookiePolicyIgnore() throws Exception { man.setCookiePolicy(CookiePolicy.IGNORE_COOKIES); URL url = new URL("http://order.now/sub1/moo.html"); man.addCookieFromHeader("test1=moo1;", url); man.addCookieFromHeader("test2=moo2;path=/sub1", url); man.addCookieFromHeader("test2=moo3;path=/", url); assertEquals(0,man.getCookieCount())
Clone fragments detected by clone detection tool
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: Method name:
Number of AST nodes: 0 Number of AST nodes: 0
1
assertEquals("/sub1",man.get(1).getPath());
1
assertEquals("/sub1",man.get(1).getPath());
2
            assertEquals("/",man.get(2).getPath());
2
            assertEquals("/",man.get(2).getPath());
3
            String s = man.getCookieHeaderForURL(url);
3
            String s = man.getCookieHeaderForURL(url);
4
            assertNotNull(s);
4
            assertNotNull(s);
5
            org.apache.commons.httpclient.Cookie[] c = man.getCookiesForUrl(url);
5
            org.apache.commons.httpclient.Cookie[] c = man.getCookiesForUrl(url);
6
            assertEquals("/sub1",c[0].getPath());
6
            assertEquals("/sub1",c[0].getPath());
7
            assertFalse(c[0].isPathAttributeSpecified());
7
            assertFalse(c[0].isPathAttributeSpecified());
8
            assertEquals("/sub1",c[1].getPath());
8
            assertEquals("/sub1",c[1].getPath());
9
            assertTrue(c[1].isPathAttributeSpecified());
9
            assertTrue(c[1].isPathAttributeSpecified());
10
            assertEquals("/",c[2].getPath());
10
            assertEquals("/",c[2].getPath());
11
            assertTrue(c[2].isPathAttributeSpecified());
11
            assertTrue(c[2].isPathAttributeSpecified());
12
            assertEquals("$Version=0; test1=moo1; test2=moo2; $Path=/sub1; test2=moo3; $Path=/", s);
12
            assertEquals("test1=moo1; test2=moo2; test2=moo3", s);
13
        }
13
        }
14
        public void testCookiePolicyNetscape() throws Exception {
14
        public void testCookiePolicyIgnore() throws Exception {
15
            man.setCookiePolicy(CookiePolicy.NETSCAPE);
15
            man.setCookiePolicy(CookiePolicy.IGNORE_COOKIES);
16
            URL url = new URL("http://order.now/sub1/moo.html");
16
            URL url = new URL("http://order.now/sub1/moo.html");
17
            man.addCookieFromHeader("test1=moo1;", url);
17
            man.addCookieFromHeader("test1=moo1;", url);
18
            man.addCookieFromHeader("test2=moo2;path=/sub1", url);
18
            man.addCookieFromHeader("test2=moo2;path=/sub1", url);
19
            man.addCookieFromHeader("test2=moo3;path=/", url);
19
            man.addCookieFromHeader("test2=moo3;path=/", url);
20
            assertEquals(3,man.getCookieCount())
20
            assertEquals(0,man.getCookieCount())
Summary
Number of common nesting structure subtrees0
Number of refactorable cases0
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones location
Number of node comparisons0